RE: Get BITS value

"Yong Chen (yongche)" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <52E903A38F544F46A2A6632AC66103EEDF819C@xmb-sjc-221.amer.cisco.com>
Also you are saying the net-snmp stack doesn't reverse the order, so I
(the mib implementator) need to do it?

Thank you,
Yong Chen 

-----Original Message-----
From: Yong Chen (yongche) 
Sent: Thursday, October 27, 2005 1:36 PM
To: 'Dave Shield'
Cc: [email protected]
Subject: RE: Get BITS value

Hi Dave,

Thanks for the reply. Then how should I get the response OCTET STRING?
How did you get 0x90 & 0x20 ? 

Thanks,
Yong Chen

-----Original Message-----
From: Dave Shield [mailto:[email protected]]
Sent: Thursday, October 27, 2005 1:15 AM
To: Yong Chen (yongche)
Cc: [email protected]
Subject: Re: Get BITS value

On Wed, 2005-10-26 at 17:46 -0700, Yong Chen (yongche) wrote:
> I have a question regarding BITS object, please help.
> I'm using netsnmp 5.1.

That's fairly old - we'd strongly suggest that you upgrade.
mib2c has never been very good at handling BITS-syntax objects, but I
believe that newer versions are a little bit better.



> Lets say in get func, I want to return the value with v0, v3 and v10 
> set, so the value is: 1 + 4 + 512 = 517.

No.
A BITS-based object is *not* an integer-based value.
The SMI BITS syntax is built on OCTET STRING.

An istance with bits v0, v3 and v10 set will have the value:

    10010000 00100000

so will consist of the two octets  0x90 & 0x20


>  Is following pseudo code correct?

Well, you come up with the correct answers.
But you have a *very* funny way of getting there!



> Also mib2c by default puts *var_len=sizeof(int32_t),  am I correct in 
> saying it may be wrong?

Yes, it's wrong.
It shouldn't be treating the value as an integer at all.


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.