You need to pass node id as an argument to this method.
e.g. in aodv.cc withing rt_resolve() method,
rt_print(0);
This will print node 0's routing table at that time with file name as node_0.
void AODV::rt_print(nsaddr_t node_id)
{
FILE * tmpFile;
char tmpFileName[50] = "node_";
char tmp[10] = "";
sprintf(tmp,"%d",node_id);
strcat(tmpFileName,tmp);
tmpFile = fopen(tmpFileName, "w");
aodv_rt_entry *rt;
for (rt = rtable.head(); rt; rt = rt->rt_link.le_next)
{
fprintf(
tmpFile,
"Node Id:%i Current time:%.4lf Destination:%i Next hop:%i No. of hops:%i Seq. No.:%i Route expire:%f Flags:%.4lf %d \n",
node_id, CURRENT_TIME, rt->rt_dst, rt->rt_nexthop, rt->rt_hops,rt->rt_seqno, rt->rt_expire, rt->rt_flags);
}
fclose(tmpFile);
}
e.g. in aodv.cc withing rt_resolve() method,
rt_print(0);
This will print node 0's routing table at that time with file name as node_0.
void AODV::rt_print(nsaddr_t node_id)
{
FILE * tmpFile;
char tmpFileName[50] = "node_";
char tmp[10] = "";
sprintf(tmp,"%d",node_id);
strcat(tmpFileName,tmp);
tmpFile = fopen(tmpFileName, "w");
aodv_rt_entry *rt;
for (rt = rtable.head(); rt; rt = rt->rt_link.le_next)
{
fprintf(
tmpFile,
"Node Id:%i Current time:%.4lf Destination:%i Next hop:%i No. of hops:%i Seq. No.:%i Route expire:%f Flags:%.4lf %d \n",
node_id, CURRENT_TIME, rt->rt_dst, rt->rt_nexthop, rt->rt_hops,rt->rt_seqno, rt->rt_expire, rt->rt_flags);
}
fclose(tmpFile);
}
This comment has been removed by the author.
ReplyDeleteDear Durgesh
ReplyDeleteI am ok. :)
can you post a blog on detecting the malicious node in network using ns2.34 with code or please mail me the explanation or the code plz
Deletemail address : anand.tripathi507@gmail.com
Can you please explain in detail .how 2 print routin table.Its ll really help me.Thanks in Advance
ReplyDeletehello Mr , how can i access to node_id and this variable is declared as protected in the file Node.h , is there any solution to do that ?
ReplyDeletewhere will the print statement in .cc file printed?
ReplyDeleteyou can use rt_print(index) in anywhere in aodv.cc as you like. For eg,u can use it in recvReply fun after update routing table or if (ih->daddr() == index) ... something like that.
Deletehi i am gaurav
ReplyDeletei want to print current node id in to comman/ttl.cc file how can i
?
Can u please mail me codes of aodv modified with watchdog in ns2
ReplyDeleteSo it'll be a great help from U...
thx
could u let us complete demo on ur above created routing table
ReplyDeletewe are doing on same one,.............can we have brief xplanation on routing table
ReplyDeleteSir, I want to isolate the malicious node. Can you please tell me how can I do that?
ReplyDeletePlease mail at ghodeswarekta@yahoo.in
Dear sir, I am using ns2-2.35 version. In TCL script when i define the energy model, all the nodes will be in green color. Can that be changed to any other color? (not dynamically in tcl). If so, pls explain me how.
ReplyDeleteMy mail id: ruthvicsakre@gmail.com
can you please tell me how to give IDs to the nodes
ReplyDeletei m getting error in make command,,.. pls help me..
ReplyDeletei m getting error in make command,,.. pls help me..
ReplyDeletecan you post a blog on detecting the malicious node in network using ns2.34 with code or please mail me the explanation or the code plz
ReplyDeletemail address : anand.tripathi507@gmail.com