Octet string length bigger than 255 - SNMP

This is a discussion on Octet string length bigger than 255 - SNMP ; Hi, how would be the values of the octets which represent the length of an octet string object have when its length is bigger than 255? Thanks a lot, Andre...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Octet string length bigger than 255

  1. Octet string length bigger than 255

    Hi,

    how would be the values of the octets which represent the length of an
    octet string object have when its length is bigger than 255?

    Thanks a lot,

    Andre

  2. Re: Octet string length bigger than 255

    Hi,

    I found that when the length is small than 128, the length of contents
    will have just one octet and its value will be this the length itself.
    But when the length is greater than 127, the most significative bit of
    the first octet will be 1, and the other 7 bits will indicate the
    number of the remaining octets of the length of contents fields.
    My question now is which of the following sequence of octets
    represents a length
    of 200?

    0x81, 0xC8 or 0x82, 0x00, 0xC8

    Thanks,

    Andre

    sieg1974@yahoo.com (sieg1974) wrote in message news:<897326d0.0311020800.6299c60b@posting.google.com>...
    > Hi,
    >
    > how would be the values of the octets which represent the length of an
    > octet string object have when its length is bigger than 255?
    >
    > Thanks a lot,
    >
    > Andre


  3. Re: Octet string length bigger than 255

    HI,

    SNMP messages are encoded using the basic encoding rules (BER).
    ASN.1 values are encoded as tag, length, value. The length, if
    less tahn 128 can be encoded in one octet. If greater than 127,
    then the first octet used to encode the length specifies the
    number of octets that follow that specify the length. BER
    has no requirement that the length be encoded in the minmum
    number of octets. So, a length of 200 could be encoded
    as 0x81c8, or as 0x8200c8.

    On 2 Nov 2003, sieg1974 wrote:
    > Hi,
    >
    > I found that when the length is small than 128, the length of contents
    > will have just one octet and its value will be this the length itself.
    > But when the length is greater than 127, the most significative bit of
    > the first octet will be 1, and the other 7 bits will indicate the
    > number of the remaining octets of the length of contents fields.
    > My question now is which of the following sequence of octets
    > represents a length
    > of 200?
    >
    > 0x81, 0xC8 or 0x82, 0x00, 0xC8
    >
    > Thanks,
    >
    > Andre
    >
    > sieg1974@yahoo.com (sieg1974) wrote in message news:<897326d0.0311020800.6299c60b@posting.google.com>...
    > > Hi,
    > >
    > > how would be the values of the octets which represent the length of an
    > > octet string object have when its length is bigger than 255?
    > >
    > > Thanks a lot,
    > >
    > > Andre

    Regards,
    /david t. perkins


+ Reply to Thread