The ArcSNMPWithOid method returns the information about SNMP OID.
virtual ARC_STATUS ArcSNMPWithOid( int *oid, int *length, unsigned
char *szCommunity, int *ret_oid, unsigned
char *tag, unsigned
char **var, int *var_len ); |
[IN]
oid: An integer array contains OID name
length: The length of OID.
szCommunity: Community string
[OUT]
ret_oid: An
integer array contains OID name returned from RAID subsystem.
tag:
The SNMP tag of the returning value.
var:
The answer of the returned OID.
var_len:
The length of the answer.
This method returns the ARC_STATUS.
The parameter of length acts both input and output,
in the input mode this filed is the length of oid,
and
in the output mode this filed is the length of the ret_oid.
The szCommunity must
terminates with a null-character
unsigned char tag; int name[] =
{1,3,6,1,4,1,18928,1,1,1,1}; int ret_oid[20]; int length = sizeof(name)
/ sizeof(int); unsigned char *var = NULL; int ret_var_len
= 0; char string[256]; char *result_str
= NULL; int result_len
= 0; int long_ret
= 0; // ignore the
initialization process of the CArclib stat = ar[0].ArcSNMPWithOid( (int *)name, (int *)&length, (unsigned char *)"public", ret_oid, &tag,
&var, (int *)&ret_var_len
); if ( stat == ARC_SUCCESS ) { if ( tag == 0x02
/*ASN_INTEGER*/ ) { long_ret = *((long *)var); } else if ( tag == 0x04
/*ASN_OCTET_STR*/ ) { result_str = (char *)var; result_len = ret_var_len; result_str[result_len] = 0; sprintf(string,"%s", result_str); } } |