First of all; thank you (*Mo Li* )for your response.


As you see in my code; that i create new packet in [void Mac::recv(Packet*
p, Handler* h)], which is sent down by using sendDown() function.

after debugging: the problem is stopped inside sendDown():



if(!abstract_)
  s.schedule(&hRes_, &intr_, txt);



when I tracked the code inside the scheduler.cc; the progressing stops in:



Scheduler::schedule(Handler* h, Event* e, double delay)

.

.

.

.

if (e->uid_ > 0) {
  printf("Scheduler: Event UID not valid!\n\n");
  abort();

}

.

.

Thus, can you tell me how can I create new packet inside MAC layer with new
valid Event UID.

your help is highly appreciated

Kind Regards



On 8/22/06, Mo Li <[EMAIL PROTECTED]> wrote:
>
> Bilal AbuQadous wrote:
> > 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
> >
> One possible reason to the "Event UID not valid!" problem is that the
> event has been scheduled twice. You can print the relevant event in the
> scheduler.cc, and see if that helps.
>
> Kind Regards,
> Mo
>

Reply via email to