Commit Graph
2986 Commits
Author SHA1 Message Date
Jon Shallow a87fb0c1cf coap_io.c: Add in support for getting state of internal file descriptors
Add in a new function coap_io_get_fds() to get the lists of (internal
to libcoap) file descriptors that are in a read or write pending state,
as well as the timeout time for the next internal to libcoap activity
(e.g. packet retransmission).
2024-12-18 14:09:48 +00:00
Hugo Hakim Damer 32c124f7d5 doc: fix invisible text if browser is set to prefer dark mode 2024-12-16 17:01:53 +00:00
Mario Kicherer ebb8f07796 add helper functions to support external event loops, see #1554 2024-12-13 14:11:01 +00:00
Jon Shallow d82f857f67 LwIP: Support client sending multicast / broadcast (IPv4) packets 2024-12-05 13:36:01 +00:00
Jon Shallow ae162903ab LwIP: Support Server Multicast registration 2024-12-05 13:05:48 +00:00
Jon Shallow 7ad6579121 coap_uri.c: Fix sending Uri-Host option
Ipv6 Hosts with %interface suffix were incorrectly getting sent
with a Uri-Host option which included the &interface as well.
2024-12-05 13:03:53 +00:00
Jon Shallow 6036e7a329 LwIP: Support DTLS if CID is enabled n TinyDTLS 2024-12-02 16:21:00 +00:00
Jon Shallow 5f4c2ab96b coap_block.c: Fix returning 2.03 for ETag match
Tag server returned data with a digest computed ETag option value so
requests with an ETag option can return 2.03 if there is a match.

The size of bytes hash that is computed for the ETag can be overwritten by
localy defining COAP_ETAG_MAX_BYTES to be a value between 1 and 8 bytes
inclusive.  It is set to 4 by default.
2024-12-02 10:15:51 +00:00
Jon Shallow 3457c2e2fd Zephyr: Track memory allocations 2024-12-02 10:04:23 +00:00
Jon Shallow 9b0ec2dae0 coap_send_internal: Log OSCORE failed PDU 2024-11-23 13:11:12 +00:00
Jon Shallow 4c6ab62e9d coap_digest_free: Handle NULL pointer 2024-11-23 12:16:27 +00:00
Jon Shallow 1d465b6bde coap_net.c: Fix TCP boundary read condition
Increment session->partial_read correctly.
2024-11-23 12:06:35 +00:00
Jon Shallow 19cef11d04 CMakeLists.txt: Fix include check order for TinyDTLS
Search built include files before libcoap general include files.
2024-11-02 10:39:38 +00:00
Jon Shallow 0808b97009 coap_net.c: New coap_send_recv() function
Supports sending a PDU and waiting for the response PDU for subsequent analysis.

Handles multiple block transfers.
2024-11-01 15:27:22 +00:00
Adrian Freihofer abfe2a3c6c CMakeLists.txt: remove vendored tinydtls build path
Do not write the absolute build path into libcoapTargets.cmake. The
libcoapTargets.cmake is supposed to be packaged and installed by
distros. An absolute path referring to the build directory looks
therefore wrong.
Some build frameworks like Yocto have quality assurance check which
handle these issues as a warning or as an error. Example:

WARNING: libcoap-4.3.4-r0 do_package_qa: QA Issue:
  File /usr/lib/cmake/libcoap/libcoapTargets.cmake in package
  libcoap-dev contains reference to TMPDIR [buildpaths]

