const coap_pdu_t * parameters are passed into application (call-back handler)
code. If the application code then calls a libcoap API with a
const coap_pdu_t * parameter, it is not possible to increment the reference
counter so that multiple entities can reference the same PDU and an entity's
call to coap_delete_pdu() does not prematurely remove the PDU until all the
entities have finished.
This code allows the (const) PDU's reference counter to be incremented.
Allow re-establishment with upstream server when server restarts.
When upstream server re-connects, re-establish any (D)TLS sessions
and active observe subscriptions.
Supported by a new function coap_context_set_session_reconnect_time().
When a server cleanly closes down (calls coap_free_context()), when
a resource gets deleted, a 4.04 message is sent out (not when using
coap_persist(3)) for any active observe subscriptions. If a server knows it is
going to be restarted, then there is no need to send out a observe failed message.
When deleting a resource when normally running, it is correct to send out a 4.04
Not Found response as the resource has genuinely gone away. However, when the
server is cleaning shutting down, it is better to use 5.03 Service Unavailable to
indicate the situation may be temporary.
Add a common cleanup function to make sure all information is correctly
freed off.
Make sure that there is client session stickability to use the same proxy entry
when making new requests.
If coap_send() returns COAP_INVALID_MID, or other internal issue found in
coap_notify_observers(), when sending an unsolicited response, do not flag
to send again as soon as possible.
For embedded applications that can call the 'main()' function multiple
times, they need to have any statically (globally) defined variables
reset to their default values.
Load in the PKI trust store with a new function
coap_context_load_pki_trust_store()
By default, make the client and server applications do this unless
explicitely disabled.
This enables clients doing (D)TLS to not need to be provided with specific
certificates but can validate trust in the server provided certificates.
Note: A default trust store is not supported across all platform types or
some TLS libraries (version dependent).
Set up a coap_io_process() loop spread across multiple threads, each thread
repeatably calling coap_io_process() and so able to handle any input packets.
Note that the application handlers need to be thread-safe for application
level activity.
Add 2 new main functions
coap_io_process_loop()
coap_io_process_terminate_loop()
Add in 2 new sub functions
coap_io_process_configure_threads()
coap_io_process_remove_threads()
to set up the parallel threads.
Update example servers to include using coap_io_process_loop().
Support optional thread number logging by configuration to maintain
backwards logging format output if required.
New functions
coap_async_set_app_data2()
coap_cache_set_app_data2()
coap_context_set_app_data2()
coap_session_set_app_data2()
that, multi-thread safe, store an application data pointer and return the
previous data pointer (if any). There is an optional callback that will
be called when the respective storage object is released that can free
off as appropriate the data that was stored.
These replace the existing coap_*_set_app_data() functions and
coap_*_get_app_data() can be used to get the stored data pointer.
When using multi-threads, if a thread does i/o, but previously that thread had
an SSL error which has not been properly cleared, then the read or write will fail
with SSL_ERROR_SSL.
Make sure that there are no errors before doing SSL_read() or SSL_write().
Tidy up naming to reduce confusion between supported proxy types.
Provides simpler proxy examples.
Fixes issue with COAP_PROXY_REVERSE_STRIP.
Support upstream server using AF_UNIX.
If the ACK (not empty) response gets lost, the repeated CON request will just
get the cached response without invoking further analysis.
This stops things like OSCORE reporting retry issues.
This functionality needs to be enabled by setting the COAP_BLOCK_CACHE_RESPONSE
bit when calling coap_context_set_block_mode(). If not enabled, then, for OSCORE
the response is sent as a separate response (empty ACK followed by CON response),
which is how code previous to this PR works.
If coap_context_set_keepalive() is set in the server, CoAP keepalive packets
will get sent for any CoAP session that is curently observing a resource.
If the keepalive times out, then the observation(s) are canceled and the
server session is deleted.