1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _UAPI_LINUX_BATADV_PACKET_H_
#define _UAPI_LINUX_BATADV_PACKET_H_
#include <asm/byteorder.h>
#include <linux/if_ether.h>
#include <linux/types.h>
#define batadv_tp_is_error(n) ((__u8) (n) > 127 ? 1 : 0)
enum batadv_packettype {
BATADV_IV_OGM = 0x00,
BATADV_BCAST = 0x01,
BATADV_CODED = 0x02,
BATADV_ELP = 0x03,
BATADV_OGM2 = 0x04,
#define BATADV_UNICAST_MIN 0x40
BATADV_UNICAST = 0x40,
BATADV_UNICAST_FRAG = 0x41,
BATADV_UNICAST_4ADDR = 0x42,
BATADV_ICMP = 0x43,
BATADV_UNICAST_TVLV = 0x44,
#define BATADV_UNICAST_MAX 0x7f
};
enum batadv_subtype {
BATADV_P_DATA = 0x01,
BATADV_P_DAT_DHT_GET = 0x02,
BATADV_P_DAT_DHT_PUT = 0x03,
BATADV_P_DAT_CACHE_REPLY = 0x04,
};
#define BATADV_COMPAT_VERSION 15
enum batadv_iv_flags {
BATADV_NOT_BEST_NEXT_HOP = 1UL << 0,
BATADV_PRIMARIES_FIRST_HOP = 1UL << 1,
BATADV_DIRECTLINK = 1UL << 2,
};
enum batadv_icmp_packettype {
BATADV_ECHO_REPLY = 0,
BATADV_DESTINATION_UNREACHABLE = 3,
BATADV_ECHO_REQUEST = 8,
BATADV_TTL_EXCEEDED = 11,
BATADV_PARAMETER_PROBLEM = 12,
BATADV_TP = 15,
};
enum batadv_mcast_flags {
BATADV_MCAST_WANT_ALL_UNSNOOPABLES = 1UL << 0,
BATADV_MCAST_WANT_ALL_IPV4 = 1UL << 1,
BATADV_MCAST_WANT_ALL_IPV6 = 1UL << 2,
BATADV_MCAST_WANT_NO_RTR4 = 1UL << 3,
BATADV_MCAST_WANT_NO_RTR6 = 1UL << 4,
};
#define BATADV_TT_DATA_TYPE_MASK 0x0F
enum batadv_tt_data_flags {
BATADV_TT_OGM_DIFF = 1UL << 0,
BATADV_TT_REQUEST = 1UL << 1,
BATADV_TT_RESPONSE = 1UL << 2,
BATADV_TT_FULL_TABLE = 1UL << 4,
};
enum batadv_vlan_flags {
BATADV_VLAN_HAS_TAG = 1UL << 15,
};
enum batadv_bla_claimframe {
BATADV_CLAIM_TYPE_CLAIM = 0x00,
BATADV_CLAIM_TYPE_UNCLAIM = 0x01,
BATADV_CLAIM_TYPE_ANNOUNCE = 0x02,
BATADV_CLAIM_TYPE_REQUEST = 0x03,
BATADV_CLAIM_TYPE_LOOPDETECT = 0x04,
};
enum batadv_tvlv_type {
BATADV_TVLV_GW = 0x01,
BATADV_TVLV_DAT = 0x02,
BATADV_TVLV_NC = 0x03,
BATADV_TVLV_TT = 0x04,
BATADV_TVLV_ROAM = 0x05,
BATADV_TVLV_MCAST = 0x06,
};
#pragma pack(2)
struct batadv_bla_claim_dst {
__u8 magic[3];
__u8 type;
__be16 group;
};
struct batadv_ogm_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 flags;
__be32 seqno;
__u8 orig[ETH_ALEN];
__u8 prev_sender[ETH_ALEN];
__u8 reserved;
__u8 tq;
__be16 tvlv_len;
};
#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
struct batadv_ogm2_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 flags;
__be32 seqno;
__u8 orig[ETH_ALEN];
__be16 tvlv_len;
__be32 throughput;
};
#define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet)
struct batadv_elp_packet {
__u8 packet_type;
__u8 version;
__u8 orig[ETH_ALEN];
__be32 seqno;
__be32 elp_interval;
};
#define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet)
struct batadv_icmp_header {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 msg_type;
__u8 dst[ETH_ALEN];
__u8 orig[ETH_ALEN];
__u8 uid;
__u8 align[3];
};
struct batadv_icmp_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 msg_type;
__u8 dst[ETH_ALEN];
__u8 orig[ETH_ALEN];
__u8 uid;
__u8 reserved;
__be16 seqno;
};
struct batadv_icmp_tp_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 msg_type;
__u8 dst[ETH_ALEN];
__u8 orig[ETH_ALEN];
__u8 uid;
__u8 subtype;
__u8 session[2];
__be32 seqno;
__be32 timestamp;
};
enum batadv_icmp_tp_subtype {
BATADV_TP_MSG = 0,
BATADV_TP_ACK,
};
#define BATADV_RR_LEN 16
struct batadv_icmp_packet_rr {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 msg_type;
__u8 dst[ETH_ALEN];
__u8 orig[ETH_ALEN];
__u8 uid;
__u8 rr_cur;
__be16 seqno;
__u8 rr[BATADV_RR_LEN][ETH_ALEN];
};
#define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr)
struct batadv_unicast_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 ttvn;
__u8 dest[ETH_ALEN];
};
struct batadv_unicast_4addr_packet {
struct batadv_unicast_packet u;
__u8 src[ETH_ALEN];
__u8 subtype;
__u8 reserved;
};
struct batadv_frag_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
#ifdef __BIG_ENDIAN_BITFIELD
__u8 no : 4;
__u8 priority : 3;
__u8 reserved : 1;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
__u8 reserved : 1;
__u8 priority : 3;
__u8 no : 4;
#else
#error "unknown bitfield endianness"
#endif
__u8 dest[ETH_ALEN];
__u8 orig[ETH_ALEN];
__be16 seqno;
__be16 total_size;
};
struct batadv_bcast_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 reserved;
__be32 seqno;
__u8 orig[ETH_ALEN];
};
struct batadv_coded_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 first_ttvn;
__u8 first_source[ETH_ALEN];
__u8 first_orig_dest[ETH_ALEN];
__be32 first_crc;
__u8 second_ttl;
__u8 second_ttvn;
__u8 second_dest[ETH_ALEN];
__u8 second_source[ETH_ALEN];
__u8 second_orig_dest[ETH_ALEN];
__be32 second_crc;
__be16 coded_len;
};
struct batadv_unicast_tvlv_packet {
__u8 packet_type;
__u8 version;
__u8 ttl;
__u8 reserved;
__u8 dst[ETH_ALEN];
__u8 src[ETH_ALEN];
__be16 tvlv_len;
__u16 align;
};
struct batadv_tvlv_hdr {
__u8 type;
__u8 version;
__be16 len;
};
struct batadv_tvlv_gateway_data {
__be32 bandwidth_down;
__be32 bandwidth_up;
};
struct batadv_tvlv_tt_data {
__u8 flags;
__u8 ttvn;
__be16 num_vlan;
};
struct batadv_tvlv_tt_vlan_data {
__be32 crc;
__be16 vid;
__u16 reserved;
};
struct batadv_tvlv_tt_change {
__u8 flags;
__u8 reserved[3];
__u8 addr[ETH_ALEN];
__be16 vid;
};
struct batadv_tvlv_roam_adv {
__u8 client[ETH_ALEN];
__be16 vid;
};
struct batadv_tvlv_mcast_data {
__u8 flags;
__u8 reserved[3];
};
#pragma pack()
#endif
|