Home | History | Annotate | Download | only in linux
      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 };
     64 #define BATADV_TT_DATA_TYPE_MASK 0x0F
     65 enum batadv_tt_data_flags {
     66   BATADV_TT_OGM_DIFF = 1UL << 0,
     67   BATADV_TT_REQUEST = 1UL << 1,
     68   BATADV_TT_RESPONSE = 1UL << 2,
     69   BATADV_TT_FULL_TABLE = 1UL << 4,
     70 };
     71 enum batadv_vlan_flags {
     72   BATADV_VLAN_HAS_TAG = 1UL << 15,
     73 };
     74 enum batadv_bla_claimframe {
     75   BATADV_CLAIM_TYPE_CLAIM = 0x00,
     76   BATADV_CLAIM_TYPE_UNCLAIM = 0x01,
     77   BATADV_CLAIM_TYPE_ANNOUNCE = 0x02,
     78   BATADV_CLAIM_TYPE_REQUEST = 0x03,
     79   BATADV_CLAIM_TYPE_LOOPDETECT = 0x04,
     80 };
     81 enum batadv_tvlv_type {
     82   BATADV_TVLV_GW = 0x01,
     83   BATADV_TVLV_DAT = 0x02,
     84   BATADV_TVLV_NC = 0x03,
     85   BATADV_TVLV_TT = 0x04,
     86   BATADV_TVLV_ROAM = 0x05,
     87   BATADV_TVLV_MCAST = 0x06,
     88 };
     89 #pragma pack(2)
     90 struct batadv_bla_claim_dst {
     91   __u8 magic[3];
     92   __u8 type;
     93   __be16 group;
     94 };
     95 struct batadv_ogm_packet {
     96   __u8 packet_type;
     97   __u8 version;
     98   __u8 ttl;
     99   __u8 flags;
    100   __be32 seqno;
    101   __u8 orig[ETH_ALEN];
    102   __u8 prev_sender[ETH_ALEN];
    103   __u8 reserved;
    104   __u8 tq;
    105   __be16 tvlv_len;
    106 };
    107 #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
    108 struct batadv_ogm2_packet {
    109   __u8 packet_type;
    110   __u8 version;
    111   __u8 ttl;
    112   __u8 flags;
    113   __be32 seqno;
    114   __u8 orig[ETH_ALEN];
    115   __be16 tvlv_len;
    116   __be32 throughput;
    117 };
    118 #define BATADV_OGM2_HLEN sizeof(struct batadv_ogm2_packet)
    119 struct batadv_elp_packet {
    120   __u8 packet_type;
    121   __u8 version;
    122   __u8 orig[ETH_ALEN];
    123   __be32 seqno;
    124   __be32 elp_interval;
    125 };
    126 #define BATADV_ELP_HLEN sizeof(struct batadv_elp_packet)
    127 struct batadv_icmp_header {
    128   __u8 packet_type;
    129   __u8 version;
    130   __u8 ttl;
    131   __u8 msg_type;
    132   __u8 dst[ETH_ALEN];
    133   __u8 orig[ETH_ALEN];
    134   __u8 uid;
    135   __u8 align[3];
    136 };
    137 struct batadv_icmp_packet {
    138   __u8 packet_type;
    139   __u8 version;
    140   __u8 ttl;
    141   __u8 msg_type;
    142   __u8 dst[ETH_ALEN];
    143   __u8 orig[ETH_ALEN];
    144   __u8 uid;
    145   __u8 reserved;
    146   __be16 seqno;
    147 };
    148 struct batadv_icmp_tp_packet {
    149   __u8 packet_type;
    150   __u8 version;
    151   __u8 ttl;
    152   __u8 msg_type;
    153   __u8 dst[ETH_ALEN];
    154   __u8 orig[ETH_ALEN];
    155   __u8 uid;
    156   __u8 subtype;
    157   __u8 session[2];
    158   __be32 seqno;
    159   __be32 timestamp;
    160 };
    161 enum batadv_icmp_tp_subtype {
    162   BATADV_TP_MSG = 0,
    163   BATADV_TP_ACK,
    164 };
    165 #define BATADV_RR_LEN 16
    166 struct batadv_icmp_packet_rr {
    167   __u8 packet_type;
    168   __u8 version;
    169   __u8 ttl;
    170   __u8 msg_type;
    171   __u8 dst[ETH_ALEN];
    172   __u8 orig[ETH_ALEN];
    173   __u8 uid;
    174   __u8 rr_cur;
    175   __be16 seqno;
    176   __u8 rr[BATADV_RR_LEN][ETH_ALEN];
    177 };
    178 #define BATADV_ICMP_MAX_PACKET_SIZE sizeof(struct batadv_icmp_packet_rr)
    179 struct batadv_unicast_packet {
    180   __u8 packet_type;
    181   __u8 version;
    182   __u8 ttl;
    183   __u8 ttvn;
    184   __u8 dest[ETH_ALEN];
    185 };
    186 struct batadv_unicast_4addr_packet {
    187   struct batadv_unicast_packet u;
    188   __u8 src[ETH_ALEN];
    189   __u8 subtype;
    190   __u8 reserved;
    191 };
    192 struct batadv_frag_packet {
    193   __u8 packet_type;
    194   __u8 version;
    195   __u8 ttl;
    196 #ifdef __BIG_ENDIAN_BITFIELD
    197   __u8 no : 4;
    198   __u8 priority : 3;
    199   __u8 reserved : 1;
    200 #elif defined(__LITTLE_ENDIAN_BITFIELD)
    201   __u8 reserved : 1;
    202   __u8 priority : 3;
    203   __u8 no : 4;
    204 #else
    205 #error "unknown bitfield endianness"
    206 #endif
    207   __u8 dest[ETH_ALEN];
    208   __u8 orig[ETH_ALEN];
    209   __be16 seqno;
    210   __be16 total_size;
    211 };
    212 struct batadv_bcast_packet {
    213   __u8 packet_type;
    214   __u8 version;
    215   __u8 ttl;
    216   __u8 reserved;
    217   __be32 seqno;
    218   __u8 orig[ETH_ALEN];
    219 };
    220 struct batadv_coded_packet {
    221   __u8 packet_type;
    222   __u8 version;
    223   __u8 ttl;
    224   __u8 first_ttvn;
    225   __u8 first_source[ETH_ALEN];
    226   __u8 first_orig_dest[ETH_ALEN];
    227   __be32 first_crc;
    228   __u8 second_ttl;
    229   __u8 second_ttvn;
    230   __u8 second_dest[ETH_ALEN];
    231   __u8 second_source[ETH_ALEN];
    232   __u8 second_orig_dest[ETH_ALEN];
    233   __be32 second_crc;
    234   __be16 coded_len;
    235 };
    236 struct batadv_unicast_tvlv_packet {
    237   __u8 packet_type;
    238   __u8 version;
    239   __u8 ttl;
    240   __u8 reserved;
    241   __u8 dst[ETH_ALEN];
    242   __u8 src[ETH_ALEN];
    243   __be16 tvlv_len;
    244   __u16 align;
    245 };
    246 struct batadv_tvlv_hdr {
    247   __u8 type;
    248   __u8 version;
    249   __be16 len;
    250 };
    251 struct batadv_tvlv_gateway_data {
    252   __be32 bandwidth_down;
    253   __be32 bandwidth_up;
    254 };
    255 struct batadv_tvlv_tt_data {
    256   __u8 flags;
    257   __u8 ttvn;
    258   __be16 num_vlan;
    259 };
    260 struct batadv_tvlv_tt_vlan_data {
    261   __be32 crc;
    262   __be16 vid;
    263   __u16 reserved;
    264 };
    265 struct batadv_tvlv_tt_change {
    266   __u8 flags;
    267   __u8 reserved[3];
    268   __u8 addr[ETH_ALEN];
    269   __be16 vid;
    270 };
    271 struct batadv_tvlv_roam_adv {
    272   __u8 client[ETH_ALEN];
    273   __be16 vid;
    274 };
    275 struct batadv_tvlv_mcast_data {
    276   __u8 flags;
    277   __u8 reserved[3];
    278 };
    279 #pragma pack()
    280 #endif
    281