version 1.5.14.2, 2003/08/13 19:39:51
|
version 1.14, 2006/08/11 19:47:07
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) |
|
// |
|
// Modified By: Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "sr_conf.h" | #include "sr_conf.h" |
|
|
| |
#include "snmpDeliverTrap.h" | #include "snmpDeliverTrap.h" |
| |
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
// l10n | // l10n |
// lots of hacking to make up these messages | // lots of hacking to make up these messages |
| |
|
static const char _MSG_INITSUBAGENT_FAILED [] = "InitSubagent Failed to initialize"; |
|
|
static const char _MSG_INITSUBAGENT_FAILED [] = "$0 Failed to initialize"; |
|
static const char _MSG_INITSUBAGENT [] = "InitSubagent"; |
|
static const char _MSG_INITSUBAGENT_FAILED_KEY [] = | static const char _MSG_INITSUBAGENT_FAILED_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INITSUBAGENT_FAILED"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INITSUBAGENT_FAILED"; |
| |
static const char _MSG_INVALID_TRAPOID [] = "Invalid $0."; |
static const char _MSG_INVALID_TRAPOID [] = "Invalid trapOid."; |
static const char _MSG_TRAPOID [] = "trapOid"; |
|
static const char _MSG_INVALID_KEY [] = | static const char _MSG_INVALID_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; |
| |
|
|
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_DESTINATION_NOT_FOUND"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_DESTINATION_NOT_FOUND"; |
| |
static const char _MSG_TARGETHOSTFORMAT_NOT_SUPPORTED [] = | static const char _MSG_TARGETHOSTFORMAT_NOT_SUPPORTED [] = |
"$0 and $1 are the only supported $2 values."; |
"Host Name and IPV4 Address are the only supported TargetHostFormat values."; |
static const char _MSG_HOSTNAME [] = "Host Name"; |
|
static const char _MSG_IPV4 [] = "IPV4 Address"; |
|
static const char _MSG_TARGETHOSTFORMAT [] = "TargetHostFormat"; |
|
static const char _MSG_TARGETHOSTFORMAT_NOT_SUPPORTED_KEY [] = | static const char _MSG_TARGETHOSTFORMAT_NOT_SUPPORTED_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_TARGETHOSTFORMAT_NOT_SUPPORTED"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_TARGETHOSTFORMAT_NOT_SUPPORTED"; |
| |
static const char _MSG_INVALID_SECURITY_NAME [] = "Invalid $0."; |
static const char _MSG_INVALID_SECURITY_NAME [] = "Invalid SNMP SecurityName."; |
static const char _MSG_SECURITY_NAME [] = "SNMP SecurityName"; |
|
static const char _MSG_INVALID_SECURITY_NAME_KEY [] = | static const char _MSG_INVALID_SECURITY_NAME_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; |
| |
|
|
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID_OCTET_VALUE"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID_OCTET_VALUE"; |
| |
static const char _MSG_CREATE_OCTET_FAILED [] = | static const char _MSG_CREATE_OCTET_FAILED [] = |
"Creation of empty 4 length $0 failed."; |
"Creation of empty 4 length OctetString failed."; |
static const char _MSG_OCTETSTRING [] = "OctetString"; |
|
static const char _MSG_CREATE_OCTET_FAILED_KEY [] = | static const char _MSG_CREATE_OCTET_FAILED_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_CREATE_OCTET_FAILED"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_CREATE_OCTET_FAILED"; |
| |
static const char _MSG_INVALID_ENTERPRISEOID [] = "Invalid $0."; |
static const char _MSG_INVALID_ENTERPRISEOID [] = "Invalid enterpriseOid."; |
static const char _MSG_ENTERPRISEOID [] = "enterpriseOid."; |
|
static const char _MSG_INVALID_ENTERPRISEOID_KEY [] = | static const char _MSG_INVALID_ENTERPRISEOID_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; |
| |
static const char _MSG_INVALID_PROPERTYOID [] = "Invalid $0 of $1 Property."; |
static const char _MSG_INVALID_PROPERTYOID [] = "Invalid OID of CIM Property."; |
static const char _MSG_OID [] = "OID"; |
|
static const char _MSG_CIM [] = "CIM"; |
|
static const char _MSG_INVALID_PROPERTYOID_KEY [] = | static const char _MSG_INVALID_PROPERTYOID_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID_PROPERTYOID"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID_PROPERTYOID"; |
| |
static const char _MSG_INVALID_PROPERTYVALUE [] = "Invalid value of $0 Property."; |
static const char _MSG_INVALID_PROPERTYVALUE [] = "Invalid value of CIM Property."; |
// declared above static const char _MSG_CIM [] = "CIM"; |
|
static const char _MSG_INVALID_PROPERTYVALUE_KEY [] = | static const char _MSG_INVALID_PROPERTYVALUE_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID_PROPERTY"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID_PROPERTY"; |
| |
static const char _MSG_MAKE_VARBIND_FAILED [] = |
static const char _MSG_MAKE_VARBIND_FAILED_FOR_OCTET_PRIM_TYPE [] = |
"Failed to $0 for type $1."; |
"Failed to MakeVarBindWithValue for type OCTET_PRIM_TYPE."; |
static const char _MSG_MAKE_VARBIND_FAILED_KEY [] = |
static const char _MSG_MAKE_VARBIND_FAILED_FOR_OCTET_PRIM_TYPE_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_MAKE_FAILED"; |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_MAKE_FAILED_FOR_OCTET_PRIM_TYPE"; |
static const char _MSG_VARBIND [] = "MakeVarBindWithValue"; |
|
|
static const char _MSG_MAKE_VARBIND_FAILED_FOR_OBJECT_ID_TYPE [] = |
static const char _MSG_OCTET_PRIM_TYPE [] = "OCTET_PRIM_TYPE"; |
"Failed to MakeVarBindWithValue for type OBJECT_ID_TYPE."; |
|
static const char _MSG_MAKE_VARBIND_FAILED_FOR_OBJECT_ID_TYPE_KEY [] = |
|
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_MAKE_FAILED_FOR_OBJECT_ID_TYPE"; |
|
|
|
static const char _MSG_MAKE_VARBIND_FAILED_FOR_INTEGER_TYPE [] = |
|
"Failed to MakeVarBindWithValue for type INTEGER_TYPE."; |
|
static const char _MSG_MAKE_VARBIND_FAILED_FOR_INTEGER_TYPE_KEY [] = |
|
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_MAKE_FAILED_FOR_INTEGER_TYPE"; |
| |
static const char _MSG_OBJECT_ID_TYPE [] = "OBJECT_ID_TYPE"; |
|
|
|
static const char _MSG_INTEGER_TYPE [] = "INTEGER_TYPE"; |
|
| |
static const char _MSG_VERSION_NOT_SUPPORTED [] = | static const char _MSG_VERSION_NOT_SUPPORTED [] = |
"$0 and $1 are the only supported $2 values."; |
"SNMPv1 Trap and SNMPv2C Trap are the only supported SNMPVersion values."; |
static const char _MSG_SNMPv1 [] = "SNMPv1 Trap"; |
|
static const char _MSG_SNMPv2C [] = "SNMPv2C Trap"; |
|
static const char _MSG_SNMPVersion [] = "SNMPVersion"; |
|
static const char _MSG_VERSION_NOT_SUPPORTED_KEY [] = | static const char _MSG_VERSION_NOT_SUPPORTED_KEY [] = |
"Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_VERSION_NOT_SUPPORTED"; | "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_VERSION_NOT_SUPPORTED"; |
| |
|
|
| |
void initialize(); | void initialize(); |
| |
|
void terminate(); |
|
|
/** | /** |
Send snmp trap to the target. | Send snmp trap to the target. |
@param trapOid snmp trap OID | @param trapOid snmp trap OID |
|
|
const Uint32& portNumber, | const Uint32& portNumber, |
const Uint16& snmpVersion, | const Uint16& snmpVersion, |
const String& engineID, | const String& engineID, |
Array<String>& vbOids, |
const Array<String>& vbOids, |
Array<String>& vbTypes, |
const Array<String>& vbTypes, |
Array<String>& vbValues); |
const Array<String>& vbValues); |
| |
private: | private: |
char * _getIPAddress(const CString& hostName); | char * _getIPAddress(const CString& hostName); |