Dangerous SNMP
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
PDU Class Reference

A PDU represents an SNMP Protocol Data Unit (PDU). More...

#include <pdu.hpp>

Public Member Functions

 PDU ()
 Default constructor. More...
 
 PDU (const PDU &pdu)
 Copy constructor. More...
 
 ~PDU ()
 Destructor.
 
void addOid (const NumericOid &oid)
 This adds a new VarBind to the PDU (with a null value). More...
 
bool containsOid (const NumericOid &oid)
 This checks to see if the PDU contains the given OID. More...
 

Static Public Member Functions

static const char * errorName (int errorStatus)
 This returns a pointer to a statically allocated string that contains the standard name for the error status given. More...
 

Public Attributes

int requestId
 This is the RequestID for the PDU. More...
 
int errorStatus
 This is the ErrorStatus for the PDU. More...
 
int errorIndex
 This is the ErrorIndex for the PDU. More...
 
VarBindList varbinds
 This is the list of VarBinds in the PDU.
 

Detailed Description

A PDU represents an SNMP Protocol Data Unit (PDU).

The SNMP PDU was introduced in RFC 1157 (see Section 4, Protocol Specification).

An SNMP PDU is intended to be the basic input and output data structure for SNMP.

Constructor & Destructor Documentation

PDU ( )

Default constructor.

This creates a PDU with no VarBinds.

PDU ( const PDU pdu)

Copy constructor.

This creates a PDU that is an exact copy of the specified PDU.

Parameters
pduThe PDU to copy.

Member Function Documentation

void addOid ( const NumericOid oid)

This adds a new VarBind to the PDU (with a null value).

Parameters
oidThe OID to add.
bool containsOid ( const NumericOid oid)

This checks to see if the PDU contains the given OID.

Parameters
oidThe OID to look for.
Returns
true if it is present, false if it is not.
static const char* errorName ( int  errorStatus)
static

This returns a pointer to a statically allocated string that contains the standard name for the error status given.

Parameters
errorStatusThe error status value.
Returns
A pointer to the name of the value.

Member Data Documentation

int errorIndex

This is the ErrorIndex for the PDU.

This was originally intended to communicate the index of the VarBind that caused the error. However, when there are multiple VarBinds, there could be multiple VarBinds with errors. For SNMPv2c and higher Get requests, the errors are encoded at the VarBind level, so this is not used. However, this is still valid for Set requests.

int errorStatus

This is the ErrorStatus for the PDU.

This was originally intended to communicate whether or not there was a major error with the request. However, for SNMPv2c and higher, Get requests encode the error at the VarBind level. However, this is still valid for Set requests.

int requestId

This is the RequestID for the PDU.

According to RFC 1157,

RequestIDs are used to distinguish among outstanding requests. By use of the RequestID, an SNMP application entity can correlate incoming responses with outstanding requests. In cases where an unreliable datagram service is being used, the RequestID also provides a simple means of identifying messages duplicated by the network.


The documentation for this class was generated from the following file: