[coap] process CoAP header in message (#3419)

This commit refines Coap::Header into Coap::Message to avoid declaring
the big Coap::Header in stack which was causing problems in low-memory
systems such as CC2538.

A UDP reserves 56 bytes by default, which will not be used before an
outbound message goes down to transport layer and after an inbound
message is delievered to CoAP agent. To get better performance, this commit
utilizes these reserved bytes of cache basic header of CoAP message
including CoAP version, code, message ID and token. These cached data
are parsed when CoAP agent receives a CoAP message and are dumped into
the correct place of a CoAP Message before sending by lower layer.

To make sure there is enough reserved bytes for an inbound message, This
commit removes headers in UDP layer before delivering a ot::Message to
handlers.
This commit is contained in:
Yakun Xu
2019-01-15 05:00:21 -08:00
committed by Jonathan Hui
parent 1f6d7c8b3b
commit 5eee323b8d
61 changed files with 1725 additions and 2132 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ LOCAL_SRC_FILES := \
src/core/api/thread_ftd_api.cpp \
src/core/api/udp_api.cpp \
src/core/coap/coap.cpp \
src/core/coap/coap_header.cpp \
src/core/coap/coap_message.cpp \
src/core/coap/coap_secure.cpp \
src/core/common/crc16.cpp \
src/core/common/instance.cpp \