version 1.3.2.2, 2006/11/08 22:58:06
|
version 1.8, 2006/08/11 19:47:07
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Yi Zhou, Hewlett-Packard Company (Yi.Zhou@hp.com) |
|
// |
|
// Modified By: |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <Pegasus/Common/Packer.h> | #include <Pegasus/Common/Packer.h> |
|
|
exceptionStr = _MSG_SESSION_OPEN_FAILED; | exceptionStr = _MSG_SESSION_OPEN_FAILED; |
| |
// Get library, system errno | // Get library, system errno |
snmp_sess_error(&snmpSession, &libErr, &sysErr, &errStr); |
snmp_error(&snmpSession, &libErr, &sysErr, &errStr); |
| |
exceptionStr.append(errStr); | exceptionStr.append(errStr); |
| |
|
|
communityName = securityName; | communityName = securityName; |
} | } |
| |
if (snmpSession.peername) |
|
{ |
|
free(snmpSession.peername); | free(snmpSession.peername); |
} |
|
| |
if (sessionPtr->community) |
|
{ |
|
free(sessionPtr->community); | free(sessionPtr->community); |
} |
|
| |
CString communityNameCStr = communityName.getCString(); | CString communityNameCStr = communityName.getCString(); |
size_t communityNameLen = strlen(communityNameCStr); | size_t communityNameLen = strlen(communityNameCStr); |
|
|
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, | throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, |
MessageLoaderParms(_MSG_VERSION_NOT_SUPPORTED_KEY, | MessageLoaderParms(_MSG_VERSION_NOT_SUPPORTED_KEY, |
_MSG_VERSION_NOT_SUPPORTED)); | _MSG_VERSION_NOT_SUPPORTED)); |
break; |
|
} | } |
} | } |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
| |
|
|
// Pack trap information into the PDU | // Pack trap information into the PDU |
void snmpDeliverTrap_netsnmp::_packTrapInfoIntoPdu( | void snmpDeliverTrap_netsnmp::_packTrapInfoIntoPdu( |
const String & trapOid, | const String & trapOid, |
|
|
CString trapOidCStr = trapOid.getCString(); | CString trapOidCStr = trapOid.getCString(); |
| |
char * trapOidCopy = strdup(trapOidCStr); | char * trapOidCopy = strdup(trapOidCStr); |
char * numericEntOid = (char *) malloc(strlen(trapOidCStr)); |
|
|
|
try |
|
{ |
|
| |
#if !defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) | #if !defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) |
char *last; | char *last; |
|
|
| |
enterpriseOidLength = MAX_OID_LEN; | enterpriseOidLength = MAX_OID_LEN; |
| |
|
char * numericEntOid = (char *) malloc(strlen(trapOidCStr)); |
if (Contains(standard_traps, trapOid)) | if (Contains(standard_traps, trapOid)) |
{ | { |
// | // |
|
|
strcat(numericEntOid, oidSubIdentifiers[i]); | strcat(numericEntOid, oidSubIdentifiers[i]); |
} | } |
| |
if (oidSubIdentifiers[oidSubIdentifiers.size()-2] != "0") |
if (strcmp(oidSubIdentifiers[oidSubIdentifiers.size()-2], "0") != 0) |
{ | { |
strcat(numericEntOid, "."); | strcat(numericEntOid, "."); |
strcat(numericEntOid, | strcat(numericEntOid, |
|
|
enterpriseOidLength * sizeof(oid)); | enterpriseOidLength * sizeof(oid)); |
| |
snmpPdu->enterprise_length = enterpriseOidLength; | snmpPdu->enterprise_length = enterpriseOidLength; |
} |
|
catch (...) |
|
{ |
|
free(trapOidCopy); |
|
free(numericEntOid); |
|
|
|
PEG_METHOD_EXIT(); |
|
throw; |
|
} |
|
| |
free(trapOidCopy); | free(trapOidCopy); |
free(numericEntOid); | free(numericEntOid); |