2 * Copyright (C) 2007-2010 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 */
27 #define BAT_PACKET 0x01
29 #define BAT_UNICAST 0x03
30 #define BAT_BCAST 0x04
32 #define BAT_UNICAST_FRAG 0x06
34 /* this file is included by batctl which needs these defines */
35 #define COMPAT_VERSION 13
36 #define DIRECTLINK 0x40
37 #define VIS_SERVER 0x20
38 #define PRIMARIES_FIRST_HOP 0x10
40 /* ICMP message types */
42 #define DESTINATION_UNREACHABLE 3
43 #define ECHO_REQUEST 8
44 #define TTL_EXCEEDED 11
45 #define PARAMETER_PROBLEM 12
48 #define VIS_TYPE_SERVER_SYNC 0
49 #define VIS_TYPE_CLIENT_UPDATE 1
51 /* fragmentation defines */
52 #define UNI_FRAG_HEAD 0x01
54 struct batman_packet
{
56 uint8_t version
; /* batman version field */
57 uint8_t flags
; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
61 uint8_t prev_sender
[6];
64 } __attribute__((packed
));
66 #define BAT_PACKET_LEN sizeof(struct batman_packet)
70 uint8_t version
; /* batman version field */
71 uint8_t msg_type
; /* see ICMP message types above */
77 } __attribute__((packed
));
81 /* icmp_packet_rr must start with all fields from imcp_packet
82 * as this is assumed by code that handles ICMP packets */
83 struct icmp_packet_rr
{
85 uint8_t version
; /* batman version field */
86 uint8_t msg_type
; /* see ICMP message types above */
93 uint8_t rr
[BAT_RR_LEN
][ETH_ALEN
];
94 } __attribute__((packed
));
96 struct unicast_packet
{
98 uint8_t version
; /* batman version field */
101 } __attribute__((packed
));
103 struct unicast_frag_packet
{
105 uint8_t version
; /* batman version field */
111 } __attribute__((packed
));
113 struct bcast_packet
{
115 uint8_t version
; /* batman version field */
119 } __attribute__((packed
));
123 uint8_t version
; /* batman version field */
124 uint8_t vis_type
; /* which type of vis-participant sent this? */
125 uint8_t entries
; /* number of entries behind this struct */
126 uint32_t seqno
; /* sequence number */
127 uint8_t ttl
; /* TTL */
128 uint8_t vis_orig
[6]; /* originator that informs about its
130 uint8_t target_orig
[6]; /* who should receive this packet */
131 uint8_t sender_orig
[6]; /* who sent or rebroadcasted this packet */
132 } __attribute__((packed
));
134 #endif /* _NET_BATMAN_ADV_PACKET_H_ */