Skip to main content

Posts

Showing posts from December, 2011

Finding the Node Position, speed and Velocity of a Node while using AODV

Finding the Node Position, speed and Velocity of a Node while using AODV Steps 1. ~ns-2.34/aodv/aodv.h include the following header line in aodv.h 1: #include<mobilenode.h> 2.In protected scope declare the variables you would be using to store the node parameters. 1: double xpos; 2: double ypos; 3: double zpos; 4: double iEnergy; 5: int node_speed; 6: MobileNode *iNode; 7: FILE *fp; 3.In aodv.cc initialize the declared variables. 1: xpos = 0.0; 2: ypos = 0.0; 3: zpos = 0.0; 4: node_speed = 0; 5: iEnergy=0.0; 6: fp=fopen( "pradeep.csv" , "w" ); 7: MobileNode *iNode; 4.Finally access the required functions from mobilenode.h . Paste the following lines in the AODV::forward() function //Code by pradeepkumar /***This code retrieves node position*****/ fprintf(fp, "Position is, X, Y, Z, Velocity is, X, Y, Z, Velocity, Node Speed, Energy \n" ); iNode = (MobileNode*) (Node::get_node_by_...

Promiscuous Mode in AODV (ns 2.34)

In a network, promiscuous mode allows a network device to intercept and read each network packet that arrives in its entirety. This mode of operation is sometimes given to a network snoop server that captures and saves all packets for analysis (for example, for monitoring network usage). Its often used to monitor network activity Files to be changed 1. ~ns-2.34/aodv/aodv.h 2. ~ns-2.34/aodv/aodv.cc 3. ~ns-2.34/lib/tcl/ns-mobilenode.tcl 1. Make AODV agent a child class of Tap (you should have a member function tap), and define the Mac variable 1: #include <mac.h> 2: class AODV: public Tap, public Agent { 3: public : 4: void tap( const Packet *p); 5: ...... 6: protected : 7: Mac *mac_; 8: ...... 9: } 2. Modify aodv/aodv.cc Define TCL command "install-tap" and implement AODV::tap() 1: int AODV::command( int argc, const char * const * argv) { 2:   3: ...... 4:   5: else if (argc == 3) { 6:   7: .....

Network Simulators for Education and Research

There are various real hardware tools and emulators are available in the market for measuring the performance of a network, wireless network. But one cannot invest much in terms of money and time. Hence there should be some tools that helps the researchers to do their research to measure the performance and find the results. Here are some of the tools that are free and easily avaialble to everyone at the cost of Time (you need to invest time thats what a researcher is supposed to do) 1. Network Simulator 2 (NS2) Link : http://www.isi.edu/nsnam/ns/ Ns is a discrete event simulator targeting for networking research. This simulator provides support for simulation of Wired networks like TCP, routing, and multicast protocols over wired and wireless  networks. In short it is called as NS2. Languages Used: Tcl, OTcl, C++, Simple AWK Script to analyze the results (freely available in the web) Pros: It is free and Open Source  Simulate almost any type of networks which are ...

Creating a New Agent in Network Simulator 2

How to create a new agent in NS2. You can use any version of the Simulator. The following codes will make you to understand the writing of a sample agent. Requirements: NS2 Simulator A tcl file to test the compiled agent If any two values are supplied from the TCL file, the agent computes the Surface area of the Cylinder which is nothing but (2* PI * r * h).  The supplied values from TCL file are r and h. How to do that. 1. Copy the newagent.cc (given below ) file in ~ns-allinone-2.34/ns-2.34/newfolder 2. Make an entry in the ~ns-2.34/Makefile.in     Make an entry in the OBJ_CC =             newfolder/newagent.o \ 3. in the shell prompt, go to ~ns-2.34 and give the command ./configure make 4. run the file agent_new.tcl (given below) you can see the output Here is the C++ code to be written and compiled //Name of the file is newagent.cc and put it in a folder inside ~ns-2.34/newfolder/ #include <stdio....