[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Questions regarding AODV codes in ns-allinone-2.1b7
Dear ns users:
I just want to raise some doubt regarding the following sections of AODV
codes in ns-allinone2.1b7 package.
1. ~ns2/aodv/aodv.cc:
In the beginning of the file, Line 50:
#define max(a,b) a > b ? a : b
I think this line should be modified as:
#define max(a,b) (a > b ? a : b)
Because WITHOUT the brackets, the code in recvRequest() at Line 873:
seqno = max((unsigned)seqno, (unsigned)rq->rq_dst_seqno) + 1;
is actually interpret as:
seqno = max((unsigned)seqno, (unsigned)rq->rq_dst_seqno + 1);
which is rather misleading.
2. ~ns2/rttable.h:
In definition of class rttable, Line 183:
LIST_HEAD(ncache, rt_entry) rthead;
I think using nchache here as the struct name is rather bad practice
because
it has already been used as the global struct name for Neighbor
cache, Line 80:
LIST_HEAD(ncache, Neighbor);
The two do not conflict but are misleading. I suggest some other
name be used in
Line 183, such as:
LIST_HEAD(rtt, rt_entry) rthead;
Your comments are welcomed. Thank you.