version 1.1.2.1, 2001/10/12 17:33:08
|
version 1.1.2.2, 2001/11/08 20:02:27
|
|
|
CIMInstance& indicationInstance, | CIMInstance& indicationInstance, |
String nameSpace) | String nameSpace) |
{ | { |
String enterprise, trapOid, destination, trapType; |
String enterprise, trapOid, destination; |
|
|
Array<String> propOIDs; | Array<String> propOIDs; |
Array<String> propTYPEs; | Array<String> propTYPEs; |
Array<String> propVALUEs; | Array<String> propVALUEs; |
| |
String propName; |
CIMProperty prop; |
|
|
Uint32 propPos; |
|
Uint32 qualifierPos; |
|
Uint32 typePos; |
|
CIMValue propValue; |
|
CIMProperty trapProp; |
|
CIMQualifier trapQualifier; |
|
| |
CIMClass indicationClass = _repository->getClass( | CIMClass indicationClass = _repository->getClass( |
nameSpace, | nameSpace, |
indicationInstance.getClassName(), | indicationInstance.getClassName(), |
false); | false); |
| |
//filling the array with enterprise first |
Uint32 propPos = indicationClass.findProperty("enterprise"); |
propPos = indicationClass.findProperty("enterprise"); |
|
if (propPos != PEG_NOT_FOUND) | if (propPos != PEG_NOT_FOUND) |
{ | { |
trapProp = indicationClass.getProperty(propPos); |
CIMProperty trapProp = indicationClass.getProperty(propPos); |
qualifierPos = trapProp.findQualifier("OID"); |
|
trapQualifier = trapProp.getQualifier(qualifierPos); |
Uint32 qualifierPos = trapProp.findQualifier("MappingStrings"); |
|
if (qualifierPos != PEG_NOT_FOUND) |
|
{ |
|
CIMQualifier trapQualifier = trapProp.getQualifier(qualifierPos); |
enterprise = trapQualifier.getValue().toString(); | enterprise = trapQualifier.getValue().toString(); |
| |
int i; |
for (int i=0; i<indicationInstance.getPropertyCount();i++) |
for (i=0; i<indicationInstance.getPropertyCount();i++) |
|
{ | { |
propValue = indicationInstance.getProperty(i).getValue(); |
char* property_oid = NULL; |
|
char* property_value = NULL; |
|
char* property_datatype = NULL; |
|
|
|
prop = indicationInstance.getProperty(i); |
| |
if (!propValue.isNull()) |
if (prop != NULL) |
{ | { |
propName = indicationInstance.getProperty(i).getName(); |
String propName = prop.getName(); |
propPos = indicationClass.findProperty(propName); |
Uint32 propPos = indicationClass.findProperty(propName); |
trapProp = indicationClass.getProperty(propPos); |
CIMProperty trapProp = indicationClass.getProperty(propPos); |
| |
if (trapProp.existsQualifier("OID")) |
if (trapProp.existsQualifier("MappingStrings")) |
{ | { |
if (propName == "trapOid") | if (propName == "trapOid") |
{ | { |
trapOid = propValue.toString(); |
trapOid = prop.getValue().toString(); |
} | } |
else | else |
{ | { |
qualifierPos = trapProp.findQualifier("OID"); |
Uint32 qualifierPos = trapProp.findQualifier("MappingStrings"); |
trapQualifier = trapProp.getQualifier(qualifierPos); |
CIMQualifier trapQualifier = trapProp.getQualifier(qualifierPos); |
propOIDs.append(trapQualifier.getValue().toString()); |
|
propVALUEs.append(propValue.toString()); |
String mapstr1 = trapQualifier.getValue().toString(); |
if (trapProp.existsQualifier("SNMPTYPE")) |
String mapstr2 = ""; |
{ |
|
typePos = trapProp.findQualifier("SNMPTYPE"); |
if ((mapstr1.find("OID") != PEG_NOT_FOUND) && |
trapQualifier = trapProp.getQualifier(typePos); |
(mapstr1.find("SNMP") != PEG_NOT_FOUND)) |
propTYPEs.append(trapQualifier.getValue().toString()); |
{ |
|
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); |
|
propVALUEs.append(prop.getValue().toString()); |
|
propTYPEs.append(mapstr1.subString(mapstr1.find("|")+1)); |
|
} |
|
} |
|
} |
} | } |
else |
|
propTYPEs.append(TypeToString(trapProp.getType())); |
|
} | } |
} | } |
} | } |
} | } |
|
|
destination = handlerInstance.getProperty( |
|
handlerInstance.findProperty("destination")).getValue().toString(); |
|
|
|
trapType = handlerInstance.getProperty( |
|
handlerInstance.findProperty("trapType")).getValue().toString(); |
|
| |
// Collected complete data in arrays and ready to send the trap. | // Collected complete data in arrays and ready to send the trap. |
// 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 | #ifdef HPUX_EMANATE |
snmpDeliverTrap_emanate emanateTrap; | snmpDeliverTrap_emanate emanateTrap; |
#else | #else |
snmpDeliverTrap_stub emanateTrap; | snmpDeliverTrap_stub emanateTrap; |
#endif | #endif |
| |
cout << "Trap to deliver " << endl; |
if ((handlerInstance.findProperty("Destination") != PEG_NOT_FOUND) && |
|
(handlerInstance.findProperty("trapType") != PEG_NOT_FOUND)) |
|
{ |
emanateTrap.deliverTrap(trapOid, | emanateTrap.deliverTrap(trapOid, |
enterprise, | enterprise, |
destination, |
handlerInstance.getProperty(handlerInstance.findProperty("Destination")) |
trapType, |
.getValue().toString(), |
|
handlerInstance.getProperty(handlerInstance.findProperty("trapType")) |
|
.getValue().toString(), |
propOIDs, | propOIDs, |
propTYPEs, | propTYPEs, |
propVALUEs); | propVALUEs); |
|
} |
cout << "Trap Delivered " << endl; |
|
} | } |
else | else |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, | throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |