version 1.12.12.1, 2003/07/29 15:08:29
|
version 1.19, 2003/10/09 16:43:40
|
|
|
#include "snmpDeliverTrap_stub.h" | #include "snmpDeliverTrap_stub.h" |
#endif | #endif |
| |
|
// l10n |
|
#include <Pegasus/Common/MessageLoader.h> |
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
} | } |
| |
// l10n - note: ignoring indication language | // l10n - note: ignoring indication language |
void snmpIndicationHandler::handleIndication(CIMInstance& handler, |
void snmpIndicationHandler::handleIndication( |
|
const OperationContext& context, |
|
CIMInstance& handler, |
CIMInstance& indication, String nameSpace, | CIMInstance& indication, String nameSpace, |
ContentLanguages & contentLanguages) | ContentLanguages & contentLanguages) |
{ | { |
|
|
String mapstr2; | String mapstr2; |
| |
CIMClass indicationClass = _repository->getClass( | CIMClass indicationClass = _repository->getClass( |
nameSpace, indication.getClassName(), false); |
nameSpace, indication.getClassName(), false, true, false, CIMPropertyList()); |
| |
Uint32 propertyCount = indication.getPropertyCount(); | Uint32 propertyCount = indication.getPropertyCount(); |
| |
|
|
PEG_NOT_FOUND)) | PEG_NOT_FOUND)) |
{ | { |
// properties from the handler instance | // properties from the handler instance |
String targetHost, otherTargetHostFormat; |
String targetHost; |
String securityName, engineID; |
String otherTargetHostFormat = String(); |
Uint16 targetHostFormat, snmpVersion; |
String securityName = String(); |
|
String engineID = String(); |
|
Uint16 targetHostFormat = 0; |
|
Uint16 snmpVersion = 0; |
Uint32 portNumber; | Uint32 portNumber; |
| |
// trapOid from indication Class |
String trapOid; |
|
// |
|
// Get snmpTrapOid from context |
|
// |
|
try |
|
{ |
|
SnmpTrapOidContainer trapContainer = context.get |
|
(SnmpTrapOidContainer::NAME); |
|
|
|
trapOid = trapContainer.getSnmpTrapOid(); |
|
} |
|
catch (Exception& e) |
|
{ |
|
// get trapOid from indication Class |
| |
String trapOid = indicationClass.getQualifier( |
Uint32 pos = indicationClass.findQualifier(CIMName ("MappingStrings")); |
indicationClass.findQualifier |
if (pos != PEG_NOT_FOUND) |
(CIMName ("MappingStrings"))).getValue().toString(); |
{ |
|
trapOid = indicationClass.getQualifier(pos).getValue().toString(); |
| |
Uint32 index = trapOid.find("SNMP."); |
trapOid = trapOid.subString(11, PEG_NOT_FOUND); |
| |
if (index != PEG_NOT_FOUND) |
if ((String::compare(trapOid, "SNMP.", 5)) == 0) |
{ | { |
trapOid = trapOid.subString(index+5); |
trapOid = trapOid.subString(5, (trapOid.size()-6)); |
trapOid = trapOid.subString(0, (trapOid.size()-1)); |
|
} | } |
else | else |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "Invalid MappingStrings Value"); |
// l10n |
|
// throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "Invalid MappingStrings Value"); |
|
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
|
MessageLoaderParms("Handler.snmpIndicationHandler.snmpIndicationHandler.INVALID_MS_VALUE", |
|
"Invalid MappingStrings Value")); |
|
} |
|
} |
|
else |
|
{ |
|
//L10N_ TODO DONE |
|
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "Qualifier MappingStrings can not be found"); |
|
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(targetHostPos).getValue().get(targetHost); |
handler.getProperty(targetHostFormatPos).getValue().get(targetHostFormat); | handler.getProperty(targetHostFormatPos).getValue().get(targetHostFormat); |
|
if (otherTargetHostFormatPos != PEG_NOT_FOUND) |
|
{ |
handler.getProperty(otherTargetHostFormatPos).getValue().get | handler.getProperty(otherTargetHostFormatPos).getValue().get |
(otherTargetHostFormat); | (otherTargetHostFormat); |
|
} |
|
if (portNumberPos != PEG_NOT_FOUND) |
|
{ |
handler.getProperty(portNumberPos).getValue().get(portNumber); | handler.getProperty(portNumberPos).getValue().get(portNumber); |
|
} |
handler.getProperty(snmpVersionPos).getValue().get(snmpVersion); | handler.getProperty(snmpVersionPos).getValue().get(snmpVersion); |
|
if (securityNamePos != PEG_NOT_FOUND) |
|
{ |
handler.getProperty(securityNamePos).getValue().get(securityName); | handler.getProperty(securityNamePos).getValue().get(securityName); |
|
} |
|
if (engineIDPos != PEG_NOT_FOUND) |
|
{ |
handler.getProperty(engineIDPos).getValue().get(engineID); | handler.getProperty(engineIDPos).getValue().get(engineID); |
|
} |
| |
emanateTrap.deliverTrap( | emanateTrap.deliverTrap( |
trapOid, | trapOid, |
|
|
} | } |
else | else |
{ | { |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
// l10n |
"Invalid IndicationHandlerSNMPMapper instance"); |
|
|
// throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
// "Invalid IndicationHandlerSNMPMapper instance"); |
|
|
|
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_FAILED, |
|
MessageLoaderParms("Handler.snmpIndicationHandler.snmpIndicationHandler.INVALID_SNMP_INSTANCE", |
|
"Invalid IndicationHandlerSNMPMapper instance")); |
} | } |
} | } |
| |