The macro did not respect zero-length option values hence a pointer
to the option byte itself was returned. This macro now returns NULL
for zero-length option values. Macros and functions that use this
macro have been updated accordingly. COAP_OPT_BLOCK_NUM has been
replaced by the function coap_opt_block_num().
The function wellknown_response() now honors a Block2 option when present
in the request or adds a new Block2 option to the response when the resource
description does not fit.
Bug: get_wkc_len() currently returns a hard-coded value instead of calculating
the size of the resource description (which requires changes in resource.c).
This change provides basic support for block-wise transfer of resource
descriptions. print_wellknown() now takes an additional parameter that
specifies the offset in the resource description where output shall start.
coap_print_link() has been modified to truncate resource descriptions that
do not fit in the given buffer (instead of failing with an error code as
was the case before).
if the coap pdu struct is larger than the headers that are stripped off
a datagram by the time it arrives at coap, all the nice zero-copying
stops working. instead of working around by allocating bigger headers
(which would go untested), it was decided to lock up. given how
reproducible the header calculations are, this will let the developer
know what's up early, if this ever happens to be critical at all.
there are two plausible causes for this to happen:
* the pdu struct grows, eg. because of additional fields or becaus it is
used on architecture with large alignment requirements
* packages "come in shallow", that is, are created from an interface
that barely has headers. such an interface could be a network
interfaces created from a hardware network stack.
this also changes the sizes of allocated pdus, in which previously, the
probelm was not considered and covered by overallocation.
this way, the send-then-delete approach to pdus keeps working (meaning
less lwip specific patches), and for retransmission it's required to
keep the pdu around anyway (until we switch the send queue to a pbuf
queue)
this will make reading the ifdefed sections easier.
as the typedef struct __coap_address_t {...}; /
define coap_address_t __coap_address_t trick is not needed any more to
detect whether a WITH defined coap_address_t or not, it was removed.
the coap_add_option_later works like coap_add_option, but does not take
data. instead, it allocates the option empty, and returns an address the
application has to fill with data later.
this is especially useful for the etag and block options; the
application can write out its variable data, generate a checksum while
writing, and fill the etag when the data is already written to the pdu.
with the block options, the more flag can be set at the last moment.