Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
packet.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
2  *
3  * Marek Lindner, Simon Wunderlich
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public
7  * License as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA
18  */
19 
20 #ifndef _NET_BATMAN_ADV_PACKET_H_
21 #define _NET_BATMAN_ADV_PACKET_H_
22 
23 #define BATADV_ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
24 
26  BATADV_IV_OGM = 0x01,
27  BATADV_ICMP = 0x02,
29  BATADV_BCAST = 0x04,
30  BATADV_VIS = 0x05,
34 };
35 
36 /* this file is included by batctl which needs these defines */
37 #define BATADV_COMPAT_VERSION 14
38 
44 };
45 
46 /* ICMP message types */
53 };
54 
55 /* vis defines */
59 };
60 
61 /* fragmentation defines */
65 };
66 
67 /* TT_QUERY subtypes */
68 #define BATADV_TT_QUERY_TYPE_MASK 0x3
69 
73 };
74 
75 /* TT_QUERY flags */
78 };
79 
80 /* BATADV_TT_CLIENT flags.
81  * Flags from BIT(0) to BIT(7) are sent on the wire, while flags from BIT(8) to
82  * BIT(15) are used for local computation only
83  */
92 };
93 
94 /* claim frame types for the bridge loop avoidance */
100 };
101 
102 /* the destination hardware field in the ARP frame is used to
103  * transport the claim type and the group id
104  */
106  uint8_t magic[3]; /* FF:43:05 */
107  uint8_t type; /* bla_claimframe */
108  __be16 group; /* group id */
109 } __packed;
110 
113  uint8_t version; /* batman version field */
115 } __packed;
116 
119  uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
123  uint8_t gw_flags; /* flags related to gateway class */
126  uint8_t ttvn; /* translation table version number */
128 } __packed;
129 
130 #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
131 
134  uint8_t msg_type; /* see ICMP message types above */
140 } __packed;
141 
142 #define BATADV_RR_LEN 16
143 
144 /* icmp_packet_rr must start with all fields from imcp_packet
145  * as this is assumed by code that handles ICMP packets
146  */
149  uint8_t msg_type; /* see ICMP message types above */
156 } __packed;
157 
160  uint8_t ttvn; /* destination translation table version number */
162 } __packed;
163 
166  uint8_t ttvn; /* destination translation table version number */
172 } __packed;
173 
179 } __packed;
180 
183  uint8_t vis_type; /* which type of vis-participant sent this? */
184  __be32 seqno; /* sequence number */
185  uint8_t entries; /* number of entries behind this struct */
187  uint8_t vis_orig[ETH_ALEN]; /* originator reporting its neighbors */
188  uint8_t target_orig[ETH_ALEN]; /* who should receive this packet */
189  uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */
190 } __packed;
191 
194  /* the flag field is a combination of:
195  * - TT_REQUEST or TT_RESPONSE
196  * - TT_FULL_TABLE
197  */
201  /* the ttvn field is:
202  * if TT_REQUEST: ttvn that triggered the
203  * request
204  * if TT_RESPONSE: new ttvn for the src
205  * orig_node
206  */
208  /* tt_data field is:
209  * if TT_REQUEST: crc associated with the
210  * ttvn
211  * if TT_RESPONSE: table_size
212  */
214 } __packed;
215 
222 } __packed;
223 
227 } __packed;
228 
229 #endif /* _NET_BATMAN_ADV_PACKET_H_ */