From Didier Gautheron:
[obnox/wireshark/wip.git] / epan / dissectors / packet-bat.h
1 /* packet-bat.h
2  * Routines for B.A.T.M.A.N. Layer 3 dissection
3  * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors:
4  * Marek Lindner
5  *
6  * $Id$
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of version 2 of the GNU General Public
10  * License as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301, USA
21  *
22  */
23
24 #ifndef _PACKET_BAT_H
25 #define _PACKET_BAT_H
26
27 #define BAT_BATMAN_PORT  4305
28 #define BAT_GW_PORT  4306
29 #define BAT_VIS_PORT  4307
30
31 #define UNIDIRECTIONAL 0x80
32 #define DIRECTLINK 0x40
33
34 struct batman_packet_v5 {
35         guint8  version;  /* batman version field */
36         guint8  flags;    /* 0x80: UNIDIRECTIONAL link, 0x40: DIRECTLINK flag, ... */
37         guint8  ttl;
38         guint8  gwflags;  /* flags related to gateway functions: gateway class */
39         guint16 seqno;
40         guint16 gwport;
41         address orig;
42         address old_orig;
43         guint8 tq;
44         guint8 hna_len;
45 };
46 #define BATMAN_PACKET_V5_SIZE 18
47
48 struct gw_packet {
49         guint8  type;
50 };
51 #define GW_PACKET_SIZE 1
52
53 #define TUNNEL_DATA 0x01
54 #define TUNNEL_IP_REQUEST 0x02
55 #define TUNNEL_IP_INVALID 0x03
56 #define TUNNEL_KEEPALIVE_REQUEST 0x04
57 #define TUNNEL_KEEPALIVE_REPLY 0x05
58
59 #define DATA_TYPE_NEIGH 1
60 #define DATA_TYPE_SEC_IF 2
61 #define DATA_TYPE_HNA 3
62
63
64
65 struct vis_packet_v22 {
66         address sender_ip;
67         guint8 version;
68         guint8 gw_class;
69         guint16 tq_max;
70 };
71 #define VIS_PACKET_V22_SIZE 8
72
73 struct vis_data_v22 {
74         guint8 type;
75         guint16 data;
76         address ip;
77 };
78 #define VIS_PACKET_V22_DATA_SIZE 7
79
80 struct vis_packet_v23 {
81         address sender_ip;
82         guint8 version;
83         guint8 gw_class;
84         guint8 tq_max;
85 };
86 #define VIS_PACKET_V23_SIZE 7
87
88 struct vis_data_v23 {
89         guint8 type;
90         guint8 data;
91         address ip;
92 };
93 #define VIS_PACKET_V23_DATA_SIZE 6
94
95 #endif /* _PACKET_BAT_H */