Coder Social home page Coder Social logo

ajayarunachalam / neighbor-discovery Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 38 KB

P2P Network Resource Discovery Simulation in MANET

License: MIT License

C++ 46.69% Shell 22.47% Awk 8.03% Tcl 22.82%
aodv p2p p2p-application neighbor-count peer tcl manet peer-to-peer neighbor-discovery peer-discovery

neighbor-discovery's Introduction

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.

neighbor-discovery's People

Contributors

ajayarunachalam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lilangg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.