Dear ns-users; I use ns-allinone-2.29 under cygwin/winXP.
I faced the following problem after changing the MAC in ns2.29. during the simulation I got the follwoing Error: Scheduler: Event UID not valid! the code is here ( I made the changes just in the recv() function): void Mac::recv(Packet* p, Handler* h) { printf(" \n Now you are in Mac layer"); int i; int k; int r; int errcount; int recR; //===================start=============================== BiLaL if (hdr_cmn::access(p)->direction() == hdr_cmn::UP) { if (hdr_mac::access(p)-> ftype() == MF_FEC_R) { Red_= hdr_mac::access(p)->Red(); drop(p); printf(" \n Redundancy is CHANGED"); return; } if (hdr_cmn::access(p)->size()%framesize_ != 0) k=1; else k=0; k +=(hdr_cmn::access(p)->size()+ Red_)/framesize_ ; for (i=0;i<= k; i++) { r=(rand()%100); if (r >= p_) errcount++; } if (errcount > Red_) { drop(p);//Packet::free(p); //discard the received packet printf("\n one packet has been lost"); Packet *p = Packet::alloc(); hdr_cmn* ch = HDR_CMN(p); hdr_mac* mhr = HDR_MAC(p); mhr->ftype()=MF_FEC_R; ch->uid() = 0; ch->ptype() = PT_MAC; ch->iface() = -2; ch->error() = 0; ch->size()=64; ch->direction() = hdr_cmn::DOWN; // *********** changing the Redundancy strategy mhr-> Red()= errcount; callback_=h; mhr->set(MF_FEC_R, index_); state(MAC_SEND); printf("\n telling the sender by new R"); sendDown(p); } else { // the Redundant Data must be removed hdr_mac* mhr = HDR_MAC(p); recR = mhr-> Red(); hdr_cmn::access(p)->size()-= recR; //===================END=============================== BiLaL sendUp(p); } return; } callback_ = h; hdr_mac* mh = HDR_MAC(p); mh->set(MF_DATA, index_); state(MAC_SEND); //=======================================================FEC (Redundancy) BiLaL printf("\n Here we adding the R to TCP packet"); hdr_cmn* ch = HDR_CMN(p); ch->size() += Red_; //======================================================== sendDown(p); the problem stop inside the sendDown() function and the problem as I told you first: Scheduler: Event UID not valid! I look forward to your help as soon as possible. thank you in advance Kind Regards