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.
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.
Make sure all application callbacks are called with a coap_lock_callback*()
wrapper.
Rename callback variables within the internal structures with a _cb suffix for
ease of review.
The first coap_send(pdu) is held back until after the optional tests for
Extended Token or Q-Block support are complete with the return from coap_send()
containing the held back pdu's mid.
If there are any errors with this PDU when subsequentially sent, the
event COAP_EVENT_FIRST_PDU_FAIL gets raised.
Add in new function coap_add_data_large_request_app() that provides a call-back
to get individual blocks rather than having a large buffer held in
(contrained) memory.
If we correctly determine the presence of the sys/time.h and time.h
files using the HAVE_TIME_H and HAVE_SYS_TIME_H macros, then the LWIP
compilation will result in a duplicate function error. Perhaps previous
versions of LWIP did not have these files, in which case everything
would have worked correctly.
These changes add the necessary ifdefs and keep the optimal timer
function for LWIP.
Adds missed #include <time.h> lines to examples and documentation.
Adds the detection of the sys/select.h header to the CMake and autoconf.
For the libcoap COAP_ compile time options configured in coap_defines.h or
coap_config.h make sure that #ifdef, #ifndef or defined() are not used and
replaced with #if as appropriate so that if the COAP_ compile time option
is defined as 0, the correct code gets built.
Add #if wrappers to source files that are platform specific or OSCORE.
Some of the Zephyr include files need to be C++, not C based. The 'extern "C"'
wrapper in include/coap3/coap.h means that all #include are treated as being C.
Remove 'extern "C"' wrapper from include/coap3/coap.h and add wrapper to
include files after #include and before any function / structure definitions.
Add in a C++ build test for CI.
Let libcoap do the necessary multi-thread locking during resource
generation, lookup and deletion.
Supported using a new handler set up by coap_register_dynamic_resource_handler().
Server to Client is already supported, this provides the reverse with
coap_session_set_type_server().
Add in call-home support to coap-client and coap-server for testing.
Addition of a new event COAP_EVENT_SERVER_SESSION_CONNECTED.
Changes:
- Remove duplicate OBSERVE_PERSIST configuration block
Improve example build:
- Make virtual environment activation optional in Makefile
- Remove --fresh flag unsupported in newer west versions
- Copy mbedTLS config header to workspace include directory
- Add TARGET check for mbedTLS before configuring include directories
- Add mbedTLS linking to coap-3 target
Add POSIX API support:
- Enable CONFIG_POSIX_API=y in examples/zephyr
- Replace direct Linux/Windows system calls with Zephyr POSIX API
equivalents
- Add Zephyr's sys_rand_get() to coap_prng_default()
- Define missing network macros (IN_MULTICAST, IN6_IS_ADDR_MULTICAST,
etc.)
- Add FIONBIO and OPTVAL_T/OPTVAL_GT macro definitions for Zephyr
- Add native Zephyr timing functions to replace missing mbedTLS timing
support
- Fix fd_set mapping using zephyr/net/socket_select.h
- Exclude strnlen redefinition conflicts for Zephyr
- Add proper IPv6 packet info and address mapped definitions
(Patch) Add DNS resolution and net setup to example client:
- Enable CONFIG_DNS_RESOLVER for hostname resolution
- Add Linux networking setup instructions for native_sim board
- Configure static IP gateway and DNS server (8.8.8.8)
- Add DHCP vs static IP configuration documentation
Co-authored-by: mrdeep1
Multiple threads can call coap_check_async() when one of them does a callback
into application space. Only allow one thread to be scanning async_state.
Makes reading the code simpler.
Context is no longer used as global_lock is used in the coap_lock_lock() and
coap_lock_unlock() functions.
Part 3 of 3.
Update coap_lock_lock() and coap_lock_unlock() macros and all users.
Makes reading the code simpler.
Context is no longer used as global_lock is used in the coap_lock_lock() and
coap_lock_unlock() functions.
Part 2 of 3.
Update coap_lock_check_locked() and all users.
Makes reading the code simpler.
Context is no longer used as global_lock is used in the coap_lock_lock() and
coap_lock_unlock() functions.
Part 1 of 3.
Update coap_lock_callback(), coap_lock_callback_ret(),
coap_lock_callback_release(), coap_lock_callback_ret_release() and
coap_lock_invert() macros and all users.
If multiple clients subscribe to the same resource, one of the clients
'goes away', the server will eventually close down the session for that client
which will then remove any subscriptions, iterating through the different
resources.
If this happens at the same time that coap_resource_notify_observers() is called
in another thread, and the GET/FETCH handler is called for a common resource
and in particular for the session that is now going away, on return from the
callback the subscription may no longer exist. This PR fixes this window.
In addition, if the resource subscriber list is being traversed, then a another
call to coap_notify_observers() for the same resource will not generate a new set
unsolicited observe responses for multi-thread protection.
Update
Malformed PDUs were responsed to with a RST. Now request PDUs with invalid
lengths are also reported with a 4.02 response.
See RFC7252 5.4.3 and 5.4.1.
The checking can be overriden by using coap_register_option().
Updated the diagnostic payload for 4.02 responses to be inline with RFC 7252,
and not include the actual errant options in the response.