One way to print routing table in aodv in ns-2.28 would be the following..
(Assuming you have basic familiarity with C++ and any general routing
table structure)

1. Declare a function - rt_display(int node_id) as a member of class
aodv_rtable (in file aodv_rtable.h)
node_id is an argument which you can pass while calling the function and
later print it along with the routing table so that you know which node is
printing it's routing table.

2. Define the same function in aodv_rtable.cc. Inside the function
rt_display(int node_id), print the fields of rt->rt_dst, rt->rt_nexthop
and so on.. (all the fields that are of interest to you). To see how to
access individual entries of the routing table, take a look at rt_lookup
function.

3. From an "appropriate place", call this function.  ( one place I would
suggest is from rt_update in aodv.cc , call rtable.rt_display(index). This
would dump the routing table whenever there is an update to the routing
table )

Then, recompile ns with make and try running your simulation.

Thanks,
Kanthi


>
>                          Hi all ,
>    To print the routing table I have followed this steps   :
>    1)    I went to the file  aodv_rtrace.h and add this line
>             void   print(Trace*);
>    2) I wet to the file aodv_rtrace.cc and add this fuction
>              void
>          aodv_rtable::print(Trace* out) {
>          sprintf(out->pt_->buffer(), "P\tdest\tnext");
>          out->pt_->dump();
>    for (rtable_t::iterator it =rt_ begin() ; it != rt_ e();it++)  {
>           sprintf(out->pt_->buffer(),"P\t%d\t%d",
>            (*it).first,
>            (*it).second);
>             out->pt_->dump();
>            }
>         }
>   (print is the function which print the routing table in the trace file )
>   3)recompile ns2 by typing ./configure then make install in the
>     ~ns-2.29 directory because i'm using ns2.29
>
>   so then i must see in my trace file the routing table printed
>   but I don't see this routing table and i don't know why ?????
>   So please help me it's verrrry important
>   i have attached you my 2 files
>     aodv_rtable.cc and aodv_rtable.h
>
>   Thank u a lot in advance
>   Amel
>
>
>
>
>
>
> ---------------------------------
>  Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> tarifs exceptionnels pour appeler la France et
> l'international.Téléchargez la version beta.


-- 
" I gave my life to become the person I am right now. Was it worth it? "
 - Richard Bach

Reply via email to