need help with v3 traps

Laura Quiroga lquiroga____entercept.com
Thu Dec 13 03:22:54 CET 2001


I am trying to send v3 traps by following the example in snmpTraps.cpp.
Unfortunately, this does not seem to work for me.  I am getting an
exception when it tries to resolve the address.
 
Here is my code:
SnmpTarget *target = NULL;
 if (m_nVersion == version3) 
 {
  int port = atoi(m_sTargetPort.c_str());
  address.set_port(port);
  UTarget utarget(address);
  utarget.set_version((snmp_version)m_nVersion);   // set the SNMP
version SNMPV1 or V2
  utarget.set_security_model(SecurityModel_USM);
  utarget.set_security_name(securityName);
  m_pPdu->set_security_level(SecurityLevel_authNoPriv);
  m_pPdu->set_context_name("receive_trap");
  m_pPdu->set_context_engine_id("receive_trap");
  target = &utarget;
 }
 else
 {
  CTarget ctarget(address);
  ctarget.set_version((snmp_version)m_nVersion);   // set the SNMP
version SNMPV1 or V2
  ctarget.set_readcommunity(community);     // set the community name to
use 
  target = &ctarget;
 }
 
status = snmp.trap(*m_pPdu,*target);

Here is the callstack:
GenAddress::operator=(const GenAddress & {...}) line 1876
UTarget::resolve_to_U(OctetStr & {...}, int & 3, GenAddress & {...},
unsigned long & 3435973836, int & -858993460, unsigned char & 204) line
625
Snmp::trap(Pdu & {...}, SnmpTarget & {...}) line 1013 + 53 bytes

It fails at address = (Address *)(addr.address)->clone();
 
Any suggestions?
 
-lxq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.agentpp.org/pipermail/agentpp/attachments/20011212/2c8adcae/attachment.htm 


More information about the AGENTPP mailing list