accessing handlers
Will Stockwell
bigwill at mit.edu
Tue May 6 12:54:11 EDT 2003
Whoops, scratch that. One of my message() calls was erroneous. It should
read errh->message("%s", str.cc()). This now shows me the correctly value
in str to be parsed. However, it does not change the fact that
cp_unsigned_real10() is not correctly parsing. rate and frac are defined
as unsigned integers previously to this code.
Will
On Tue, 6 May 2003, Will Stockwell wrote:
> I've got a bit of code that's going through a vector of Counter elements,
> attempting to read their 'rate' handlers:
>
> for(int i = 0; i < _elements.size(); i++) {
> e = _elements[i];
> const Router::Handler *rh = Router::handler(e, String("rate"));
> str = rh->call_read(e);
> cp_unsigned_real10(str, 3, &rate, &frac);
> errh->message("%s", str);
> errh->message("output %d rate %d", i, rate);
>
> if(rate < minRate) {
> minRate = rate;
> eoutput = i;
> }
> }
>
>
> Things weren't working right, so I adding the messages you see above to
> debug and discovered values along the lines of:
>
> chatter: <garbage>
> chatter: output 0 rate -1492252910
> chatter: <garbage>
> chatter: output 1 rate -1492252910
> chatter: chose output 0 rate -1492252910
>
>
> The value stored in str indeed is not the appropriate output from the
> handler and leads to inappropriate numerical values. What about my
> attempt to read the 'rate' handler is failing or incorrect?
>
>
> Thanks,
>
> Will
>
>
>
More information about the click
mailing list