]> The Tcpdump Group git mirrors - tcpdump/blob - mptcp.h
use macros for VAT and WB port numbers
[tcpdump] / mptcp.h
1 /**
2 * Copyright (c) 2012
3 *
4 * Gregory Detal <gregory.detal@uclouvain.be>
5 * Christoph Paasch <christoph.paasch@uclouvain.be>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * 3. Neither the name of the University nor of the Laboratory may be used
19 * to endorse or promote products derived from this software without
20 * specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35 #define MPTCP_SUB_CAPABLE 0x0
36 #define MPTCP_SUB_JOIN 0x1
37 #define MPTCP_SUB_DSS 0x2
38 #define MPTCP_SUB_ADD_ADDR 0x3
39 #define MPTCP_SUB_REMOVE_ADDR 0x4
40 #define MPTCP_SUB_PRIO 0x5
41 #define MPTCP_SUB_FAIL 0x6
42 #define MPTCP_SUB_FCLOSE 0x7
43
44
45 struct mptcp_option {
46 u_int8_t kind;
47 u_int8_t len;
48 #if !LBL_ALIGN
49 u_int8_t ver:4,
50 sub:4;
51 #else
52 u_int8_t sub:4,
53 ver:4;
54 #endif
55 };
56
57 struct mp_capable {
58 u_int8_t kind;
59 u_int8_t len;
60 #if !LBL_ALIGN
61 u_int8_t ver:4,
62 sub:4;
63 u_int8_t s:1,
64 rsv:6,
65 c:1;
66 #else
67 u_int8_t sub:4,
68 ver:4;
69 u_int8_t c:1,
70 rsv:6,
71 s:1;
72 #endif
73 u_int64_t sender_key;
74 u_int64_t receiver_key;
75 } __attribute__((__packed__));
76
77 struct mp_join {
78 u_int8_t kind;
79 u_int8_t len;
80 #if !LBL_ALIGN
81 u_int8_t b:1,
82 rsv:3,
83 sub:4;
84 #else
85 u_int8_t sub:4,
86 rsv:3,
87 b:1;
88 #endif
89 u_int8_t addr_id;
90 union {
91 struct {
92 u_int32_t token;
93 u_int32_t nonce;
94 } syn;
95 struct {
96 u_int64_t mac;
97 u_int32_t nonce;
98 } synack;
99 struct {
100 u_int8_t mac[20];
101 } ack;
102 } u;
103 } __attribute__((__packed__));
104
105 struct mp_dss {
106 u_int8_t kind;
107 u_int8_t len;
108 #if !LBL_ALIGN
109 u_int16_t rsv1:4,
110 sub:4,
111 A:1,
112 a:1,
113 M:1,
114 m:1,
115 F:1,
116 rsv2:3;
117 #else
118 u_int16_t sub:4,
119 rsv1:4,
120 rsv2:3,
121 F:1,
122 m:1,
123 M:1,
124 a:1,
125 A:1;
126 #endif
127 };
128
129 struct mp_add_addr {
130 u_int8_t kind;
131 u_int8_t len;
132 #if !LBL_ALIGN
133 u_int8_t ipver:4,
134 sub:4;
135 #else
136 u_int8_t sub:4,
137 ipver:4;
138 #endif
139 u_int8_t addr_id;
140 union {
141 struct {
142 struct in_addr addr;
143 u_int16_t port;
144 } v4;
145 struct {
146 struct in6_addr addr;
147 u_int16_t port;
148 } v6;
149 } u;
150 } __attribute__((__packed__));
151
152 struct mp_remove_addr {
153 u_int8_t kind;
154 u_int8_t len;
155 #if !LBL_ALIGN
156 u_int8_t rsv:4,
157 sub:4;
158 #else
159 u_int8_t sub:4,
160 rsv:4;
161 #endif
162 /* list of addr_id */
163 u_int8_t addrs_id;
164 };
165
166 struct mp_fail {
167 u_int8_t kind;
168 u_int8_t len;
169 #if !LBL_ALIGN
170 u_int16_t rsv1:4,
171 sub:4,
172 rsv2:8;
173 #else
174 u_int16_t sub:4,
175 rsv1:4,
176 rsv2:8;
177 #endif
178 u_int64_t data_seq;
179 } __attribute__((__packed__));
180
181 struct mp_fclose {
182 u_int8_t kind;
183 u_int8_t len;
184 #if !LBL_ALIGN
185 u_int16_t rsv1:4,
186 sub:4,
187 rsv2:8;
188 #else
189 u_int16_t sub:4,
190 rsv1:4,
191 rsv2:8;
192 #endif
193 u_int64_t key;
194 } __attribute__((__packed__));
195
196 struct mp_prio {
197 u_int8_t kind;
198 u_int8_t len;
199 #if !LBL_ALIGN
200 u_int8_t b:1,
201 rsv:3,
202 sub:4;
203 #else
204 u_int8_t sub:4,
205 rsv:3,
206 b:1;
207 #endif
208 u_int8_t addr_id;
209 } __attribute__((__packed__));
210