version 1.31, 2006/07/25 18:27:26
|
version 1.32, 2006/08/11 19:47:07
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) |
|
// |
|
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// : Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
|
|
// l10n | // l10n |
#include <Pegasus/Common/MessageLoader.h> | #include <Pegasus/Common/MessageLoader.h> |
| |
|
PEGASUS_USING_STD; |
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
PEGASUS_USING_STD; |
snmpIndicationHandler::snmpIndicationHandler() |
|
{ |
|
PEG_METHOD_ENTER (TRC_IND_HANDLER, |
|
"snmpIndicationHandler::snmpIndicationHandler"); |
| |
#ifdef HPUX_EMANATE | #ifdef HPUX_EMANATE |
static snmpDeliverTrap_emanate snmpTrap; |
_snmpTrapSender = new snmpDeliverTrap_emanate(); |
#elif defined (PEGASUS_USE_NET_SNMP) | #elif defined (PEGASUS_USE_NET_SNMP) |
static snmpDeliverTrap_netsnmp snmpTrap; |
_snmpTrapSender = new snmpDeliverTrap_netsnmp(); |
#else | #else |
static snmpDeliverTrap_stub snmpTrap; |
_snmpTrapSender = new snmpDeliverTrap_stub(); |
#endif | #endif |
| |
snmpIndicationHandler::snmpIndicationHandler() |
|
{ |
|
PEG_METHOD_ENTER (TRC_IND_HANDLER, |
|
"snmpIndicationHandler::snmpIndicationHandler"); |
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
|
| |
_repository = repository; | _repository = repository; |
| |
#ifdef PEGASUS_USE_NET_SNMP |
_snmpTrapSender->initialize(); |
snmpTrap.initialize(); |
|
#endif |
|
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
|
|
PEG_METHOD_ENTER (TRC_IND_HANDLER, | PEG_METHOD_ENTER (TRC_IND_HANDLER, |
"snmpIndicationHandler::terminate"); | "snmpIndicationHandler::terminate"); |
| |
#ifdef PEGASUS_USE_NET_SNMP |
_snmpTrapSender->terminate(); |
snmpTrap.terminate(); |
|
#endif |
|
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
|
|
PEG_METHOD_ENTER (TRC_IND_HANDLER, | PEG_METHOD_ENTER (TRC_IND_HANDLER, |
"snmpIndicationHandler::~snmpIndicationHandler"); | "snmpIndicationHandler::~snmpIndicationHandler"); |
| |
|
delete _snmpTrapSender; |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
|
|
// | // |
// Get snmpTrapOid from context | // Get snmpTrapOid from context |
// | // |
try |
if (context.contains(SnmpTrapOidContainer::NAME)) |
{ | { |
SnmpTrapOidContainer trapContainer = context.get | SnmpTrapOidContainer trapContainer = context.get |
(SnmpTrapOidContainer::NAME); | (SnmpTrapOidContainer::NAME); |
| |
trapOid = trapContainer.getSnmpTrapOid(); | trapOid = trapContainer.getSnmpTrapOid(); |
} | } |
catch (Exception& e) |
else |
{ | { |
// get trapOid from indication Class | // get trapOid from indication Class |
| |
|
|
handler.getProperty(engineIDPos).getValue().get(engineID); | handler.getProperty(engineIDPos).getValue().get(engineID); |
} | } |
| |
snmpTrap.deliverTrap( |
_snmpTrapSender->deliverTrap( |
trapOid, | trapOid, |
securityName, | securityName, |
targetHost, | targetHost, |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
PEGASUS_NAMESPACE_END |
|
|
|
PEGASUS_USING_PEGASUS; |
|
|
// 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 appended to "PegasusCreateHandler_" | // this handler is "snmpIndicationHandler" which is appended to "PegasusCreateHandler_" |
// to form a symbol name. This function is called by the HandlerTable | // to form a symbol name. This function is called by the HandlerTable |
// to load this handler. | // to load this handler. |
| |
extern "C" PEGASUS_EXPORT CIMHandler* |
extern "C" PEGASUS_EXPORT |
PegasusCreateHandler_snmpIndicationHandler() { |
CIMHandler* PegasusCreateHandler_snmpIndicationHandler() |
|
{ |
return new snmpIndicationHandler; | return new snmpIndicationHandler; |
} | } |
|
|
PEGASUS_NAMESPACE_END |
|