NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
AODV.h
1/************************************************************************************
2* Copyright (C) 2023 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi Kant Suman *
12* *
13* ---------------------------------------------------------------------------------*/
14
15
16/************************************************************************************
17RFC 3561 Ad hoc On-Demand Distance Vector (AODV) Routing July 2003
18************************************************************************************/
19
20#ifndef _NETSIM_AODV_H_
21#define _NETSIM_AODV_H_
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define AODV_ACTIVE_ROUTE_TIMEOUT 3000* MILLISECOND
27#define AODV_ALLOWED_HELLO_LOSS 2
28#define AODV_BLACKLIST_TIMEOUT AODV_RREQ_RETRIES * AODV_NET_TRAVERSAL_TIME
29#define AODV_DELETE_PERIOD K * max (AODV_ACTIVE_ROUTE_TIMEOUT, AODV_HELLO_INTERVAL)
30#define K 5
31#define AODV_HELLO_INTERVAL 1000* MILLISECOND
32#define AODV_LOCAL_ADD_TTL 2
33#define AODV_MAX_REPAIR_TTL 0.3 * AODV_NET_DIAMETER
34#define AODV_MIN_REPAIR_TTL //see note below
35#define AODV_MY_ROUTE_TIMEOUT (2 * AODV_ACTIVE_ROUTE_TIMEOUT)
36#define AODV_NET_DIAMETER 35
37#define AODV_NET_TRAVERSAL_TIME 2 * AODV_NODE_TRAVERSAL_TIME * AODV_NET_DIAMETER
38#define AODV_NEXT_HOP_WAIT AODV_NODE_TRAVERSAL_TIME + 10
39#define AODV_NODE_TRAVERSAL_TIME 40 * MILLISECOND
40#define AODV_PATH_DISCOVERY_TIME 2 * AODV_NET_TRAVERSAL_TIME
41#define AODV_RERR_RATELIMIT 10
42#define AODV_RING_TRAVERSAL_TIME(ttl) 2 * AODV_NODE_TRAVERSAL_TIME *(ttl + AODV_TIMEOUT_BUFFER)
43#define AODV_RREQ_RETRIES 2
44#define AODV_RREQ_RATELIMIT 10
45#define AODV_TIMEOUT_BUFFER 2
46#define AODV_TTL_START 1
47#define AODV_TTL_INCREMENT 2
48#define AODV_TTL_THRESHOLD 7
49
50 //Packet size
51#define AODV_RREQ_SIZE_IPV4 24 ///< AODV route request size in bytes
52#define AODV_RREQ_SIZE_IPV6 72
53#define AODV_RREQ_SIZE(dev) DEVICE_NWPROTOCOL(dev,1) == NW_PROTOCOL_IPV4 ? AODV_RREQ_SIZE_IPV4:AODV_RREQ_SIZE_IPV6
54#define AODV_RREP_SIZE_IPV4 20 ///< AODV route reply size in bytes
55#define AODV_RREP_SIZE_IPV6 56
56#define AODV_RREP_SIZE(dev) DEVICE_NWPROTOCOL(dev,1) == NW_PROTOCOL_IPV4 ? AODV_RREP_SIZE_IPV4:AODV_RREP_SIZE_IPV6
57#define AODV_RERR_SIZE_FIXED 4 ///< AODV route error size in bytes
58
59#define AODV_ROUTE_TABLE_LOG_NAME "AODV_ROUTE_TABLE_LOG"
60
61 //Typedef
62 typedef enum enum_AODV_Ctrl_Packet AODV_CONTROL_PACKET;
63 typedef struct stru_AODV_Primitives AODV_PRIMITIVES;
64 typedef struct stru_NetSim_AODV_RouteTable AODV_ROUTETABLE;
65 typedef struct stru_AODV_FIFO AODV_FIFO;
66 typedef struct stru_AODV_DeviceVariable AODV_DEVICE_VAR;
67 typedef struct stru_AODV_RREQ_Seen_Table AODV_RREQ_SEEN_TABLE;
68 typedef struct stru_AODV_RREQ_Sent_Table AODV_RREQ_SENT_TABLE;
69 typedef struct stru_NetSim_AODV_PrecursorsList AODV_PRECURSORS_LIST;
70 typedef struct stru_AODV_Metrics AODV_METRICS;
71
72 //packet typedef
73 typedef struct stru_NetSim_AODV_RREQ AODV_RREQ;
74 typedef struct stru_NetSim_AODV_RREP AODV_RREP;
75 typedef struct stru_NetSim_AODV_RERR AODV_RERR;
76 /** Enumeration for AODV control packets */
77 enum enum_AODV_Ctrl_Packet
78 {
79 AODVctrlPacket_RREQ=NW_PROTOCOL_AODV*100+1,
80 AODVctrlPacket_RREP,
81 AODVctrlPacket_RERR,
82 };
83 /** Enumeration for AODV sub events */
84 typedef enum
85 {
86 AODVsubevent_RREQ_TIMEOUT=NW_PROTOCOL_AODV*100+1,
87 AODVsubevent_TRANSMIT_HELLO,
88 AODVsubevent_ACTIVE_ROUTE_TIMEOUT,
89 }AODV_SUB_EVENT;
90
91 /**
92 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93 5.1. Route Request (RREQ) Message Format
94
95 0 1 2 3
96 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
97 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
98 | Type |J|R|G|D|U| Reserved | Hop Count |
99 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
100 | RREQ ID |
101 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
102 | Destination IP Address |
103 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
104 | Destination Sequence Number |
105 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
106 | Originator IP Address |
107 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
108 | Originator Sequence Number |
109 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
110 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111 */
113 {
114 unsigned int Type:8; //1
115 char JRGDU[6]; /**<
116 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
117 J Join flag; reserved for multicast.
118
119 R Repair flag; reserved for multicast.
120
121 G Gratuitous RREP flag; indicates whether a
122 gratuitous RREP should be unicast to the node
123 specified in the Destination IP Address field (see
124 sections 6.3, 6.6.3).
125
126 D Destination only flag; indicates only the
127 destination may respond to this RREQ (see
128 section 6.5).
129
130 U Unknown sequence number; indicates the destination
131 sequence number is unknown (see section 6.3).
132 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 */
134 unsigned int Reserved:11; ///< Sent as 0; ignored on reception.
135 unsigned int HopCount:8; /**<
136 The number of hops from the Originator IP Address
137 to the node handling the request.
138 */
139 unsigned int RREQID; /**<
140 A sequence number uniquely identifying the
141 particular RREQ when taken in conjunction with the
142 originating node's IP address.
143 */
144 NETSIM_IPAddress DestinationIPAddress;/**< The IP address of the destination for which a route is desired.*/
145 unsigned int DestinationSequenceNumber;/**<
146 The latest sequence number received in the past by the originator for any route towards the
147 destination.
148 */
149 NETSIM_IPAddress OriginatorIPAddress;/**< The IP address of the node which originated the Route Request.*/
150 unsigned int OriginatorSequenceNumber;/**<
151 The current sequence number to be used in the route
152 entry pointing towards the originator of the route
153 request.
154 */
155 NETSIM_IPAddress LastAddress;//NetSim Specific
156 };
157
158
159 /**
160 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161 5.2. Route Reply (RREP) Message Format
162
163 0 1 2 3
164 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
165 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
166 | Type |R|A| Reserved |Prefix Sz| Hop Count |
167 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
168 | Destination IP address |
169 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
170 | Destination Sequence Number |
171 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
172 | Originator IP address |
173 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
174 | Lifetime |
175 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
176
177 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178 */
180 {
181 unsigned int Type:8;//2
182 char RA[3]; /**<
183 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 R Repair flag; used for multicast.
185
186 A Acknowledgment required; see sections 5.4 and 6.7.
187 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 */
189 unsigned int Reserved:9; ///< Sent as 0; ignored on reception.
190 unsigned int PrefixSz:5; /**<
191 If nonzero, the 5-bit Prefix Size specifies that the
192 indicated next hop may be used for any nodes with
193 the same routing prefix (as defined by the Prefix
194 Size) as the requested destination.
195 */
196 unsigned int HopCount:8; /**<
197 The number of hops from the Originator IP Address
198 to the Destination IP Address. For multicast route
199 requests this indicates the number of hops to the
200 multicast tree member sending the RREP.
201 */
202 NETSIM_IPAddress DestinationIPaddress;////< The IP address of the destination for which a route is supplied.
203 unsigned int DestinationSequenceNumber;///< The destination sequence number associated to the route.
204 NETSIM_IPAddress OriginatorIPaddress;///< The IP address of the node which originated the RREQ for which the route is supplied.
205 unsigned int Lifetime;///< The time in milliseconds for which nodes receiving the RREP consider the route to be valid.
206 NETSIM_IPAddress LastAddress; //NetSim-specific
207 };
208
209 /**
210 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211
212 5.3. Route Error (RERR) Message Format
213
214 0 1 2 3
215 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
216 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
217 | Type |N| Reserved | DestCount |
218 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
219 | Unreachable Destination IP Address (1) |
220 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
221 | Unreachable Destination Sequence Number (1) |
222 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
223 | Additional Unreachable Destination IP Addresses (if needed) |
224 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
225 |Additional Unreachable Destination Sequence Numbers (if needed)|
226 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
227
228 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
229 */
231 {
232 unsigned int Type:8;//3
233 char N;/**<
234 No delete flag; set when a node has performed a local
235 repair of a link, and upstream nodes should not delete
236 the route.
237 */
238 unsigned int Reserved:15; ///< Sent as 0; ignored on reception.
239 unsigned int DestCount:8;/**<
240 The number of unreachable destinations included in the
241 message; MUST be at least 1.
242 */
243
244 NETSIM_IPAddress* UnreachableDestinationIPAddress;/**<
245 The IP address of the destination that has become
246 unreachable due to a link break.
247 */
248
250 The sequence number in the route table entry for
251 the destination listed in the previous Unreachable
252 Destination IP Address field.
253 */
254 };
255
256 /**
257 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
258 5.4. Route Reply Acknowledgment (RREP-ACK) Message Format
259
260 The Route Reply Acknowledgment (RREP-ACK) message MUST be sent in
261 response to a RREP message with the 'A' bit set (see section 5.2).
262 This is typically done when there is danger of unidirectional links
263 preventing the completion of a Route Discovery cycle (see section
264 6.8).
265
266 0 1
267 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
268 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
269 | Type | Reserved |
270 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
271
272 Type 4
273
274 Reserved Sent as 0; ignored on reception.
275
276 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277 */
279 {
280 unsigned int Type:8;
281 unsigned int Reserved:8;
282 };
283
284
285 typedef enum
286 {
287 AODV_RoutingFlag_Valid,
288 AODV_RoutingFlag_InValid,
289 AODV_RoutingFlag_Repairable,
290 AODV_RoutingFlag_beingRepaired,
291 }AODV_RoutingFlag;
293 {
294 NETSIM_IPAddress* list;
295 int count;
296 };
297 /**
298 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299 AODV is a routing protocol, and it deals with route table management.
300 Route table information must be kept even for short-lived routes,
301 such as are created to temporarily store reverse paths towards nodes
302 originating RREQs. AODV uses the following fields with each route
303 table entry:
304
305 - Destination IP Address
306 - Destination Sequence Number
307 - Valid Destination Sequence Number flag
308 - Other state and routing flags (e.g., valid, invalid, repairable,
309 being repaired)
310 - Network Interface
311 - Hop Count (number of hops needed to reach destination)
312 - Next Hop
313 - List of Precursors (described in Section 6.2)
314 - Lifetime (expiration or deletion time of the route)
315 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316 */
318 {
319 NETSIM_IPAddress DestinationIPAddress;
320 unsigned int DestinationSequenceNumber;
321 bool ValidDestinationSequenceNumberflag;
322 AODV_RoutingFlag routingFlags;
323 NETSIM_ID NetworkInterface;
324 unsigned int HopCount;
325 NETSIM_IPAddress NextHop;
326 AODV_PRECURSORS_LIST* ListofPrecursors;
327 double Lifetime;
328 struct element* ele;
329 };
330 /**
331 This is a buffer to which packets are added after if no route is present to the target.
332 */
334 {
335 NETSIM_IPAddress destination; ///< Destination - destination ip address.
336 NetSim_PACKET* packetList; ///< PacketList - List of packets added to the FIFO buffer.
337 double time;
338 struct element* ele; ///< ele - next buffer
339 };
340 ///Structure of RREQ Seen Table in which entry is made of the RREQ received
342 {
343 NETSIM_IPAddress OrginatingNode; ///< IP address of a node originating RREQ
344 unsigned int nRREQId; ///< RREQ identification no
345 double time;
346 struct element* ele; ///< Next AODV_RREQ_Seen_Table
347 };
348 ///Structure of RREQ sent Table in which entry of RREQ sent is made
350 {
351 NETSIM_IPAddress DestAddress; ///< Destination IP Address
352 int ttl; ///< Time to live
353 int times;
354 double dTimeoutTime;
355 struct element* ele; ///< Next AODV_RREQ_Sent_Table
356 };
357 /// Stucture for AODV Metrics
359 {
360 unsigned int rreqSent;
361 unsigned int rreqForwarded;
362 unsigned int rrepSent;
363 unsigned int rrepForwarded;
364 unsigned int rerrSent;
365 unsigned int rerrForwarded;
366 unsigned int routeBreak;
367 unsigned int packetTransmitted;
368 unsigned int packetOrginated;
369 unsigned int packetReceived;
370 unsigned int packetDropped;
371 };
372 /**
373 This is the AODV DeviceVariable Structure which contains -
374 FIFO - a packet is added in FIFO buffer if the device does not have route to the target<br>
375 routeTable - this contains the next HOP ip of the routes to the target<br>
376 RREQ_SEEN_TABLE - this contains list differnet RREQ a device encounters.
377 */
379 {
380 unsigned int nSequenceNumber;
381 AODV_FIFO* fifo;
382 AODV_ROUTETABLE* routeTable;
383 AODV_RREQ_SEEN_TABLE* rreqSeenTable;
384 AODV_RREQ_SENT_TABLE* rreqSentTable;
385 AODV_PRECURSORS_LIST* precursorsList;
386 double dLastBroadcastTime;
387 unsigned int nRerrCount;
388 double dFirstRerrTime;
389 AODV_METRICS aodvMetrics;
390 bool isHelloEnabled;
391 };
392
393#define AODV_PACKET_PROCESSING() fn_NetSim_AODV_GeneralPacketProcessing(pstruEventDetails)
394#define AODV_CHECK_ROUTE_FOUND(destIP) fn_NetSim_AODV_CheckRouteFound(destIP,pstruEventDetails)
395#define AODV_ADD_TO_FIFO(packet,fifoBuffer,time) fn_NetSim_AODV_AddToFIFOBuffer(packet,fifoBuffer,time)
396#define AODV_GEN_RREQ() fn_NetSim_AODV_GenerateRREQ(pstruEventDetails)
397#define AODV_RETRY_RREQ() fn_NetSim_AODV_RetryRREQ(pstruEventDetails)
398#define AODV_PROCESS_RREQ() fn_NetSim_AODV_ProcessRREQ(pstruEventDetails)
399#define AODV_INSERT_ROUTE_TABLE(ip,seq,hopcount,nexthop,lifeTime) fn_NetSim_AODV_InsertInRouteTable(ip,seq,hopcount,nexthop,lifeTime,pstruEventDetails)
400#define AODV_INSERT_PRECURSOR(ip) fn_NetSim_AODV_InsertInPrecursorsList(ip,pstruEventDetails)
401#define AODV_FORWARD_RREQ() fn_NetSim_AODV_ForwardRREQ(pstruEventDetails)
402#define AODV_GENERATE_RREP() fn_NetSim_AODV_GenerateRREP(pstruEventDetails)
403#define AODV_TRANSMIT_FIFO(devVar) fn_NetSim_AODV_TransmitFIFOBuffer(devVar,pstruEventDetails)
404#define AODV_PROCESS_RREP() fn_NetSim_AODV_ProcessRREP(pstruEventDetails)
405#define AODV_FORWARD_RREP() fn_NetSim_AODV_ForwardRREP(pstruEventDetails)
406#define AODV_FIND_NEXT_HOP(devVar,dest) fn_NetSim_AODV_FindNextHop(devVar,dest,pstruEventDetails)
407#define AODV_GENERATE_RREP_BY_IN() fn_NetSim_AODV_GenerateRREPByIntermediate(pstruEventDetails)
408#define AODV_TRANSMIT_HELLO() fn_NetSim_AODV_TransmitHelloMessage(pstruEventDetails)
409#define AODV_UPDATE_ROUTE_TABLE(ip,lifetime) fn_NetSim_AODV_UpdateRouteTable(ip,lifetime,pstruEventDetails)
410#define AODV_ACTIVE_ROUTE_TIMEOUT_EVENT() fn_NetSim_AODV_ActiveRouteTimeout(pstruEventDetails)
411#define AODV_GENERATE_RERR(DevId,UnreachableIP) fn_NetSim_AODV_GenerateRERR(DevId,UnreachableIP,pstruEventDetails)
412#define AODV_PROCESS_RERR() fn_NetSim_AODV_ProcessRERR(pstruEventDetails)
413
414
415#define AODV_DEV_VAR(devId) ((AODV_DEVICE_VAR*)NETWORK->ppstruDeviceList[devId-1]->pstruNetworkLayer->RoutingVar)
416#define AODV_METRICS_VAR(devId) (AODV_DEV_VAR(devId)->aodvMetrics)
417#define FIFO_ALLOC() (AODV_FIFO*)list_alloc(sizeof(AODV_FIFO),offsetof(AODV_FIFO,ele))
418#define RREQSEENTABLE_ALLOC() (AODV_RREQ_SEEN_TABLE*)list_alloc(sizeof(AODV_RREQ_SEEN_TABLE),offsetof(AODV_RREQ_SEEN_TABLE,ele))
419#define RREQSENTTABLE_ALLOC() (AODV_RREQ_SENT_TABLE*)list_alloc(sizeof(AODV_RREQ_SENT_TABLE),offsetof(AODV_RREQ_SENT_TABLE,ele))
420#define ROUTETABLE_ALLOC() (AODV_ROUTETABLE*)list_alloc(sizeof(AODV_ROUTETABLE),offsetof(AODV_ROUTETABLE,ele))
421
422 // AODV LOG
423#define AODV_LOG_ENABLED() get_protocol_log_status(AODV_ROUTE_TABLE_LOG_NAME)
424
425 void set_aodv_curr();
426 NETSIM_IPAddress aodv_get_curr_ip();
427 NETSIM_ID aodv_get_curr_if();
428 NETSIM_IPAddress aodv_get_dev_ip(NETSIM_ID d);
429 bool isAodvConfigured(NETSIM_ID d, NETSIM_ID in);
430
431 //Function prototype
432 unsigned int fnFindSequenceNumber(AODV_DEVICE_VAR* devVar,NETSIM_IPAddress ip);
433 int fnEmptyFIFOBuffer(AODV_DEVICE_VAR* devVar,NETSIM_IPAddress dest);
434 AODV_ROUTETABLE* fnFindRouteTable(AODV_ROUTETABLE* table,NETSIM_IPAddress dest);
435 NetSim_PACKET* fn_NetSim_AODV_GenerateCtrlPacket(NETSIM_ID src,
436 NETSIM_ID dest,
437 NETSIM_ID recv,
438 double dTime,
439 AODV_CONTROL_PACKET type);
440 int fn_NetSim_AODV_InsertInRouteTable(NETSIM_IPAddress ip,
441 unsigned int seqNumber,
442 unsigned int hopCount,
443 NETSIM_IPAddress nextHop,
444 double lifeTime,
445 NetSim_EVENTDETAILS* pstruEventDetails);
446 int fn_NetSim_AODV_TransmitFIFOBuffer(AODV_DEVICE_VAR* devVar,NetSim_EVENTDETAILS* pstruEventDetails);
447 int fn_NetSim_AODV_InsertInPrecursorsList(NETSIM_IPAddress ip,NetSim_EVENTDETAILS* pstruEventDetails);
448 int fn_NetSim_AODV_UpdateRouteTable(NETSIM_IPAddress ip,double lifetime,NetSim_EVENTDETAILS* pstruEventDetails);
449 int fn_NetSim_AODV_ForwardRREP(NetSim_EVENTDETAILS* pstruEventDetails);
450 bool fn_NetSim_AODV_CheckRouteFound(NETSIM_IPAddress ip, NetSim_EVENTDETAILS* pstruEventDetails);
451 NETSIM_IPAddress fn_NetSim_AODV_FindNextHop(AODV_DEVICE_VAR* devVar,
452 NETSIM_IPAddress dest,
453 NetSim_EVENTDETAILS* pstruEventDetails);
454 int fn_NetSim_AODV_ForwardRREQ(NetSim_EVENTDETAILS* pstruEventDetails);
455 int fn_NetSim_AODV_GeneralPacketProcessing(NetSim_EVENTDETAILS* pstruEventDetails);
456
457 bool fn_NetSim_AODV_CheckRouteFound(NETSIM_IPAddress destIP,
458 NetSim_EVENTDETAILS* pstruEventDetails);
459
460 bool fn_NetSim_AODV_AddToFIFOBuffer(NetSim_PACKET* packet,
461 AODV_FIFO** fifoBuffer,
462 double time);
463
464 NetSim_PACKET* fn_NetSim_AODV_GenerateRREQ(NetSim_EVENTDETAILS* pstruEventDetails);
465
466 int fn_NetSim_AODV_RetryRREQ(NetSim_EVENTDETAILS* pstruEventDetails);
467
468 int fn_NetSim_AODV_ProcessRREQ(NetSim_EVENTDETAILS* pstruEventDetails);
469
470 int fn_NetSim_AODV_InsertInRouteTable(NETSIM_IPAddress ip,
471 unsigned int seqNumber,
472 unsigned int hopCount,
473 NETSIM_IPAddress nextHop,
474 double lifeTime,
475 NetSim_EVENTDETAILS* pstruEventDetails);
476
477 int fn_NetSim_AODV_InsertInPrecursorsList(NETSIM_IPAddress ip,
478 NetSim_EVENTDETAILS* pstruEventDetails);
479
480 int fn_NetSim_AODV_ForwardRREQ(NetSim_EVENTDETAILS* pstruEventDetails);
481
482 int fn_NetSim_AODV_GenerateRREP(NetSim_EVENTDETAILS* pstruEventDetails);
483
484 int fn_NetSim_AODV_ProcessRREP(NetSim_EVENTDETAILS* pstruEventDetails);
485 int fn_NetSim_AODV_ForwardRREP(NetSim_EVENTDETAILS* pstruEventDetails);
486 NETSIM_IPAddress fn_NetSim_AODV_FindNextHop(AODV_DEVICE_VAR* devVar,
487 NETSIM_IPAddress dest,
488 NetSim_EVENTDETAILS* pstruEventDetails);
489
490 int fn_NetSim_AODV_GenerateRREPByIntermediate(NetSim_EVENTDETAILS* pstruEventDetails);
491
492 int fn_NetSim_AODV_TransmitHelloMessage(NetSim_EVENTDETAILS* pstruEventDetails);
493
494 int fn_NetSim_AODV_ReceiveHelloMessage(NetSim_EVENTDETAILS* pstruEventDetails);
495
496 int fn_NetSim_AODV_UpdateRouteTable(NETSIM_IPAddress nextHop,
497 double lifetime,
498 NetSim_EVENTDETAILS* pstruEventDetails);
499
500 int fn_NetSim_AODV_ActiveRouteTimeout(NetSim_EVENTDETAILS* pstruEventDetails);
501
502 int fn_NetSim_AODV_GenerateRERR(NETSIM_ID nDeviceId,
503 NETSIM_IPAddress UnreachableIP,
504 NetSim_EVENTDETAILS* pstruEventDetails);
505 int fn_NetSim_AODV_ProcessRERR(NetSim_EVENTDETAILS* pstruEventDetails);
506
507 bool get_protocol_log_status(char* logname);
508
509 int fn_NetSim_AODV_Route_Table_Log_Init();
510 int fn_NetSim_AODV_Route_Table_Log_Update(NETSIM_ID devid, char* msg);
511 void fn_NetSim_AODV_Route_Table_Log_Finish();
512 char comment[BUFSIZ];
513
514#ifdef __cplusplus
515}
516#endif
517#endif
Definition List.h:43
NetSim_PACKET * packetList
PacketList - List of packets added to the FIFO buffer.
Definition AODV.h:336
NETSIM_IPAddress destination
Destination - destination ip address.
Definition AODV.h:335
struct element * ele
ele - next buffer
Definition AODV.h:338
Stucture for AODV Metrics.
Definition AODV.h:359
Structure of RREQ Seen Table in which entry is made of the RREQ received.
Definition AODV.h:342
struct element * ele
Next AODV_RREQ_Seen_Table.
Definition AODV.h:346
unsigned int nRREQId
RREQ identification no.
Definition AODV.h:344
NETSIM_IPAddress OrginatingNode
IP address of a node originating RREQ.
Definition AODV.h:343
Structure of RREQ sent Table in which entry of RREQ sent is made.
Definition AODV.h:350
NETSIM_IPAddress DestAddress
Destination IP Address.
Definition AODV.h:351
struct element * ele
Next AODV_RREQ_Sent_Table.
Definition AODV.h:355
int ttl
Time to live.
Definition AODV.h:352
unsigned int * UnreachableDestinationSequenceNumber
Definition AODV.h:249
unsigned int DestCount
Definition AODV.h:239
unsigned int Reserved
Sent as 0; ignored on reception.
Definition AODV.h:238
NETSIM_IPAddress * UnreachableDestinationIPAddress
Definition AODV.h:244
unsigned int HopCount
Definition AODV.h:196
NETSIM_IPAddress OriginatorIPaddress
The IP address of the node which originated the RREQ for which the route is supplied.
Definition AODV.h:204
unsigned int Reserved
Sent as 0; ignored on reception.
Definition AODV.h:189
unsigned int PrefixSz
Definition AODV.h:190
unsigned int DestinationSequenceNumber
The destination sequence number associated to the route.
Definition AODV.h:203
unsigned int Lifetime
The time in milliseconds for which nodes receiving the RREP consider the route to be valid.
Definition AODV.h:205
unsigned int HopCount
Definition AODV.h:135
NETSIM_IPAddress DestinationIPAddress
Definition AODV.h:144
NETSIM_IPAddress OriginatorIPAddress
Definition AODV.h:149
unsigned int Reserved
Sent as 0; ignored on reception.
Definition AODV.h:134
unsigned int RREQID
Definition AODV.h:139
unsigned int OriginatorSequenceNumber
Definition AODV.h:150
unsigned int DestinationSequenceNumber
Definition AODV.h:145