Can any one tell me the function of this common?
send (p, (Handler*) 0);
with this in forward function in vanet, my forward function is that which is written below.
and also if the mention of RSU is correct or not.
===============================================================
void
VanetABCAgent::forward (Packet * )
{
Packet *p = Packet::alloc();
u_int32_t id =10;
nsaddr_t rsu1=id;
nsaddr_t rsu2= id+1;
nsaddr_t rsu3= id +2;
int interval_ =400;
struct hdr_vanet_abc *hdr = HDR_VANET_ABC(p);
// access the incoming packet
struct hdr_cmn *ch = HDR_CMN (p);
struct hdr_ip *iph = HDR_IP (p);
nsaddr_t nexthop;
hdr->abc_msgtype = VANETTYPE_JOINREQ; // (necessary for dispatching!)
// this can be read at reception in
MobileNode *pnode = (MobileNode *) Node::get_node_by_address (index);
pnode->update_position (); // update the position, before using it
hdr->abc_posx = pnode->X (); // include current own location
hdr->abc_posy = pnode->Y ();
hdr->abc_speed = pnode->speed ();
hdr->abc_dx = pnode->dX (); // include current own location
hdr->abc_dy = pnode->dY ();
double x_S = hdr->abc_posx;
double y_S = hdr->abc_posy;
double dist = sqrt (pow ((x_S - 1000), 2) + pow ((y_S - 500), 2));
double dist1 = sqrt (pow ((x_S - 2000), 2) + pow ((y_S - 500), 2));
double dist2 = sqrt (pow ((x_S - 3000), 2) + pow ((y_S - 500), 2));
if (dist < interval_)
{
hdr->abc_receiverID =rsu1;
cout << "distf Iid: " << dist << endl;
}
if (dist1 < interval_)
{
hdr->abc_receiverID =rsu1;
cout << "distf Id11: " << dist1 << endl;
}
if (dist2 < interval_)
{
hdr->abc_receiverID =rsu3;
cout << "distf Id22: " << dist2 << endl;
}
else {
hdr->abc_receiverID =index;
}
// hdrgen->vn_msgtype
ch->prev_hop_ = index;
ch->iface() = -2;
ch->addr_type() = NS_AF_NONE;
ch->ptype () = PT_VANETABC;
ch->size() = IP_HDR_LEN + hdr->size();
iph->saddr() = index;
iph->daddr() = IP_BROADCAST;
iph->dport() = iph->sport();
// IP_BROADCAST == rsu1;
hdr->abc_senderID = index;
//hdr->abc_receiverID = rsu1 ;
//hdr->abc_receiverID = rsu2;
//*/
hdr->appID=appID;
//
// hdr->origSender=hdr1->origSender;
hdr->abc_timestamp = Scheduler::instance().clock();
hdr_cmn::access(p)->size() = hdr->size();
iph->ttl_=3;
JOIN_pkt_timer_.resched(1);
send(p, (Handler*) 0);
}