Skip to content

ajayarunachalam/Neighbor-Discovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neighbor Discovery in P2P MANETs

Overview:-

I have suggested an alternate way for neighbor discovery in peer-to-peer(P2P) applications over mobile ad-hoc network (MANET), whose source code is made publicly available.

The modified AODV routing protocol gets the neighbor list and neighbor count from the routing agent of the node, and passes this information to the P2P application.

I have implemented the function neighor_list in aodv.cc that will return the neighbor list of nodes separated by ":", like say for example 3:2:33:24:55".

Psuedocode

  1. Point to the first element in neighbor cache of AODV_Neighbor.
  2. For each neighbor, link to its next node.
  3. Get the neighbor address.
  4. Append AODV routing layer neighbor list information to neighbor array.
  5. Pass this information to P2P application.

Procedure for patching aodv protocol with my implementation

The following is the simple procedure for patching aodv protocol for getting neighbor count and neighbor list under a tcl simulation.

Step 1:

Open the file ns-allinone-2.35/ns-2.35/aodv/aodv.h

In the file aodv.h comment the two lines as shown in the following
(see the lines - define AODV_LINK_LAYER_DETECTION & define AODV_USE_LL_METRIC)

/////////////Modified by Ajay Arunachalam //////////////////

//Here we enable the aodv hello mechanism // AODV_LINK_LAYER_DETECTION AODV_USE_LL_METRIC were undefined // to enable hello Messages

/* Allows AODV to use link-layer (802.11) feedback in determining when links are up/down. */ //#define AODV_LINK_LAYER_DETECTION

/* Causes AODV to apply a "smoothing" function to the link layer feedback that is generated by 802.11. In essence, it requires that RT_MAX_ERROR errors occurs within a window of RT_MAX_ERROR_TIME before the link is considered bad. */ //#define AODV_USE_LL_METRIC ////////////////////////////////////////////////////////////////////////////////////

Step 2:

Open the file ns-allinone-2.35/ns-2.35/aodv/aodv.cc

And add the two sections in the function AODV::command(int argc, const charconst argv)

///////////// Modified by Ajay Arunachalam ////////////

 // For Passing the Neighbor Count to TCL  

if(strcmp(argv[1], "neighbor_count") == 0) {

    
int nbrs=0;
AODV_Neighbor *nb = nbhead.lh_first;
for(; nb; nb = nb->nb_link.le_next)
    nbrs++;
  tcl.resultf("%d", nbrs);
  return TCL_OK;
}

 // For Passing the Neighbor List to TCL 

char neighbor[10];

if(strcmp(argv[1], "neighbor_list") == 0) {
	

char neighbor_list[1000]="";


AODV_Neighbor *nb = nbhead.lh_first;

for(; nb; nb = nb->nb_link.le_next)  {

    sprintf(neighbor,"%d:",nb->nb_addr);

    strcat(neighbor_list,neighbor);

}
  tcl.result(neighbor_list);
  return TCL_OK;
}

////////////////////////////////////////////////////////////

Step 3:

In terminal window, change to the ns-allinone-2.35/ns-2.35/

cd ns-allinone-2.35/ns-2.35/

(here you may installed ns2 under different directory – so cd according to your installation)

Step 4:

Compile the code as follows :

make

make install

(this is optional in the case if you already added ns-allinone-2.35/ns-2.35/ in path)

Now the new version of aodv will contain two more commands in the command section, so that you can invoke those two commands from the tcl code. All the supporting experiment files are provided. Just follow the instructions as given in procedure_running_code.txt file to test the protocol.