RE: Get BITS value

"Yong Chen (yongche)" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <52E903A38F544F46A2A6632AC66103EEE6F598@xmb-sjc-221.amer.cisco.com>
Hi Dave,

Thanks a lot for your patience. I re-read the RFC and understand it
better. Yes you are right I was thinking about it in terms of Integers.

Thanks and appreciate your help,
Yong Chen

-----Original Message-----
From: Dave Shield [mailto:[email protected]] 
Sent: Monday, October 31, 2005 1:48 AM
To: Yong Chen (yongche)
Cc: [email protected]
Subject: RE: Get BITS value

On Fri, 2005-10-28 at 10:59 -0700, Yong Chen (yongche) wrote:
> But I thought an instance with bits v0, v3 and v10 set would be:
> 
>       00000100 00000101
>            ^        ^ ^
>   bit      10       3 0

Why?
RFC 1906 states very clearly:

   (3)  When encoding an object whose syntax is described using the BITS
        construct, the value is encoded as an OCTET STRING, in which all
        the named bits in (the definition of) the bitstring, commencing
        with the first bit and proceeding to the last bit, are placed in
        bits 8 to 1 of the first octet, followed by bits 8 to 1 of each
        subsequent octet in turn....

RFC 3416/7 is even more explicit that bit 8 is the high order bit, and
bit 1 is the low order bit.

You still seem to be thinking in terms of this as a numeric value.
It's not - it's a *string* of independent bits.  


> So it's 0x04 and 0x05 (not 0x90 & 0x20). That's why I did the "funny"
> conversion based on RFC 3417 section 8.

You're looking in the right place, but seem to be interpreting it
backwards.

> Also should I send out 0x9020 or 0x2090?

0x9020 - as you quoted below

>  Does big/small endian-ness (and network order) play a role here?

No.


Dave


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
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.