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