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

Diff for /pegasus/src/Pegasus/Handler/snmpIndicationHandler/snmpIndicationHandler.cpp between version 1.1.2.3 and 1.43

version 1.1.2.3, 2001/11/15 20:15:24 version 1.43, 2010/12/22 12:19:06
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001 BMC Software, Hewlett Packard, IBM, The Open Group,  // Licensed to The Open Group (TOG) under one or more contributor license
 // Tivoli Systems  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
   // this work for additional information regarding copyright ownership.
   // Each contributor licenses this file to you under the OpenPegasus Open
   // Source License; you may not use this file except in compliance with the
   // License.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // Permission is hereby granted, free of charge, to any person obtaining a
 // of this software and associated documentation files (the "Software"), to  // copy of this software and associated documentation files (the "Software"),
 // deal in the Software without restriction, including without limitation the  // to deal in the Software without restriction, including without limitation
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // sell copies of the Software, and to permit persons to whom the Software is  // and/or sell copies of the Software, and to permit persons to whom the
 // furnished to do so, subject to the following conditions:  // Software is furnished to do so, subject to the following conditions:
 //  
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  // The above copyright notice and this permission notice shall be included
   // in all copies or substantial portions of the Software.
 // //
 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // //
 // Modified By:  //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <iostream>  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
   #include <Pegasus/Common/PegasusVersion.h>
   
   #include <iostream>
 #include <Pegasus/Handler/CIMHandler.h> #include <Pegasus/Handler/CIMHandler.h>
 #include <Pegasus/Repository/CIMRepository.h> #include <Pegasus/Repository/CIMRepository.h>
   #include <Pegasus/Common/Tracer.h>
  
 #include "snmpIndicationHandler.h" #include "snmpIndicationHandler.h"
  
 #ifdef HPUX_EMANATE #ifdef HPUX_EMANATE
 #include "snmpDeliverTrap_emanate.h" #include "snmpDeliverTrap_emanate.h"
   #elif defined (PEGASUS_USE_NET_SNMP)
   # include "snmpDeliverTrap_netsnmp.h"
 #else #else
 #include "snmpDeliverTrap_stub.h" #include "snmpDeliverTrap_stub.h"
 #endif #endif
  
 PEGASUS_NAMESPACE_BEGIN  #include <Pegasus/Common/MessageLoader.h>
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 //#define DDD(X) X  PEGASUS_NAMESPACE_BEGIN
 #define DDD(X) // X  
   snmpIndicationHandler::snmpIndicationHandler()
   {
       PEG_METHOD_ENTER (TRC_IND_HANDLER,
           "snmpIndicationHandler::snmpIndicationHandler");
   
   #ifdef HPUX_EMANATE
       _snmpTrapSender = new snmpDeliverTrap_emanate();
   #elif defined (PEGASUS_USE_NET_SNMP)
       _snmpTrapSender = new snmpDeliverTrap_netsnmp();
   #else
       _snmpTrapSender = new snmpDeliverTrap_stub();
   #endif
  
 DDD(static const char* _SNMPINDICATIONHANDLER = "snmpIndicationHandler::";)      PEG_METHOD_EXIT();
   }
  
 void snmpIndicationHandler::initialize(CIMRepository* repository) void snmpIndicationHandler::initialize(CIMRepository* repository)
 { {
       PEG_METHOD_ENTER (TRC_IND_HANDLER,
           "snmpIndicationHandler::initialize");
   
     _repository = repository;     _repository = repository;
     DDD(cout << _SNMPINDICATIONHANDLER << "initialize()" << endl;)  
       _snmpTrapSender->initialize();
   
       PEG_METHOD_EXIT();
   }
   
   void snmpIndicationHandler::terminate()
   {
       PEG_METHOD_ENTER(TRC_IND_HANDLER,
           "snmpIndicationHandler::terminate");
   
       _snmpTrapSender->terminate();
   
       PEG_METHOD_EXIT();
 } }
  
 void snmpIndicationHandler::handleIndication(CIMInstance& handlerInstance,  snmpIndicationHandler::~snmpIndicationHandler()
     CIMInstance& indicationInstance,  {
     String nameSpace)      PEG_METHOD_ENTER(TRC_IND_HANDLER,
           "snmpIndicationHandler::~snmpIndicationHandler");
   
       delete _snmpTrapSender;
   
       PEG_METHOD_EXIT();
   }
   
   // l10n - note: ignoring indication language
   void snmpIndicationHandler::handleIndication(
       const OperationContext& context,
       const String nameSpace,
       CIMInstance& indication,
       CIMInstance& handler,
       CIMInstance& subscription,
       ContentLanguageList & contentLanguages)
 { {
     String enterprise, trapOid, destination;  
     Array<String> propOIDs;     Array<String> propOIDs;
     Array<String> propTYPEs;     Array<String> propTYPEs;
     Array<String> propVALUEs;     Array<String> propVALUEs;
  
     CIMProperty prop;      Array<String> mapStr;
   
       PEG_METHOD_ENTER(TRC_IND_HANDLER,
           "snmpIndicationHandler::handleIndication");
  
       try
       {
           PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
               "snmpIndicationHandler %s:%s.%s processing %s Indication",
              (const char*)(nameSpace.getCString()),
              (const char*)(handler.getClassName().getString().getCString()),
              (const char*)(handler.getProperty(
              handler.findProperty(PEGASUS_PROPERTYNAME_NAME)).
              getValue().toString().getCString()),
              (const char*)(indication.getClassName().getString().
              getCString())));
     CIMClass indicationClass = _repository->getClass(     CIMClass indicationClass = _repository->getClass(
         nameSpace,              nameSpace, indication.getClassName(), false, true,
         indicationInstance.getClassName(),              false, CIMPropertyList());
         false);  
           Uint32 propertyCount = indication.getPropertyCount();
  
     Uint32 propPos = indicationClass.findProperty("enterprise");          for (Uint32 i=0; i < propertyCount; i++)
     if (propPos != PEG_NOT_FOUND)  
     {     {
         CIMProperty trapProp = indicationClass.getProperty(propPos);              CIMProperty prop = indication.getProperty(i);
  
         Uint32 qualifierPos = trapProp.findQualifier("MappingStrings");              Uint32 propDeclPos = indicationClass.findProperty(prop.getName());
         if (qualifierPos != PEG_NOT_FOUND)              if (propDeclPos != PEG_NOT_FOUND)
         {         {
             CIMQualifier trapQualifier = trapProp.getQualifier(qualifierPos);                  CIMProperty propDecl = indicationClass.getProperty(propDeclPos);
             // ATTN: Catch TypeMismatch exception on the next line  
             trapQualifier.getValue().get(enterprise);  
  
             for (int i=0; i<indicationInstance.getPropertyCount();i++)                  Uint32 qualifierPos =
                       propDecl.findQualifier(CIMName("MappingStrings"));
                   if (qualifierPos != PEG_NOT_FOUND)
             {             {
                 char* property_oid = NULL;                      //
                 char* property_value = NULL;                      // We are looking for following fields:
                 char* property_datatype = NULL;                      // MappingStrings {"OID.IETF | SNMP." oidStr,
                       //     "DataType.IETF |" dataType}
                       // oidStr is the object identifier (e.g. "1.3.6.1.2.1.5..."
                       // dataType is either Integer, or OctetString,
                       // or OID
                       // Following is one example:
                       // MappingStrings {"OID.IETF | SNMP.1.3.6.6.3.1.1.5.2",
                       //    "DataType.IETF | Integer"}
                       //
   
                       propDecl.getQualifier(qualifierPos).getValue().get(
                           mapStr);
  
                 prop = indicationInstance.getProperty(i);                      String oidStr, dataType;
                       String mapStr1, mapStr2;
                       Boolean isValidAuthority = false;
                       Boolean isValidDataType = false;
  
                 if (prop != NULL)                      for (Uint32 j=0; j < mapStr.size(); j++)
                 {                 {
                     String propName = prop.getName();                          Uint32 barPos = mapStr[j].find("|");
                     Uint32 propPos = indicationClass.findProperty(propName);  
                     CIMProperty trapProp = indicationClass.getProperty(propPos);  
  
                     if (trapProp.existsQualifier("MappingStrings"))                          if (barPos != PEG_NOT_FOUND)
                     {                     {
                         if (propName == "trapOid")                              mapStr1 = mapStr[j].subString(0, barPos);
                               mapStr2 = mapStr[j].subString(barPos + 1);
   
                               _trimWhitespace(mapStr1);
                               _trimWhitespace(mapStr2);
   
                               if ((mapStr1 == "OID.IETF") &&
                                   (String::compare(mapStr2,
                                    String("SNMP."), 5) == 0))
                         {                         {
                             // ATTN: Catch TypeMismatch exception on the next line                                  isValidAuthority = true;
                             prop.getValue().get(trapOid);                                  oidStr = mapStr2.subString(5);
                         }                         }
                         else                              else if (mapStr1 == "DataType.IETF")
                         {                         {
                             Uint32 qualifierPos = trapProp.findQualifier("MappingStrings");                                  isValidDataType = true;
                             CIMQualifier trapQualifier = trapProp.getQualifier(qualifierPos);                                  dataType = mapStr2;
   
                             String mapstr1;  
                             // ATTN: Catch TypeMismatch exception on the next line  
                             trapQualifier.getValue().get(mapstr1);  
                             String mapstr2 = "";  
   
                             if ((mapstr1.find("OID") != PEG_NOT_FOUND) &&  
                                 (mapstr1.find("SNMP") != PEG_NOT_FOUND))  
                             {  
                                 if (mapstr1.subString(0, 4) == "OID.")  
                                 {  
                                     mapstr1 = mapstr1.subString(mapstr1.find("SNMP.")+5);  
                                     if (mapstr1.find("|") != PEG_NOT_FOUND)  
                                     {  
                                         mapstr2 = mapstr1.subString(0, mapstr1.find("|"));  
   
                                         propOIDs.append(mapstr2);  
                                         String propValue;  
                                         // ATTN: Catch TypeMismatch exception on the next line  
                                         prop.getValue().get(propValue);  
                                         propVALUEs.append(propValue);  
                                         propTYPEs.append(mapstr1.subString(mapstr1.find("|")+1));  
                                     }  
                                 }                                 }
   
                               if (isValidAuthority && isValidDataType)
                               {
                                   propOIDs.append(oidStr);
                                   propTYPEs.append(dataType);
                                   propVALUEs.append(prop.getValue().toString());
   
                                   break;
                             }                             }
                         }                         }
                     }                     }
Line 143 
Line 212 
         // trap destination and SNMP type are defined in handlerInstance         // trap destination and SNMP type are defined in handlerInstance
         // and passing this instance as it is to deliverTrap() call         // and passing this instance as it is to deliverTrap() call
  
 #ifdef HPUX_EMANATE          Uint32 targetHostPos = handler.findProperty(CIMName("TargetHost"));
         snmpDeliverTrap_emanate emanateTrap;          Uint32 targetHostFormatPos =
 #else              handler.findProperty(CIMName("TargetHostFormat"));
         snmpDeliverTrap_stub emanateTrap;          Uint32 otherTargetHostFormatPos =
 #endif              handler.findProperty(CIMName("OtherTargetHostFormat"));
           Uint32 portNumberPos = handler.findProperty(CIMName("PortNumber"));
           Uint32 snmpVersionPos = handler.findProperty(CIMName("SNMPVersion"));
           Uint32 securityNamePos =
               handler.findProperty(CIMName("SNMPSecurityName"));
           Uint32 engineIDPos = handler.findProperty(CIMName("SNMPEngineID"));
           Uint32 snmpSecLevelPos =
               handler.findProperty(CIMName("SNMPSecurityLevel"));
           Uint32 snmpSecAuthProtoPos =
               handler.findProperty(CIMName("SNMPSecurityAuthProtocol"));
           Uint32 snmpSecAuthKeyPos =
               handler.findProperty(CIMName("SNMPSecurityAuthKey"));
           Uint32 snmpSecPrivProtoPos =
               handler.findProperty(CIMName("SNMPSecurityPrivProtocol"));
           Uint32 snmpSecPrivKeyPos =
               handler.findProperty(CIMName("SNMPSecurityPrivKey"));
   
           if (targetHostPos == PEG_NOT_FOUND)
           {
               PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
                   "Target host is not set for IndicationHandlerSNMPMapper %s"
                   " Indication.",
                   (const char*)(indication.getClassName().getString().
                   getCString())));
               PEG_METHOD_EXIT();
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
                   "Handler.snmpIndicationHandler.snmpIndicationHandler."
                   "INVALID_SNMP_INSTANCE",
                   "Invalid IndicationHandlerSNMPMapper instance"));
           }
           if (targetHostFormatPos == PEG_NOT_FOUND)
           {
               PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
                   "Target host format is not set for IndicationHandlerSNMPMapper"
                   " %s Indication.",
                   (const char*)(indication.getClassName().getString().
                   getCString())));
               PEG_METHOD_EXIT();
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
                   "Handler.snmpIndicationHandler.snmpIndicationHandler."
                   "INVALID_SNMP_INSTANCE",
                   "Invalid IndicationHandlerSNMPMapper instance"));
           }
           if (snmpVersionPos == PEG_NOT_FOUND)
           {
               PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
                   "SNMP Version is not set for IndicationHandlerSNMPMapper %s"
                   " Indication.",
                   (const char*)(indication.getClassName().getString().
                   getCString())));
               PEG_METHOD_EXIT();
               throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
                   "Handler.snmpIndicationHandler.snmpIndicationHandler."
                   "INVALID_SNMP_INSTANCE",
                   "Invalid IndicationHandlerSNMPMapper instance"));
           }
           else
           {
               // properties from the handler instance
               String targetHost;
               String otherTargetHostFormat = String();
               String securityName = String();
               String engineID = String();
               Uint16 targetHostFormat = 0;
               Uint16 snmpVersion = 0;
               Uint32 portNumber;
               Uint8 snmpSecLevel = 1; // noAuthnoPriv
               Uint8 snmpSecAuthProto = 0;
               Array<Uint8> snmpSecAuthKey;// no key
               Uint8 snmpSecPrivProto = 0;
               Array<Uint8> snmpSecPrivKey ;// no key
  
         if ((handlerInstance.findProperty("Destination") != PEG_NOT_FOUND) &&              String trapOid;
             (handlerInstance.findProperty("trapType") != PEG_NOT_FOUND))              Boolean trapOidAvailable = false;
               //
               //  Get snmpTrapOid from context
               //
               if (context.contains(SnmpTrapOidContainer::NAME))
               {
                   SnmpTrapOidContainer trapContainer =
                       context.get(SnmpTrapOidContainer::NAME);
   
                   trapOid = trapContainer.getSnmpTrapOid();
                   trapOidAvailable = true;
               }
               else
         {         {
             String destination;                  // get trapOid from indication Class
             String trapType;  
             // ATTN: Add error checking                  Uint32 pos =
             // ATTN: Catch TypeMismatch exception on the next line                      indicationClass.findQualifier(CIMName("MappingStrings"));
             handlerInstance.getProperty(                  if (pos != PEG_NOT_FOUND)
                 handlerInstance.findProperty("Destination"))                  {
                 .getValue().get(destination);                      Array<String> classMapStr;
             // ATTN: Add error checking                      indicationClass.getQualifier(pos).getValue().
             // ATTN: Catch TypeMismatch exception on the next line                          get(classMapStr);
             handlerInstance.getProperty(  
                 handlerInstance.findProperty("trapType"))                      for (Uint32 i=0; i < classMapStr.size(); i++)
                 .getValue().get(trapType);                      {
                           Uint32 barPos = classMapStr[i].find("|");
             emanateTrap.deliverTrap(trapOid,  
                 enterprise,                          if (barPos != PEG_NOT_FOUND)
                 destination,                          {
                 trapType,                              String authorityName =
                                   classMapStr[i].subString(0, barPos);
                               String oidStr = classMapStr[i].subString(
                                   barPos+1, PEG_NOT_FOUND);
   
                               _trimWhitespace(authorityName);
                               _trimWhitespace(oidStr);
   
                               if ((authorityName == "OID.IETF") &&
                                   (String::compare(oidStr,
                                    String("SNMP."), 5) == 0))
                               {
                                   trapOid = oidStr.subString(5);
                                   trapOidAvailable = true;
                                   break;
                               }
                           }
                       }
   
                       if (!trapOidAvailable)
                       {
                           PEG_TRACE((
                               TRC_IND_HANDLER,
                               Tracer::LEVEL1,
                               "No MappingStrings for snmp trap is specified "
                                   "for class: %s",
                               (const char*)
                                 indication.getClassName().getString().getCString()
                               ));
   
                           PEG_METHOD_EXIT();
   
                           throw PEGASUS_CIM_EXCEPTION_L(
                               CIM_ERR_FAILED,
                               MessageLoaderParms(
                                   "Handler.snmpIndicationHandler."
                                   "snmpIndicationHandler.NO_MS_FOR_SNMP_TRAP",
                                   "No MappingStrings for snmp trap is specified "
                                       "for class: $0",
                                   indication.getClassName().getString()));
                       }
                   }
                   else
                   {
                       PEG_TRACE_CSTRING(TRC_IND_HANDLER, Tracer::LEVEL1,
                           "Qualifier MappingStrings can not be found.");
                       PEG_METHOD_EXIT();
                       MessageLoaderParms parms(
                           "Handler.snmpIndicationHandler.snmpIndicationHandler."
                               "QUALIFIER_MAPPINGS_NOT_FOUND",
                           "Qualifier MappingStrings can not be found");
                       throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
                   }
               }
   
               handler.getProperty(targetHostPos).getValue().get(targetHost);
               handler.getProperty(targetHostFormatPos).getValue().get(
                   targetHostFormat);
               if (otherTargetHostFormatPos != PEG_NOT_FOUND)
               {
                   handler.getProperty(otherTargetHostFormatPos).getValue().get(
                       otherTargetHostFormat);
               }
               if (portNumberPos != PEG_NOT_FOUND)
               {
                   handler.getProperty(portNumberPos).getValue().get(portNumber);
               }
               else
               {
                   // default port
                   portNumber = SNMP_TRAP_DEFAULT_PORT;
               }
   
               handler.getProperty(snmpVersionPos).getValue().get(snmpVersion);
               if (securityNamePos != PEG_NOT_FOUND)
               {
                   handler.getProperty(securityNamePos).getValue().get(
                       securityName);
               }
               if (engineIDPos != PEG_NOT_FOUND)
               {
                   handler.getProperty(engineIDPos).getValue().get(engineID);
               }
   
               if(snmpVersion == 5) // SNMPv3 Trap
               {
                   //fetch the security data
                   if(snmpSecLevelPos != PEG_NOT_FOUND)
                   {
                       handler.getProperty(snmpSecLevelPos).getValue(). \
                           get(snmpSecLevel);
                   }
                   if(snmpSecAuthProtoPos != PEG_NOT_FOUND)
                   {
                       handler.getProperty(snmpSecAuthProtoPos).getValue(). \
                           get(snmpSecAuthProto);
                   }
                   if(snmpSecAuthKeyPos != PEG_NOT_FOUND)
                   {
                       handler.getProperty(snmpSecAuthKeyPos).getValue(). \
                           get(snmpSecAuthKey);
                   }
                   if(snmpSecPrivProtoPos != PEG_NOT_FOUND)
                   {
                       handler.getProperty(snmpSecPrivProtoPos).getValue(). \
                           get(snmpSecPrivProto);
                   }
                   if(snmpSecPrivKeyPos!= PEG_NOT_FOUND)
                   {
                       handler.getProperty(snmpSecPrivKeyPos).getValue(). \
                           get(snmpSecPrivKey);
                   }
               }
   
               PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
                  "snmpIndicationHandler sending %s Indication trap %s to target"
                  " host %s target port %d",
                  (const char*)(indication.getClassName().getString().
                  getCString()),
                  (const char*)(trapOid.getCString()),
                  (const char*)(targetHost.getCString()),portNumber));
              _snmpTrapSender->deliverTrap(
                   trapOid,
                   securityName,
                   targetHost,
                   targetHostFormat,
                   otherTargetHostFormat,
                   portNumber,
                   snmpVersion,
                   engineID,
                   snmpSecLevel,
                   snmpSecAuthProto,
                   snmpSecAuthKey,
                   snmpSecPrivProto,
                   snmpSecPrivKey,
                 propOIDs,                 propOIDs,
                 propTYPEs,                 propTYPEs,
                 propVALUEs);                 propVALUEs);
   
           PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
              "%s Indication trap %s sent to target host %s target port %d "
              "successfully",
              (const char*)(indication.getClassName().getString().getCString()),
              (const char*)(trapOid.getCString()),
              (const char*)(targetHost.getCString()),portNumber));
         }         }
     }     }
     else      catch (CIMException& c)
         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,      {
             "Indication is without enterprise OID");          PEG_TRACE((TRC_IND_HANDLER, Tracer::LEVEL1, "CIMException %s",
               (const char*)c.getMessage().getCString()));
           PEG_METHOD_EXIT();
           throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, c.getMessage());
 } }
       catch (Exception& e)
       {
           PEG_TRACE((TRC_IND_HANDLER, Tracer::LEVEL1, "Exception %s",
               (const char*)e.getMessage().getCString()));
           PEG_METHOD_EXIT();
  
 // This is the dynamic entry point into this dynamic module. The name of          throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
 // this handler is "snmpIndicationHandler" which is appened to "PegasusCreateHandler_"      }
 // to form a symbol name. This function is called by the HandlerTable      catch (...)
 // to load this handler.      {
           PEG_TRACE_CSTRING(TRC_IND_HANDLER, Tracer::LEVEL1,
 extern "C" PEGASUS_EXPORT CIMHandler*              "Failed to deliver trap.");
     PegasusCreateHandler_snmpIndicationHandler() {          PEG_METHOD_EXIT();
     DDD(cout << "Called PegasusCreateHandler_snmpIndicationHandler" << endl;)  
     return new snmpIndicationHandler;          throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
               "Handler.snmpIndicationHandler.snmpIndicationHandler."
                   "FAILED_TO_DELIVER_TRAP",
               "Failed to deliver trap."));
       }
       PEG_METHOD_EXIT();
   }
   
   void snmpIndicationHandler::_trimWhitespace(
       String & nameStr)
   {
       PEG_METHOD_ENTER(TRC_IND_HANDLER,
           "snmpIndicationHandler::_trimWhitespace");
   
       Uint32 ps = 0;
       // skip begining whitespace
       for (ps = 0; ps < nameStr.size(); ps++)
       {
           if (nameStr[ps] != ' ')
           {
               break;
           }
       }
   
       if (ps != 0)
       {
           nameStr.remove(0, ps);
       }
   
       // skip the appended whitespace
       for (ps = nameStr.size(); ps != 0; ps--)
       {
           if (nameStr[ps-1] != ' ')
           {
               break;
           }
       }
   
       if (ps !=  nameStr.size())
       {
           nameStr.remove(ps);
       }
   
       PEG_METHOD_EXIT();
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
   
   PEGASUS_USING_PEGASUS;
   
   // This is the entry point into this dynamic module.
   
   extern "C" PEGASUS_EXPORT CIMHandler* PegasusCreateHandler(
       const String& handlerName)
   {
       if (handlerName == "snmpIndicationHandler")
       {
           return new snmpIndicationHandler;
       }
   
       return 0;
   }


Legend:
Removed from v.1.1.2.3  
changed lines
  Added in v.1.43

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2