On 05 Nov 2004 10:50:22 +0530 Sasikumar wrote:
SB> below is the code snippet.
SB> cVal contains the result returned by the agent in string form, cVal is
SB>
SB> static u_char cVal[100];
SB>
SB> fLog("COLUMN_IPNETTOMEDIAPHYSADDRESS in string form is %s\n", cVal);
SB> snmp_set_var_typed_value(var, ASN_OCTET_STR,
SB> (u_char *) cVal,
SB> strlen(cVal)*sizeof(u_char)
SB> );
SB>
SB> The fLog output is as follows
SB>
SB> COLUMN_IPNETTOMEDIAPHYSADDRESS in string form is 00 00 5E 00 01 01
This is the problem. You want to pass the raw hex to snmp_set_var_typed_value,
not an actual string. If cVal is an ASCII string, you need to convert it to 6
hex bytes before passing it in, and you don't want to be using strlen. In
other words, cVal should not be a printable string.
--
Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/>
<irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users>
You are lost in a twisty maze of little standards, all different.
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
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