[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] New beacon detection in MobileIP



Hi,

            I am trying to run some MobileIP simulations using ns-2.1b7 and 
detect when the mobile node starts receiving beacons from a new base station.

            I think that a new beacon could be detected by adding the 
following line to the recv() method in mip-reg.cc within the case MIPT_ADS

            if (coa_ != miph->coa_) { //if this is a beacon after a handoff
            printf("A NEW BEACON was received at MHAgent indicating handoff at 
time %f and the ChangedBS is %d\n",
            Scheduler::instance().clock(), ChangedBS); }


            The portion of code where I added this line is:
            case MIPT_ADS:
            {
            AgentList **ppagts = &agts_, *ptr;


            while (*ppagts) {
            if ((*ppagts)->node_ == miph->coa_) break;
            ppagts = &(*ppagts)->next_;
            }
            if (*ppagts) {
            ptr = *ppagts;
            *ppagts = ptr->next_;
            ptr->expire_time_ = beacon_ +
            Scheduler::instance().clock();
            ptr->lifetime_ = miph->lifetime_;
            ptr->next_ = agts_;
            agts_ = ptr;
            if (coa_ == miph->coa_) {
            seqno_++;
            reg();
            }
            }
            else { // new ads
            ptr = new AgentList;
            ptr->node_ = miph->coa_;
            ptr->expire_time_ = beacon_ +
            Scheduler::instance().clock();
            ptr->lifetime_ = miph->lifetime_;
            ptr->next_ = agts_;
            agts_ = ptr;

            //gmc50 addition:=========================================
            if (coa_ != miph->coa_) { //if this is a beacon after a handoff 
then set ChangedBS
            //to true so that when the registration reply arrives I can send
            //the saved acks and the connection should be up again .
            ChangedBS = 1;
            printf("A NEW BEACON was received at MHAgent at time %f and the 
ChangedBS is %d\n",
            Scheduler::instance().clock(), ChangedBS);
            }
            //end of changes=========================================

            coa_ = miph->coa_;


            I would expect to see the message saying that a new beacon was 
received at MHAgent only when the mobile enters a new base station. However, I 
get this message
            approximately every beacon period (even before the mobile changes 
base stations). Does anyone have any ideas as to why this is happening or how 
I can detect the
            reception of beacons from a new base station?

            Any comments or ideas would be very appreciated. Thanks,

            Gustavo.