Return to snmpDeliverTrap_emanate.h CVS log | Up to [Pegasus] / pegasus / src / Pegasus / Handler / snmpIndicationHandler |
File: [Pegasus] / pegasus / src / Pegasus / Handler / snmpIndicationHandler / snmpDeliverTrap_emanate.h
(download)
Revision: 1.15, Tue Nov 14 18:34:53 2006 UTC (17 years, 7 months ago) by kumpf Branch: MAIN CVS Tags: TASK_PEP328_SOLARIS_NEVADA_PORT, TASK-PEP328_SOLARIS_NEVADA_PORT_v2-root, TASK-PEP328_SOLARIS_NEVADA_PORT_v2-branch, TASK-PEP328_SOLARIS_NEVADA_PORT-root, TASK-PEP328_SOLARIS_NEVADA_PORT-branch, TASK-PEP328_SOLARIS_IX86_CC_PORT-root, TASK-PEP328_SOLARIS_IX86_CC_PORT-branch-v2, TASK-PEP328_SOLARIS_IX86_CC_PORT-branch, TASK-PEP311_WSMan-root, TASK-PEP311_WSMan-branch, TASK-PEP305_VXWORKS-root, TASK-PEP305_VXWORKS-branch-pre-solaris-port, TASK-PEP305_VXWORKS-branch-post-solaris-port, TASK-PEP305_VXWORKS-branch-beta2, TASK-PEP305_VXWORKS-branch, TASK-PEP305_VXWORKS-2008-10-23, TASK-PEP291_IPV6-root, TASK-PEP291_IPV6-branch, TASK-PEP286_PRIVILEGE_SEPARATION-root, TASK-PEP286_PRIVILEGE_SEPARATION-branch, TASK-PEP274_dacim-root, TASK-PEP274_dacim-merged_out_to_branch, TASK-PEP274_dacim-merged_out_from_trunk, TASK-PEP274_dacim-merged_in_to_trunk, TASK-PEP274_dacim-merged_in_from_branch, TASK-PEP274_dacim-branch, TASK-Bug2102_RCMPIWindows-root, TASK-Bug2102_RCMPIWindows-merged_out_to_branch, TASK-Bug2102_RCMPIWindows-merged_out_from_trunk, TASK-Bug2102_RCMPIWindows-merged_in_to_trunk, TASK-Bug2102_RCMPIWindows-merged_in_from_branch, TASK-Bug2102_RCMPIWindows-branch, TASK-Bug2102Final-root, TASK-Bug2102Final-merged_out_to_branch, TASK-Bug2102Final-merged_out_from_trunk, TASK-Bug2102Final-merged_in_to_trunk, TASK-Bug2102Final-merged_in_from_branch, TASK-Bug2102Final-branch, TASK-BUG7240-root, TASK-BUG7240-branch, TASK-BUG7146_SqlRepositoryPrototype-root, TASK-BUG7146_SqlRepositoryPrototype-merged_out_to_branch, TASK-BUG7146_SqlRepositoryPrototype-merged_out_from_trunk, TASK-BUG7146_SqlRepositoryPrototype-merged_in_to_trunk, TASK-BUG7146_SqlRepositoryPrototype-merged_in_from_branch, TASK-BUG7146_SqlRepositoryPrototype-branch, RELEASE_2_8_2-RC1, RELEASE_2_8_2, RELEASE_2_8_1-RC1, RELEASE_2_8_1, RELEASE_2_8_0_BETA, RELEASE_2_8_0-RC2, RELEASE_2_8_0-RC1, RELEASE_2_8_0-FC, RELEASE_2_8_0, RELEASE_2_8-root, RELEASE_2_8-branch, RELEASE_2_7_3-RC1, RELEASE_2_7_3, RELEASE_2_7_2-RC1, RELEASE_2_7_2, RELEASE_2_7_1-RC1, RELEASE_2_7_1, RELEASE_2_7_0-RC1, RELEASE_2_7_0-BETA, RELEASE_2_7_0, RELEASE_2_7-root, RELEASE_2_7-branch, RELEASE_2_6_3-RC2, RELEASE_2_6_3-RC1, RELEASE_2_6_3, RELEASE_2_6_2-RC1, RELEASE_2_6_2, RELEASE_2_6_1-RC1, RELEASE_2_6_1, RELEASE_2_6_0-RC1, RELEASE_2_6_0, RELEASE_2_6-root, RELEASE_2_6-branch-clean, RELEASE_2_6-branch, PEP286_PRIVILEGE_SEPARATION_ROOT, PEP286_PRIVILEGE_SEPARATION_CODE_FREEZE, PEP286_PRIVILEGE_SEPARATION_BRANCH, PEP286_PRIVILEGE_SEPARATION_1 Changes since 1.14: +98 -70 lines BUG#: 5850 TITLE: Source files do not meet chksrc requirements DESCRIPTION: Remove tab characters and author names and shorten lines that are wider than 80 characters. |
//%2006//////////////////////////////////////////////////////////////////////// // // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development // 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 // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // //============================================================================== // //%///////////////////////////////////////////////////////////////////////////// #include "sr_conf.h" #include <stdio.h> #include <stdarg.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <stdlib.h> #include <sys/types.h> #include <sys/sem.h> #include <sys/stat.h> #include <sys/param.h> #include <signal.h> #include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netdb.h> #include <errno.h> #include "sr_snmp.h" #include "comunity.h" #include "v2clssc.h" #include "sr_trans.h" #include "context.h" #include "method.h" #include "diag.h" #include "subagent.h" #include "agentsoc.h" #include "evq.h" #include "sig.h" #include <iostream> #include <Pegasus/Common/Config.h> #include "snmpDeliverTrap.h" PEGASUS_NAMESPACE_BEGIN // l10n // lots of hacking to make up these messages static const char _MSG_INITSUBAGENT_FAILED[] = "InitSubagent Failed to initialize"; static const char _MSG_INITSUBAGENT_FAILED_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_INITSUBAGENT_FAILED"; static const char _MSG_INVALID_TRAPOID[] = "Invalid trapOid."; static const char _MSG_INVALID_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; static const char _MSG_DESTINATION_NOT_FOUND[] = "Can not find trap destination."; static const char _MSG_DESTINATION_NOT_FOUND_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_DESTINATION_NOT_FOUND"; static const char _MSG_TARGETHOSTFORMAT_NOT_SUPPORTED[] = "Host Name and IPV4 Address are the only supported TargetHostFormat " "values."; static const char _MSG_TARGETHOSTFORMAT_NOT_SUPPORTED_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_TARGETHOSTFORMAT_NOT_SUPPORTED"; static const char _MSG_INVALID_SECURITY_NAME[] = "Invalid SNMP SecurityName."; static const char _MSG_INVALID_SECURITY_NAME_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; static const char _MSG_INVALID_OCTET_VALUE[] = "Invalid octet value in trap destination."; static const char _MSG_INVALID_OCTET_VALUE_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_INVALID_OCTET_VALUE"; static const char _MSG_CREATE_OCTET_FAILED[] = "Creation of empty 4 length OctetString failed."; static const char _MSG_CREATE_OCTET_FAILED_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_CREATE_OCTET_FAILED"; static const char _MSG_INVALID_ENTERPRISEOID[] = "Invalid enterpriseOid."; static const char _MSG_INVALID_ENTERPRISEOID_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate._MSG_INVALID"; static const char _MSG_INVALID_PROPERTYOID[] = "Invalid OID of CIM Property."; static const char _MSG_INVALID_PROPERTYOID_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_INVALID_PROPERTYOID"; static const char _MSG_INVALID_PROPERTYVALUE[] = "Invalid value of CIM Property."; static const char _MSG_INVALID_PROPERTYVALUE_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_INVALID_PROPERTY"; static const char _MSG_MAKE_VARBIND_FAILED_FOR_OCTET_PRIM_TYPE[] = "Failed to MakeVarBindWithValue for type OCTET_PRIM_TYPE."; static const char _MSG_MAKE_VARBIND_FAILED_FOR_OCTET_PRIM_TYPE_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_MAKE_FAILED_FOR_OCTET_PRIM_TYPE"; static const char _MSG_MAKE_VARBIND_FAILED_FOR_OBJECT_ID_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_VERSION_NOT_SUPPORTED[] = "SNMPv1 Trap and SNMPv2C Trap are the only supported SNMPVersion values."; static const char _MSG_VERSION_NOT_SUPPORTED_KEY[] = "Handler.snmpIndicationHandler.snmpDeliverTrap_emanate." "_MSG_VERSION_NOT_SUPPORTED"; class snmpDeliverTrap_emanate : public snmpDeliverTrap { public: snmpDeliverTrap_emanate(); ~snmpDeliverTrap_emanate(); void initialize(); void terminate(); /** Send snmp trap to the target. @param trapOid snmp trap OID @param securityName either an SNMPv1 or SNMPv2c community name or an SNMPv3 user name @param targetHost address of the trap/infom destination @param targetHostFormat targetHost format @param otherTargetHostFormat other target format type @param portNumber UDP port number to send the trap/inform @param snmpVersion snmp version and format to use to send the indication @param engineID snmp engine ID used to create the SNMPv3 inform @param vbOids VarBind OIDs @param vbTypes VarBind types @param vbValues VarBind values */ void deliverTrap( const String& trapOid, const String& securityName, const String& targetHost, const Uint16& targetHostFormat, const String& otherTargetHostFormat, const Uint32& portNumber, const Uint16& snmpVersion, const String& engineID, const Array<String>& vbOids, const Array<String>& vbTypes, const Array<String>& vbValues); private: char* _getIPAddress(const CString& hostName); Boolean _isValidOctet(const Uint32& octetValue); /** Values for the TargetHostFormat property of the PG_IndicationHandlerSNMPMapper class. */ enum TargetHostFormat { _OTHER = 1, _HOST_NAME = 2, _IPV4_ADDRESS = 3, _IPV6_ADDRESS = 4 }; enum SNMPVersion { _SNMPv1_TRAP = 2, _SNMPv2C_TRAP = 3, _SNMPv2C_INFORM = 4, _SNMPv3_TRAP = 5, _SNMPv3_INFORM = 6 }; }; PEGASUS_NAMESPACE_END
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |