Thanks Dave. Still the output does not look like
Ipaddress.
> 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
The output should come as dotted decimal. Please let
me know if Any thing wrong in my understanding.
Regards
Mamon.
--- Dave Shield <[EMAIL PROTECTED]> wrote:
> On Mon, 2005-10-31 at 22:17 -0800, mahua dutta
> wrote:
>
> > I like to know whether Inetaddress be considered
> > as OCTET sting while implementing the mib.
>
> Yes.
> It *must* be considered as an OCTET STRING.
>
> > If So, for Ipv6 or Ipv4, the pseudo code can be as
> > snmp_set_var_typed_value(var, ASN_OCTET_STR,
> (u_char
> > *)"127.0.0.1", strlen("127.0.0.1")).
> >
> > Is it correct to do that ?
>
> No.
> An IPv4 address is a fixed-length *binary* string,
> not a (variable-length) printable string.
> See RFC 2578, section 7.1.5
>
> So this code would actually be more like:
>
> 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);
>
> IPv6 addresses would be handled in a similar way.
>
>
> > There is an similar question in the following link
> >
>
http://sourceforge.net/mailarchive/message.php?msg_id=11149756
>
> Not really - this questioner *was* using a fixed
> length binary string, and was asking about the
> difference between ASN_OCTET_STR and ASN_IPADDRESS
>
> The two types work in basically the same way - they
> both use *binary* string values, not printable ones.
>
> Dave
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
-------------------------------------------------------
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