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