Home
Name Modified Size InfoDownloads / Week
README.md 2018-04-22 3.1 kB
aodv.h 2018-04-22 10.8 kB
aodv.cc 2018-04-22 35.9 kB
Totals: 3 Items   49.8 kB 0

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).

The modified AODV routing protocol gets the neighbor list and neighbor count from the routing agent of the node, and passes this information to 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".

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

///////////// 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.

Source: README.md, updated 2018-04-22