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