27 * struct ccid_operations - Interface to Congestion-Control Infrastructure |
27 * struct ccid_operations - Interface to Congestion-Control Infrastructure |
28 * |
28 * |
29 * @ccid_id: numerical CCID ID (up to %CCID_MAX, cf. table 5 in RFC 4340, 10.) |
29 * @ccid_id: numerical CCID ID (up to %CCID_MAX, cf. table 5 in RFC 4340, 10.) |
30 * @ccid_ccmps: the CCMPS including network/transport headers (0 when disabled) |
30 * @ccid_ccmps: the CCMPS including network/transport headers (0 when disabled) |
31 * @ccid_name: alphabetical identifier string for @ccid_id |
31 * @ccid_name: alphabetical identifier string for @ccid_id |
32 * @ccid_owner: module which implements/owns this CCID |
|
33 * @ccid_hc_{r,t}x_slab: memory pool for the receiver/sender half-connection |
32 * @ccid_hc_{r,t}x_slab: memory pool for the receiver/sender half-connection |
34 * @ccid_hc_{r,t}x_obj_size: size of the receiver/sender half-connection socket |
33 * @ccid_hc_{r,t}x_obj_size: size of the receiver/sender half-connection socket |
35 * |
34 * |
36 * @ccid_hc_{r,t}x_init: CCID-specific initialisation routine (before startup) |
35 * @ccid_hc_{r,t}x_init: CCID-specific initialisation routine (before startup) |
37 * @ccid_hc_{r,t}x_exit: CCID-specific cleanup routine (before destruction) |
36 * @ccid_hc_{r,t}x_exit: CCID-specific cleanup routine (before destruction) |
46 */ |
45 */ |
47 struct ccid_operations { |
46 struct ccid_operations { |
48 unsigned char ccid_id; |
47 unsigned char ccid_id; |
49 __u32 ccid_ccmps; |
48 __u32 ccid_ccmps; |
50 const char *ccid_name; |
49 const char *ccid_name; |
51 struct module *ccid_owner; |
|
52 struct kmem_cache *ccid_hc_rx_slab, |
50 struct kmem_cache *ccid_hc_rx_slab, |
53 *ccid_hc_tx_slab; |
51 *ccid_hc_tx_slab; |
54 __u32 ccid_hc_rx_obj_size, |
52 __u32 ccid_hc_rx_obj_size, |
55 ccid_hc_tx_obj_size; |
53 ccid_hc_tx_obj_size; |
56 /* Interface Routines */ |
54 /* Interface Routines */ |
88 const int optname, int len, |
86 const int optname, int len, |
89 u32 __user *optval, |
87 u32 __user *optval, |
90 int __user *optlen); |
88 int __user *optlen); |
91 }; |
89 }; |
92 |
90 |
93 extern int ccid_register(struct ccid_operations *ccid_ops); |
91 extern struct ccid_operations ccid2_ops; |
94 extern int ccid_unregister(struct ccid_operations *ccid_ops); |
92 #ifdef CONFIG_IP_DCCP_CCID3 |
|
93 extern struct ccid_operations ccid3_ops; |
|
94 #endif |
|
95 |
|
96 extern int ccid_initialize_builtins(void); |
|
97 extern void ccid_cleanup_builtins(void); |
95 |
98 |
96 struct ccid { |
99 struct ccid { |
97 struct ccid_operations *ccid_ops; |
100 struct ccid_operations *ccid_ops; |
98 char ccid_priv[0]; |
101 char ccid_priv[0]; |
99 }; |
102 }; |
101 static inline void *ccid_priv(const struct ccid *ccid) |
104 static inline void *ccid_priv(const struct ccid *ccid) |
102 { |
105 { |
103 return (void *)ccid->ccid_priv; |
106 return (void *)ccid->ccid_priv; |
104 } |
107 } |
105 |
108 |
106 extern struct ccid *ccid_new(unsigned char id, struct sock *sk, int rx, |
109 extern bool ccid_support_check(u8 const *ccid_array, u8 array_len); |
107 gfp_t gfp); |
110 extern int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len); |
108 |
111 extern int ccid_getsockopt_builtin_ccids(struct sock *sk, int len, |
109 extern struct ccid *ccid_hc_rx_new(unsigned char id, struct sock *sk, |
112 char __user *, int __user *); |
110 gfp_t gfp); |
113 |
111 extern struct ccid *ccid_hc_tx_new(unsigned char id, struct sock *sk, |
114 extern struct ccid *ccid_new(const u8 id, struct sock *sk, bool rx); |
112 gfp_t gfp); |
115 |
|
116 static inline int ccid_get_current_rx_ccid(struct dccp_sock *dp) |
|
117 { |
|
118 struct ccid *ccid = dp->dccps_hc_rx_ccid; |
|
119 |
|
120 if (ccid == NULL || ccid->ccid_ops == NULL) |
|
121 return -1; |
|
122 return ccid->ccid_ops->ccid_id; |
|
123 } |
|
124 |
|
125 static inline int ccid_get_current_tx_ccid(struct dccp_sock *dp) |
|
126 { |
|
127 struct ccid *ccid = dp->dccps_hc_tx_ccid; |
|
128 |
|
129 if (ccid == NULL || ccid->ccid_ops == NULL) |
|
130 return -1; |
|
131 return ccid->ccid_ops->ccid_id; |
|
132 } |
113 |
133 |
114 extern void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk); |
134 extern void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk); |
115 extern void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk); |
135 extern void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk); |
116 |
136 |
117 static inline int ccid_hc_tx_send_packet(struct ccid *ccid, struct sock *sk, |
137 static inline int ccid_hc_tx_send_packet(struct ccid *ccid, struct sock *sk, |