Re: snprint_value formating

Dave Shield <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On Thu, 2005-12-01 at 13:26 -0800, marc schneider wrote: 
> I'm using snprint_value to format data retrieve from the RMON field
> captureBufferPacketData. The MIB defines this as octet data. Sometimes
> this data is formated by snprint_value as Hex-STRING and sometimes it
> is formatted as STRING. Is there a way to force this to always be
> formatted as Hex-STRING?

   $ man snmpcmd
   
   OUTPUT OPTIONS
       -Oa    If a string-valued object definition does not
              include a Display Hint, then the library attempts
              to  determine  whether it  is an ascii or binary
              string, and displays the value accordingly.  This
              flag bypasses this check, and displays all strings
              as ASCII.  Note that this does not affect objects
              that do have a Display Hint.

       -Ox    This works similarly to ’-Oa’, but displays strings
              as Hex.


Or

        case 'a':
            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
                               NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT,
                               NETSNMP_STRING_OUTPUT_ASCII);
            break;
        case 'x':
            netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
                               NETSNMP_DS_LIB_STRING_OUTPUT_FORMAT,
                               NETSNMP_STRING_OUTPUT_HEX);
            break;

Dave 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.