Clean up duplicate MID handling, and just send back last response if MID
matches.
Removed COAP_BLOCK_CACHE_RESPONSE as no longer required for duplicate MID
handling, and so no need to send an Empty ACK response for a subsequent
Separate response as a referenced copy of the last PDU respponse is now kept
for a session.
Note that if a request is sent by a proxy to an upstream server, this always
converts the upstream server's response into a Separate response back to the
client as the upstream server may take time to respond, do any error recovery
etc.
This allows (D)TLS1.3 to be negotiated when using PSK.
If '-i match_identity_file' is being used, the hint is taken from the first
entry if not otherwise defined by '-h hint'.
Compiling with gcc-16.1.1 and glibc-2.43 yields warnings: "initialization
discards ‘const’ qualifier from pointer target type".
Indeed, pointer passed to strchr() is `const char *` and memory pointed by
return value of strchr() is never modified, so variable to assign return
value should be `const char *`.
New ./configure option
--with-mbedtls-oscore
If --disable-dtls is set, then MbedTLS is used as the OSCORE backend, otherwise
the MbedTLS library is used for both (D)TLS and OSCORE.
New cmake option
-DOSCORE_BACKEND=mbedtls
If -DENABLE_DTLS=OFF is set, then MbedTLS is used as the OSCORE backend, otherwise
the MbedTLS library is used for both (D)TLS and OSCORE.
New Zephyr option
config MBEDTLS_OSCORE
If set to y and CONFIG_LIBCOAP_OSCORE_SUPPORT is set to y, then the Zephyr MbedTLS
backend will get used for the OSCORE backend (no (D)TLS).
If both MEMP_USE_CUSTOM_POOLS and MEM_USE_POOLS are defined in
lwipopts.h and there is a suitable
LWIP_MALLOC_MEMPOOL_START .. LWIP_MALLOC_MEMPOOL_END
definition in lwippools.h, then any coap_malloc_type(COAP_STRING, ..) will
make use of the defined pools.
A new src/coap_mem_lwip.c file has been added.
Add reference counting to recipient contexts so they can be safely removed
while still in use by active sessions. Expose callback hooks for credential
lookup, echo, and sequence storage to allow custom backends.
Expand example server to demonstrate the external storage via a simple
file based database. Expand coap_oscore_rcp_conf_t to enable settings
preconfigured echo value, sequence counter and window value as uint64
Enable temporary credentials returned by the find function and are destroyed
after use.
Check incoming Uri-Path and Location-Path options for just . or .. (or %2e
hex encoded variants) and treat as being invalid.
Stop insertion of Uri-Path and Location-Path options that contain just
. or .. (or %2e hex encoded variants).
d33b7fa571 adds a call to setup_cpsk(),
which is only defined with COAP_PROXY_SUPPORT defined. This commit
enables said function if COAP_CLIENT_SUPPORT is enabled as well.
If an app request call-back modifies any data associated with a resource,
then multiple threads can attempt to unsafely modify the data at the same time.
Lock the resource when calling the app request handler (as global_lock is
unlocked) to prevent concurrent changes to the resource information.
If the app request handler is definately known to not modify the resource
information, then COAP_RESOURCE_SAFE_REQUEST_HANDLER can be set in the flags
for coap_resource_init(). Usually if there is a PUT, POST, PATCH or IPATCH
handler it is unsafe to set this. Setting this will reduce lock contention.
Include common system header files in coap_internal.h based on HAVE_*H
definitions.
Remove these system header files from include/*/*.h.
Add in system header files where appropriate in various apps.
Add some improvements to make secure coap work on Zephyr 4.3.0
with mbedtls (not using Zephyr TLS protocol options).
We now set the build options to zephyr, so we make use of the
internal mbedtl in zephyr, so we do not require a specific header
file anymore.
In older versions of Zephyr, where mbedtls does not expose the
configuration, we can force-set the macro in the C flags, so that
mbedtls will have our required function.
This way, we do not need to change the mbedtls included in Zephyr,
while still supporting a few older versions.
Function coap_context_set_max_body_size() added.
For servers, if body size is too large, a 4.13 response is generated.
For clients, if the body size is too large, the server gets a RST and
no date is passed to the application. A new event COAP_EVENT_BLOCK_ISSUE
is generated.
Add in new functions
coap_new_client_session3()
coap_new_client_session_pki3()
coap_new_client_session_psk3()
coap_new_client_session_oscore3()
coap_new_client_session_oscore_pki3()
coap_new_client_session_oscore_psk3()
which effectively does coap_session_set_app_data2() and
coap_ws_set_host_request() early on in the session set up cycle.