6 * An implementation of the DCCP protocol
7 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
17 #include <linux/dccp.h>
18 #include <linux/list.h>
19 #include <linux/module.h>
24 unsigned char ccid_id
;
25 const char *ccid_name
;
26 struct module
*ccid_owner
;
27 int (*ccid_init
)(struct sock
*sk
);
28 void (*ccid_exit
)(struct sock
*sk
);
29 int (*ccid_hc_rx_init
)(struct sock
*sk
);
30 int (*ccid_hc_tx_init
)(struct sock
*sk
);
31 void (*ccid_hc_rx_exit
)(struct sock
*sk
);
32 void (*ccid_hc_tx_exit
)(struct sock
*sk
);
33 void (*ccid_hc_rx_packet_recv
)(struct sock
*sk
, struct sk_buff
*skb
);
34 int (*ccid_hc_rx_parse_options
)(struct sock
*sk
,
36 unsigned char len
, u16 idx
,
37 unsigned char* value
);
38 void (*ccid_hc_rx_insert_options
)(struct sock
*sk
, struct sk_buff
*skb
);
39 void (*ccid_hc_tx_insert_options
)(struct sock
*sk
, struct sk_buff
*skb
);
40 void (*ccid_hc_tx_packet_recv
)(struct sock
*sk
, struct sk_buff
*skb
);
41 int (*ccid_hc_tx_parse_options
)(struct sock
*sk
,
43 unsigned char len
, u16 idx
,
44 unsigned char* value
);
45 int (*ccid_hc_tx_send_packet
)(struct sock
*sk
,
46 struct sk_buff
*skb
, int len
,
48 void (*ccid_hc_tx_packet_sent
)(struct sock
*sk
, int more
, int len
);
51 extern int ccid_register(struct ccid
*ccid
);
52 extern int ccid_unregister(struct ccid
*ccid
);
54 extern struct ccid
*ccid_init(unsigned char id
, struct sock
*sk
);
55 extern void ccid_exit(struct ccid
*ccid
, struct sock
*sk
);
57 static inline void __ccid_get(struct ccid
*ccid
)
59 __module_get(ccid
->ccid_owner
);
62 static inline int ccid_hc_tx_send_packet(struct ccid
*ccid
, struct sock
*sk
,
63 struct sk_buff
*skb
, int len
,
67 if (ccid
->ccid_hc_tx_send_packet
!= NULL
)
68 rc
= ccid
->ccid_hc_tx_send_packet(sk
, skb
, len
, delay
);
72 static inline void ccid_hc_tx_packet_sent(struct ccid
*ccid
, struct sock
*sk
,
75 if (ccid
->ccid_hc_tx_packet_sent
!= NULL
)
76 ccid
->ccid_hc_tx_packet_sent(sk
, more
, len
);
79 static inline int ccid_hc_rx_init(struct ccid
*ccid
, struct sock
*sk
)
82 if (ccid
->ccid_hc_rx_init
!= NULL
)
83 rc
= ccid
->ccid_hc_rx_init(sk
);
87 static inline int ccid_hc_tx_init(struct ccid
*ccid
, struct sock
*sk
)
90 if (ccid
->ccid_hc_tx_init
!= NULL
)
91 rc
= ccid
->ccid_hc_tx_init(sk
);
95 static inline void ccid_hc_rx_exit(struct ccid
*ccid
, struct sock
*sk
)
97 if (ccid
->ccid_hc_rx_exit
!= NULL
)
98 ccid
->ccid_hc_rx_exit(sk
);
101 static inline void ccid_hc_tx_exit(struct ccid
*ccid
, struct sock
*sk
)
103 if (ccid
->ccid_hc_tx_exit
!= NULL
)
104 ccid
->ccid_hc_tx_exit(sk
);
107 static inline void ccid_hc_rx_packet_recv(struct ccid
*ccid
, struct sock
*sk
,
110 if (ccid
->ccid_hc_rx_packet_recv
!= NULL
)
111 ccid
->ccid_hc_rx_packet_recv(sk
, skb
);
114 static inline void ccid_hc_tx_packet_recv(struct ccid
*ccid
, struct sock
*sk
,
117 if (ccid
->ccid_hc_tx_packet_recv
!= NULL
)
118 ccid
->ccid_hc_tx_packet_recv(sk
, skb
);
121 static inline int ccid_hc_tx_parse_options(struct ccid
*ccid
, struct sock
*sk
,
122 unsigned char option
,
123 unsigned char len
, u16 idx
,
124 unsigned char* value
)
127 if (ccid
->ccid_hc_tx_parse_options
!= NULL
)
128 rc
= ccid
->ccid_hc_tx_parse_options(sk
, option
, len
, idx
, value
);
132 static inline int ccid_hc_rx_parse_options(struct ccid
*ccid
, struct sock
*sk
,
133 unsigned char option
,
134 unsigned char len
, u16 idx
,
135 unsigned char* value
)
138 if (ccid
->ccid_hc_rx_parse_options
!= NULL
)
139 rc
= ccid
->ccid_hc_rx_parse_options(sk
, option
, len
, idx
, value
);
143 static inline void ccid_hc_tx_insert_options(struct ccid
*ccid
, struct sock
*sk
,
146 if (ccid
->ccid_hc_tx_insert_options
!= NULL
)
147 ccid
->ccid_hc_tx_insert_options(sk
, skb
);
150 static inline void ccid_hc_rx_insert_options(struct ccid
*ccid
, struct sock
*sk
,
153 if (ccid
->ccid_hc_rx_insert_options
!= NULL
)
154 ccid
->ccid_hc_rx_insert_options(sk
, skb
);