aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccid.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2005-08-09 23:14:34 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:49:46 -0400
commit7c657876b63cb1d8a2ec06f8fc6c37bb8412e66c (patch)
tree3cb2732870c9cf8f976cb6fa57e0223f1c648e2a /net/dccp/ccid.h
parentc4365c9235f80128c3c3d5993074173941b1c1f0 (diff)
[DCCP]: Initial implementation
Development to this point was done on a subversion repository at: http://oops.ghostprotocols.net:81/cgi-bin/viewcvs.cgi/dccp-2.6/ This repository will be kept at this site for the foreseable future, so that interested parties can see the history of this code, attributions, etc. If I ever decide to take this offline I'll provide the full history at some other suitable place. Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccid.h')
-rw-r--r--net/dccp/ccid.h156
1 files changed, 156 insertions, 0 deletions
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
new file mode 100644
index 000000000000..06105b2a613c
--- /dev/null
+++ b/net/dccp/ccid.h
@@ -0,0 +1,156 @@
1#ifndef _CCID_H
2#define _CCID_H
3/*
4 * net/dccp/ccid.h
5 *
6 * An implementation of the DCCP protocol
7 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
8 *
9 * CCID infrastructure
10 *
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.
14 */
15
16#include <net/sock.h>
17#include <linux/dccp.h>
18#include <linux/list.h>
19#include <linux/module.h>
20
21#define CCID_MAX 255
22
23struct ccid {
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,
35 unsigned char option,
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,
42 unsigned char option,
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,
47 long *delay);
48 void (*ccid_hc_tx_packet_sent)(struct sock *sk, int more, int len);
49};
50
51extern int ccid_register(struct ccid *ccid);
52extern int ccid_unregister(struct ccid *ccid);
53
54extern struct ccid *ccid_init(unsigned char id, struct sock *sk);
55extern void ccid_exit(struct ccid *ccid, struct sock *sk);
56
57static inline void __ccid_get(struct ccid *ccid)
58{
59 __module_get(ccid->ccid_owner);
60}
61
62static inline int ccid_hc_tx_send_packet(struct ccid *ccid, struct sock *sk,
63 struct sk_buff *skb, int len,
64 long *delay)
65{
66 int rc = 0;
67 if (ccid->ccid_hc_tx_send_packet != NULL)
68 rc = ccid->ccid_hc_tx_send_packet(sk, skb, len, delay);
69 return rc;
70}
71
72static inline void ccid_hc_tx_packet_sent(struct ccid *ccid, struct sock *sk,
73 int more, int len)
74{
75 if (ccid->ccid_hc_tx_packet_sent != NULL)
76 ccid->ccid_hc_tx_packet_sent(sk, more, len);
77}
78
79static inline int ccid_hc_rx_init(struct ccid *ccid, struct sock *sk)
80{
81 int rc = 0;
82 if (ccid->ccid_hc_rx_init != NULL)
83 rc = ccid->ccid_hc_rx_init(sk);
84 return rc;
85}
86
87static inline int ccid_hc_tx_init(struct ccid *ccid, struct sock *sk)
88{
89 int rc = 0;
90 if (ccid->ccid_hc_tx_init != NULL)
91 rc = ccid->ccid_hc_tx_init(sk);
92 return rc;
93}
94
95static inline void ccid_hc_rx_exit(struct ccid *ccid, struct sock *sk)
96{
97 if (ccid->ccid_hc_rx_exit != NULL)
98 ccid->ccid_hc_rx_exit(sk);
99}
100
101static inline void ccid_hc_tx_exit(struct ccid *ccid, struct sock *sk)
102{
103 if (ccid->ccid_hc_tx_exit != NULL)
104 ccid->ccid_hc_tx_exit(sk);
105}
106
107static inline void ccid_hc_rx_packet_recv(struct ccid *ccid, struct sock *sk,
108 struct sk_buff *skb)
109{
110 if (ccid->ccid_hc_rx_packet_recv != NULL)
111 ccid->ccid_hc_rx_packet_recv(sk, skb);
112}
113
114static inline void ccid_hc_tx_packet_recv(struct ccid *ccid, struct sock *sk,
115 struct sk_buff *skb)
116{
117 if (ccid->ccid_hc_tx_packet_recv != NULL)
118 ccid->ccid_hc_tx_packet_recv(sk, skb);
119}
120
121static 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)
125{
126 int rc = 0;
127 if (ccid->ccid_hc_tx_parse_options != NULL)
128 rc = ccid->ccid_hc_tx_parse_options(sk, option, len, idx, value);
129 return rc;
130}
131
132static 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)
136{
137 int rc = 0;
138 if (ccid->ccid_hc_rx_parse_options != NULL)
139 rc = ccid->ccid_hc_rx_parse_options(sk, option, len, idx, value);
140 return rc;
141}
142
143static inline void ccid_hc_tx_insert_options(struct ccid *ccid, struct sock *sk,
144 struct sk_buff *skb)
145{
146 if (ccid->ccid_hc_tx_insert_options != NULL)
147 ccid->ccid_hc_tx_insert_options(sk, skb);
148}
149
150static inline void ccid_hc_rx_insert_options(struct ccid *ccid, struct sock *sk,
151 struct sk_buff *skb)
152{
153 if (ccid->ccid_hc_rx_insert_options != NULL)
154 ccid->ccid_hc_rx_insert_options(sk, skb);
155}
156#endif /* _CCID_H */