[AGENT++] Unexpected request type for SNMP set

Jochen Katz katz at agentpp.com
Thu Apr 28 19:16:56 CEST 2005


Hi,

> I'm trying to detect a request type of sNMP_PDU_SET in my process request loop
> so that I can save off the persistent mibs if there is a set operation.  When I
> do a set operation from the snmp client though, the req->get_type() is
> sNMP_PDU_RESPONSE instead of sNMP_PDU_SET.  Am I doing something wrong here?

without looking at the agent++ code: The process_request() function
changes the request type before answering the request, so check the type
before calling process_request().

Request* req = reqList->receive(0);
if ( req )
{
     bool save = false;
     if ( req->get_type() == sNMP_PDU_SET )
         save = true;
     mib->process_request(req);
     if (save)
         mib->save_all();
 }

Regards,
  Jochen



More information about the AGENTPP mailing list