Do not call coap_free_context() from within sigint handler.
Always call coap_io_process().
Use sys_arch_sem_wait() for timeouts while waiting for input.
When context is de-allocated, other threads can still access the
context lock held within context. Indicating being freed when
coap_free_context() was called worked in most cases, but not all.
Create new options coap_uri_into_optlist(), coap_path_into_optlist() and
coap_query_into_optlist() to be used instead of coap_uri_into_options(),
coap_split_path() and coap_split_query() functions so the requirement
for a scratch buffer is not needed.
Getting the minimum size for a scratch buffer is not straight forward and
potential for unexpected boundary condition errors to occurif too small.
Correct parsing and stripping out of "%2E%2E" ("..") and "%2E" (".")
path segments. ".." now removes the previous segment (if it exists).
Update documentation and unit testcases.
Update examples to use new options.
Set up lg_crcv if separate ACK response received for a coap_send() CON
request to be able to handle Block2 responses.
Handle Block1 request getting back a Block2 request that has an initial
separate response once the Block1 has completed by adjusting the stateless
token counter.
Separate response is typical for proxy support (OSCORE previously handled)..
Move requirements for client to determine how to set up the SNI for
PSK/PKI encrypted communications down into libcoap. The client just
needs to indicate the host to connect to in the client_sni field of
coap_dtls_cpsk_t or coap_dtls_pki_t.
New internal function coap_sanitize_client_sni() makes sure that
the SNI sent follows RFC 6066. As per
https://datatracker.ietf.org/doc/html/rfc6066#section-3
Literal IPv4 and IPv6 addresses are not permitted in "HostName".
all IPv4 and IPv6 addresses are dropped for the SNI, and so no SNI is
sent. DNS hostnames will get transmitted as the SNI.
Handle Observe cancellation with large blocked FETCH that needs to use
diffferent tokens when there is packet loss by checking the cache-key
if the token is not found (Q-Block1).
Let FETCH with Q-Block1 use NON now that cache-key is getting checked
if token mismatch.
Handle getting an unsolicited Observe response in the middle of
sending the FETCH blocks that ultimately will be doing the Observe
cancellation following re-assembly. (The unsolicited Observe token will
be the same token that is used to respond to the observe cancellation).
Move get_wkc_len() into hnd_get_wellknown_lkd() to simply document how
hnd_get_wellknown() should be done.
Revert out coap_register_print_wellknown_callback() changes as no
longer needed.
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.
Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.
Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.
Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.
Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]
Work in progress for all the functions that need to be multi-thread safe.
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.
Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.
Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.
Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.
Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]
Work in progress for all the functions that need to be multi-thread safe.
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.
Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.
Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.
Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.
Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]
Work in progress for all the functions that need to be multi-thread safe.
Update the Public API equivalent of the libcoap functions that need to be
called when locked with a name suffix of _lkd.
Move matching Public API functions out of coap_threadsafe.c to be coded
just ahead of the newly renamed _lkd function.
Properly define the _lkd function in the appropriate _internal.h file for
documentation, removing the #defines from coap_threadsafe_internal.h.
Tag all the Public API functions that have a _lkd function with COAP_API.
COAP_API can then be defined as to what should be done for that function.
Check libcoap library does not call the original Public API function when
it should be calling the _lkd function by marking the Public API not _lkd
functions as deprecated during the libcoap library build.
[Done by the new COAP_API being defined as __attribute__((deprecated)).]
Work in progress for all the functions that need to be multi-thread safe.
Gives the ability to add in additional library build checks through
the use of #define etc. that is not available to applications or
other host o/s support.
Preparatory work for further locking checks.
Update libcoap functions that need to be called locked with a name
suffix of _locked.
Move matching functions out of coap_threadsafe.c to be coded just ahead
of the newly renamed _locked function.
Properly define the _locked function in the appropriate _internal.h file
for documentation, removing the #defines from coap_threadsafe_internal.h.
Work in progress for all the functions.
Remove coap_lock_* requirements for testdriver (coap_delete_node()).
Two new functions added
coap_tls_engine_configure()
coap_tls_engine_remove()
Added in new PKI key type coap_pki_key_define_t which allows the CA, Public Cert
and Private Key to be different types (e.g. PEM, DER etc.).
Added a new key type ENGINE to make use of the configured tls_engine.
Added in a -q option to coap-server and coap-client for testing ENGINE.
Note: ENGINE is only supported by OpenSSL.
Add in new COAP_BLOCK_NOT_RANDOM_BLOCK1 option for
coap_context_set_block_mode(). This disables receipt of any Block1
packet (but not Q-BLock1) if the block numbers are not sequentially
received starting with 0. A 4.08 code is returned for every packet
out of order and its data is ignored.
If COAP_BLOCK_SINGLE_BODY is set in coap_context_set_block_mode(),
but not COAP_BLOCK_NOT_RANDOM_BLOCK1, then all Block1 packets are
assembled in the correct order before passing the body up to the
application. The receive logic will timeout after MAX_TRANSMIT_WAIT
(93 seconds) if there are any missing blocks, or 10 seconds if the
last block is seen.
If COAP_BLOCK_SINGLE_BODY is not set in coap_context_set_block_mode(),
and not COAP_BLOCK_NOT_RANDOM_BLOCK1, then the random order packets
are passed up to the application layer where it is the application's
responsibility to decide what to do with the randomly ordered packets,
and what response code to send.
A duplicate CON message is sent by the server if the client's ACK to the original
confirmable message did not reach the server.
See issue #1306 for full description: https://github.com/obgm/libcoap/issues/1306
Optional compile time thread safe code supported.
Locking is done at the coap_context_t level, and if enabled is primarily
done coap_threadsafe.c and coap_threadsafe_internal.h.
coap_threadsafe_internal.h causes coap_X() to get mapped to coap_X_locked()
throughout the libcoap library code with the exception of coap_threadsafe.c
if thread safe is enabled.