[AGENT++] reporting an error from MibTable::update(Request*)

Razvan Cojocaru razvan.cojocaru at kaspersky.ro
Thu Mar 15 11:09:56 CET 2007


Hello.

For MibLeaves, I employ the following strategy for reporting an error if
I cannot retrieve the value associated with the OID:

void get_request(Request* req, int ind)
{
	try {
		*((SNMPTYPE *)value) = get_value_from_socket();
	} catch(... /* socket exceptions */) {
		req->set_error_index(ind);
		req->set_error_status(SNMP_ERROR_RESOURCE_UNAVAIL);
	}
	MibLeaf::get_request(req, ind);
}

Does that look about right? But for MibTable::update(Request *req), I
don't have an index parameter. Since I'm constructing dynamic tables, I
have to report an error for the same case as the MibLeaf above (socket
errors, and so on). How then do I properly report an error from
MibTable::update(Request* req)? Is it enough to just do
req->set_error_status(SNMP_ERROR_RESOURCE_UNAVAIL), or do I also have to
do req->set_error_index(1) or something similar?

Thanks.


-- 
Razvan Cojocaru
KeyID: 1024D/04CA34DE




More information about the AGENTPP mailing list