PDUs contain SNMP requests or responses. A client application will send a PDU to the SNMP server, and then the server replies with another PDU.
In a typical GET scenario, a request PDU will contain one or more SNMP OIDs with a NULL value placeholder. The SNMP server then sends back a PDU filled out with the appropriate values for each OID in the original request.
The C++ PDU class is a wrapper for the netsnmp_pdu structure. With the class, you can easily add [OID], or read back the value the server provided in the response.
Note that PDUs don't automatically send themselves to the server. A PDU is basically a list of OIDs. Once you create a request PDU, you must combine a [SessionHandle] and the PDU in a call such as SNMPpp::get(...) to have the SNMP server reply.
For example:
SNMPpp::PDU pdu( SNMPpp::PDU::kGet );
pdu.addNullVar( "1.3.6.1.2.1.1.1.0" );
pdu.addNullVar( "1.3.6.1.2.1.1.2.0" );
// this will free up the request PDU and return a new result PDU
pdu = SNMPpp::get( handle, pdu );
Wiki: Get
Wiki: Home
Wiki: OID
Wiki: Sending SNMPv2 traps
Wiki: SessionHandle