[AGENT++] Can not Get dot1dBaseBridge when using vb::get_value function

吴海峰 hfwu at seu.edu.cn
Mon Feb 21 09:59:29 CET 2005


Hi all!

I met a problem. 

In the code as follows,it can't get the 1.3.6.1.2.1.17.1.1.0 value.

	Pdu pdu;                               // construct a Pdu object
	Vb vb;                                 // construct a Vb object
	vb.set_oid("1.3.6.1.2.1.17.1.1.0");	   // dot1dBaseBridgeAddress
	pdu += vb;                             // add the vb to the Pdu	
	address.set_port(port);
	CTarget ctarget(address);             // make a target using the address
	ctarget.set_version(version);         // set the SNMP version SNMPV1 or V2
	ctarget.set_retry(retries);           // set the number of auto retries
	ctarget.set_timeout(timeout);         // set timeout
	ctarget.set_readcommunity(community); // set the read community name

	SnmpTarget *target = &ctarget;
	
	int status = snmpThread->get(pdu, *target);
	if (status==SNMP_CLASS_SUCCESS)
	{
		pdu.get_vb( vb,0);
		char mac[128];
		if(vb.get_value(mac)==SNMP_CLASS_SUCCESS)
		{
			cout<<"MAC "<<mac<<endl;
		}
	}


Any idea? Thanks.





More information about the AGENTPP mailing list