1#ifndef _ACKVEC_H
2#define _ACKVEC_H
3
4
5
6
7
8
9
10
11
12
13
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>
19
20
21#define DCCP_MAX_ACKVEC_LEN (DCCP_SINGLE_OPT_MAXLEN * 2)
22
23
24#define DCCPAV_MIN_OPTLEN 16
25
26#define DCCP_ACKVEC_STATE_RECEIVED 0
27#define DCCP_ACKVEC_STATE_ECN_MARKED (1 << 6)
28#define DCCP_ACKVEC_STATE_NOT_RECEIVED (3 << 6)
29
30#define DCCP_ACKVEC_STATE_MASK 0xC0
31#define DCCP_ACKVEC_LEN_MASK 0x3F
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54struct dccp_ackvec {
55 u64 av_buf_ackno;
56 struct list_head av_records;
57 ktime_t av_time;
58 u16 av_buf_head;
59 u16 av_vec_len;
60 u8 av_buf_nonce;
61 u8 av_ack_nonce;
62 u8 av_buf[DCCP_MAX_ACKVEC_LEN];
63};
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78struct dccp_ackvec_record {
79 struct list_head avr_node;
80 u64 avr_ack_seqno;
81 u64 avr_ack_ackno;
82 u16 avr_ack_ptr;
83 u16 avr_sent_len;
84 u8 avr_ack_nonce;
85};
86
87struct sock;
88struct sk_buff;
89
90extern int dccp_ackvec_init(void);
91extern void dccp_ackvec_exit(void);
92
93extern struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority);
94extern void dccp_ackvec_free(struct dccp_ackvec *av);
95
96extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
97 const u64 ackno, const u8 state);
98
99extern void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
100 struct sock *sk, const u64 ackno);
101extern int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
102 u64 *ackno, const u8 opt,
103 const u8 *value, const u8 len);
104
105extern int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb);
106
107static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
108{
109 return av->av_vec_len;
110}
111#endif
112