Skip to main content

PRINTING ROUTING TABLE IN TERMINAL

 Here, we are going to generate routing tables IN  for tcl scripts by modifying AODV protocol. For that we have to modify following files in the AODV directory[for AODV directory look at ns2.35 folder];

  1. aodv.h 
  2. aodv.cc

1. aodv.h modification

First display aodv.h file and then add the following lines inside the class AODV in the protected scope Add the line after the rt_down() function.

void rt_print(nsaddr_t nodeid);




Save the aodv.h file and

2. aodv.cc modification

Now click on aodv.cc file and select display option,

Now add the following function rt_print to the aodv.cc file probably below rt_down function.

void  AODV::rt_print(nsaddr_t nodeid) {
aodv_rt_entry *rt;
printf("Node id \t time \t destination \t nexthop \t hop count \t seq.no\n");
for (rt=rtable.head();rt; rt = rt->rt_link.le_next) {
printf("NODE: %i \t %f \t %i \t %i \t \t %i \t \t %i \n", nodeid, CURRENT_TIME, rt->rt_dst, rt->rt_nexthop, rt->rt_hops, rt->rt_seqno);
}
}



Now finally we have to call the function that we written above,we can call it in any part of protocol. Here we are going to call inside recvReply() function.

For that we have to write following line inside if (ih->daddr() == index);

 rt_print(index);



After completing these steps.Open the terminal window and change the directory to the ns2.35 by using following command.

cd /home/user/Desktop/ns-allinone-2.35/ns-2.35 [change path as yours]

and now type 
                                                                     make clean 
then type
                                                                         make
then type
                                                               sudo make install

After successful completion of steps.Run a sample program.
For sample program,click here  and run the program using command ns filename.tcl

Screen shot




Comments

Popular posts from this blog

INTRODUCTION TO NETWORK SIMULATOR 2

  INTRODUCTION  Network Simulator Version 2, widely known as NS2, is an event driven simulation tool that is useful in studying the dynamic nature of communication networks. Simulation of wired as well as wireless network functions and protocols (e.g., routing algorithms, TCP, UDP) can be done using NS2. In general, NS2 provides users with a way of specifying such network protocols and simulating their corresponding behaviors. Due to its flexibility and modular nature, NS2 has gained constant popularity in the networking research community since its birth in 1989. Ever since, several revolutions and revisions have marked the growing maturity of the tool, thanks to substantial contributions from the players in the field. Among these are the University of California and Cornell University who developed the REAL network simulator,1 the foundation which NS is based on. Since 1995 the Defense Advanced Research Projects Agency (DARPA) supported development of NS through the Virtual ...

Matter: A next generation home standard

The smart home is evolving. To date, if you've wanted to get into developing a smart home, you've had to deal with the multitude of smart home ecosystems, and making sure that each device you buy is compatible. That, however, may soon change — thanks to new smart home standard called Matter. Matter isn't available just yet, but when it is finally released, it could completely change how you buy smart home products, for the better. All of the best smart home devices could soon support the standard, helping them all work together nicely, and ensuring that no matter what products you buy, you'll be able to use them. Matter is basically the name of a new smart home connectivity standard . But this standard is a little unlike others. That's because of the fact that it's being developed by the Connectivity Standards Alliance, which counts hundreds of companies as members. That includes the likes of Google, Alexa, and Apple. So, whether you prefer to use Google Assista...

How to turn off package notifications on Alexa

Echo smart speakers and smart displays have a handy feature that can show and tell you when there’s a package sitting on your doorstep and even what’s in it. While this can be helpful most of the time, around the holidays it could seriously ruin some surprises. Avoid making any Grinch-like moves this holiday and manage your Amazon shopping notifications in the Alexa app to help keep the magic alive. Alongside options for tailoring package announcements, the notifications section of the app also has a number of settings you can toggle on or off to help make the voice assistant a little more helpful when it comes to purchases you make on Amazon. Below are a few of the most useful that you might want to tweak this holiday season. Open the Alexa app. Tap on More in the bottom right hand corner. Select Settings > Notifications > Amazon Shopping . Under “Say or Show Item Titles” toggle off “including items in your shopping cart marked as gifts, or those that might be gifts during major...