Re: about the hex-string

This is a discussion on Re: about the hex-string within the SNMP Users forums, part of the Networking and Network Related category; 2008/5/27 <javelin2008@sina.com>: > Good all. > > I am a new expolder in net-...


Go Back   Usenet Forums > Networking and Network Related > SNMP Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-27-2008
Dave Shield
 
Posts: n/a
Default Re: about the hex-string

2008/5/27 <javelin2008@sina.com>:
> Good all.
>
> I am a new expolder in net-snmp;
>
> I wirte a test mib and registered in the net-snmp lib,but where i run
> snmpwalk command,there are some problem:
>
> #snmpwalk -v 2c -c public localhost 1.3.6.1.4.1


[snip]

> In the handle functions they are ASN_OCTET_STR type.


An "Octet String" is simply a string of octets.
These could be printable characters, or binary data.
The same ASN.1 type is used for both.

The MIB file would normally include a DISPLAY HINT,
to indicate how this value should be printed.

In the absence of such a hint, the Net-SNMP library attempts
to guess whether this is a printable string, or a binary value,
based on the value returned.


> Please tell me how could the happen ?


Looking at the value returned:

> iso.3.6.1.4.1.55555.1.1.1.10.1.2.1 = Hex-STRING: 4E 55 4C 4C 00 00 00 00 00
> 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


This contains four printable characters ("NULL"),
followed by a large number of 0-valued octets, which
are not printable. So the library has decided that this
is a binary string value, and displayed it as such.

It looks as if the code implementing this particular
object has returned the full buffer holding the value,
rather than just the printable value itself.
I.e.

snmp_set_var_typed_value(
request->requestvb, ASN_OCTET_STR,
myRow->myColumn, sizeof(myRow->myColumn));

instead of

snmp_set_var_typed_value(
request->requestvb, ASN_OCTET_STR,
myRow->myColumn, strlen(myRow->myColumn));


If you use strlen, things should be OK.

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/...net-snmp-users

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0