version 1.5, 2007/02/21 10:02:34
|
version 1.6, 2007/06/26 20:26:16
|
|
|
#include <Pegasus/Common/FileSystem.h> | #include <Pegasus/Common/FileSystem.h> |
#include <Pegasus/Common/Stopwatch.h> | #include <Pegasus/Common/Stopwatch.h> |
#include <Pegasus/Client/CIMClient.h> | #include <Pegasus/Client/CIMClient.h> |
|
#include <Pegasus/Common/HostAddress.h> |
| |
PEGASUS_USING_PEGASUS; | PEGASUS_USING_PEGASUS; |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
const String FILTER_NAME = String ("IPFilter01"); | const String FILTER_NAME = String ("IPFilter01"); |
| |
enum SNMPVersion {_SNMPV1_TRAP = 2, _SNMPV2C_TRAP = 3}; | enum SNMPVersion {_SNMPV1_TRAP = 2, _SNMPV2C_TRAP = 3}; |
enum TargetHostFormat {_HOST_NAME = 2, _IPV4_ADDRESS = 3}; |
enum TargetHostFormat {_HOST_NAME = 2, _IPV4_ADDRESS = 3, _IPV6_ADDRESS = 4}; |
| |
#define PORT_NUMBER 2006 | #define PORT_NUMBER 2006 |
| |
|
|
| |
try | try |
{ | { |
|
String ipAddress; |
|
int af; |
|
System::getHostIP(System::getFullyQualifiedHostName (), &af, ipAddress); |
// Create SNMPv2 trap handler | // Create SNMPv2 trap handler |
snmpv2HandlerObjectPath = _createHandlerInstance (client, | snmpv2HandlerObjectPath = _createHandlerInstance (client, |
SNMPV2C_HANDLER_NAME, | SNMPV2C_HANDLER_NAME, |
System::getHostIP(System::getFullyQualifiedHostName ()), |
ipAddress, |
"public", | "public", |
_IPV4_ADDRESS, |
af == AF_INET ? _IPV4_ADDRESS : _IPV6_ADDRESS, |
_SNMPV2C_TRAP); | _SNMPV2C_TRAP); |
} | } |
catch (CIMException& e) | catch (CIMException& e) |