]> The Tcpdump Group git mirrors - tcpdump/blob - aodv.h
From Bruce M. Simpson <[email protected]>: RFC 3561 AODV support.
[tcpdump] / aodv.h
1 /* @(#) $Header: /tcpdump/master/tcpdump/aodv.h,v 1.1 2003-08-06 06:49:39 guy Exp $ (LBL) */
2 /*
3 * Copyright (c) 2003 Bruce M. Simpson <bms@spc.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Bruce M. Simpson.
17 * 4. Neither the name of Bruce M. Simpson nor the names of co-
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY Bruce M. Simpson AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Bruce M. Simpson OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33 #ifndef _AODV_H_
34 #define _AODV_H_
35
36 struct aodv_rreq {
37 u_char rreq_type; /* AODV message type (1) */
38 u_char rreq_flags; /* various flags */
39 u_char rreq_zero0; /* reserved, set to zero */
40 u_char rreq_hops; /* number of hops from originator */
41 u_long rreq_id; /* request ID */
42 u_long rreq_da; /* destination IPv4 address */
43 u_long rreq_ds; /* destination sequence number */
44 u_long rreq_oa; /* originator IPv4 address */
45 u_long rreq_os; /* originator sequence number */
46 };
47 #ifdef INET6
48 struct aodv_rreq6 {
49 u_char rreq_type; /* AODV message type (1) */
50 u_char rreq_flags; /* various flags */
51 u_char rreq_zero0; /* reserved, set to zero */
52 u_char rreq_hops; /* number of hops from originator */
53 u_long rreq_id; /* request ID */
54 struct in6_addr rreq_da; /* destination IPv6 address */
55 u_long rreq_ds; /* destination sequence number */
56 struct in6_addr rreq_oa; /* originator IPv6 address */
57 u_long rreq_os; /* originator sequence number */
58 };
59 #endif
60
61 #define RREQ_JOIN 0x80 /* join (reserved for multicast */
62 #define RREQ_REPAIR 0x40 /* repair (reserved for multicast */
63 #define RREQ_GRAT 0x20 /* gratuitous RREP */
64 #define RREQ_DEST 0x10 /* destination only */
65 #define RREQ_UNKNOWN 0x08 /* unknown destination sequence num */
66 #define RREQ_FLAGS_MASK 0xF8 /* mask for rreq_flags */
67
68 struct aodv_rrep {
69 u_char rrep_type; /* AODV message type (2) */
70 u_char rrep_flags; /* various flags */
71 u_char rrep_ps; /* prefix size */
72 u_char rrep_hops; /* number of hops from o to d */
73 u_long rrep_da; /* destination IPv4 address */
74 u_long rrep_ds; /* destination sequence number */
75 u_long rrep_oa; /* originator IPv4 address */
76 u_long rrep_life; /* lifetime of this route */
77 };
78 #ifdef INET6
79 struct aodv_rrep6 {
80 u_char rrep_type; /* AODV message type (2) */
81 u_char rrep_flags; /* various flags */
82 u_char rrep_ps; /* prefix size */
83 u_char rrep_hops; /* number of hops from o to d */
84 struct in6_addr rrep_da; /* destination IPv6 address */
85 u_long rrep_ds; /* destination sequence number */
86 struct in6_addr rrep_oa; /* originator IPv6 address */
87 u_long rrep_life; /* lifetime of this route */
88 };
89 #endif
90
91 #define RREP_REPAIR 0x80 /* repair (reserved for multicast */
92 #define RREP_ACK 0x40 /* acknowledgement required */
93 #define RREP_FLAGS_MASK 0xC0 /* mask for rrep_flags */
94 #define RREP_PREFIX_MASK 0x1F /* mask for prefix size */
95
96 struct rerr_unreach {
97 u_long u_da; /* IPv4 address */
98 u_long u_ds; /* sequence number */
99 };
100 #ifdef INET6
101 struct rerr_unreach6 {
102 struct in6_addr u_da; /* IPv6 address */
103 u_long u_ds; /* sequence number */
104 };
105 #endif
106
107 struct aodv_rerr {
108 u_char rerr_type; /* AODV message type (3) */
109 u_char rerr_flags; /* various flags */
110 u_char rerr_zero0; /* reserved, set to zero */
111 u_char rerr_dc; /* destination count */
112 union {
113 struct rerr_unreach dest[1];
114 #ifdef INET6
115 struct rerr_unreach6 dest6[1];
116 #endif
117 } r;
118 };
119
120 #define RERR_NODELETE 0x80 /* don't delete the link */
121 #define RERR_FLAGS_MASK 0x80 /* mask for rerr_flags */
122
123 struct aodv_rrep_ack {
124 u_char ra_type;
125 u_char ra_zero0;
126 };
127
128 union aodv {
129 struct aodv_rreq rreq;
130 struct aodv_rrep rrep;
131 struct aodv_rerr rerr;
132 struct aodv_rrep_ack rrep_ack;
133 #ifdef INET6
134 struct aodv_rreq6 rreq6;
135 struct aodv_rrep6 rrep6;
136 #endif
137 };
138
139 #define AODV_RREQ 1 /* route request */
140 #define AODV_RREP 2 /* route response */
141 #define AODV_RERR 3 /* error report */
142 #define AODV_RREP_ACK 4 /* route response acknowledgement */
143
144 struct aodv_ext {
145 u_char type; /* extension type */
146 u_char length; /* extension length */
147 };
148
149 struct aodv_hello {
150 struct aodv_ext eh; /* extension header */
151 u_long interval; /* expect my next hello in
152 * (n) ms */
153 };
154
155 #define AODV_EXT_HELLO 1
156
157 #endif /* _AODV_H_ */