[ns] MIP Handover and ARP in ns-2.28

2006-05-22 Thread altaf hussain

Hi Users. I hope al of u would be OK. I have been working on Mobile IP v4 
implemented in ns-2.28. There is a bug in the implementation of Mobile IP in 
ns2 and that have been reported by Michal in AUGUST 2005. 
  The modifications indicated by Michal are infact confusing me.
  The function to get the current mobile node  get_node_michu() is giving 
problems while compiling.
  I am posting the modificatins done by Michal. Can any one really give me a 
better and working modification in ns-2.28
  Thanks 
   
  Michal

PS. Below there is ll:recv() function with my modifications.

_/*
This shall be added in arp.cc
MobileNode*
ARPTable::get_node_michu()
{
return node_;
}
*/

void LL::recv(Packet* p, Handler* _/*h*/)
{
hdr_cmn *ch = HDR_CMN(p);
hdr_arp *ah = HDR_ARP(p);
hdr_mip *miph = hdr_mip::access(p);
hdr_ip *ip_h = hdr_ip::access(p);



//char *mh = (char*) HDR_MAC(p);
//struct hdr_sr *hsr = HDR_SR(p);

_/*
* Sanity Check
*/
assert(initialized());

//if(p->incoming) {
//p->incoming = 0;
//}
// X 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 direction = UP, then pass it up the stack
// Otherwise, set direction to DOWN and pass it down the stack
if(ch->direction() == hdr_cmn::UP) {
//if(mac_->hdr_type(mh) == ETHERTYPE_ARP)
if(ch->ptype_ == PT_ARP){


if(ah->arp_spa == 4194305) // I mean Mobile Node's IP here. Not very
elegant way to do it
{
if(licznik < 10)
{
nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
IP addr
nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
arptable_->arprequest(src_arp, dst_arp, this);

licznik++;
//printf(" src_arp %d\n", src_arp);
//printf(" dst_arp %d\n", dst_arp);
//printf("arprequest %d\n", licznik);
}
}

if(ah->arp_spa == 4194304) // I mean Mobile Node's IP here. Not very
elegant way to do it
{
if(licznik2 < 10)
{
nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
IP addr
nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
arptable_->arprequest(src_arp, dst_arp, this);

licznik2++;
//printf(" src_arp %d\n", src_arp);
//printf(" dst_arp %d\n", dst_arp);
//printf("arprequest %d\n", licznik);
}
}

if(ah->arp_spa == 8388608) // I mean Mobile Node's IP here. Not very
elegant way to do it
{
if(licznik3 < 10)
{
nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
IP addr
nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
arptable_->arprequest(src_arp, dst_arp, this);

licznik3++;
//printf(" src_arp %d\n", src_arp);
//printf(" dst_arp %d\n", dst_arp);
//printf("arprequest %d\n", licznik);
}
}


arptable_->arpinput(p, this);
//printf("arpinput %d\n", licznik);
}
else
{

if((miph->type_ == MIPT_REG_REQUEST) || (miph->type_ == MIPT_REG_REPLY) ||
(miph->type_ == MIPT_SOL)) //in FA
{
nsaddr_t src = arptable_->get_node_michu()->address(); // this host's IP
addr
nsaddr_t dst = miph->ha_;   //Home Address of Mobile Node
arptable_->arprequest(src, dst, this);

//uptarget_ ? sendUp(p) : drop(p);
//printf(" src %d\n", src);
//printf(" dst %d\n", dst);
//printf("uptarget_ MIPT_REG_REQUEST\n");

}


uptarget_ ? sendUp(p) : drop(p);
//printf("uptarget_\n");

}
return;
}


if((miph->type_) == MIPT_REG_REQUEST)
{
//double local_time = Scheduler::instance().clock();
//printf(" local_time MIPT_REG_REQUEST %.9f\n", local_time);

// printf("MIPT_REG_REQUEST %d \n",
arptable_->get_node_michu()->address());
nsaddr_t src_down = 4194305;
//arptable_->get_node_michu()->address(); // this host's IP addr
nsaddr_t dst_down = miph->coa_;//miph->coa_;
arptable_->arprequest(src_down, dst_down, this);
}
else if((miph->type_) == MIPT_ADS)
{
//double local_time = Scheduler::instance().clock();
//printf(" local_time MIPT_REG_REQUEST %.9f\n", local_time);

nsaddr_t src_down = 4194305;
//arptable_->get_node_michu()->address(); // this host's IP addr
nsaddr_t dst_down = miph->coa_;
arptable_->arprequest(src_down, dst_down, this);
}

