[ns] shedule Null handler timer pb
sarym binome
binome_ini at hotmail.com
Fri Mar 6 03:19:39 PST 2009
hello
i introduced a new pkt in AODV protocol ,witch i want to send it once when i start a simulation
i want to broadcast it , so i write a send_newpkt ()
and I have this error when
I run a tcl example
Scheduler: attempt to
schedule an event with a NULL handler. Don't DO that.
i didn't use any timer cause i don't send the newpkt periodically but only once at the beginning
plz look the code below :
this is the code
and i call it in AODV.CC
AODV::AODV(nsaddr_t id) : Agent(PT_AODV),
btimer(this), htimer(this), ntimer(this),
rtimer(this), lrtimer(this), rqueue() {
index = id;
seqno = 2;
bid = 1;
LIST_INIT(&nbhead);
LIST_INIT(&bihead);
logtarget = 0;
ifqueue = 0;
sendnewpkt();
}
void
AODV::sendnewpkt() {
Packet *p = Packet::alloc();
struct hdr_cmn *ch = HDR_CMN(p);
struct hdr_ip *ih = HDR_IP(p);
struct hdr_srs_aodv_reply *rh = HDR_srs_AODV_REPLY(p);
#ifdef DEBUG
fprintf(stderr, "sending newpkt from %d at %.2f\n", index, Scheduler::instance().clock());
#endif // DEBUG
rh->rp_type = AODVTYPE_newpkt;
//rh->rp_flags = 0x00;
rh->rp_hop_count = 1;
rh->rp_dst = index;
rh->rp_dst_seqno = seqno;
rh->rp_lifetime = (1 + ALLOWED_HELLO_LOSS) * HELLO_INTERVAL;
// ch->uid() = 0;
ch->ptype() = PT_AODV;
ch->size() = IP_HDR_LEN + rh->size();
ch->iface() = -2;
ch->error() = 0;
ch->addr_type() = NS_AF_NONE;
ch->prev_hop_ = index; //AODV hack
ih->saddr() = index;
ih->daddr() = IP_BROADCAST;
ih->sport() = RT_PORT;
ih->dport() = RT_PORT;
ih->ttl_ = 1;
Scheduler::instance().schedule(target_, p, 0.0); //send(p,0);
}
i tried send(p,0) but i had a segment fault
best regards
_________________________________________________________________
Découvrez Windows Live Spaces et créez votre site Web perso en quelques clics !
http://spaces.live.com/signup.aspx
More information about the Ns-users
mailing list