[AGENT++] reporting an error from MyLeaf::get_request()

Jochen Katz katz at agentpp.com
Thu Mar 8 22:55:38 CET 2007


Hello,

> How do I report an error from a class derived from MibLeaf, in it's
> implementation of get_request()?

just look at the source of MibLeaf::get_request:

void MibLeaf::get_request(Request* req, int ind)
{
        if (get_access() >= READONLY) {
                if ((my_table) && (valid() == 0)) {
                        Vbx vb(req->get_oid(ind));
                        vb.set_syntax(sNMP_SYNTAX_NOSUCHINSTANCE);
                        req->finish(ind, vb);
                }
                else {
                        req->finish(ind, get_value());
                }
        }
        else {
            req->error(ind, SNMP_ERROR_NO_ACCESS);
        }
}

Possibly the only appropriate error value for your code sample is
SNMP_ERROR_RESOURCE_UNAVAIL.

Regards,
  Jochen



More information about the AGENTPP mailing list