[Click] newbie click programming question

Tomas Mahoney tomasmahoney at yahoo.com
Tue Sep 20 22:23:05 EDT 2005


oops sorry - i meant (!p) does NOT seem to be doing
the job...

i check for (!p) before pulling a packet but it still
seg faults every now and then presumably when the
queue goes empty.

thanks
tomas


--- Tomas Mahoney <tomasmahoney at yahoo.com> wrote:

> hi beyers - thanks for the response.
>  
> head() is simply inheriuted from simplequeue also.
> it turns out that with
> p = head() 
> if we print p then it always shows the same value.
> so it appears that (!p) does seem to be doing the
> job. 
> thanks
> harry
>  
> 
> 
> Beyers Cronje <bcronje at gmail.com> wrote: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 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 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 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
> >
> _______________________________________________
> 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 
> _______________________________________________
> 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