#include <iostream>
#include <snmp_pp/snmp_pp.h>
#define SYSDESCR "1.3.6.1.2.1.1.1.0" //ObjectID for system descriptor
#define SYSOBJECTID "1.3.6.1.2.1.1.2.0" //ObjectID for system object ID
#define SYSCONTACT "1.3.6.1.2.1.1.4.0" //ObjectID for system contact
#define SYSCONTACT1 "1.3.6.1.2.1.2.2.1.4" //ObjectID for system contact
#define sysName "1.3.6.1.2.1.1.5.0"
using namespace std;
int main()
{
int status;
Vb vb[4];
Pdu pdu;
vb[0].set_oid(SYSDESCR);
vb[1].set_oid(SYSOBJECTID);
vb[2].set_oid(SYSCONTACT);
vb[3].set_oid(sysName);
pdu.set_vblist(vb,3);
//CTarget ctarget((IpAddress)"10.150.0.88");
CTarget ctarget((IpAddress)"127.0.0.1");
Snmp snmp(status);
if((status=snmp.get(pdu, ctarget))!=SNMP_CLASS_SUCCESS)
cout<<snmp.error_msg(status)<<endl;
else {
pdu.get_vblist(vb,4);
for(int i=0;i<4;i++)
{
cout<<vb[i].get_printable_value()<<endl;
char s[256];
sprintf(s,vb[i].get_printable_value());
}
}
getchar();
return 0;
}