Hello,  I am interested in displaying the contents of Routing Table of
a node running DSDV. For this I carried out the following steps:

1.   I declared this function in dsdv.h as a protected member function of 
DSDV_Agent class.
void displayrtable();    // display the contents of the routing table

2.  Defined displayrtable() method in dsdv.cc as above.
void DSDV_Agent::displayrtable() {
rtable_ent *ent;
int desti, next, metric, sqnum;
printf("======================== Routing table 
=============================\n\n");
printf("Destination\tNext-hop\tMetric\tSequence Number\n");
for(table_->InitLoop (); (ent = table_->NextLoop ());){
    desti = ent->dst;
    next = ent->hop;
    metric = ent->metric;
    sqnum = ent->seqnum;
    printf("%10d\t%10d\t%-10d\t%-10d\n",desti,next,metric,sqnum);
} //end for
}// end displayrtable()

3.Told dsdv when to invoke dsplayrtable() in command() method.
if(strcmp (argv[1], "displayrtable") == 0)
    {
    displayrtable();
    return (TCL_OK);
    }

4. Invoked displayrtable in TCl.
set dsdv [new Agent/DSDV]
$ns at 3.5 "$dsdv displayrtable"

output==>
num_nodes is set 2
INITIALIZE THE LIST xListHead
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_
= 1.5,  distCST_ =
179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
SORTING LISTS ...DONE!
======================== Routing table =============================

Destination     Next-hop        Metric  Sequence Number
end simulation

>From the output I assume that the control never reaches the 'for'  loop's 
>body. Kindly highlight any point I am missing.

Best Regards


      

Reply via email to