cfg80211: expect different rd in cfg80211 when intersecting
[linux-2.6/mini2440.git] / net / dccp / ackvec.h
blob4ccee030524e403abac5cec98e340307937021b1
1 #ifndef _ACKVEC_H
2 #define _ACKVEC_H
3 /*
4 * net/dccp/ackvec.h
6 * An implementation of the DCCP protocol
7 * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@mandriva.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/dccp.h>
15 #include <linux/compiler.h>
16 #include <linux/ktime.h>
17 #include <linux/list.h>
18 #include <linux/types.h>
20 /* We can spread an ack vector across multiple options */
21 #define DCCP_MAX_ACKVEC_LEN (DCCP_SINGLE_OPT_MAXLEN * 2)
23 #define DCCP_ACKVEC_STATE_RECEIVED 0
24 #define DCCP_ACKVEC_STATE_ECN_MARKED (1 << 6)
25 #define DCCP_ACKVEC_STATE_NOT_RECEIVED (3 << 6)
27 #define DCCP_ACKVEC_STATE_MASK 0xC0 /* 11000000 */
28 #define DCCP_ACKVEC_LEN_MASK 0x3F /* 00111111 */
30 /** struct dccp_ackvec - ack vector
32 * This data structure is the one defined in RFC 4340, Appendix A.
34 * @av_buf_head - circular buffer head
35 * @av_buf_tail - circular buffer tail
36 * @av_buf_ackno - ack # of the most recent packet acknowledgeable in the
37 * buffer (i.e. %av_buf_head)
38 * @av_buf_nonce - the one-bit sum of the ECN Nonces on all packets acked
39 * by the buffer with State 0
41 * Additionally, the HC-Receiver must keep some information about the
42 * Ack Vectors it has recently sent. For each packet sent carrying an
43 * Ack Vector, it remembers four variables:
45 * @av_records - list of dccp_ackvec_record
46 * @av_ack_nonce - the one-bit sum of the ECN Nonces for all State 0.
48 * @av_time - the time in usecs
49 * @av_buf - circular buffer of acknowledgeable packets
51 struct dccp_ackvec {
52 u64 av_buf_ackno;
53 struct list_head av_records;
54 ktime_t av_time;
55 u16 av_buf_head;
56 u16 av_vec_len;
57 u8 av_buf_nonce;
58 u8 av_ack_nonce;
59 u8 av_buf[DCCP_MAX_ACKVEC_LEN];
62 /** struct dccp_ackvec_record - ack vector record
64 * ACK vector record as defined in Appendix A of spec.
66 * The list is sorted by avr_ack_seqno
68 * @avr_node - node in av_records
69 * @avr_ack_seqno - sequence number of the packet this record was sent on
70 * @avr_ack_ackno - sequence number being acknowledged
71 * @avr_ack_ptr - pointer into av_buf where this record starts
72 * @avr_ack_nonce - av_ack_nonce at the time this record was sent
73 * @avr_sent_len - lenght of the record in av_buf
75 struct dccp_ackvec_record {
76 struct list_head avr_node;
77 u64 avr_ack_seqno;
78 u64 avr_ack_ackno;
79 u16 avr_ack_ptr;
80 u16 avr_sent_len;
81 u8 avr_ack_nonce;
84 struct sock;
85 struct sk_buff;
87 #ifdef CONFIG_IP_DCCP_ACKVEC
88 extern int dccp_ackvec_init(void);
89 extern void dccp_ackvec_exit(void);
91 extern struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority);
92 extern void dccp_ackvec_free(struct dccp_ackvec *av);
94 extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
95 const u64 ackno, const u8 state);
97 extern void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
98 struct sock *sk, const u64 ackno);
99 extern int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
100 u64 *ackno, const u8 opt,
101 const u8 *value, const u8 len);
103 extern int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb);
105 static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
107 return av->av_vec_len;
109 #else /* CONFIG_IP_DCCP_ACKVEC */
110 static inline int dccp_ackvec_init(void)
112 return 0;
115 static inline void dccp_ackvec_exit(void)
119 static inline struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority)
121 return NULL;
124 static inline void dccp_ackvec_free(struct dccp_ackvec *av)
128 static inline int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
129 const u64 ackno, const u8 state)
131 return -1;
134 static inline void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
135 struct sock *sk, const u64 ackno)
139 static inline int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
140 const u64 *ackno, const u8 opt,
141 const u8 *value, const u8 len)
143 return -1;
146 static inline int dccp_insert_option_ackvec(const struct sock *sk,
147 const struct sk_buff *skb)
149 return -1;
152 static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
154 return 0;
156 #endif /* CONFIG_IP_DCCP_ACKVEC */
157 #endif /* _ACKVEC_H */