[AGENT++] How to add trap IP addresses?

Henning Eggers henning.eggers at plath.de
Thu Oct 21 09:33:38 CEST 2004


> > SnmpPdu pdu( _target );
>
> Here you used SnmpPdu to create "pdu" object with "_target" as an
argument. First of all, I can't find
> SnmpPdu class object in the SNMP++ or Agent++ code. Where is this one
coming from?
I forgot to explain: SnmpPdu is a special version of a Pdu object which does
all the initialization needed for SNMPv3 (SecurityLevel, Context, etc) by
itself, using the information in Target. Have a look at the Pdu class and
the other examples to see what has to be done.

> Secondly, you used "_target" as an argument, and I can't figure out what
is that?
That would be a UTarget that has to be created first.

> > status = _snmp->set( pdu, *_target->getTarget() );

> Here is also "_snmp" object that I am not sure where is it coming from.
> My guess is that should be Snmpx object created in the main(), and since
> it should be only one out there.
That's the one, although Snmpx is from Agent++ and you only need Snmp++ for
this. Hence an instance of Snmp will do.

>> status = _snmp->set( pdu, *_target->getTarget() );
>
> What is the reason for the snmpTargetAddrTable to be created in two passes
instead of one?
Read the RFC, try it out (using MibExplorer or the like) and you will find
that it won't work in one step. The main reason is probably that the domain
thing (snmpUDPDomain) has to be defined first before the actual data can be
entered (OK, could have guessed that from the code.)

Have fun!
Henning





More information about the AGENTPP mailing list