[Click] Rated Unqueue element

I.E.Pearce-02@student.lboro.ac.uk I.E.Pearce-02 at student.lboro.ac.uk
Wed Mar 29 09:00:19 EST 2006



Hi,

Thanks for the help, I am very new to click and programming in general.I
have tried implementing the code you suggested but am receiving the
following error;

tosunqueue.cc:76: error: `ComparePackets' undeclared (first use this
function)
tosunqueue.cc:76: error: (Each undeclared identifier is reported only once
for
   each function it appears in.)
tosunqueue.cc:76: error: parse error before string constant
tosunqueue.cc:79: error: `what_you_want' undeclared (first use this
function)
tosunqueue.cc:79: warning: unused variable `String rate_str'

also I am not sure what you mean by the what_you_want field and where it
should be declared. I have left it with this name so you can associate with
it.

It may help if I told you exactly what I am trying to do. I am investigating
AQM for priority based flows. I have written an element that sets the TOS
field in the IP Header and I am using this to differentiate between flows
with values between 0-255, 255 being the highest priority. The element I am
trying to create is based on the RatedUnqueue element. But I want my element
to calculate the rate at which it should pull packets from the queue by
using the TOS value of that flow to calculate a percentage of the max rate
which is the parameter passed to the element at configuration. I need to
calcualte the pull rate before the packets are pulled from the queue so
that is why I want to use handlers to read the TOS value of the flows from
the ComparePackets element and use this to calculate the rate at which to
pull the packets from the upstream queue, I am not sure this is the best way
to do it though. Do you know how exactly the
_rate.set_rate(r, errh);
line works in the RatedUnqueue element and can it be used outside of the
configuration function. As I would like to use the read handlers to read in
the TOS value of the flow, use this to calcuate the percentage of max rate
for that flow and then use _rate.set_rate. At moment I am not sure how to
do this as it seems this function must be used in the configuration stage.

Sorry about the long question. But I have been playing around with this for
ages with no luck and need to get it done quite urgently.

Any help would be greatly appreciated.

Thanks in advance



Quoting Eddie Kohler <kohler at cs.ucla.edu>:

> Hi,
>
> > String rate_str = HandlerCall::call_read(Element
> *ComparePackets,"diffs",
> > errh);
>
> This is not correct C++ code.  You are mixing declaration syntax and
> normal code.
>
> If you really want to look for an upstream ComparePackets element, take a
> look
> at the elements/aqm/red.cc element's initialize() mehtod.  You will want
> to
> call something like:
>
> #include <click/elemfilter.hh>
>
> ...
>
>    CastElementFilter filter("ComparePackets");
>    Vector<Element *> results;
>    int ok = router()->upstream_elements(this, 0, &filter, results);
>    if (ok < 0)
>       /* return error */;
>    filter.filter(results);
>    if (results.size() != 1)
>       /* return error */;
>    ComparePackets *what_you_want = (ComparePackets *) results[0];
>
>    // now call the handler
>    String rate_str = HandlerCall::call_read(what_you_want, "diffs",
> errh);
>
> But the other approach, of requiring the user to name the element, works
> too.
>
> Another potential issue: You cannot call handlers in the configure()
> method;
> they don't exist yet.  Call them in the initialize() method at the
> earliest.
>
> Eddie
>
>
> > unsigned different;
> > (void) cp_unsigned(cp_uncomment(rate_str), &different);
> >
> > .....
> >
> > I have put this code in the configure part of my element. However I
> keep
> > recieving the below error when tryin to compile the element.
> >
> >
> > tosunqueue.cc: In member function `virtual int
> >    TOSUnqueue::configure(Vector<String>&, ErrorHandler*)':
> > tosunqueue.cc:51: error: parse error before `*' token
> > make: *** [tosunqueue.uo] Error 1
> >
> > Can anyone help me with this error?
> >
> > It is quite urgent i get this working as quickly as possibe so a quick
> > response would be greatly appreciated.
> >
> > Thanks
> >
> >


More information about the click mailing list