Proxy forwarder configuration help
Chaudhury, Neel
nchaudhury____iPolicyNet.COM
Fri Apr 13 10:36:32 CEST 2001
Hi Frank and others,
I have implemented an agent using snmp++3 and agent ++3.4 with disabled
_SNMPv3 option. It seems to be working fine except one problem that I face
now. The following description explanins about the problem:
I have a class for SNMP agent derived from our own thread class. In the
constructor of this class, I initialize the snmp session object to 0, and
from my code I call the initialize() to create the snmp session. If
everything goes fine, it works fine. Suppose the SNMP session could not be
created, say due to bind failure. As I have allocated the snmp session
object, I want to free the memory using delete operator for that object
pointer. At this point the application crashes. I use winNT4.0 and VC++ 6.0.
When I tried to debug it, I found that the memory content for the session
object changes when it enters the destructor of Snmp class. In the ~snmp(),
since the construct_status is not SNMP_CLASS_SUCCESS, it returns without
doing clean up. As soon as it returns it crashes. I could not get much help
why it's happening.
--------------------------
class SnmpAgent : public PmThread {
public:
// construtor and destructor
SnmpAgent() {pSnmpSess = 0}
~SnmpAgent(){};
virtual void initialize () ;
// terminate function of the thread
virtual void terminate () ;
// process function of the thread
virtual void process ();
//----Abstract Methods-----------------------------
private:
Snmpx *pSnmpSess; // SNMP session object
Mib mib; // the agent's MIB
RequestList reqList; // request list to be used by mib for outgoing
requests
};
void SnmpAgent :: initialize() {
int snmpStatus = 0;
pSnmpSess = new Snmpx(snmpStatus, portNum); // create SNMP session
if (snmpStatus != SNMP_CLASS_SUCCESS) {
delete pSnmpSess; // delete the object
if (snmpStatus == SNMP_CLASS_TL_IN_USE) {
//error message - bind failed
}
}
}
-----------------------------
Please help me.
Thanking you all in advance.
Regards,
Neel
iPolicy Networks Inc.,
nchaudhury at ipolicynet.com
More information about the AGENTPP
mailing list