Commit Graph
2503 Commits
Author SHA1 Message Date
Jon Shallow de369eb7c7 coap-client.c: Cleanup following observe cancellation
Delay exit briefly checking if there are any response packets following
observe cancellation and process as appropriate.

If multiple observes are outstanding, cancelling them using CON will
cause issues as NSTART limit is hit.  The server then does not know
about all of the cancellations.

Also, this can allow the server to properly shutdown observe
activity when blocks are used.
2022-10-14 08:44:21 +02:00
Jon Shallow d09d56860f coap.txt.in: Fix missing references and hyperlink RFC references
The RFC references appear without the hyperlink in the man pages,
but now appear as hyperlinked in the doxygen output.

SEE ALSO updated with missing references.
2022-10-12 21:38:42 +01:00
kkrentz dc66470a1a Simplifies a few preprocessor directives 2022-10-12 17:21:20 +01:00
Jon Shallow c5c4f9bf1d uri.c: Add coap_uri_into_options() function
Simplify code for applications by providing coap_uri_into_options()
which then adds the (optional) port and splits out the path / query
as CoAP options, adding them to the optlist_chain for subsequent use.

Added a new coap_delete_uri() for completeness.

Update documentation to include the uri based functions.

Update examples to use the new coap_uri_into_options() function.
2022-10-12 15:24:02 +01:00
Jon Shallow 3659e3c0cb LwIP: Support receiving ethernet MTU sized packets
Define PBUF_POOL_BUFSIZE appropriately in lwipopts.h
2022-10-12 14:37:20 +01:00
Jon Shallow 149fe74805 coap_openssl.c: Fix CA memory leak 2022-10-12 11:08:21 +01:00
Jon Shallow c0572443dc uri.c: Fix oss-fuzz issue 48362
Introduced by fix #818 Feb 7 2022.
2022-10-05 09:22:50 +02:00
Jon Shallow 6a633e3d49 CMake: Force all Warnings to Errors when doing github actions
Add new option WARNING_TO_ERROR for CMakeLists.txt

Includes cmake builds for Windows and macOS
[Fix coap-client S_ISDIR() duplication bug]
2022-09-30 17:25:00 +02:00
Jon Shallow 692c06d95f build: Fix client and server only builds
Also correct LwIP build directory.
2022-09-27 10:37:38 +01:00
Jon Shallow de1bc9f3cb LwIP: Add in support for client
New demo client app.

Update some of the memory sizes.
New coap_lwip_dump_memory_pools() to dump LwIP memory pool usage.

Add in logic to handle new client sessions.

New coap_io_process() to handle LwIP which can invoke a callback handler
to wait / timeout for the next input handler.
New coap_lwip_set_input_wait_handler() to define this handler.

Update coap_io_prepare_io() to handle LwIP.

Support re-use of pbuf for PDU re-transmissions.

Make sure that NSTART is correctly obeyed.

Build the client with client only libcoap code.

Build the server with server only libcoap code.

Update LwIP source to latest stable release.

Reserve memory for a response PDU.

New coap_lwip(3) man page.

Update directory structures for config files.

Update files contained in "make dist" and check lwip rebuilds
in the github workflows.
2022-09-22 10:14:48 +01:00
Jon Shallow da213380d9 coap_session.c: Make sure large block handling is cleaned up if network issue 2022-09-22 10:04:07 +01:00
Jon Shallow 2f25c950af net.c: Call nack handler for badly formatted response packet
If a response packet is received that is badly formatted, invoke the
nack handler (if defined) with COAP_NACK_BAD_RESPONSE so that the
requestor knows there is an issue, rather than timing out.

However, if the response packet is so badly formatted, or it is not
possible to find the requesting packet, then this nack event will not
trigger, but an event is triggered with COAP_EVENT_BAD_PACKET.
2022-09-20 15:12:29 +02:00
Olaf Bergmann 02b76470ab Merge branch 'release-4.3.1' 2022-09-02 13:45:57 +02:00
Olaf Bergmann c694baead2 Update version to release 4.3.1 v4.3.1 2022-09-02 13:42:24 +02:00
Jon Shallow ab9488559f Doxygen: Fix missing links for later versions of asciidoc
Fix the link for the last entry in the name list where asciidoc
converts the minus sign to an extended dash (em dash)

