Вы находитесь на странице: 1из 7

AODV Operations

This document explains the action of a node with respect to different AODV events in terms of a pseudo code. With this, we are also mentioning some of the modification required in basic AODV operations to work for P-AODV. Generating Route Requests. [ Same for P-AODV ]

While [(Time to wait for last RREQ reply is completed) AND (RREQ Retries < = MAX)] { If (Node has data to send) { If (No valid entry in route table for destination) { Generate RREQ with unknown sequence number flag must be set; } Else If (Have a invalid destination entry in route table) { Generate RREQ with last sequence number; } Save [(RREQ_ID) and (IP address source)]; // To Avoid rebroadcast. } }

Processing and Forwarding Route Requests.

---------------------------------------------------------------------------------------AODV ---------------------------------------------------------------------------------------If (Node listen a RREQ) { If (same as forwarded in near past) { Discard; } Else //This is a new RREQ { Entry for Reverse Route // (Route from node to originator of this RREQ message) { // update the sequence no. , // Set the valid flag for route, // Change the life time for route to originator.

Update the routing table entries for originator IP address; Increase the hop count by one in RREQ packet; } IF (TTL > 1) { Decrease the TTL field by one; If [(Node is Destination for this RREQ) OR (Node has route to destination)] { Send RREP; Discard RREQ; } Else { Broadcast RREQ; } } } }

---------------------------------------------------------------------------------------P-AODV ---------------------------------------------------------------------------------------If (Node listen a RREQ) { If (same as forwarded in near past) { Discard; } Else //This is a new RREQ { Entry for Reverse Route // (Route from node to originator of this RREQ message) { // update the sequence no. , // Set the valid flag for route, // Change the life time for route to originator. Update the routing table entries for originator IP address; Increase the hop count by one in RREQ packet; } IF (TTL > 1) { Decrease the TTL field by one; If [(Node is Destination for this RREQ) OR (Node has route to destination)] { Send RREP; Discard RREQ; }

Else { If (Node is eligible for proxy destination) { Send Proxy_RREP; } Broadcast RREQ; } } } }

Generating Route Replies.

o Route Reply Generation by the Destination. // Increment the sequence number for RREP; // Hop count = 0; Do some routine task like above for RREP and IP packet; Send RREP; o Route Reply Generation by an Intermediate Node.

---------------------------------------------------------------------AODV ---------------------------------------------------------------------// Use same sequence number for RREP; // Hop count = original destination ho count from routing table; Do some routine task like above for RREP and IP packet; Send RREP to originator; If (Gratuitous flag is set in RREQ) { Send RREP to destination also; }

---------------------------------------------------------------------P-AODV ---------------------------------------------------------------------// Use same sequence number for RREP; // Hop count = original destination ho count from routing table; Do some routine task like above for RREP and IP packet; Send RREP to originator; If (Gratuitous flag is set in RREQ and Not a proxy reply) { Send RREP to destination also; }

Receiving and Forwarding Route Replies.

-------------------------------------------------------------------------------------AODV -------------------------------------------------------------------------------------Do { // Changes for destinations IP address Make valid changes in the routing table with respect to RREP packet { Update Sequence number IF 1. Sequence number in routing table is marked as invalid. 2. Sequence number in RREP is greater than stored sequence number.

Update Hop Count IF 1. Sequence number is same but route flag is marked as invalid. 2. Sequence number is same but new hop count is less than stored hop count. } IF (This node is not ultimate receiver for this RREP){ Consult from routing table for next hop; Forward RREP; } }

-------------------------------------------------------------------------------------P-AODV -------------------------------------------------------------------------------------Do { // Changes for destinations IP address Make valid changes in the routing table with respect to RREP packet { Update Sequence number IF 3. Sequence number in routing table is marked as invalid. 4. Sequence number in RREP is greater than stored sequence number.

Update Hop Count IF 3. Sequence number is same but route flag is marked as invalid. 4. Sequence number is same but new hop count is less than stored hop count. } IF (This node is not ultimate receiver for this RREP) { Consult from routing table for next hop; Forward RREP; } IF (This node is ultimate receiver for this RREP) { Wait for RREP time expire; // waiting for original route reply; If (RREP is from original destination or have path to original destination) { Estatblish path; } Else { Choose some of the proxy destination to store the data; } }

Hello Messages.

-------------------------------------------------------------------------------------AODV -------------------------------------------------------------------------------------Do { Send Hello message after every Hello_Interval { TTL = 1; Destination IP = nodes IP; Destinations Sequence number = latest sequence Number; Hop Count = 0; Life Time = Allowed_Hello_Loss * Hello_Interval; } On Receiving Hello message from neighbor { Update the routing table for neighbor; } }

-------------------------------------------------------------------------------------P-AODV -------------------------------------------------------------------------------------Do { Send Hello message after every Hello_Interval { TTL = 1; Destination IP = nodes IP; Destinations Sequence number = latest sequence Number; Hop Count = 0; Life Time = Allowed_Hello_Loss * Hello_Interval; } On Receiving Hello message from neighbor { If (first hello message from neighbor) { Exchange message list with neighbor; } Update the routing table for neighbor; } }

Route Error (RERR) Messages, Route Expiry and Route Deletion. [ Same for P-AODV ] IF ((Link is Break for next hop for an active route) OR (Node has a data packet for a node but not have an active route) OR (Receives a RERR from neighbor for one or more active route)) { Make a list of unreachable destinations; IF (destination list is not empty) { Send RERR messages to those destinations; } Mark that route as invalid in routing table; Increment the sequence number for those destinations; }

Local Repair. [ Same for P-AODV ] If (node detects a link break) { Increase the sequence number for destination; Broadcast RREQ for that destination; }

Actions after Reboot. [ Same for P-AODV ] Do { (Wait for a DELETE_PERIOD time to become all sequence number invalid) OR IF (listen RREQ or RREP or RERR) { Make appropriate changes in sequence number; } IF (Receive a data packet) { Send RERR; } }

Вам также может понравиться