(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.2 and 1.6

version 1.1.2.2, 2001/11/08 20:02:27 version 1.6, 2002/04/17 22:46:33
Line 27 
Line 27 
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #include <iostream>  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
   #include <iostream>
 #include <Pegasus/Handler/CIMHandler.h> #include <Pegasus/Handler/CIMHandler.h>
 #include <Pegasus/Repository/CIMRepository.h> #include <Pegasus/Repository/CIMRepository.h>
  
Line 55 
Line 55 
     DDD(cout << _SNMPINDICATIONHANDLER << "initialize()" << endl;)     DDD(cout << _SNMPINDICATIONHANDLER << "initialize()" << endl;)
 } }
  
 void snmpIndicationHandler::handleIndication(CIMInstance& handlerInstance,  void snmpIndicationHandler::handleIndication(CIMInstance& handler,
     CIMInstance& indicationInstance,      CIMInstance& indication, String nameSpace)
     String nameSpace)  
 { {
     String enterprise, trapOid, destination;  
     Array<String> propOIDs;     Array<String> propOIDs;
     Array<String> propTYPEs;     Array<String> propTYPEs;
     Array<String> propVALUEs;     Array<String> propVALUEs;
  
     CIMProperty prop;     CIMProperty prop;
       CIMQualifier trapQualifier;
  
     CIMClass indicationClass = _repository->getClass(      Uint32 qualifierPos;
         nameSpace,  
         indicationInstance.getClassName(),  
         false);  
  
     Uint32 propPos = indicationClass.findProperty("enterprise");      String propValue;
     if (propPos != PEG_NOT_FOUND)  
     {  
         CIMProperty trapProp = indicationClass.getProperty(propPos);  
  
         Uint32 qualifierPos = trapProp.findQualifier("MappingStrings");      String mapstr1;
         if (qualifierPos != PEG_NOT_FOUND)      String mapstr2;
         {  
             CIMQualifier trapQualifier = trapProp.getQualifier(qualifierPos);  
             enterprise = trapQualifier.getValue().toString();  
  
             for (int i=0; i<indicationInstance.getPropertyCount();i++)      CIMClass indicationClass = _repository->getClass(
             {          nameSpace, indication.getClassName(), false);
                 char* property_oid = NULL;  
                 char* property_value = NULL;  
                 char* property_datatype = NULL;  
  
                 prop = indicationInstance.getProperty(i);      for (Uint32 i=0; i<indication.getPropertyCount();i++)
       {
           prop = indication.getProperty(i);
  
                 if (prop != NULL)          if (prop)
                 {                 {
                     String propName = prop.getName();                     String propName = prop.getName();
                     Uint32 propPos = indicationClass.findProperty(propName);                     Uint32 propPos = indicationClass.findProperty(propName);
               if (propPos != PEG_NOT_FOUND)
               {
                     CIMProperty trapProp = indicationClass.getProperty(propPos);                     CIMProperty trapProp = indicationClass.getProperty(propPos);
  
                     if (trapProp.existsQualifier("MappingStrings"))                     if (trapProp.existsQualifier("MappingStrings"))
                     {                     {
                         if (propName == "trapOid")                  qualifierPos = trapProp.findQualifier("MappingStrings");
                         {                  trapQualifier = trapProp.getQualifier(qualifierPos);
                             trapOid = prop.getValue().toString();  
                         }  
                         else  
                         {  
                             Uint32 qualifierPos = trapProp.findQualifier("MappingStrings");  
                             CIMQualifier trapQualifier = trapProp.getQualifier(qualifierPos);  
  
                             String mapstr1 = trapQualifier.getValue().toString();                  mapstr1.clear();
                             String mapstr2 = "";                  mapstr1 = trapQualifier.getValue().toString();
  
                             if ((mapstr1.find("OID") != PEG_NOT_FOUND) &&                  if ((mapstr1.find("OID.IETF") != PEG_NOT_FOUND) &&
                                 (mapstr1.find("SNMP") != PEG_NOT_FOUND))                      (mapstr1.find("DataType.IETF") != PEG_NOT_FOUND))
                             {                             {
                                 if (mapstr1.subString(0, 4) == "OID.")                      if (mapstr1.subString(0, 8) == "OID.IETF")
                                 {                                 {
                                     mapstr1 = mapstr1.subString(mapstr1.find("SNMP.")+5);                                     mapstr1 = mapstr1.subString(mapstr1.find("SNMP.")+5);
                                     if (mapstr1.find("|") != PEG_NOT_FOUND)                                     if (mapstr1.find("|") != PEG_NOT_FOUND)
                                     {                                     {
                                         mapstr2 = mapstr1.subString(0, mapstr1.find("|"));                              mapstr2.clear();
                               mapstr2 = mapstr1.subString(0,
                                   mapstr1.find("DataType.IETF")-1);
                                         propOIDs.append(mapstr2);                                         propOIDs.append(mapstr2);
                                         propVALUEs.append(prop.getValue().toString());  
                                         propTYPEs.append(mapstr1.subString(mapstr1.find("|")+1));                              propValue.clear();
                                     }                              propValue = prop.getValue().toString();
                               propVALUEs.append(propValue);
   
                               mapstr2 = mapstr1.subString(mapstr1.find("|")+2);
                               mapstr2 = mapstr2.subString(0, mapstr2.size()-1);
                               propTYPEs.append(mapstr2);
                                 }                                 }
                             }                             }
                         }                         }
Line 142 
Line 133 
         snmpDeliverTrap_stub emanateTrap;         snmpDeliverTrap_stub emanateTrap;
 #endif #endif
  
         if ((handlerInstance.findProperty("Destination") != PEG_NOT_FOUND) &&      if ((handler.findProperty("TrapDestination") != PEG_NOT_FOUND) &&
             (handlerInstance.findProperty("trapType") != PEG_NOT_FOUND))          (handler.findProperty("SNMPVersion") != PEG_NOT_FOUND) &&
           (indicationClass.findQualifier("MappingStrings") != PEG_NOT_FOUND))
         {         {
             emanateTrap.deliverTrap(trapOid,          String community, trapType, destination;   // from handler instance
                 enterprise,          String trapOid;     // from indication Class
                 handlerInstance.getProperty(handlerInstance.findProperty("Destination"))  
                     .getValue().toString(),          trapOid = indicationClass.getQualifier(
                 handlerInstance.getProperty(handlerInstance.findProperty("trapType"))              indicationClass.findQualifier("MappingStrings")).getValue().toString();
                     .getValue().toString(),  
           trapOid = trapOid.subString(trapOid.find("OID.IETF | SNMP.")+16);
   
           community = handler.getProperty(
               handler.findProperty("SNMPCommunityName")).getValue().toString();
   
           destination = handler.getProperty(
               handler.findProperty("TrapDestination")).getValue().toString();
   
           trapType = handler.getProperty(
               handler.findProperty("SNMPVersion")).getValue().toString();
   
           emanateTrap.deliverTrap(
               trapOid,
               community,
               destination,
               trapType,
                 propOIDs,                 propOIDs,
                 propTYPEs,                 propTYPEs,
                 propVALUEs);                 propVALUEs);
         }         }
     }  
     else     else
         throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED,          cout << "Invalid Indication" << endl;
             "Indication is without enterprise OID");  
 } }
  
 // This is the dynamic entry point into this dynamic module. The name of // This is the dynamic entry point into this dynamic module. The name of


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2