2 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
4 * Marek Lindner, Simon Wunderlich
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #ifndef _NET_BATMAN_ADV_PACKET_H_
23 #define _NET_BATMAN_ADV_PACKET_H_
25 #define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
33 BAT_UNICAST_FRAG = 0x06
36 /* this file is included by batctl which needs these defines */
37 #define COMPAT_VERSION 12
40 PRIMARIES_FIRST_HOP = 1 << 4,
45 /* ICMP message types */
46 enum icmp_packettype {
48 DESTINATION_UNREACHABLE = 3,
51 PARAMETER_PROBLEM = 12
56 VIS_TYPE_SERVER_SYNC = 0,
57 VIS_TYPE_CLIENT_UPDATE = 1
60 /* fragmentation defines */
61 enum unicast_frag_flags {
62 UNI_FRAG_HEAD = 1 << 0,
63 UNI_FRAG_LARGETAIL = 1 << 1
66 struct batman_packet {
68 uint8_t version; /* batman version field */
69 uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
73 uint8_t prev_sender[6];
76 uint8_t gw_flags; /* flags related to gateway class */
80 #define BAT_PACKET_LEN sizeof(struct batman_packet)
84 uint8_t version; /* batman version field */
85 uint8_t msg_type; /* see ICMP message types above */
95 /* icmp_packet_rr must start with all fields from imcp_packet
96 * as this is assumed by code that handles ICMP packets */
97 struct icmp_packet_rr {
99 uint8_t version; /* batman version field */
100 uint8_t msg_type; /* see ICMP message types above */
107 uint8_t rr[BAT_RR_LEN][ETH_ALEN];
110 struct unicast_packet {
112 uint8_t version; /* batman version field */
117 struct unicast_frag_packet {
119 uint8_t version; /* batman version field */
127 struct bcast_packet {
129 uint8_t version; /* batman version field */
137 uint8_t version; /* batman version field */
138 uint8_t vis_type; /* which type of vis-participant sent this? */
139 uint8_t entries; /* number of entries behind this struct */
140 uint32_t seqno; /* sequence number */
141 uint8_t ttl; /* TTL */
142 uint8_t vis_orig[6]; /* originator that announces its neighbors */
143 uint8_t target_orig[6]; /* who should receive this packet */
144 uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */
147 #endif /* _NET_BATMAN_ADV_PACKET_H_ */