Contiki 3.x
uaodv-def.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005, Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  *
31  */
32 
33 /**
34  * \file
35  * Definitions for the micro implementation of the AODV ad hoc routing protocol
36  * \author
37  * Adam Dunkels <adam@sics.se>
38  */
39 
40 #ifndef UAODV_DEF_H_
41 #define UAODV_DEF_H_
42 
43 #include "net/ip/uip.h"
44 
45 #define NUM_PRECURSORS 4
46 
47 
48 #define UAODV_UDPPORT 654
49 
50 #if 0
51 /* AODV routing table entry */
52 struct uaodv_rtentry {
53  uip_ipaddr_t dest_addr;
54  uip_ipaddr_t next_hop;
55  uip_ipaddr_t precursors[NUM_PRECURSORS];
56  uint32_t dest_seqno;
57  uint16_t lifetime;
58  uint8_t dest_seqno_flag;
59  uint8_t route_flags;
60  uint8_t hop_count;
61 };
62 #endif
63 
64 /* Generic AODV message */
65 struct uaodv_msg {
66  uint8_t type;
67 };
68 
69 /* AODV RREQ message */
70 #define UAODV_RREQ_TYPE 1
71 #define UAODV_RREQ_JOIN (1 << 7)
72 #define UAODV_RREQ_REPAIR (1 << 6)
73 #define UAODV_RREQ_GRATIOUS (1 << 5)
74 #define UAODV_RREQ_DESTONLY (1 << 4)
75 #define UAODV_RREQ_UNKSEQNO (1 << 3)
76 
77 struct uaodv_msg_rreq {
78  uint8_t type;
79  uint8_t flags;
80  uint8_t reserved;
81  uint8_t hop_count;
82  uint32_t rreq_id;
83  uip_ipaddr_t dest_addr;
84  uint32_t dest_seqno;
85  uip_ipaddr_t orig_addr;
86  uint32_t orig_seqno;
87 };
88 
89 /* AODV RREP message */
90 #define UAODV_RREP_TYPE 2
91 #define UAODV_RREP_REPAIR (1 << 7)
92 #define UAODV_RREP_ACK (1 << 6)
93 
94 struct uaodv_msg_rrep {
95  uint8_t type;
96  uint8_t flags;
97  uint8_t prefix_sz; /* prefix_sz:5 */
98  uint8_t hop_count;
99  uip_ipaddr_t dest_addr;
100  uint32_t dest_seqno;
101  uip_ipaddr_t orig_addr;
102  uint32_t lifetime;
103 };
104 
105 /* AODV RERR message */
106 #define UAODV_RERR_TYPE 3
107 #define UAODV_RERR_NODELETE (1 << 7)
108 #define UAODV_RERR_UNKNOWN (1 << 6) /* Non standard extension /bg. */
109 
110 struct uaodv_msg_rerr {
111  uint8_t type;
112  uint8_t flags;
113  uint8_t reserved;
114  uint8_t dest_count;
115  struct {
116  uip_ipaddr_t addr;
117  uint32_t seqno;
118  } unreach[1];
119 };
120 
121 /* AODV RREP-ACK message */
122 #define UAODV_RREP_ACK_TYPE 4
123 
124 struct uaodv_msg_rrep_ack {
125  uint8_t type;
126  uint8_t reserved;
127 };
128 
129 #define RREP_HELLO_INTERVAL_EXT 1 /* Per RFC 3561. */
130 #define RREQ_BAD_HOP_EXT 101 /* Non standard extension /bg */
131 
132 struct uaodv_extension {
133  uint8_t type;
134  uint8_t length;
135  /* uint8_t value[length]; */
136 };
137 
138 struct uaodv_bad_hop_ext {
139  uint8_t type;
140  uint8_t length;
141  uint8_t unused1, unused2;
142  uip_ipaddr_t addrs[1];
143 };
144 
145 #endif /* UAODV_DEF_H_ */
Header file for the uIP TCP/IP stack.