[AGENT++] How to get PDU type

Jochen Katz katz at agentpp.com
Thu Oct 14 21:31:47 CEST 2010


Hi,

> I working on SNMP implementation from Manager side(SNMP++).  How to 
> get the PDU type from SNMP Server Agent For example: I have sent a 
> couple of requests(get, get-next, set, get_bulk) from SNMP++ and I 
> have received a ResponsePDU from AGent side, Now I want to know
> whether the PDU type is for get or get-next or set.
> 
> So how to get the PDU type of the Server Agent in my SNMP Manager 
> client.

the function is Pdu::get_type(), but you cannot distinguish, if the
response is for a get, get-next, set or get_bulk, because the agent
returns a reponse pdu for all these requests.

I don't know, what you are trying to do, but if you use async requests,
you can use the callback_data to map the response to your request.

Regards,
  Jochen

//--------------[ different types of PDU's ]--------------------
/** @name Pdu types */
#define sNMP_PDU_GET	    (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x0)
#define sNMP_PDU_GETNEXT    (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x1)
#define sNMP_PDU_RESPONSE   (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x2)
#define sNMP_PDU_SET	    (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x3)
#define sNMP_PDU_V1TRAP     (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x4)
#define sNMP_PDU_GETBULK    (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x5)
#define sNMP_PDU_INFORM     (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x6)
#define sNMP_PDU_TRAP       (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x7)
#define sNMP_PDU_REPORT     (aSN_CONTEXT | aSN_CONSTRUCTOR | 0x8)



More information about the AGENTPP mailing list