version 1.16, 2003/10/22 14:26:11
|
version 1.21, 2006/01/27 19:21:20
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., 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.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // 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. |
// | // |
// 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 |
|
|
| |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
#include <Pegasus/Common/ArrayInternal.h> | #include <Pegasus/Common/ArrayInternal.h> |
#include <Pegasus/Common/Destroyer.h> |
|
#include <Pegasus/Common/InternalException.h> | #include <Pegasus/Common/InternalException.h> |
#include "snmpDeliverTrap_emanate.h" | #include "snmpDeliverTrap_emanate.h" |
| |
|
|
| |
#include <prnt_lib.h> // MUST be at the end in include list. | #include <prnt_lib.h> // MUST be at the end in include list. |
| |
static char *sr_filename = __FILE__; |
static const char *sr_filename = __FILE__; |
| |
IPCFunctionP IPCfp; /* IPC functions pointer */ | IPCFunctionP IPCfp; /* IPC functions pointer */ |
| |
|
|
| |
snmpDeliverTrap_emanate::snmpDeliverTrap_emanate() | snmpDeliverTrap_emanate::snmpDeliverTrap_emanate() |
{ | { |
|
// |
|
// Initialize Subagent and establish comunication with the Master Agent |
|
// |
|
initialize(); |
} | } |
| |
snmpDeliverTrap_emanate::~snmpDeliverTrap_emanate() | snmpDeliverTrap_emanate::~snmpDeliverTrap_emanate() |
{ | { |
|
// |
|
// Close the connection to the Master Agent and shut down the |
|
// Subagent |
|
// |
|
EndSubagent(); |
} | } |
| |
| |
|
|
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) |
{ | { |
VarBind *vbhead = NULL; | VarBind *vbhead = NULL; |
VarBind *vb = NULL; | VarBind *vb = NULL; |
|
|
| |
OID *object = NULL; | OID *object = NULL; |
| |
// Initialize with Master agent |
|
|
|
initialize(); |
|
|
|
// Translate a string into an OID | // Translate a string into an OID |
OID *sendtrapOid = MakeOIDFromDot(trapOid.getCString()); | OID *sendtrapOid = MakeOIDFromDot(trapOid.getCString()); |
| |
|
|
struct hostent *targetHostInfo; | struct hostent *targetHostInfo; |
struct in_addr in; | struct in_addr in; |
| |
#ifdef PEGASUS_OS_SOLARIS |
#if defined(PEGASUS_OS_LINUX) |
#define HOSTENT_BUFF_SIZE 8192 |
char hostEntryBuffer[8192]; |
char buf[HOSTENT_BUFF_SIZE]; |
struct hostent hostEntryStruct; |
struct hostent h_result; |
int hostEntryErrno; |
int h_errorp; |
|
targetHostInfo=gethostbyname_r(hostName, &h_result, buff, |
gethostbyname_r( |
HOSTENT_BUFF_SIZE, &h_errorp); |
hostName, |
|
&hostEntryStruct, |
|
hostEntryBuffer, |
|
sizeof(hostEntryBuffer), |
|
&targetHostInfo, |
|
&hostEntryErrno); |
|
#elif defined(PEGASUS_OS_SOLARIS) |
|
char hostEntryBuffer[8192]; |
|
struct hostent hostEntryStruct; |
|
int hostEntryErrno; |
|
|
|
targetHostInfo = gethostbyname_r( |
|
(char *)hostName, |
|
&hostEntryStruct, |
|
hostEntryBuffer, |
|
sizeof(hostEntryBuffer), |
|
&hostEntryErrno); |
#else | #else |
targetHostInfo = gethostbyname(hostName); | targetHostInfo = gethostbyname(hostName); |
#endif | #endif |