[AGENT++] MimProxy example err! Help!!

zhutao zt_luck at 163.com
Fri Sep 17 10:05:17 CEST 2004


Helo, 
	This after i wrote the code:
#include <stdlib.h>
#include <signal.h>

#include <agent_pp/agent++.h>
#include <agent_pp/mib_proxy.h>
#include <agent_pp/log.h>
#include <agent_pp/snmp_group.h>

//using namespace Agentpp;

void
main(int argc, char* argv[])
{
	u_short port = 161;
	UdpAddress source("127.0.0.1");
	source.set_port( port );
	RequestList*	requestList;
	
	if ( argc > 1 ) port = atoi(argv[1]);
	if ( argc > 2 ) source = argv[2];
	if ( argc > 3 ) source.set_port( atoi(argv[3]));

	Snmp::socket_startup();	

	int status;
	Snmpx snmp(status, port);

	if ( status == SNMP_CLASS_SUCCESS )
	{
		LOG_BEGIN( EVENT_LOG|1 );
		LOG("main: SNMP listen port");
		LOG(port);
		LOG_END;
	}
	else
	{
		LOG_BEGIN(ERROR_LOG | 0 );
		LOG("main:SNMP port init failed");
		LOG(status);
		LOG_END;
	}
	
	requestList = new RequestList();

	requestList->set_snmp(&snmp);
	
	Mib mib;
	mib.add(new snmpGroup());
	mib.add(new MibProxy("1.3.6.1.2.1.1", READCREATE, source));
	mib.add(new MibProxy("1.3.6.1.2.1.2", READCREATE, source));
	mib.add(new MibProxy("1.3.6.1.2.1.31", READCREATE, source));

	for (;;)
	{
		Request* req = requestList->receive(120);
		if(req)
			mib.process_request( req );
	}

	Snmp::socket_cleanup();
}

use VC6 compile it!
I need't snmpv3 function ,so i set "_NO_SNMPv3" in the Preprocess definitions:

while i compile it, there always have errors
d:\devlibrary\agent_snmp\agent++\examples\mibproxyexam\mibproxyexam.cpp(51) : error C2514: 'MibProxy' : class has no constructors
        d:\devlibrary\agent_snmp\agent++\include\agent_pp\mib.h(2224) : see declaration of 'MibProxy'
d:\devlibrary\agent_snmp\agent++\examples\mibproxyexam\mibproxyexam.cpp(52) : error C2514: 'MibProxy' : class has no constructors
        d:\devlibrary\agent_snmp\agent++\include\agent_pp\mib.h(2224) : see declaration of 'MibProxy'
d:\devlibrary\agent_snmp\agent++\examples\mibproxyexam\mibproxyexam.cpp(53) : error C2514: 'MibProxy' : class has no constructors
        d:\devlibrary\agent_snmp\agent++\include\agent_pp\mib.h(2224) : see declaration of 'MibProxy'


How can I do it? Someone help me!





More information about the AGENTPP mailing list