Use:

If( ((LL *)uptarget_)->ifq()){
        //code if non-null
} else {
        // code if null
}

note that a null queue é a node without a queue, NOT an empty queue!


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of M. Shen
> Sent: quarta-feira, 6 de Dezembro de 2006 14:56
> To: ghada; ns-users@ISI.EDU
> Subject: Re: [ns] accessing queue length in 802.11 MAC
> 
> 
> Dear ghada,
> 
> Thank you very much for your reply. But how to check if the queue is
> null or not? Should I do it in the queue.cc peoriodically and transfer
> the state to mac? Or check it in the MAC? If it's the latter, we still
> need to access ifq() in the mac.cc, right?
> 
> thanks,
> Min
> 
> 
> On Wed, 6 Dec 2006 14:03:15 +0900
>  "ghada" <[EMAIL PROTECTED]> wrote:
> >
> >  I think you can solve this problem if you check first  if the queue
> > is null
> > or not before using length() function.
> >
> >
> > ----- Original Message ----- From: "M. Shen" <[EMAIL PROTECTED]>
> > To: <ns-users@ISI.EDU>
> > Sent: Wednesday, December 06, 2006 12:10 PM
> > Subject: Re: [ns] accessing queue length in 802.11 MAC
> >
> >
> > >
> > > Dear guys,
> > >
> > > I tried to access queue length in MAC. So I wrote
> > > int pkt_num = ((LL *)uptarget_)->ifq()->length();
> > >
> > > When I run the simulation us gdb, segmentation fault occurs. I
> > shows
> > > that
> > >
> > > Program received signal SIGSEGV, Segmentation fault.
> > > 0x080c3ad4 in Queue::length() (this=0x0) at queue/queue.h:136
> > > 136 int length() { return pq_->length(); }  /* number of pkts
> > currently
> > > in
> > >
> > > Does any one know how to deal with this problem?
> > >
> > > Thank you very much,
> > > Min
> > >
> > >
> >


Reply via email to