batman-adv: Explicitly mark the common header structure
[linux-2.6-block.git] / net / batman-adv / packet.h
index 4d9e54c57a360352323a1b2d720545878dc7332d..88c717b9344df8083d71c52b889b8a4aa823fa5d 100644 (file)
@@ -90,10 +90,14 @@ enum tt_client_flags {
        TT_CLIENT_PENDING = 1 << 10
 };
 
-struct batman_ogm_packet {
+struct batman_header {
        uint8_t  packet_type;
        uint8_t  version;  /* batman version field */
        uint8_t  ttl;
+} __packed;
+
+struct batman_ogm_packet {
+       struct batman_header header;
        uint8_t  flags;    /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
        uint32_t seqno;
        uint8_t  orig[6];
@@ -108,9 +112,7 @@ struct batman_ogm_packet {
 #define BATMAN_OGM_LEN sizeof(struct batman_ogm_packet)
 
 struct icmp_packet {
-       uint8_t  packet_type;
-       uint8_t  version;  /* batman version field */
-       uint8_t  ttl;
+       struct batman_header header;
        uint8_t  msg_type; /* see ICMP message types above */
        uint8_t  dst[6];
        uint8_t  orig[6];
@@ -124,9 +126,7 @@ struct icmp_packet {
 /* icmp_packet_rr must start with all fields from imcp_packet
  * as this is assumed by code that handles ICMP packets */
 struct icmp_packet_rr {
-       uint8_t  packet_type;
-       uint8_t  version;  /* batman version field */
-       uint8_t  ttl;
+       struct batman_header header;
        uint8_t  msg_type; /* see ICMP message types above */
        uint8_t  dst[6];
        uint8_t  orig[6];
@@ -137,17 +137,13 @@ struct icmp_packet_rr {
 } __packed;
 
 struct unicast_packet {
-       uint8_t  packet_type;
-       uint8_t  version;  /* batman version field */
-       uint8_t  ttl;
+       struct batman_header header;
        uint8_t  ttvn; /* destination translation table version number */
        uint8_t  dest[6];
 } __packed;
 
 struct unicast_frag_packet {
-       uint8_t  packet_type;
-       uint8_t  version;  /* batman version field */
-       uint8_t  ttl;
+       struct batman_header header;
        uint8_t  ttvn; /* destination translation table version number */
        uint8_t  dest[6];
        uint8_t  flags;
@@ -157,18 +153,14 @@ struct unicast_frag_packet {
 } __packed;
 
 struct bcast_packet {
-       uint8_t  packet_type;
-       uint8_t  version;  /* batman version field */
-       uint8_t  ttl;
+       struct batman_header header;
        uint8_t  reserved;
        uint32_t seqno;
        uint8_t  orig[6];
 } __packed;
 
 struct vis_packet {
-       uint8_t  packet_type;
-       uint8_t  version;        /* batman version field */
-       uint8_t  ttl;            /* TTL */
+       struct batman_header header;
        uint8_t  vis_type;       /* which type of vis-participant sent this? */
        uint32_t seqno;          /* sequence number */
        uint8_t  entries;        /* number of entries behind this struct */
@@ -179,9 +171,7 @@ struct vis_packet {
 } __packed;
 
 struct tt_query_packet {
-       uint8_t  packet_type;
-       uint8_t  version;  /* batman version field */
-       uint8_t  ttl;
+       struct batman_header header;
        /* the flag field is a combination of:
         * - TT_REQUEST or TT_RESPONSE
         * - TT_FULL_TABLE */
@@ -202,9 +192,7 @@ struct tt_query_packet {
 } __packed;
 
 struct roam_adv_packet {
-       uint8_t  packet_type;
-       uint8_t  version;
-       uint8_t  ttl;
+       struct batman_header header;
        uint8_t  reserved;
        uint8_t  dst[ETH_ALEN];
        uint8_t  src[ETH_ALEN];