_/*
nsaddr_t src_down = 4194305;
nsaddr_t dst_down = 8388608;
arptable_->arprequest(src_down, dst_down, this);

nsaddr_t src_down = 8388608;
nsaddr_t dst_down = 4194305;
arptable_->arprequest(src_down, dst_down, this);

nsaddr_t src_down = 8388608;
nsaddr_t dst_down = 4194304;
arptable_->arprequest(src_down, dst_down, this);
*/


double local_time = Scheduler::instance().clock();
if(local_time < 13)
{
printf(" time %.9f node %d packet %s\n", local_time,
arptable_->get_node_michu()->address(), packet_info.name(ch->ptype()));
}


ch->direction() = hdr_cmn::DOWN;
sendDown(p);
}



-
New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.


Re: [ns] MIP Handover and ARP in ns-2.28

2007-04-26 Thread Youngmin Kim

Hello.
This is some different story..
After I changed routing protocol from DSDV to AODV, I experienced zero
handover time..
I hope this helps you..

2006/5/23, altaf hussain <[EMAIL PROTECTED]>:
>
> Hi Users. I hope al of u would be OK. I have been working on Mobile IP v4 
> implemented in ns-2.28. There is a bug in the implementation of Mobile IP in 
> ns2 and that have been reported by Michal in AUGUST 2005.
>   The modifications indicated by Michal are infact confusing me.
>   The function to get the current mobile node  get_node_michu() is giving 
> problems while compiling.
>   I am posting the modificatins done by Michal. Can any one really give me a 
> better and working modification in ns-2.28
>   Thanks
>
>   Michal
>
> PS. Below there is ll:recv() function with my modifications.
>
> _/*
> This shall be added in arp.cc
> MobileNode*
> ARPTable::get_node_michu()
> {
> return node_;
> }
> */
>
> void LL::recv(Packet* p, Handler* _/*h*/)
> {
> hdr_cmn *ch = HDR_CMN(p);
> hdr_arp *ah = HDR_ARP(p);
> hdr_mip *miph = hdr_mip::access(p);
> hdr_ip *ip_h = hdr_ip::access(p);
>
>
>
> //char *mh = (char*) HDR_MAC(p);
> //struct hdr_sr *hsr = HDR_SR(p);
>
> _/*
> * Sanity Check
> */
> assert(initialized());
>
> //if(p->incoming) {
> //p->incoming = 0;
> //}
> // X 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 direction = UP, then pass it up the stack
> // Otherwise, set direction to DOWN and pass it down the stack
> if(ch->direction() == hdr_cmn::UP) {
> //if(mac_->hdr_type(mh) == ETHERTYPE_ARP)
> if(ch->ptype_ == PT_ARP){
>
>
> if(ah->arp_spa == 4194305) // I mean Mobile Node's IP here. Not very
> elegant way to do it
> {
> if(licznik < 10)
> {
> nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
> IP addr
> nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
> arptable_->arprequest(src_arp, dst_arp, this);
>
> licznik++;
> //printf(" src_arp %d\n", src_arp);
> //printf(" dst_arp %d\n", dst_arp);
> //printf("arprequest %d\n", licznik);
> }
> }
>
> if(ah->arp_spa == 4194304) // I mean Mobile Node's IP here. Not very
> elegant way to do it
> {
> if(licznik2 < 10)
> {
> nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
> IP addr
> nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
> arptable_->arprequest(src_arp, dst_arp, this);
>
> licznik2++;
> //printf(" src_arp %d\n", src_arp);
> //printf(" dst_arp %d\n", dst_arp);
> //printf("arprequest %d\n", licznik);
> }
> }
>
> if(ah->arp_spa == 8388608) // I mean Mobile Node's IP here. Not very
> elegant way to do it
> {
> if(licznik3 < 10)
> {
> nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
> IP addr
> nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
> arptable_->arprequest(src_arp, dst_arp, this);
>
> licznik3++;
> //printf(" src_arp %d\n", src_arp);
> //printf(" dst_arp %d\n", dst_arp);
> //printf("arprequest %d\n", licznik);
> }
> }
>
>
> arptable_->arpinput(p, this);
> //printf("arpinput %d\n", licznik);
> }
> else
> {
>
> if((miph->type_ == MIPT_REG_REQUEST) || (miph->type_ == MIPT_REG_REPLY) ||
> (miph->type_ == MIPT_SOL)) //in FA
> {
> nsaddr_t src = arptable_->get_node_michu()->address(); // this host's IP
> addr
> nsaddr_t dst = miph->ha_;   //Home Address of Mobile Node
> arptable_->arprequest(src, dst, this);
>
> //uptarget_ ? sendUp(p) : drop(p);
> //printf(" src %d\n", src);
> //printf(" dst %d\n", dst);
> //printf("uptarget_ MIPT_REG_REQUEST\n");
>
> }
>
>
> uptarget_ ? sendUp(p) : drop(p);
> //printf("uptarget_\n");
>
> }
> return;
> }
>
>
> if((miph->type_) == MIPT_REG_REQUEST)
> {
> //double local_time = Scheduler::instance().clock();
> //printf(" local_time MIPT_REG_REQUEST %.9f\n", local_time);
>
> // printf("MIPT_REG_REQUEST %d \n",
> arptable_->get_node_michu()->address());
> nsaddr_t src_down = 4194305;
> //arptable_->get_node_michu()->address(); // this host's IP addr
> nsaddr_t dst_down = miph->coa_;//miph->coa_;
> arptable_->arprequest(src_down, dst_down, this);
> }
> else if((miph->type_) == MIPT_ADS)
> {
> //double local_time = Scheduler::instance().clock();
> //printf(" local_time MIPT_REG_REQUEST %.9f\n", local_time);
>
> nsaddr_t src_down = 4194305;
> //arptable_->get_node_michu()->address(); // this host's IP addr
> nsaddr_t dst_down = miph->coa_;
> arptable_->arprequest(src_down, dst_down, this);
> }
>
> _/*
> nsaddr_t src_down = 4194305;
> nsaddr_t dst_down = 8388608;
> arptable_->arprequest(src_down, dst_down, this);
>
> nsaddr_t src_down = 8388608;
> nsaddr_t dst_down = 4194305;
> arptable_->arprequest(src_down, dst_down, this);
>
> nsaddr_t src_down = 8388608;
> nsaddr_t dst_down = 4194304;
> arptable_->arprequest(src_down, dst_down, this);
> */
>
>
> double local_time = Scheduler::instance().clock();
> if(local_time < 13)
> {
> printf(" time %

Re: [ns] MIP Handover and ARP in ns-2.28

2007-04-27 Thread Youngmin Kim

I'm sorry...
You can get zero handover time only when wired node sends udp traffic
to wireless node..

2007/4/27, Youngmin Kim <[EMAIL PROTECTED]>:
> Hello.
> This is some different story..
> After I changed routing protocol from DSDV to AODV, I experienced zero
> handover time..
> I hope this helps you..
>
> 2006/5/23, altaf hussain <[EMAIL PROTECTED]>:
> >
> > Hi Users. I hope al of u would be OK. I have been working on Mobile IP v4 
> > implemented in ns-2.28. There is a bug in the implementation of Mobile IP 
> > in ns2 and that have been reported by Michal in AUGUST 2005.
> >   The modifications indicated by Michal are infact confusing me.
> >   The function to get the current mobile node  get_node_michu() is giving 
> > problems while compiling.
> >   I am posting the modificatins done by Michal. Can any one really give me 
> > a better and working modification in ns-2.28
> >   Thanks
> >
> >   Michal
> >
> > PS. Below there is ll:recv() function with my modifications.
> >
> > _/*
> > This shall be added in arp.cc
> > MobileNode*
> > ARPTable::get_node_michu()
> > {
> > return node_;
> > }
> > */
> >
> > void LL::recv(Packet* p, Handler* _/*h*/)
> > {
> > hdr_cmn *ch = HDR_CMN(p);
> > hdr_arp *ah = HDR_ARP(p);
> > hdr_mip *miph = hdr_mip::access(p);
> > hdr_ip *ip_h = hdr_ip::access(p);
> >
> >
> >
> > //char *mh = (char*) HDR_MAC(p);
> > //struct hdr_sr *hsr = HDR_SR(p);
> >
> > _/*
> > * Sanity Check
> > */
> > assert(initialized());
> >
> > //if(p->incoming) {
> > //p->incoming = 0;
> > //}
> > // X 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 direction = UP, then pass it up the stack
> > // Otherwise, set direction to DOWN and pass it down the stack
> > if(ch->direction() == hdr_cmn::UP) {
> > //if(mac_->hdr_type(mh) == ETHERTYPE_ARP)
> > if(ch->ptype_ == PT_ARP){
> >
> >
> > if(ah->arp_spa == 4194305) // I mean Mobile Node's IP here. Not very
> > elegant way to do it
> > {
> > if(licznik < 10)
> > {
> > nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
> > IP addr
> > nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
> > arptable_->arprequest(src_arp, dst_arp, this);
> >
> > licznik++;
> > //printf(" src_arp %d\n", src_arp);
> > //printf(" dst_arp %d\n", dst_arp);
> > //printf("arprequest %d\n", licznik);
> > }
> > }
> >
> > if(ah->arp_spa == 4194304) // I mean Mobile Node's IP here. Not very
> > elegant way to do it
> > {
> > if(licznik2 < 10)
> > {
> > nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
> > IP addr
> > nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
> > arptable_->arprequest(src_arp, dst_arp, this);
> >
> > licznik2++;
> > //printf(" src_arp %d\n", src_arp);
> > //printf(" dst_arp %d\n", dst_arp);
> > //printf("arprequest %d\n", licznik);
> > }
> > }
> >
> > if(ah->arp_spa == 8388608) // I mean Mobile Node's IP here. Not very
> > elegant way to do it
> > {
> > if(licznik3 < 10)
> > {
> > nsaddr_t src_arp = arptable_->get_node_michu()->address(); // this host's
> > IP addr
> > nsaddr_t dst_arp = miph->ha_;   //Home Address of Mobile Node
> > arptable_->arprequest(src_arp, dst_arp, this);
> >
> > licznik3++;
> > //printf(" src_arp %d\n", src_arp);
> > //printf(" dst_arp %d\n", dst_arp);
> > //printf("arprequest %d\n", licznik);
> > }
> > }
> >
> >
> > arptable_->arpinput(p, this);
> > //printf("arpinput %d\n", licznik);
> > }
> > else
> > {
> >
> > if((miph->type_ == MIPT_REG_REQUEST) || (miph->type_ == MIPT_REG_REPLY) ||
> > (miph->type_ == MIPT_SOL)) //in FA
> > {
> > nsaddr_t src = arptable_->get_node_michu()->address(); // this host's IP
> > addr
> > nsaddr_t dst = miph->ha_;   //Home Address of Mobile Node
> > arptable_->arprequest(src, dst, this);
> >
> > //uptarget_ ? sendUp(p) : drop(p);
> > //printf(" src %d\n", src);
> > //printf(" dst %d\n", dst);
> > //printf("uptarget_ MIPT_REG_REQUEST\n");
> >
> > }
> >
> >
> > uptarget_ ? sendUp(p) : drop(p);
> > //printf("uptarget_\n");
> >
> > }
> > return;
> > }
> >
> >
> > if((miph->type_) == MIPT_REG_REQUEST)
> > {
> > //double local_time = Scheduler::instance().clock();
> > //printf(" local_time MIPT_REG_REQUEST %.9f\n", local_time);
> >
> > // printf("MIPT_REG_REQUEST %d \n",
> > arptable_->get_node_michu()->address());
> > nsaddr_t src_down = 4194305;
> > //arptable_->get_node_michu()->address(); // this host's IP addr
> > nsaddr_t dst_down = miph->coa_;//miph->coa_;
> > arptable_->arprequest(src_down, dst_down, this);
> > }
> > else if((miph->type_) == MIPT_ADS)
> > {
> > //double local_time = Scheduler::instance().clock();
> > //printf(" local_time MIPT_REG_REQUEST %.9f\n", local_time);
> >
> > nsaddr_t src_down = 4194305;
> > //arptable_->get_node_michu()->address(); // this host's IP addr
> > nsaddr_t dst_down = miph->coa_;
> > arptable_->arprequest(src_down,