Remove the updating of navtree.js as it is done differently in later
versions of doxygen.

Add in the missing name entry for coap_attribute.
2022-09-02 13:00:51 +02:00
Jon Shallow 144f9c4381 Manual pages: Update NAME section to contain all of the alternative names
Update the NAME section with all of the alternative names.  All the different
files are already built.
2022-09-02 12:59:26 +02:00
Jon Shallow 707aed35d3 Doxygen: Hyperlink man page functions
Where functions are referred to in the man pages, hyperlink them for
easy cross reference.
2022-08-26 17:37:41 +01:00
Jon Shallow 46feac2455 Misc: Tidy up documentation and space usage 2022-08-24 17:55:43 +02:00
Jon Shallow d09204e24a Doxygen: Add in individual man pages for the ease of finding the functions
Add in a new index tag for all the functions defined within the man pages.

Highlight the occurrence of that function name in the appropriate displayed
page.

For the man pages that have been restructured to break out the individual
functions, jump to the function definition.
2022-08-23 14:21:45 +02:00
Olaf Bergmann 09aab40d14 Tag release candidate 2 for version 4.3.1 v4.3.1-rc2 2022-08-23 13:19:08 +02:00
Olaf Bergmann 2755af4d1a block.c: Clarify ignored result from coap_get_data()
Addresses CID 1520612.
2022-08-23 10:49:15 +02:00
Olaf Bergmann 5f0eea8dbb coap_session.c: Fix adding NULL pointer on error in coap_new_server_session()
When coap_make_session() fails, the local variable session will be
NULL, and the program continues at the error label. Because of
session == NULL, coap_session_free() will return immediately, leaving
a NULL entry in ep->sessions.

This fix is related to CID 1520613.
2022-08-23 08:43:38 +02:00
Olaf Bergmann ea89cb842c coap_cache.txt.in: Fix typo in function name 2022-08-22 15:31:11 +02:00
Jon Shallow 922e81a0d2 Doc: Include statement about upgrading to 4.3.1 2022-08-22 14:54:47 +02:00
Jon Shallow 5c498249e7 ChangeLog: Add summary for version update to 4.3.1 2022-08-22 14:54:31 +02:00
Jon Shallow 4f12b9be1b coap_event.h: Clean up Doxygen documentation for coap_event_t 2022-08-22 14:50:03 +02:00
Jon Shallow 43bfbea924 Copyright: Update dates to 2022 where appropriate 2022-08-18 13:23:36 +01:00
Jon Shallow 37731524a0 RFC8516: Document support 2022-08-18 13:22:18 +01:00
Jon Shallow a7b2f2b490 block.c: Timeout coap_lg_crcv_t structures correctly
Track usage and timeout after COAP_MAX_TRANSMIT_WAIT seconds if
not everything has been received.
2022-08-15 08:22:14 +01:00
Jon Shallow f4507e6e9a Block: Report event on large xmit failures
Add in new event COAP_EVENT_XMIT_BLOCK_FAIL which gets triggered on
detecting transmission failure of large body using BlockX.

Track the last time a lg_xmit was sent, so it can be timed out on failure.

Correctly track the next lg_xmit timeout time (and lg_crcv, lg_srcv) so that
the lg_xmit can be expired.
2022-08-13 14:28:38 +01:00
Jon Shallow 3d387a5be4 block.c: Correct size of allocated PDU buffer
Fix potential buffer overrun corruptions.
2022-08-13 14:19:58 +01:00
Jon Shallow 6a9a787503 Observe: Clean up server timing out after observe failures
Support for larger COAP_OBS_MAX_NON and COAP_OBS_MAX_FAIL definitions.

Change default for COAP_OBS_MAX_FAIL to 1 as there will already have
been MAX_RETRANSMIT(4) of the notification over a period of 93 seconds if
defaults are used.

