※一路风尘※leyond.blog.chinaunix.net
yexin218
网上的蜘蛛
全部博文(227)
Eclipse(2)
英语写作(0)
LDAP(0)
Linux(3)
驱动开发(5)
linuxWeb(0)
图表编程(0)
Python(7)
Ruby(1)
AS3(2)
NS2(31)
Flex(35)
XML(3)
VirtualWiFi(5)
JQuery(2)
struts(0)
LifeRay(0)
Ajax(4)
Delphi(0)
OpenGL(6)
2010年(19)
2009年(29)
2008年(179)
叶绍琛
奥丁@
libydwei
鸟哥のli
大鬼不动
hyrish
shiyigud
a987654
Elaine20
格伯纳
Phyllis6
浪花小雨
lizi3121
xiao1729
yoyosys
分类: 系统运维
2008-07-25 16:10:33
根据AODV中recv()函数的代码,我们可以知道,只需要将IP包头的目的地址设为广播地址即可,ih->daddr() != IP_BROADCASTvoidAODV::recv(Packet *p, Handler*) {//访问通用以及IP包头struct hdr_cmn *ch = HDR_CMN(p);struct hdr_ip *ih = HDR_IP(p); assert(initialized()); //assert(p->incoming == 0); // XXXXX NOTE: use of incoming flag has been depracated; In order to track direction of pkt flow, direction_ in hdr_cmn is used instead. see packet.h for details. if(ch->ptype() == PT_AODV) { ih->ttl_ -= 1; recvAODV(p); return; } /* * Must be a packet I'm originating... */if((ih->saddr() == index) && (ch->num_forwards() == 0)) { /* * Add the IP Header */ ch->size() += IP_HDR_LEN; // Added by Parag Dadhania && John Novatnack to handle broadcasting if ( (u_int32_t)ih->daddr() != IP_BROADCAST) ih->ttl_ = NETWORK_DIAMETER;} /* * I received a packet that I sent. Probably * a routing loop. */else if(ih->saddr() == index) { drop(p, DROP_RTR_ROUTE_LOOP); return; } /* * Packet I'm forwarding... */ else { /* * Check the TTL. If it is zero, then discard. */ if(--ih->ttl_ == 0) { drop(p, DROP_RTR_TTL); return; } }// Added by Parag Dadhania && John Novatnack to handle broadcasting if ( (u_int32_t)ih->daddr() != IP_BROADCAST) rt_resolve(p); else forward((aodv_rt_entry*) 0, p, NO_DELAY);}
上一篇:NS技巧--改变节点在nam中显示的颜色
下一篇:NS技巧--怎样从trace文件中获得从节点a发送到b的数据报经历的路径
登录 注册