#include “snmp_pp.h”
#define SYSDESCR “1.3.6.1.2.1.1.1.0” // Object ID for System Descriptor
void get_system_descriptor()
{
int status; // return status
CTarget ctarget( (IpAddress) “10.4.8.5”);// SNMP++ v1 target
Vb vb( SYSDESCR); // SNMP++ Variable Binding
Pdu pdu; // SNMP++ PDU
//-------[ Construct a SNMP++ SNMP Object ]---------------------------
Snmp snmp( status); // Create a SNMP++ session
if ( status != SNMP_CLASS_SUCCESS)
{ // check creation status
cout << snmp.error_msg( status); // if fail, print error string
return;
}
//-------[ Invoke a SNMP++ Get ]---------------------------------------
pdu += vb; // add the variable binding
if ( (status = snmp.get( pdu, ctarget)) != SNMP_CLASS_SUCCESS)
cout << snmp.error_msg( status);
else
{
pdu.get_vb( vb,0); // extract the variable binding
cout << “System Descriptor = ”<< vb.get_printable_value();
} // print out
};
#define SYSDESCR “1.3.6.1.2.1.1.1.0” // Object ID for System Descriptor
void get_system_descriptor()
{
int status; // return status
CTarget ctarget( (IpAddress) “10.4.8.5”);// SNMP++ v1 target
Vb vb( SYSDESCR); // SNMP++ Variable Binding
Pdu pdu; // SNMP++ PDU
//-------[ Construct a SNMP++ SNMP Object ]---------------------------
Snmp snmp( status); // Create a SNMP++ session
if ( status != SNMP_CLASS_SUCCESS)
{ // check creation status
cout << snmp.error_msg( status); // if fail, print error string
return;
}
//-------[ Invoke a SNMP++ Get ]---------------------------------------
pdu += vb; // add the variable binding
if ( (status = snmp.get( pdu, ctarget)) != SNMP_CLASS_SUCCESS)
cout << snmp.error_msg( status);
else
{
pdu.get_vb( vb,0); // extract the variable binding
cout << “System Descriptor = ”<< vb.get_printable_value();
} // print out
};