1/* @(#) $Header: /tcpdump/master/tcpdump/aodv.h,v 1.3 2003/09/13 01:34:42 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 36struct aodv_rreq { 37 u_int8_t rreq_type; /* AODV message type (1) */ 38 u_int8_t rreq_flags; /* various flags */ 39 u_int8_t rreq_zero0; /* reserved, set to zero */ 40 u_int8_t rreq_hops; /* number of hops from originator */ 41 u_int32_t rreq_id; /* request ID */ 42 u_int32_t rreq_da; /* destination IPv4 address */ 43 u_int32_t rreq_ds; /* destination sequence number */ 44 u_int32_t rreq_oa; /* originator IPv4 address */ 45 u_int32_t rreq_os; /* originator sequence number */ 46}; 47#ifdef INET6 48struct aodv_rreq6 { 49 u_int8_t rreq_type; /* AODV message type (1) */ 50 u_int8_t rreq_flags; /* various flags */ 51 u_int8_t rreq_zero0; /* reserved, set to zero */ 52 u_int8_t rreq_hops; /* number of hops from originator */ 53 u_int32_t rreq_id; /* request ID */ 54 struct in6_addr rreq_da; /* destination IPv6 address */ 55 u_int32_t rreq_ds; /* destination sequence number */ 56 struct in6_addr rreq_oa; /* originator IPv6 address */ 57 u_int32_t rreq_os; /* originator sequence number */ 58}; 59struct aodv_rreq6_draft_01 { 60 u_int8_t rreq_type; /* AODV message type (16) */ 61 u_int8_t rreq_flags; /* various flags */ 62 u_int8_t rreq_zero0; /* reserved, set to zero */ 63 u_int8_t rreq_hops; /* number of hops from originator */ 64 u_int32_t rreq_id; /* request ID */ 65 u_int32_t rreq_ds; /* destination sequence number */ 66 u_int32_t rreq_os; /* originator sequence number */ 67 struct in6_addr rreq_da; /* destination IPv6 address */ 68 struct in6_addr rreq_oa; /* originator IPv6 address */ 69}; 70#endif 71 72#define RREQ_JOIN 0x80 /* join (reserved for multicast */ 73#define RREQ_REPAIR 0x40 /* repair (reserved for multicast */ 74#define RREQ_GRAT 0x20 /* gratuitous RREP */ 75#define RREQ_DEST 0x10 /* destination only */ 76#define RREQ_UNKNOWN 0x08 /* unknown destination sequence num */ 77#define RREQ_FLAGS_MASK 0xF8 /* mask for rreq_flags */ 78 79struct aodv_rrep { 80 u_int8_t rrep_type; /* AODV message type (2) */ 81 u_int8_t rrep_flags; /* various flags */ 82 u_int8_t rrep_ps; /* prefix size */ 83 u_int8_t rrep_hops; /* number of hops from o to d */ 84 u_int32_t rrep_da; /* destination IPv4 address */ 85 u_int32_t rrep_ds; /* destination sequence number */ 86 u_int32_t rrep_oa; /* originator IPv4 address */ 87 u_int32_t rrep_life; /* lifetime of this route */ 88}; 89#ifdef INET6 90struct aodv_rrep6 { 91 u_int8_t rrep_type; /* AODV message type (2) */ 92 u_int8_t rrep_flags; /* various flags */ 93 u_int8_t rrep_ps; /* prefix size */ 94 u_int8_t rrep_hops; /* number of hops from o to d */ 95 struct in6_addr rrep_da; /* destination IPv6 address */ 96 u_int32_t rrep_ds; /* destination sequence number */ 97 struct in6_addr rrep_oa; /* originator IPv6 address */ 98 u_int32_t rrep_life; /* lifetime of this route */ 99}; 100struct aodv_rrep6_draft_01 { 101 u_int8_t rrep_type; /* AODV message type (17) */ 102 u_int8_t rrep_flags; /* various flags */ 103 u_int8_t rrep_ps; /* prefix size */ 104 u_int8_t rrep_hops; /* number of hops from o to d */ 105 u_int32_t rrep_ds; /* destination sequence number */ 106 struct in6_addr rrep_da; /* destination IPv6 address */ 107 struct in6_addr rrep_oa; /* originator IPv6 address */ 108 u_int32_t rrep_life; /* lifetime of this route */ 109}; 110#endif 111 112#define RREP_REPAIR 0x80 /* repair (reserved for multicast */ 113#define RREP_ACK 0x40 /* acknowledgement required */ 114#define RREP_FLAGS_MASK 0xC0 /* mask for rrep_flags */ 115#define RREP_PREFIX_MASK 0x1F /* mask for prefix size */ 116 117struct rerr_unreach { 118 u_int32_t u_da; /* IPv4 address */ 119 u_int32_t u_ds; /* sequence number */ 120}; 121#ifdef INET6 122struct rerr_unreach6 { 123 struct in6_addr u_da; /* IPv6 address */ 124 u_int32_t u_ds; /* sequence number */ 125}; 126struct rerr_unreach6_draft_01 { 127 struct in6_addr u_da; /* IPv6 address */ 128 u_int32_t u_ds; /* sequence number */ 129}; 130#endif 131 132struct aodv_rerr { 133 u_int8_t rerr_type; /* AODV message type (3 or 18) */ 134 u_int8_t rerr_flags; /* various flags */ 135 u_int8_t rerr_zero0; /* reserved, set to zero */ 136 u_int8_t rerr_dc; /* destination count */ 137 union { 138 struct rerr_unreach dest[1]; 139#ifdef INET6 140 struct rerr_unreach6 dest6[1]; 141 struct rerr_unreach6_draft_01 dest6_draft_01[1]; 142#endif 143 } r; 144}; 145 146#define RERR_NODELETE 0x80 /* don't delete the link */ 147#define RERR_FLAGS_MASK 0x80 /* mask for rerr_flags */ 148 149struct aodv_rrep_ack { 150 u_int8_t ra_type; 151 u_int8_t ra_zero0; 152}; 153 154union aodv { 155 struct aodv_rreq rreq; 156 struct aodv_rrep rrep; 157 struct aodv_rerr rerr; 158 struct aodv_rrep_ack rrep_ack; 159#ifdef INET6 160 struct aodv_rreq6 rreq6; 161 struct aodv_rreq6_draft_01 rreq6_draft_01; 162 struct aodv_rrep6 rrep6; 163 struct aodv_rrep6_draft_01 rrep6_draft_01; 164#endif 165}; 166 167#define AODV_RREQ 1 /* route request */ 168#define AODV_RREP 2 /* route response */ 169#define AODV_RERR 3 /* error report */ 170#define AODV_RREP_ACK 4 /* route response acknowledgement */ 171 172#define AODV_V6_DRAFT_01_RREQ 16 /* IPv6 route request */ 173#define AODV_V6_DRAFT_01_RREP 17 /* IPv6 route response */ 174#define AODV_V6_DRAFT_01_RERR 18 /* IPv6 error report */ 175#define AODV_V6_DRAFT_01_RREP_ACK 19 /* IPV6 route response acknowledgment */ 176 177struct aodv_ext { 178 u_int8_t type; /* extension type */ 179 u_int8_t length; /* extension length */ 180}; 181 182struct aodv_hello { 183 struct aodv_ext eh; /* extension header */ 184 u_int32_t interval; /* expect my next hello in 185 * (n) ms */ 186}; 187 188#define AODV_EXT_HELLO 1 189 190#endif /* _AODV_H_ */ 191