snmp_set_var_typed_value with ASN_TIMETICKS problem
stan buyanov <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Could you help me with this problem?
The subagent that has been built using mib2c.table_data.conf returns a wrong value.
The explanations are in bold. Definitely something I am doing wrongly.
int
get_protocolDirLastChange(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
u_char str_return[MAX_VAR_LEN+1];
long returnVal = 123456;
sprintf((char*)str_return,"%d",returnVal);
int str_return_len = strlen((char*)str_return);
switch (reqinfo->mode) {
case MODE_GET:
//when there is str_return_len IReasonning MIB Browser gives error message: bad size for integer-like type (6)
snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS,
(u_char *)str_return,
str_return_len);
//when there is str_return_len = 4 IReasonning MIB Browser gives a wrong value (no error message)
//str_return_len = 4;
//snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS,
// (u_char *)str_return,
str_return_len);
break;
default:
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
Thanks,
Stan
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.