aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccid.h
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:30:19 -0400
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:45:34 -0400
commit3306c781ff13aea89606435c134ec84e3c608681 (patch)
tree281cfebaf9504e4747938509efca0cc255b3372f /net/dccp/ccid.h
parent47a61e7b433a014296971ea1226eb1adb6310ab4 (diff)
dccp: Add packet type information to CCID-specific option parsing
This patch ... 1. adds packet type information to ccid_hc_{rx,tx}_parse_options(). This is necessary, since table 3 in RFC 4340, 5.8 leaves it to the CCIDs to state which options may (not) appear on what packet type. 2. adds such a check for CCID-3's {Loss Event, Receive} Rate as specified in RFC 4340 8.3 ("Receive Rate options MUST NOT be sent on DCCP-Data packets") and 8.5 ("Loss Event Rate options MUST NOT be sent on DCCP-Data packets"). 3. removes an unused argument `idx' from ccid_hc_{rx,tx}_parse_options(). This is also no longer necessary, since the CCID-specific option-parsing routines are passed every single parameter of the type-length-value option encoding. Also added documentation and made argument naming scheme consistent. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ccid.h')
-rw-r--r--net/dccp/ccid.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
index 20ba066b2775..bce517c99996 100644
--- a/net/dccp/ccid.h
+++ b/net/dccp/ccid.h
@@ -60,18 +60,14 @@ struct ccid_operations {
60 void (*ccid_hc_tx_exit)(struct sock *sk); 60 void (*ccid_hc_tx_exit)(struct sock *sk);
61 void (*ccid_hc_rx_packet_recv)(struct sock *sk, 61 void (*ccid_hc_rx_packet_recv)(struct sock *sk,
62 struct sk_buff *skb); 62 struct sk_buff *skb);
63 int (*ccid_hc_rx_parse_options)(struct sock *sk, 63 int (*ccid_hc_rx_parse_options)(struct sock *sk, u8 pkt,
64 unsigned char option, 64 u8 opt, u8 *val, u8 len);
65 unsigned char len, u16 idx,
66 unsigned char* value);
67 int (*ccid_hc_rx_insert_options)(struct sock *sk, 65 int (*ccid_hc_rx_insert_options)(struct sock *sk,
68 struct sk_buff *skb); 66 struct sk_buff *skb);
69 void (*ccid_hc_tx_packet_recv)(struct sock *sk, 67 void (*ccid_hc_tx_packet_recv)(struct sock *sk,
70 struct sk_buff *skb); 68 struct sk_buff *skb);
71 int (*ccid_hc_tx_parse_options)(struct sock *sk, 69 int (*ccid_hc_tx_parse_options)(struct sock *sk, u8 pkt,
72 unsigned char option, 70 u8 opt, u8 *val, u8 len);
73 unsigned char len, u16 idx,
74 unsigned char* value);
75 int (*ccid_hc_tx_send_packet)(struct sock *sk, 71 int (*ccid_hc_tx_send_packet)(struct sock *sk,
76 struct sk_buff *skb); 72 struct sk_buff *skb);
77 void (*ccid_hc_tx_packet_sent)(struct sock *sk, 73 void (*ccid_hc_tx_packet_sent)(struct sock *sk,
@@ -163,27 +159,31 @@ static inline void ccid_hc_tx_packet_recv(struct ccid *ccid, struct sock *sk,
163 ccid->ccid_ops->ccid_hc_tx_packet_recv(sk, skb); 159 ccid->ccid_ops->ccid_hc_tx_packet_recv(sk, skb);
164} 160}
165 161
162/**
163 * ccid_hc_tx_parse_options - Parse CCID-specific options sent by the receiver
164 * @pkt: type of packet that @opt appears on (RFC 4340, 5.1)
165 * @opt: the CCID-specific option type (RFC 4340, 5.8 and 10.3)
166 * @val: value of @opt
167 * @len: length of @val in bytes
168 */
166static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk, 169static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk,
167 unsigned char option, 170 u8 pkt, u8 opt, u8 *val, u8 len)
168 unsigned char len, u16 idx,
169 unsigned char* value)
170{ 171{
171 int rc = 0; 172 if (ccid->ccid_ops->ccid_hc_tx_parse_options == NULL)
172 if (ccid->ccid_ops->ccid_hc_tx_parse_options != NULL) 173 return 0;
173 rc = ccid->ccid_ops->ccid_hc_tx_parse_options(sk, option, len, idx, 174 return ccid->ccid_ops->ccid_hc_tx_parse_options(sk, pkt, opt, val, len);
174 value);
175 return rc;
176} 175}
177 176
177/**
178 * ccid_hc_rx_parse_options - Parse CCID-specific options sent by the sender
179 * Arguments are analogous to ccid_hc_tx_parse_options()
180 */
178static inline int ccid_hc_rx_parse_options(struct ccid *ccid, struct sock *sk, 181static inline int ccid_hc_rx_parse_options(struct ccid *ccid, struct sock *sk,
179 unsigned char option, 182 u8 pkt, u8 opt, u8 *val, u8 len)
180 unsigned char len, u16 idx,
181 unsigned char* value)
182{ 183{
183 int rc = 0; 184 if (ccid->ccid_ops->ccid_hc_rx_parse_options == NULL)
184 if (ccid->ccid_ops->ccid_hc_rx_parse_options != NULL) 185 return 0;
185 rc = ccid->ccid_ops->ccid_hc_rx_parse_options(sk, option, len, idx, value); 186 return ccid->ccid_ops->ccid_hc_rx_parse_options(sk, pkt, opt, val, len);
186 return rc;
187} 187}
188 188
189static inline int ccid_hc_rx_insert_options(struct ccid *ccid, struct sock *sk, 189static inline int ccid_hc_rx_insert_options(struct ccid *ccid, struct sock *sk,