OoO En cette aube naissante du dimanche 21 décembre 2008, vers 07:56,
"Lucian Romi" <[email protected]> disait :
> My code
> "
> u_char response[1];
> case MODE_GET:
> response[0] = 0x69;
> snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
> (u_char *)response, 1);
> break;
> Output for snmpget.
> SNMPv2-SMI::enterprises.27594.2.1.1.24.0 = STRING: "i"
> Interesting thing is if I set my response to a small number, say 0x06. It's
> showing my desire value 06.
If the string contains non printable characters, snmpget will display
the string as an hex string.
I don't quite understand why you don't want to use ASN_INTEGER, even if
you store the int as a byte in your program. Using a MIB, you can also
use a display hint to force displaying the octet string in hex format.
--
Don't over-comment.
- The Elements of Programming Style (Kernighan & Plauger)
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users