Code and documentation clean up
2022-08-10 11:54:09 +01:00
Jon Shallow 725e464421 mcast: Tidy up logging
Simplify code and clearly log that this is mcast delays as appropriate.
2022-08-08 16:55:04 +01:00
Jon Shallow 381ff3d94d PDU Data: Clean up internal usage of PDU data
Replace usage of hdr_size with max_hdr_size as appropriate as hdr_size
is not set until PDU is encoded. This should eliminate potential buffer
overruns.

Better checks for available space for the payload when using BlockX.

Clarify documentation.
2022-08-08 14:50:09 +01:00
Jon Shallow 0f0cac71f5 Observe: Support disabling observe cancellation on session close
Add in a new function coap_session_set_no_observe_cancel() to support this.
2022-08-08 10:19:38 +01:00
Jon Shallow bc4c75060b coap_mbedtls.c: Fix output type of a log message 2022-08-08 10:16:32 +01:00
Jon Shallow b8f01cef06 net.c: Move variable into correct block
It was possible to jump to skip_handler with added_block uninitialized.
(Found by valgrind.)
2022-08-08 10:15:15 +01:00
Jon Shallow 58a8b33804 net.c: Send appropriate delayqueue entries in coap_cancel_all_messages()
If coap_cancel_all_messages() is called because of missing separate ACK,
then release any pending delayqueue entries if message is CON.

Remove duplicate code in coap_cancel_all_messages().
2022-08-08 10:13:50 +01:00
Jon Shallow b4306bb791 observe: Make sure the correct token in used for cancellation
Use the Token used for the initial Observe response, not any
interim stateful tokens used for Block handling.
2022-08-08 10:11:43 +01:00
Jon Shallow c68d1e9fe7 mutex: Do not output mutex warnings for LwIP and Contiki
Both LwIP and Contike are single threaded at present, so no need for
stub mutex function warnings
2022-08-04 13:58:22 +01:00
Laukik Hase 7f551fcea5 coap_mbedtls.c: Upgrade to mbedTLS v3.2.1
- Updated the deprecated APIs with the respective alternatives
  - `mbedtls_ssl_conf_min_version` => `mbedtls_ssl_conf_min_tls_version`
- Updated fields for `mbedtls_ssl_ciphersuite_t`
  - `max_major_version`/`max_minor_version` => `max_tls_version`
- Added macros for backward compatibility
2022-08-04 13:56:36 +01:00
Jon Shallow 8c15b896ef esp-idf: Stop -Wformat errors for uint32_t variables
See https://github.com/espressif/idf-extra-components/pull/76
2022-08-04 13:55:16 +01:00
Olaf Bergmann 0ca2fd4a90 Tag release candidate 1 for version 4.3.1 v4.3.1-rc1 2022-07-28 12:23:46 +02:00
Olaf Bergmann 9962bab56f Updated tinydtls to current develop HEAD 2022-07-28 12:23:14 +02:00
Jon Shallow 8fbe440f8a coap_io.c: Updates for esp-idf port 2022-07-27 11:21:28 +01:00
Jon Shallow d2306569d1 proxy: Make proxy requests separate responses
As an incoming proxy request may delay its response (e.g. initiate an
ongoing connection), send back empty ACK immediately so that the
client does not timeout and re-transmit the request.

Do not process duplicated (i.e. re-transmitted) proxy requests.

Correct a couple of typos in example proxy code.
2022-07-25 12:47:18 +02:00
Jon Shallow 98ecf5a2a1 tinydtls: Update submodule to latest version 2022-07-23 12:36:25 +01:00
Jon Shallow 8c973a454e mid_duplicates: Drop general responses duplicates 2022-07-08 15:59:13 +01:00
Jon Shallow dc92fe5e1e coap.h.windows.in: Fix missing file renames 2022-07-01 13:29:06 +01:00
Jon Shallow 347270b9ab file naming: Rename files to have coap_ prefix
Initial update - rename files that are not subject to any PRs.
2022-07-01 11:36:26 +01:00