[ns] Help:How to realize the Promiscuous Model in AODV ???
zhao can
zzc4587 at yahoo.com.cn
Mon Sep 12 20:59:08 PDT 2005
Hi, everyone;
I have a question about the promiscuous model in
AODV. I want to modify the AODV , in order that it can
work in the promiscuous model. I modify the AODV as
fellow:
in aodv/aodv.h , i add these:
..............................
...............................
class AODV: public Agent, public Tap {
................................................
................................................
public:
void tap(const Packet *p);
protected:
Mac *mac;
NsObject *ll;
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
in aodv/aodv.cc, i modify it as fellow:
.................................................
..................................................
int
AODV::command(int argc, const char*const* argv) {
..........................................
..........................................
if(argc == 3) {
..........................................
..........................................
else if (strcmp(argv[1], "install-tap" ) == 0) {
mac = (Mac*) TclObject::lookup(argv[2]);
if (mac == 0)
return TCL_ERROR;
mac->installTap(this);
return TCL_OK;
}
else if (strcmp(argv[1], "set-ll") == 0) {
ll = (NsObject*) TclObject::lookup(argv[2]);
if (ll == 0)
return TCL_ERROR;
return TCL_OK;
}
}
return Agent::command(argc, argv);
}
void
AODV::tap(const Packet *p)
{
struct hdr_cmn* ch = HDR_CMN(p);
struct hdr_ip* ih = HDR_IP(p);
struct hdr_aodv* ah = HDR_AODV(p);
if (ch->direction() == hdr_cmn::DOWN)
return ;
if (ih->saddr() == index)
return ;
if (ih->daddr() == index || ih->daddr() == (nsaddr_t)
IP_BROADCAST)
return ;
if ( ! DATA_PACKET(ch->ptype()))
return ;
/*
* then i do some process to data packet
*/
//Packet
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
in ~/tcl/lib/ns-mobilenode.tcl , i do this:
.......................................................
...........................................................
Node/MobileNode instproc add-target { agent port } {
$self instvar dmux_ imep_ toraDebug_ mac_ ll_
ifq_
..............................................
............................................
set aodvonly [string first "AODV" [$agent info class]]
if {$aodvonly != -1 } {
$agent set-ll [$self set ll_(0)]
$agent if-queue [$self set ifq_(0)]
$agent install-tap $mac_(0)
}
...................................
.................................
}
That's all.
I want to know whether i do all that i must do?
Do you think what i do is right? If not, what should i
modify?
in function :void tap(const Packet *p), the Packet* p
need to free?
waiting for you help!
thanks!
___________________________________________________________
ÑÅ»¢Ãâ·ÑGÓÊÏä£ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä
http://cn.mail.yahoo.com
More information about the Ns-users
mailing list