accessing handlers

Will Stockwell bigwill at mit.edu
Tue May 6 01:37:14 EDT 2003


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