if (rt) {
assert(rt->rt_flags == RTF_UP);
rt->rt_expire = CURRENT_TIME + ACTIVE_ROUTE_TIMEOUT;
ch->next_hop_ = rt->rt_nexthop;
ch->addr_type() = NS_AF_INET;
ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction
}
else { // if it is a broadcast packet
// assert(ch->ptype() == PT_AODV); // maybe a diff pkt type like gaf
assert(ih->daddr() == (nsaddr_t) IP_BROADCAST);
ch->addr_type() = NS_AF_NONE;
ch->direction() = hdr_cmn::DOWN; //important: change the packet's direction
}
if (ih->daddr() == (nsaddr_t) IP_BROADCAST) {
// If it is a broadcast packet
assert(rt == 0);
if (ch->ptype() == PT_AODV) {
/*
* Jitter the sending of AODV broadcast packets by 10ms
*/
em=node->energy_model(); remain=em->energy();
init=em->initialenergy(); qlen=ifqueue->length();
qlimit=ifqueue->limit();
T=(α*(1-remain/init)+β*(qlen/qlimit))*Tc;
Scheduler::instance().schedule(target_, p,T);
} else {
Scheduler::instance().schedule(target_, p, 0.); // No jitter
}
}
else { // Not a broadcast packet
if(delay > 0.0) {
Scheduler::instance().schedule(target_, p, delay);
}
else {
// Not a broadcast packet, no delay, send immediately
Scheduler::instance().schedule(target_, p, 0.);
}
}
}
but I received :"error: invalid type argument of unary ‘*’ (have ‘int’)".I have no idea what that error means. I am new to pointers and they weren't explained very well in class so I'm not sure that I'm doing this correctly.
You are using non-ascii characters. I'm guessing you copy/pasted that formula from somewhere. You'll need to either rename those vars or replace them with whatever vars you're supposed to be using.