The first nibble of coap over tcp message format is used
to indicate the length of the options/payload.
if the first nibble is 13, An 8-bit unsigned integer follows
the initial byte and indicates the length of options/payload minus 13.
(14: 16-bit unsigned integer,
indicates the length of options/payload minus 269.
15: 32-bit unsigned interger,
indicates the length of options/payload minus 65805)
Change-Id: I2a88eb161584fb0104d2b533e3456c19a4b99304
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4479
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
#ifdef WITH_TCP
coap_transport_type coap_get_tcp_header_type_from_size(unsigned int size)
{
- if (COAP_TCP_LENGTH_LIMIT_8_BIT < size && COAP_TCP_LENGTH_LIMIT_16_BIT >= size)
+ if (COAP_TCP_LENGTH_FIELD_8_BIT < size && COAP_TCP_LENGTH_FIELD_16_BIT >= size)
{
return coap_tcp_8bit;
}
- else if (COAP_TCP_LENGTH_LIMIT_16_BIT < size && COAP_TCP_LENGTH_LIMIT_32_BIT >= size)
+ else if (COAP_TCP_LENGTH_FIELD_16_BIT < size && COAP_TCP_LENGTH_FIELD_32_BIT >= size)
{
return coap_tcp_16bit;
}
- else if (COAP_TCP_LENGTH_LIMIT_32_BIT < size)
+ else if (COAP_TCP_LENGTH_FIELD_32_BIT < size)
{
return coap_tcp_32bit;
}