Declaring this header files as build interface looks like the right fix.
In case of a bundled tinytls library the header files should be handled
like the header files from libcoap itself: Either in the build folder of
libcoap or in /usr/include as declared one line above.
2024-11-01 15:26:47 +00:00
Jon Shallow 466f1e0b5c coap_oscore.c: Process queued OSCORE Observe responses after de-registration
If an Observe is de-registered, but an unsolicited Observe response is received
before the de-register response is received, then the unsolicited response
failed to get decrypted.
2024-10-28 14:33:34 +00:00
Jon Shallow 92b3db23e9 NACK handling: simplify libcoap code
Remove a lot of code duplication by providing new coap_handle_nack()
function.
2024-10-19 11:58:19 +01:00
Jon Shallow 7f14e0a637 coap_mbedtls.c: Breakout of permanent loop for (D)TLS setup
Stop MbedTLS continuing to try to establish a (D)TLS session where the
server keeps on sending back a Server-Hello when it fails to decrypt
a client handhake (i.e. mismatch on PSK).
2024-10-18 13:47:11 +01:00
Jon Shallow c72a7b32a1 Contiki: Fix heapmem_free() warning
heapmem_free() warns if ptr is NULL.
2024-10-18 13:06:52 +01:00
Jon Shallow 4803f161f0 zephyr: Examples support
New examples/zephyr directory that contains a sample coap-client.
Building the coap-client assumes that the zephyrproject has already been
installed and set up (default directory ~/zephyrproject).
2024-10-10 16:48:50 +01:00
Mario Kicherer 7b4a20f64e coap_join_mcast_group_intf: fix interface selection on windows 2024-10-10 16:48:15 +01:00
Jon Shallow 8e407cc514 documentation: Various doc tidyup
configure.ac: Tidy up coap_defines.h generation

doc/upgrade_4.3.4_4.3.5.txt: Document upgrade requirements

doc/Makefile.am: Include upgrade_4.3.4_4.3.5.txt

cmake_coap_defines.h.in: Add brief description
src/coap_sha1.c: Add in brief description

Note: With Ubuntu 24.04.01, when running a2x, spurious entries
 <unknown>:1: SyntaxWarning: invalid escape sequence '\S'
occur. Fixed by https://github.com/asciidoc-py/asciidoc-py/pull/267
2024-10-05 09:58:49 +01:00
Jon Shallow 3cba2974ee coap_tinydtls.c: Fix server only build for CID 2024-09-26 13:12:02 +01:00
Jon Shallow 79a6630478 blocks: Better reporting for large transfers
Update stateless token to track 20 bits - the largest no of blocks
as per RFC7959.

Make output of data detail configurable for coap_show_pdu().

Add in new function coap_enable_pdu_data_output() to do this.

Add -x option to coap-client and coap-server to enable this dropping
of data detail.
2024-09-26 10:50:31 +01:00
kkrentz ac83b32b33 Improve MTU handling
by:
- Correcting Contiki-NG's value of COAP_DEFAULT_MAX_PDU_RX_SIZE
- Denying to create PDUs longer than COAP_DEFAULT_MAX_PDU_RX_SIZE
- Using the MTU setter, thereby not overriding stack-specific limits
- Using existing constants for L4-specific header sizes
2024-09-17 13:28:44 +01:00
Jon Shallow e234acae9f CMakeLists.txt: Handle Proxy configurations and existing built coap.h 2024-09-11 08:42:59 +01:00
Jon Shallow da539d85ad doc: Update documentation for future reference 2024-09-10 16:43:19 +01:00
Jon Shallow 7cf7465b78 Release 4.3.5: Fix SO and ABI version for new release v4.3.5 2024-09-06 11:13:56 +01:00
Jon Shallow 0d240530b4 Release 4.3.5: Release 4.3.5 2024-09-06 09:47:22 +01:00
Jon Shallow 493b503bca Zephyr: Fix k_realloc build errors for zephyr < 3.7.0 2024-09-04 15:17:06 +01:00
Jon Shallow eaff6928d6 Coverity-Scan: Fix CID 1599559-1599562 2024-09-04 12:08:47 +01:00
@pawel.szwarnowski abd0a027db Use Zephyr heap for Zephyr targets 2024-08-28 15:18:53 +01:00
Mario Kicherer 1c97907f2f coap_net.h: add ifdef WITH_LWIP around lwip functions 2024-08-27 11:59:23 +01:00
Daniel Mangum a705e04ced man: fix typo in logging documentation
Fixes small typo in logging documentation.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2024-08-27 09:10:22 +01:00
Jon Shallow c2b34daa9b mcast_loop: Drop mcast packet that server sent on different socket
Server enabled for mcast receipt.  When the server is acting as a proxy
sends a mcast packet out over a slave client type socket, it receives
the mcast packet on the server socket (which could then be forward out
of the client socket....).

