Viewing 0 reply threads
You must be logged in to reply to this topic.
Generally, in ns2, this kind of task can not done only with TCL scripts. You have to write the required code at specific areas of existing agents or you have to write your own agent to do the same.
For example, the following code segment is handling ttl.
hdr_ip *iph = HDR_IP(p);
hdr_cmn *ch = HDR_CMN(p);
int src = Address::instance().get_nodeaddr(iph->saddr());
int dst = ch->next_hop();
/*
* Must be a packet I'm originating...
*/
if(src == myaddr_ && ch->num_forwards() == 0) {
/*
* Add the IP Header
*/
ch->size() += IP_HDR_LEN;
iph->ttl_ = IP_DEF_TTL;
}
/*
Learn to write or manipulate agent code in ns2.
[/code]
You must be logged in to reply to this topic.
Discuss Through WhatsApp