[Click] newbie click programming question

Beyers Cronje bcronje at gmail.com
Mon Sep 19 08:06:10 EDT 2005


Hi Harry,

Looking at SimpleQueue::deq() , if the Queue is empty NULL is returned, else 
a pointer to a valid packet descriptor is returned. I'm not sure how you 
implemented your head() function, but it should function similar as 
SimpleQueue::deq().

So the following should work:

p = head();
if (!p) // Null packet descriptor
return EMPTY_QUEUE;

// Valid packet descriptor
......

Beyers

On 9/19/05, Harry Lasas <lasasffl at yahoo.com> wrote:
> 
> Hi Beyers and All:
> 
> Thanks for your reply.
> 
> How to check for a valid packet after calling head()?
> 
> if(*p)
> 
> does not seem to work (Packet to bool)...
> 
> Any input will help greatly.
> Thank you.
> Harry
> 
> 
> 
> --- Beyers Cronje <bcronje at gmail.com> wrote:
> 
> > Harry,
> >
> > Are you sure you are not working on an empty queue ?
> > Ie you are not checking
> > for a valid packet after calling head().
> >
> > Beyers
> >
> > On 9/12/05, Harry Lasas <lasasffl at yahoo.com> wrote:
> > >
> > > I briefly RTFM and now tried something that
> > doesn't
> > > work.
> > >
> > > I am just trying to set up WTP algorithm on Click
> > and
> > > need the waiting time of the packet at the head of
> > a
> > > queue for that. I understand I can simply set
> > packet
> > > timestamp annotation in the Click config file and
> > then
> > > try to do some (* gasp *:) arithmetic on that to
> > get
> > > the waiting time.
> > >
> > > I created a queue that inherits from simplequeue
> > and
> > > am trying to access the timestamp of the head
> > packet
> > > with something like
> > >
> > > Packet * p = head();
> > > currentTime = p->timestamp_anno();
> > >
> > > But it keeps seg faulting. Any idea why? Is there
> > a
> > > better way to do what I am trying? Thank you.
> > >
> > >
> > > Harry Lasas
> > >
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam? Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > > _______________________________________________
> > > click mailing list
> > > click at amsterdam.lcs.mit.edu
> > >
> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> > >
> >
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


More information about the click mailing list