On Fri, Feb 19, 2010 at 12:52 PM, neil.young <[email protected]> wrote:
> Hmm. Try to ask on another way: There are several variable length opaques
> throughout the draft, but - as far as I can see - the statement "there is an
> extra length byte on the wire" (what seems logical to me, btw) is provided
> only in conjunction with the RessourceID description. Does this statement
> implicitly apply to all other variable length opaques too?

This notation is derived from that of TLS (RFC 5246). Thus, you need to
look there to see how to encode these:


 Variable-length vectors are defined by specifying a subrange of legal
   lengths, inclusively, using the notation <floor..ceiling>.  When
   these are encoded, the actual length precedes the vector's contents
   in the byte stream.  The length will be in the form of a number
   consuming as many bytes as required to hold the vector's specified
   maximum (ceiling) length.  A variable-length vector with an actual
   length field of zero is referred to as an empty vector.

      T T'<floor..ceiling>;

   In the following example, mandatory is a vector that must contain
   between 300 and 400 bytes of type opaque.  It can never be empty.
   The actual length field consumes two bytes, a uint16, which is
   sufficient to represent the value 400 (see Section 4.4).  On the
   other hand, longer can represent up to 800 bytes of data, or 400
   uint16 elements, and it may be empty.  Its encoding will include a
   two-byte actual length field prepended to the vector.  The length of
   an encoded vector must be an even multiple of the length of a single
   element (for example, a 17-byte vector of uint16 would be illegal).

      opaque mandatory<300..400>;
            /* length field is 2 bytes, cannot be empty */
      uint16 longer<0..800>;
            /* zero to 400 16-bit unsigned integers */

-Ekr

> Sorry, if I wasn't specific enough with my question. I hope, it is clear
> now.
>
> Regards
>
>
>
> Eric Rescorla schrieb:
>
> Thus, the 3-byte value
>    "Foo" would be encoded as:  03 46 4f 4f.
>
> </quote>
>
> In fact it should be "encoded" as "03 46 6f 6f", or it should be named "FOO"
> :) (BTW: Those kind of errors in your draft is on the level I'm able to
> discover... :))
>
> Question behind: May I assume, that every "opaque" value, as far as no
> explicitly determined in length, is preceded by a length byte (or more bits)
> on the wire?
>
>
> There should never be a simple opaque that isn't either a fixed-length
> string (opaque foo[9]) or a veariable length vector (opaque foo<0..255>).
>
> -Ekr
>
_______________________________________________
P2PSIP mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/p2psip

Reply via email to