aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/packet.h')
-rw-r--r--net/batman-adv/packet.h49
1 files changed, 26 insertions, 23 deletions
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index 0ee1af770798..e562414c2940 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -1,5 +1,4 @@
1/* 1/* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
2 * Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
3 * 2 *
4 * Marek Lindner, Simon Wunderlich 3 * Marek Lindner, Simon Wunderlich
5 * 4 *
@@ -16,13 +15,12 @@
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA 17 * 02110-1301, USA
19 *
20 */ 18 */
21 19
22#ifndef _NET_BATMAN_ADV_PACKET_H_ 20#ifndef _NET_BATMAN_ADV_PACKET_H_
23#define _NET_BATMAN_ADV_PACKET_H_ 21#define _NET_BATMAN_ADV_PACKET_H_
24 22
25#define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ 23#define BATADV_ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
26 24
27enum bat_packettype { 25enum bat_packettype {
28 BAT_IV_OGM = 0x01, 26 BAT_IV_OGM = 0x01,
@@ -36,7 +34,7 @@ enum bat_packettype {
36}; 34};
37 35
38/* this file is included by batctl which needs these defines */ 36/* this file is included by batctl which needs these defines */
39#define COMPAT_VERSION 14 37#define BATADV_COMPAT_VERSION 14
40 38
41enum batman_iv_flags { 39enum batman_iv_flags {
42 NOT_BEST_NEXT_HOP = 1 << 3, 40 NOT_BEST_NEXT_HOP = 1 << 3,
@@ -67,7 +65,7 @@ enum unicast_frag_flags {
67}; 65};
68 66
69/* TT_QUERY subtypes */ 67/* TT_QUERY subtypes */
70#define TT_QUERY_TYPE_MASK 0x3 68#define BATADV_TT_QUERY_TYPE_MASK 0x3
71 69
72enum tt_query_packettype { 70enum tt_query_packettype {
73 TT_REQUEST = 0, 71 TT_REQUEST = 0,
@@ -81,7 +79,8 @@ enum tt_query_flags {
81 79
82/* TT_CLIENT flags. 80/* TT_CLIENT flags.
83 * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to 81 * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to
84 * 1 << 15 are used for local computation only */ 82 * 1 << 15 are used for local computation only
83 */
85enum tt_client_flags { 84enum tt_client_flags {
86 TT_CLIENT_DEL = 1 << 0, 85 TT_CLIENT_DEL = 1 << 0,
87 TT_CLIENT_ROAM = 1 << 1, 86 TT_CLIENT_ROAM = 1 << 1,
@@ -105,7 +104,7 @@ enum bla_claimframe {
105struct bla_claim_dst { 104struct bla_claim_dst {
106 uint8_t magic[3]; /* FF:43:05 */ 105 uint8_t magic[3]; /* FF:43:05 */
107 uint8_t type; /* bla_claimframe */ 106 uint8_t type; /* bla_claimframe */
108 uint16_t group; /* group id */ 107 __be16 group; /* group id */
109} __packed; 108} __packed;
110 109
111struct batman_header { 110struct batman_header {
@@ -117,41 +116,42 @@ struct batman_header {
117struct batman_ogm_packet { 116struct batman_ogm_packet {
118 struct batman_header header; 117 struct batman_header header;
119 uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */ 118 uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
120 uint32_t seqno; 119 __be32 seqno;
121 uint8_t orig[ETH_ALEN]; 120 uint8_t orig[ETH_ALEN];
122 uint8_t prev_sender[ETH_ALEN]; 121 uint8_t prev_sender[ETH_ALEN];
123 uint8_t gw_flags; /* flags related to gateway class */ 122 uint8_t gw_flags; /* flags related to gateway class */
124 uint8_t tq; 123 uint8_t tq;
125 uint8_t tt_num_changes; 124 uint8_t tt_num_changes;
126 uint8_t ttvn; /* translation table version number */ 125 uint8_t ttvn; /* translation table version number */
127 uint16_t tt_crc; 126 __be16 tt_crc;
128} __packed; 127} __packed;
129 128
130#define BATMAN_OGM_HLEN sizeof(struct batman_ogm_packet) 129#define BATADV_OGM_HLEN sizeof(struct batman_ogm_packet)
131 130
132struct icmp_packet { 131struct icmp_packet {
133 struct batman_header header; 132 struct batman_header header;
134 uint8_t msg_type; /* see ICMP message types above */ 133 uint8_t msg_type; /* see ICMP message types above */
135 uint8_t dst[ETH_ALEN]; 134 uint8_t dst[ETH_ALEN];
136 uint8_t orig[ETH_ALEN]; 135 uint8_t orig[ETH_ALEN];
137 uint16_t seqno; 136 __be16 seqno;
138 uint8_t uid; 137 uint8_t uid;
139 uint8_t reserved; 138 uint8_t reserved;
140} __packed; 139} __packed;
141 140
142#define BAT_RR_LEN 16 141#define BATADV_RR_LEN 16
143 142
144/* icmp_packet_rr must start with all fields from imcp_packet 143/* icmp_packet_rr must start with all fields from imcp_packet
145 * as this is assumed by code that handles ICMP packets */ 144 * as this is assumed by code that handles ICMP packets
145 */
146struct icmp_packet_rr { 146struct icmp_packet_rr {
147 struct batman_header header; 147 struct batman_header header;
148 uint8_t msg_type; /* see ICMP message types above */ 148 uint8_t msg_type; /* see ICMP message types above */
149 uint8_t dst[ETH_ALEN]; 149 uint8_t dst[ETH_ALEN];
150 uint8_t orig[ETH_ALEN]; 150 uint8_t orig[ETH_ALEN];
151 uint16_t seqno; 151 __be16 seqno;
152 uint8_t uid; 152 uint8_t uid;
153 uint8_t rr_cur; 153 uint8_t rr_cur;
154 uint8_t rr[BAT_RR_LEN][ETH_ALEN]; 154 uint8_t rr[BATADV_RR_LEN][ETH_ALEN];
155} __packed; 155} __packed;
156 156
157struct unicast_packet { 157struct unicast_packet {
@@ -167,20 +167,20 @@ struct unicast_frag_packet {
167 uint8_t flags; 167 uint8_t flags;
168 uint8_t align; 168 uint8_t align;
169 uint8_t orig[ETH_ALEN]; 169 uint8_t orig[ETH_ALEN];
170 uint16_t seqno; 170 __be16 seqno;
171} __packed; 171} __packed;
172 172
173struct bcast_packet { 173struct bcast_packet {
174 struct batman_header header; 174 struct batman_header header;
175 uint8_t reserved; 175 uint8_t reserved;
176 uint32_t seqno; 176 __be32 seqno;
177 uint8_t orig[ETH_ALEN]; 177 uint8_t orig[ETH_ALEN];
178} __packed; 178} __packed;
179 179
180struct vis_packet { 180struct vis_packet {
181 struct batman_header header; 181 struct batman_header header;
182 uint8_t vis_type; /* which type of vis-participant sent this? */ 182 uint8_t vis_type; /* which type of vis-participant sent this? */
183 uint32_t seqno; /* sequence number */ 183 __be32 seqno; /* sequence number */
184 uint8_t entries; /* number of entries behind this struct */ 184 uint8_t entries; /* number of entries behind this struct */
185 uint8_t reserved; 185 uint8_t reserved;
186 uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */ 186 uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */
@@ -192,7 +192,8 @@ struct tt_query_packet {
192 struct batman_header header; 192 struct batman_header header;
193 /* the flag field is a combination of: 193 /* the flag field is a combination of:
194 * - TT_REQUEST or TT_RESPONSE 194 * - TT_REQUEST or TT_RESPONSE
195 * - TT_FULL_TABLE */ 195 * - TT_FULL_TABLE
196 */
196 uint8_t flags; 197 uint8_t flags;
197 uint8_t dst[ETH_ALEN]; 198 uint8_t dst[ETH_ALEN];
198 uint8_t src[ETH_ALEN]; 199 uint8_t src[ETH_ALEN];
@@ -200,13 +201,15 @@ struct tt_query_packet {
200 * if TT_REQUEST: ttvn that triggered the 201 * if TT_REQUEST: ttvn that triggered the
201 * request 202 * request
202 * if TT_RESPONSE: new ttvn for the src 203 * if TT_RESPONSE: new ttvn for the src
203 * orig_node */ 204 * orig_node
205 */
204 uint8_t ttvn; 206 uint8_t ttvn;
205 /* tt_data field is: 207 /* tt_data field is:
206 * if TT_REQUEST: crc associated with the 208 * if TT_REQUEST: crc associated with the
207 * ttvn 209 * ttvn
208 * if TT_RESPONSE: table_size */ 210 * if TT_RESPONSE: table_size
209 uint16_t tt_data; 211 */
212 __be16 tt_data;
210} __packed; 213} __packed;
211 214
212struct roam_adv_packet { 215struct roam_adv_packet {