Hi, J.S.

Ah... 0xffe3 will be treat as a minus integer... And by recheck ISO/ 
IEC 8825-1:2003 (E) (BER encoding), I find this:

8.3.2 If the contents octets of an integer value encoding consist of  
more than one octet, then the bits of the first octet and bit 8 of the  
second octet:
a) shall not all be ones; and
b) shall not all be zero.
NOTE – These rules ensure that an integer value is always encoded in  
the smallest possible number of octets.

So this is mistake in my BER encode function for integer.

Sorry for disturbing this mail list.

Regards,
Chun TIAN (binghe)

On Feb 4, 2008, at 12:08 PM, Juergen Schoenwaelder wrote:

> On Sun, Feb 03, 2008 at 11:07:28PM +0000, Dave Shield wrote:
>
>>> What I don't know is why this value must be encoded to a 3-bytes  
>>> integer,
>>> not 2-bytes, just like this:
>>>
>>> 0x02, 0x02, 0xff, 0xe3
>>
>> Because the BER encoding does *not* use 8-bit values.
>> It uses 7-bit values plus a continuation bit.
>> The top-most bit of the first octet of an integer value must
>> *ALWAYS* be 0.
>
> You both get it wrong. The 0x00 byte is required since the value is a
> signed integer.
>
> /js
>
> -- 
> Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587         Campus Ring 1, 28759 Bremen, Germany
> Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to