This change prevents the server socket from passing up the libcoap stack
a mcast packet that it knows the client socket is sending.
2024-08-23 10:51:20 +01:00
Jon Shallow e220c371be coap.h: Remove need for different coap.h files for different OS
./autogen.sh and ./configure no longer need to be run prior to running
make for Contiki, LwIP or RIOT from the appropriate examples sub-directory.

scripts/fix_version.sh now handles updating coap.h for the different
LIBCOAP_ and PACKAGE_ definitions.
2024-08-23 10:39:37 +01:00
Mario Kicherer 8899063a4a coap_ws: accept longer header lines and specific header sent by firefox browser 2024-08-23 10:39:17 +01:00
Jon Shallow 3d790a5964 reverse-proxy: Provide dedicated reverse-proxy handler setup function 2024-08-16 13:33:31 +01:00
Jon Shallow 626d4632d1 multicast: Document coap_mcast_set_hops() 2024-08-16 13:30:30 +01:00
Jon Shallow 79e6fcdb26 examples: Do CI pre-commit checks on man page examples 2024-08-16 13:16:11 +01:00
kkrentz 7dab8f6fb2 Contiki-NG: Fix coap_resolve_address_info 2024-08-12 17:03:40 +01:00
kkrentz 76502319fc coap_proxy.c: Fix error "'.*' expects argument of type 'int'" 2024-08-12 15:41:20 +01:00
Jon Shallow 540fede1b9 release 4.3.5rc3: Release candidate 3 for 4.3.5 v4.3.5-rc3 2024-08-07 14:14:07 +01:00
Jon Shallow 82b721d7d2 coap-server.c: Replace SERVER_CAN_PROXY with COAP_PROXY_SUPPORT
Make use of the new coap_defines.h file.
2024-08-07 13:59:10 +01:00
Jon Shallow 92198b00b3 Supported: Break out run-time checks and libcoap build #defines
Group together and document the run-time checks available for checking
the libcoap built-in functionality based on the ./cconfigure and / or
CMakeLists.txt options.

Create include/coap3/coap_defines.h file that contains a list of
COAP_ #defines created from the options defined when running ./configure
or cmake.

Add additional coap_*_is_supported() functions.
2024-08-07 10:23:19 +01:00
Jon Shallow 5f3d7eb244 reverse-proxy: Add in reverse proxy support to coap-server
Tidy up the general proxy logic by moving common functionality
into libcoap.

New functions coap_proxy_forward_request(), coap_proxy_forward_response()
and coap_proxy_is_supported() added.

New --enable-proxy-code support added to configure.

New ENABLE_PROXY_CODE support added to CMakeLists.txt.

Support for common shared connection to next hop.

Support for round-robin balancing across multiple next hops.
2024-08-07 09:33:46 +01:00
Jon Shallow af024f9138 Connection-ID: Only change source port when CID has been negotiated
Only support changing the client's source port if the DTLS library
has support / configured for CID.

Used when debugging server handling source address changes and CID
is in use.

Add in support for TinyDTLS (Client only) if TinyDTLS is patched
appropriately (not currently available on TinyDTLS main branch).

Add in new function coap_dtls_cid_is_supported().
2024-08-07 09:13:52 +01:00
Jon Shallow 83718a6d2f Cleanup building header files for different OS
'make distclean' removes header files built from the .in files, which
means that they are not available for different OS builds.

The same is true for CMakeLists.txt.

Remove the need for the .in files and update for libcoap revisions
by using a new script scripts/fix_version.sh created from
scripts/fix_version.sh.in.

CI has been updated to check revisions have been updated in the
appropriate places.

Do not remove libcoap-3.sym and libcoap-3.map when doing 'make distclean'
as they are git tracked files.
2024-08-06 16:56:19 +01:00
Jon Shallow 9656876b41 configure.ac: Not all pkg-config support PKG_CHECK_MODULES_STATIC
PKG_CHECK_MODULES_STATIC is only supported by pkg-config > 0.29

Use pkg-config --static instead.
2024-07-25 09:08:36 +01:00
Jon Shallow 4851806c09 scan-build: CI Fail if scan-build warnings 2024-07-22 11:37:42 +01:00