[ns] error in the code
neeraj gupta
neerajgupta37 at rediffmail.com
Tue Apr 28 02:28:27 PDT 2009
hi all
i am using the aodv protocol in my scenario. i made certain updation to print the routing table as foolows
Add following code to aodv.h after void rt_down(aodv_rt_entry *rt);
void rt_print(nsaddr_t node_id);
Add following code to aodv.cc after void AODV:: rt_down (aodv_rt_entry *rt) { ... }
void AODV::rt_print(nsaddr_t node_id) {
FILE *out_file;
char nowfile[50] = "rtable.txt";
out_file = fopen(nowfile, "a");
aodv_rt_entry *rt;
fprintf(out_file, "=================================");
for (rt=rtable.head(); rt; rt = rt->rt_lin.le_next) {
fprintf(out_file, "NODE: %i\t %.4lf\t%i\t%i\t%i\t%i\t%.4lf\t%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(out_file);
}
The function (rt_print) can be used anywhere in AODV. For example, I am using the function when original source node receives route reply message (RREP).
void AODV:: recvReply(Packet *p) {
...
if (ih->daddr() == index) {
rt_print(index) ;
...
}
after ame i got following error rt->rt_lin.le_next not a valid field. can anybody help me to solve the problem. i am using the ns-2.30
Neeraj Gupta
Assistant Professor
HOD, CSE & IT Department
Hindu College of Engineering
Sonepat
More information about the Ns-users
mailing list