version 1.2, 2001/12/13 14:54:23
|
version 1.3, 2002/03/14 00:07:48
|
|
|
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); |
|
// ATTN: Catch TypeMismatch exception on the next line |
|
trapQualifier.getValue().get(enterprise); |
|
| |
for (Uint32 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) | if (prop) |
{ | { |
|
|
| |
if (trapProp.existsQualifier("MappingStrings")) | if (trapProp.existsQualifier("MappingStrings")) |
{ | { |
if (propName == "trapOid") |
qualifierPos = trapProp.findQualifier("MappingStrings"); |
{ |
trapQualifier = trapProp.getQualifier(qualifierPos); |
// ATTN: Catch TypeMismatch exception on the next line |
|
prop.getValue().get(trapOid); |
|
} |
|
else |
|
{ |
|
Uint32 qualifierPos = trapProp.findQualifier("MappingStrings"); |
|
CIMQualifier trapQualifier = trapProp.getQualifier(qualifierPos); |
|
| |
String mapstr1; |
mapstr1.clear(); |
// ATTN: Catch TypeMismatch exception on the next line |
mapstr1 = trapQualifier.getValue().toString(); |
trapQualifier.getValue().get(mapstr1); |
|
String mapstr2 = ""; |
|
| |
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); |
String propValue; |
|
// ATTN: Catch TypeMismatch exception on the next line |
propValue.clear(); |
prop.getValue().get(propValue); |
propValue = prop.getValue().toString(); |
propVALUEs.append(propValue); | propVALUEs.append(propValue); |
propTYPEs.append(mapstr1.subString(mapstr1.find("|")+1)); |
|
} |
mapstr2 = mapstr1.subString(mapstr1.find("|")+2); |
} |
|
|
// ATTN: There is a problem with mof compiler in |
|
// loading mof with MappingString |
|
|
|
// << 12-03-2002 : NU (HP) >> |
|
|
|
// MappingString{}. It loads if one additional |
|
// array is specified as follows: |
|
|
|
// [MappingStrings { |
|
// "OID.IETF | SNMP.1.3.6.1.4.1.11.2.3.1.6.3.1.1.4.1.1.2", |
|
// "DataType.IETF | OctetString", |
|
// "Junk"}] |
|
|
|
// where "Junk" is not required in actual definition. |
|
|
|
propTYPEs.append(mapstr2.subString(0, mapstr2.find("Junk")-1)); |
} | } |
} | } |
} | } |
|
|
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) && |
|
(indication.findQualifier("TrapOid") != PEG_NOT_FOUND)) |
{ | { |
String destination; |
String community, trapType, destination; // from handler instance |
String trapType; |
String trapOid; // from indication instance |
// ATTN: Add error checking |
|
// ATTN: Catch TypeMismatch exception on the next line |
trapOid = indication.getQualifier( |
handlerInstance.getProperty( |
indication.findQualifier("TrapOid")).getValue().toString(); |
handlerInstance.findProperty("Destination")) |
|
.getValue().get(destination); |
community = handler.getProperty( |
// ATTN: Add error checking |
handler.findProperty("SNMPCommunityName")).getValue().toString(); |
// ATTN: Catch TypeMismatch exception on the next line |
|
handlerInstance.getProperty( |
|
handlerInstance.findProperty("trapType")) |
|
.getValue().get(trapType); |
|
| |
emanateTrap.deliverTrap(trapOid, |
destination = handler.getProperty( |
enterprise, |
handler.findProperty("TrapDestination")).getValue().toString(); |
|
|
|
trapType = handler.getProperty( |
|
handler.findProperty("SNMPVersion")).getValue().toString(); |
|
|
|
emanateTrap.deliverTrap( |
|
trapOid, |
|
community, |
destination, | destination, |
trapType, | trapType, |
propOIDs, | propOIDs, |
|
|
propVALUEs); | propVALUEs); |
} | } |
} | } |
else |
|
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
"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 |
// this handler is "snmpIndicationHandler" which is appened to "PegasusCreateHandler_" | // this handler is "snmpIndicationHandler" which is appened to "PegasusCreateHandler_" |