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

Diff for /pegasus/src/Pegasus/Handler/snmpIndicationHandler/snmpDeliverTrap_netsnmp.h between version 1.1.2.1 and 1.6

version 1.1.2.1, 2006/02/10 16:11:46 version 1.6, 2006/11/14 18:34:53
Line 29 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Yi Zhou, Hewlett-Packard Company (yi.zhou@hp.com)  
 //  
 // Modified By:  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <iostream> #include <iostream>
  
 #include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h> #include <net-snmp/net-snmp-includes.h>
   #include <Pegasus/Common/Mutex.h>
 #include "snmpDeliverTrap.h" #include "snmpDeliverTrap.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 46 
Line 43 
 static const char _MSG_SESSION_OPEN_FAILED [] = static const char _MSG_SESSION_OPEN_FAILED [] =
     "Snmp Indication Handler failed to open the SNMP session: ";     "Snmp Indication Handler failed to open the SNMP session: ";
 static const char _MSG_SESSION_OPEN_FAILED_KEY [] = static const char _MSG_SESSION_OPEN_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_SESSION_OPEN_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_SESSION_OPEN_FAILED";
  
 static const char _MSG_GET_SESSION_POINT_FAILED [] = static const char _MSG_GET_SESSION_POINT_FAILED [] =
     "Snmp Indication Handler failed to get the SNMP session pointer: ";     "Snmp Indication Handler failed to get the SNMP session pointer: ";
 static const char _MSG_GET_SESSION_POINTER_FAILED_KEY [] = static const char _MSG_GET_SESSION_POINTER_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_GET_SESSION_POINT_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_GET_SESSION_POINT_FAILED";
  
 static const char _MSG_PDU_CREATE_FAILED [] = static const char _MSG_PDU_CREATE_FAILED [] =
     "Snmp Indication Handler failed to create the SNMP PDU.";     "Snmp Indication Handler failed to create the SNMP PDU.";
 static const char _MSG_PDU_CREATE_FAILED_KEY [] = static const char _MSG_PDU_CREATE_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_PDU_CREATE_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_PDU_CREATE_FAILED";
  
 static const char _MSG_VERSION_NOT_SUPPORTED [] = static const char _MSG_VERSION_NOT_SUPPORTED [] =
     "SNMPv1 Trap and SNMPv2C Trap are the only supported SNMPVersion values.";     "SNMPv1 Trap and SNMPv2C Trap are the only supported SNMPVersion values.";
 static const char _MSG_VERSION_NOT_SUPPORTED_KEY [] = static const char _MSG_VERSION_NOT_SUPPORTED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_VERSION_NOT_SUPPORTED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_VERSION_NOT_SUPPORTED";
  
 static const char _MSG_SESSION_SEND_FAILED [] = static const char _MSG_SESSION_SEND_FAILED [] =
     "Snmp Indication Handler failed to send the trap: ";     "Snmp Indication Handler failed to send the trap: ";
 static const char _MSG_SESSION_SEND_FAILED_KEY [] = static const char _MSG_SESSION_SEND_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_SESSION_SEND_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_SESSION_SEND_FAILED";
  
 static const char _MSG_PACK_TRAP_INFO_INTO_PDU_FAILED [] = static const char _MSG_PACK_TRAP_INFO_INTO_PDU_FAILED [] =
     "Snmp Indication Handler failed to pack trap information into the SNMP PDU: \"$0\".";      "Snmp Indication Handler failed to pack trap information into the "
           "SNMP PDU: \"$0\".";
 static const char _MSG_PACK_TRAP_INFO_INTO_PDU_FAILED_KEY [] = static const char _MSG_PACK_TRAP_INFO_INTO_PDU_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_PACK_TRAP_INFO_INTO_PDU_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_PACK_TRAP_INFO_INTO_PDU_FAILED";
  
 static const char _MSG_ADD_SYSUPTIME_TO_PDU_FAILED [] = static const char _MSG_ADD_SYSUPTIME_TO_PDU_FAILED [] =
     "Snmp Indication Handler failed to add sysUpTime to the SNMP PDU: \"$0\".";     "Snmp Indication Handler failed to add sysUpTime to the SNMP PDU: \"$0\".";
 static const char _MSG_ADD_SYSUPTIME_TO_PDU_FAILED_KEY [] = static const char _MSG_ADD_SYSUPTIME_TO_PDU_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_ADD_SYSUPTIME_TO_PDU_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_ADD_SYSUPTIME_TO_PDU_FAILED";
  
 static const char _MSG_ADD_SNMP_TRAP_TO_PDU_FAILED [] = static const char _MSG_ADD_SNMP_TRAP_TO_PDU_FAILED [] =
     "Snmp Indication Handler failed to add SNMP Trap to the SNMP PDU: \"$0\".";     "Snmp Indication Handler failed to add SNMP Trap to the SNMP PDU: \"$0\".";
 static const char _MSG_ADD_SNMP_TRAP_TO_PDU_FAILED_KEY [] = static const char _MSG_ADD_SNMP_TRAP_TO_PDU_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_ADD_SNMP_TRAP_TO_PDU_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_ADD_SNMP_TRAP_TO_PDU_FAILED";
  
 static const char _MSG_PACK_CIM_PROPERTY_TO_PDU_FAILED [] = static const char _MSG_PACK_CIM_PROPERTY_TO_PDU_FAILED [] =
     "Snmp Indication Handler failed to pack a CIM Property into the SNMP PDU: \"$0\".";      "Snmp Indication Handler failed to pack a CIM Property into the "
           "SNMP PDU: \"$0\".";
 static const char _MSG_PACK_CIM_PROPERTY_TO_PDU_FAILED_KEY [] = static const char _MSG_PACK_CIM_PROPERTY_TO_PDU_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_PACK_CIM_PROPERTY_TO_PDU_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_PACK_CIM_PROPERTY_TO_PDU_FAILED";
  
 static const char _MSG_READ_OBJID_FAILED [] = static const char _MSG_READ_OBJID_FAILED [] =
     "Snmp Indication Handler failed to convert trapOid \"$0\" from a "     "Snmp Indication Handler failed to convert trapOid \"$0\" from a "
     "numeric form to a list of subidentifiers.";     "numeric form to a list of subidentifiers.";
 static const char _MSG_READ_OBJID_FAILED_KEY [] = static const char _MSG_READ_OBJID_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_READ_OBJID_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_READ_OBJID_FAILED";
  
 static const char _MSG_PARSE_CIM_PROPERTY_OID_FAILED [] = static const char _MSG_PARSE_CIM_PROPERTY_OID_FAILED [] =
     "Snmp Indication Handler failed to convert a CIM property OID \"$0\" from "     "Snmp Indication Handler failed to convert a CIM property OID \"$0\" from "
     "a numeric form to a list of subidentifiers.";     "a numeric form to a list of subidentifiers.";
 static const char _MSG_PARSE_CIM_PROPERTY_OID_FAILED_KEY [] = static const char _MSG_PARSE_CIM_PROPERTY_OID_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp.__MSG_PARSE_CIM_PROPERTY_OID_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "__MSG_PARSE_CIM_PROPERTY_OID_FAILED";
  
 static const char _MSG_READ_ENTOID_FAILED [] = static const char _MSG_READ_ENTOID_FAILED [] =
     "Snmp Indication Handler failed to convert SNMPV1 enterprise OID \"$0\" "     "Snmp Indication Handler failed to convert SNMPV1 enterprise OID \"$0\" "
     "from a numeric form to a list of subidentifiers.";     "from a numeric form to a list of subidentifiers.";
 static const char _MSG_READ_ENTOID_FAILED_KEY [] = static const char _MSG_READ_ENTOID_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_READ_ENTOID_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_READ_ENTOID_FAILED";
  
 static const char _MSG_UNSUPPORTED_SNMP_DATA_TYPE [] = static const char _MSG_UNSUPPORTED_SNMP_DATA_TYPE [] =
     "Type \"$0\" is an unsupported SNMP Data Type for the CIM property.";     "Type \"$0\" is an unsupported SNMP Data Type for the CIM property.";
 static const char _MSG_UNSUPPORTED_SNMP_DATA_TYPE_KEY [] = static const char _MSG_UNSUPPORTED_SNMP_DATA_TYPE_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_UNSUPPORTED_SNMP_DATA_TYPE";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_UNSUPPORTED_SNMP_DATA_TYPE";
  
 static const char _MSG_ADD_VAR_TO_PDU_FAILED [] = static const char _MSG_ADD_VAR_TO_PDU_FAILED [] =
     "Snmp Indication Handler failed to add a CIM property \"$0\" to the SNMP PDU: \"$1\".";      "Snmp Indication Handler failed to add a CIM property \"$0\" to the "
           "SNMP PDU: \"$1\".";
 static const char _MSG_ADD_VAR_TO_PDU_FAILED_KEY [] = static const char _MSG_ADD_VAR_TO_PDU_FAILED_KEY [] =
     "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp._MSG_ADD_VAR_TO_PDU_FAILED";      "Handler.snmpIndicationHandler.snmpDeliverTrap_netsnmp."
           "_MSG_ADD_VAR_TO_PDU_FAILED";
  
 class snmpDeliverTrap_netsnmp : public snmpDeliverTrap class snmpDeliverTrap_netsnmp : public snmpDeliverTrap
 { {
 public: public:
  
       void initialize();
   
       void terminate();
   
     void deliverTrap(     void deliverTrap(
         const String& trapOid,         const String& trapOid,
         const String& securityName,         const String& securityName,
Line 135 
Line 153 
  
 private: private:
  
       // Mutex is needed before a session is created. Sessions created
       // using the Single API do not interact with other SNMP sessions.
       Mutex _sessionInitMutex;
   
     /**     /**
         Creates a SNMP session.         Creates a SNMP session.
  
Line 143 
Line 165 
                               to receive a trap                               to receive a trap
         @param portNumber     the port number to receive a trap         @param portNumber     the port number to receive a trap
         @param securityName   the human readable community name         @param securityName   the human readable community name
         @param snmpSession    the SNMP session  
         @param sessionHandle  an opaque pointer of the SNMP session         @param sessionHandle  an opaque pointer of the SNMP session
         @param sessionPtr     the SNMP session pointer to its associated         @param sessionPtr     the SNMP session pointer to its associated
                               struct snmp_session                               struct snmp_session
   
     */     */
       void _createSession(
     void _createSession(const String & targetHost,          const String& targetHost,
                         Uint32 portNumber,                         Uint32 portNumber,
                         const String & securityName,                         const String & securityName,
                         struct snmp_session & snmpSession,  
                         void *&sessionHandle,                         void *&sessionHandle,
                         struct snmp_session *&sessionPtr);                         struct snmp_session *&sessionPtr);
  
Line 171 
Line 190 
         @param trapOid      the trap OID         @param trapOid      the trap OID
         @param sessionPtr   the SNMP session pointer         @param sessionPtr   the SNMP session pointer
         @param snmpPdu      the SNMP PDU         @param snmpPdu      the SNMP PDU
   
     */     */
       void _createPdu(
     void _createPdu(Uint16 snmpVersion,          Uint16 snmpVersion,
                    const String& trapOid,                    const String& trapOid,
                    struct snmp_session *&sessionPtr,                    struct snmp_session *&sessionPtr,
                    struct snmp_pdu *& snmpPdu);                    struct snmp_pdu *& snmpPdu);
Line 185 
Line 203 
         @param trapOid  the trap OID         @param trapOid  the trap OID
         @param snmpPdu  the SNMP PDU         @param snmpPdu  the SNMP PDU
     */     */
     void _packTrapInfoIntoPdu(const String & trapOid,      void _packTrapInfoIntoPdu(
           const String& trapOid,
                               snmp_pdu * snmpPdu);                               snmp_pdu * snmpPdu);
  
     /**     /**
Line 196 
Line 215 
         @param vbValues  the array of CIM property values         @param vbValues  the array of CIM property values
         @param snmpPdu   the SNMP PDU         @param snmpPdu   the SNMP PDU
     */     */
     void _packOidsIntoPdu(const Array<String>& vbOids,      void _packOidsIntoPdu(
           const Array<String>& vbOids,
                           const Array<String>& vbTypes,                           const Array<String>& vbTypes,
                           const Array<String>& vbValues,                           const Array<String>& vbValues,
                           snmp_pdu * snmpPdu);                           snmp_pdu * snmpPdu);
  
     enum SNMPVersion {_SNMPv1_TRAP = 2, _SNMPv2C_TRAP = 3,      enum SNMPVersion
         _SNMPv2C_INFORM = 4, _SNMPv3_TRAP = 5, _SNMPv3_INFORM = 6};      {
           _SNMPv1_TRAP = 2,
           _SNMPv2C_TRAP = 3,
           _SNMPv2C_INFORM = 4,
           _SNMPv3_TRAP = 5,
           _SNMPv3_INFORM = 6
       };
 }; };
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.6

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2