As coap_send() automatically releases the specified pdu, it must
not be accessed after coap_send() has returned.
This change fixes CID 1458399 reported by Coverity scan.
coap_send() always takes the ownership of the pdu that is passed
as argument to send, i.e., the memory will be released automatically
when the pdu is not needed anymore.
In CID 1459612, Coverity scan has complained about uninitialized use
of the variable bytes_read. Although this is a false positive here,
it seems to be more safe to always initialize bytes_read.
In coap_session_create_client(), the default port for TCP did not
correctly distinguish between TCP and TLS as pointed out in [1] by
Joan Shallow. This change applies the suggested fix.
[1] https://sourceforge.net/p/libcoap/mailman/message/36092184/
The value of the observe option is kept for each resource rather than being global to the context.
The value of the observe option must wrap to be stay below 2^24.
The value of the observe option must be different from the initial value when a notification is sent.
Make coap_pdu-t independent of the header style.
Use C99 sized types when applicable.
Use transaction ids in host byte order in the library.
Make coap_pdu_t payload storage grow on demand.
Add parsing and encoding of PDUs with UDP or TCP style headers.
Adapt examples and unit tests to the new PDU format.
PR #100 has fixed the propagation of elapsed time in coap_pop_next()
which affects the next node in the respective send queue. This fix
is also required for platform POSIX.
As the current develop head does not support the recent API
changes, the platforms Contiki and LwIP cannot be built properly
by Travis (see https://travis-ci.org/obgm/libcoap/). Until this
has been fixed, these platforms are disabled.
The SSL lib used to implement DTLS is only used internally
by libcoap, so it is not necessary and sometimes harmful to
expose it via the pkg-config file. Only when doing static
linking is it necessary to link the SSL lib, this is done
via the "Libs.private: pkg-config directive.
When building outside the source tree compilation fails on
examples, because the libcoap headers expect to be all in the
same directory but coap.h is generated under the build
directory, so it is necessary to add an extra include path
for it.
Also, build directories should always appear before source
directories in the include path, so that any leftover
generated files in the source tree are ignored.