Subject: [core] Clarification regarding the length field mentioned for options in COAP Specification

From: Hari Hara Sudhan R <[email-masked]>
Date: Thu, 22 Jul 2010 18:08:23 +0530

Hi,

I have a doubt regarding the length field mentioned for options in
COAP specification.

I feel that TLV format mentioned for header options is not clear.
So please consider giving some example for this in the future versions.

To validate my understanding I have provided an example. Please let me
know whether
my understanding is correct

Example:

Suppose app want to send URI-SCHEME option as first and only option and
if the the length of option value is say 200

My option header would be some thing like this.

+---+---+---+---+---+---+
| 4 | 14| data(1 to 15) |
+---+---+---+---+---+---+

for 15..270:
+---+---+---+---+---+---+---+
| 0 | 185   | data(16-200)  |
+---+---+---+---+---+---+---+

Thanks and Regards,
Hari Hara Sudhan

---

From: Carsten Bormann <[email-masked]>
Date: Thu, 22 Jul 2010 18:34:45 +0200

Hi Hari,

it would help the editors if you could indicate what sections/what phrases are unclear.

> if the the length of option value is say 200

Uri-Scheme has option number 3, so the left-most nibble would be 3 (given that this is the only option and you are starting at 0, see 3.2 first paragraph).
The next nibble would be 15 (0b1111), to indicate that the length is larger than 14.
In summary, the first byte of the option would have a value of 63 (0x3F).
The next byte would indeed be 185 (0xB9), i.e. 200-15.
The next 200 bytes are then the option value (as there are 200 bytes of Uri-Scheme).
(Note that there are no 200-byte URI scheme names and I hope there never will be, but let's ignore that for now.)

Gruesse, Carsten