On Wed, 2005-11-02 at 00:06 -0800, mahua dutta wrote:
> >    char  localhost[4];
> >    localhost[0] = 127;
> >    localhost[1] = 0;
> >    localhost[2] = 0;
> >    localhost[3] = 1;
> > 
> >    snmp_set_var_typed_value( var, ASN_OCTET_STR,
> >                                   localhost, 4);
> 
> In that case, snmpwalk wil give the output as
> Hex-STRING: 7F 00 00 01

Which is the correct OCTET STRING value.


> The output should come as dotted decimal.

Snmpwalk will simply display the value that it
receives.  It can't do any clever presentation
without explicit instructions.

Two possibilities spring to mind:

  a)  set the typed value as 'ASN_IPADDRESS'
      instead of 'ASN_OCTET_STR'

  b)  define the MIB object using a syntax
      of InetAddressIPv4 (or equivalent)

Either of those should provide snmpwalk with
the necessary guidance to display the value
in the expected format.

But that assumes you're working with a private
MIB, and can adjust the fine details of the MIB
object definition.  As Wes says, if you're using
an existing MIB (from an external source), then
you've got to follow the specification as given.

Dave


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to