(file) Return to snmpDeliverTrap_netsnmp.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Handler / snmpIndicationHandler

Diff for /pegasus/src/Pegasus/Handler/snmpIndicationHandler/snmpDeliverTrap_netsnmp.cpp between version 1.3 and 1.3.2.1

version 1.3, 2006/01/30 16:17:54 version 1.3.2.1, 2006/04/19 22:33:44
Line 41 
Line 41 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   void snmpDeliverTrap_netsnmp::initialize()
   {
   
       PEG_METHOD_ENTER (TRC_IND_HANDLER,
           "snmpDeliverTrap_netsnmp::initialize");
   
       // Defined default MIB modules (in net-snmp-config.h) do not need to be
       // loaded and loading them can cause some stderr;
       // use environment variable MIBS to override the default MIB modules.
       // If there is no MIBS environment variable, add it in.
       char *envVar;
       envVar = getenv("MIBS");
   
       if (envVar == NULL)
       {
           putenv("MIBS=");
       }
   
       // Initialize the mib reader
       netsnmp_set_mib_directory("");
       init_mib();
   
       // Initializes the SNMP library
       init_snmp("snmpIndicationHandler");
   
       // windows32 specific initialization (is a NOOP on unix)
       SOCK_STARTUP;
   
       PEG_METHOD_EXIT ();
   
   }
   
   void snmpDeliverTrap_netsnmp::terminate()
   {
   
       PEG_METHOD_ENTER (TRC_IND_HANDLER,
           "snmpDeliverTrap_netsnmp::terminate");
   
       SOCK_CLEANUP;
   
       PEG_METHOD_EXIT ();
   }
   
 void snmpDeliverTrap_netsnmp::deliverTrap( void snmpDeliverTrap_netsnmp::deliverTrap(
         const String& trapOid,         const String& trapOid,
         const String& securityName,         const String& securityName,
Line 59 
Line 102 
         "snmpDeliverTrap_netsnmp::deliverTrap");         "snmpDeliverTrap_netsnmp::deliverTrap");
  
     void *sessionHandle;     void *sessionHandle;
     struct snmp_session snmpSession, *sessionPtr;      struct snmp_session *sessionPtr;
  
     struct snmp_pdu *snmpPdu;     struct snmp_pdu *snmpPdu;
  
     // Creates a SNMP session     // Creates a SNMP session
     _createSession(targetHost, portNumber, securityName, snmpSession,      _createSession(targetHost, portNumber, securityName,
                    sessionHandle, sessionPtr);                    sessionHandle, sessionPtr);
  
     try     try
Line 138 
Line 181 
     const String & targetHost,     const String & targetHost,
     Uint32 portNumber,     Uint32 portNumber,
     const String & securityName,     const String & securityName,
     snmp_session & snmpSession,  
     void *&sessionHandle,     void *&sessionHandle,
     snmp_session *&sessionPtr)     snmp_session *&sessionPtr)
 { {
Line 149 
Line 191 
     char *errStr;     char *errStr;
     String exceptionStr;     String exceptionStr;
  
     // Defined default MIB modules (in net-snmp-config.h) do not need to be      struct snmp_session snmpSession;
     // loaded and loading them can cause some stderr;  
     // use environment variable MIBS to override the default MIB modules.  
     // If there is no MIBS environment variable, add it in.  
   
     char *envVar;  
     envVar = getenv("MIBS");  
  
     if (envVar == NULL)  
     {     {
         putenv("MIBS=");      AutoMutex autoMut(_sessionInitMutex);
     }  
   
     // Initialize the mib reader  
     netsnmp_set_mib_directory("");  
     init_mib();  
   
     // Initializes the SNMP library  
     init_snmp("snmpIndicationHandler");  
   
     // Prepares a struct snmp_session that will be used for a set of  
     // SNMP transactions  
     snmp_sess_init(&snmpSession);     snmp_sess_init(&snmpSession);
  
     // windows32 specific initialization (is a NOOP on unix)  
     SOCK_STARTUP;  
   
     CString targetHostCStr = targetHost.getCString();     CString targetHostCStr = targetHost.getCString();
  
     // peername has format: targetHost:portNumber     // peername has format: targetHost:portNumber
Line 183 
Line 204 
                                           1+32));                                           1+32));
     sprintf(snmpSession.peername, "%s:%u", (const char*)targetHostCStr,     sprintf(snmpSession.peername, "%s:%u", (const char*)targetHostCStr,
             portNumber);             portNumber);
   
     sessionHandle = snmp_sess_open(&snmpSession);     sessionHandle = snmp_sess_open(&snmpSession);
       }
  
     if (sessionHandle == NULL)     if (sessionHandle == NULL)
     {     {
Line 196 
Line 219 
  
         free(errStr);         free(errStr);
  
         SOCK_CLEANUP;  
   
         PEG_METHOD_EXIT ();         PEG_METHOD_EXIT ();
  
         throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,         throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED,
Line 276 
Line 297 
  
     snmp_sess_close(sessionHandle);     snmp_sess_close(sessionHandle);
  
     SOCK_CLEANUP;  
   
     PEG_METHOD_EXIT ();     PEG_METHOD_EXIT ();
 } }
  


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.3.2.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2