Commit Graph
251 Commits
Author SHA1 Message Date
Jon Shallow e3f7dbeec8 doc: Support hyper-linking to defined structures for man pages 2024-03-15 09:04:52 +00:00
Jon Shallow 3852554fe2 coap-server.txt.in: Correct typo 2024-02-12 14:10:09 +00:00
slokhorst b3ba77d66a Use grep -E instead of deprecated egrep 2024-01-06 13:23:08 +00:00
Jon Shallow 8237c1d801 Copyright: Update to 2024 2024-01-02 08:45:59 +00:00
Jon Shallow 0f3ae5022d coap_block.c: Support server setting max block size for Block1/Block2 2023-11-30 16:48:10 +00:00
Jon Shallow c69c5d5af0 multi-thread: Add in thread safe support
Optional compile time thread safe code supported.

Locking is done at the coap_context_t level, and if enabled is primarily
done coap_threadsafe.c and coap_threadsafe_internal.h.

coap_threadsafe_internal.h causes coap_X() to get mapped to coap_X_locked()
throughout the libcoap library code with the exception of coap_threadsafe.c
if thread safe is enabled.
2023-11-25 11:41:26 +00:00
Jon Shallow 6b4fac968d PKI: Document intermediate CAs
Correct some typos
2023-11-20 11:27:58 +00:00
Jon Shallow 7688258c39 coap_response_handler: Tidy up sent parameter
sent PDU passed to a response handler is now reset to initial sent PDU
(token restored, Block options removed), but some or all of original
data may be missing if Block operations were needed for the request or
the repsonse.

Updated documentation to reflect this.
2023-10-23 14:49:31 +01:00
Jon Shallow 05d02be7a9 coap_net.c: Fix CSM timeouts in coap_client_delay_first()
Reduce timeout to 1 second and enter established state for servers that
only partially implement RFC8323 for TCP support, but do not send a CSM.

Add new coap_context_set_csm_timeout_ms() to control the value of the timeout.
2023-10-23 14:32:46 +01:00
Jon Shallow 26302a076b coap-server.c: Add in support for output to syslog 2023-10-19 11:26:41 +01:00
Jon Shallow 48753b155b Stateless: Add in some stateless support
Client able to send data for every FETCH command to get next Block2 response.

Server able to not keep state while sending Block2 responses back.
2023-10-19 10:33:17 +01:00
Jon Shallow 1b639d1ce6 examples-code-check.c: Make troubleshooting easier 2023-10-13 14:15:30 +01:00
Jon Shallow da0f065af2 coap_handler.txt.in: Update documentation for request handler 2023-10-04 22:02:47 +01:00
Jon Shallow 8683a3177c coap_cleanup: Allow coap_startup() to be called after coap_cleanup() 2023-10-04 22:02:31 +01:00
Jon Shallow 4abe0ea7aa doc: Add hyperlinks for different TLS libraries 2023-09-05 12:19:25 +01:00
Jon Shallow 76e8b0f029 Coverity: Fix CID 1382587, 1566422-1566493 2023-08-12 14:07:08 +01:00
Jon Shallow ded6d04e1d doc: Fix typos 2023-08-12 14:06:42 +01:00
Carsten Schoenert 36941566d6 man: Small typo fixes for coap[-client,-oscore]
Typo fixup for
seperator -> separator
particularily -> particularly
2023-07-31 08:54:16 +01:00
Jon Shallow 3f8bb33807 coap_resolve_address_info: Add in support for defining WebSocket ports 2023-07-26 13:01:42 +01:00
Jon Shallow 084c866c69 coap_startup: Make coap_startup() first function call in examples
This then makes sure that all things libcoap are properly initialized
before use, and coders realize they need to do this.

Note: coap_new_context() continues to make sure that coap_startup()
is invoked if not done previously, but this may be too late.
2023-07-25 13:50:18 +01:00
Jon Shallow d17f47ab54 coap_address_t: Update functions documentation and add coap_is_af_unix() 2023-07-17 09:43:35 +01:00
Jon Shallow 57013f3377 RFC9177: Add in Q-Block support
examples/coap-client.c:
examples/coap-server.c:

Add in Q-Block intelligence.

include/coap3/block.h
include/coap3/coap_block_internal.h
include/coap3/coap_event.h

Add in Q-Block references.
Add in new functions
coap_block_check_q_block1_xmit()
coap_block_check_q_block2_xmit()
coap_send_q_blocks()
coap_send_q_block1()
coap_send_q_block2()
coap_block_drop_resp_q_block_xmit()
coap_block_drop_resp_q_block2_crcv()
coap_q_block_is_supported()

include/coap3/coap_session.h:

Add in new Congestion Control defaults and ability to configure them.

include/coap3/pdu.h:

Add in the new options.

libcoap-3.map:
libcoap-3.sym:

Expose external Congestion Control functions.

man/coap-client.txt.in:
man/coap-server.txt.in:
man/coap_block.txt.in:
man/coap_handler.txt.in:
man/coap_recovery.txt.in:
man/coap.txt.in:

Add in Q-Block information.

src/block.c:

Add in the new functions to support Q-Block.

src/coap_debug.c:

Output the new options as appropriate.

src/coap_io.c:

Check for Q-Block transmission timeouts.

src/coap_session.c:

Add in the Congestion Control support.

src/net.c:
src/resource.c:

Add in Q-Block support.

configure.ac
CMakeLists.txt

Add in support for enabling/disabling Q-Block support (enabled by default).
2023-07-11 11:04:04 +01:00
Jon Shallow 52dcc5201b Reliable PDUs: coap_show_pdu(): Do not show all the non-reliable headers 2023-07-05 10:53:00 +01:00
Jon Shallow 9920d3e295 pre-commit: Add in initial support
Add in github workflow.

Add in .pre-commit-config.yaml.

Updated man directory using pre-commit.

Others to follow.
2023-07-03 08:57:09 +01:00
Jon Shallow 5ac47de1a4 examples-code-check.c: Report on missing man pages
Set optional 2nd parameter to libcoap-3.sym to generate missing output.
2023-06-28 21:18:22 +01:00
Jon Shallow 31f692b8b2 man: Document WebSockets support 2023-06-28 21:16:11 +01:00
Jon Shallow 1dfae51f30 man: Fix coap_attribute() example 2023-06-28 10:25:51 +01:00
Jon Shallow 295afa9f95 man: Document deprecated functions
New: man/coap_deprecated.txt.in
2023-06-28 09:53:22 +01:00
Jon Shallow 63d5248d88 examples-code-check.c: Disable potential compile warning
Fixes snprintf() warning of writing into smaller buffer.
2023-06-12 13:16:21 +01:00
Jon Shallow e386160474 man: Correct man page errors
Update examples-code-check.c to cross-check NAME and SYNOPSIS entries.

Update examples-code-check.c to cross-check SYNOPSIS and RETURN VALUE entries.

Make the formating style of RETURN VALUES consistent.
2023-06-12 09:44:41 +01:00
Jon Shallow 21bd1df95b examples: Remove references to sockaddr* structures
This means that apps need to have no knowledge of what IP support is available.

Updates coap_uri_into_options() and coap_resolve_address_info()
which have only been recently added to develop branch and are not in any
previous release.
2023-06-09 12:04:09 +01:00
Jon Shallow 9a196ce418 coap_string(3): Include missing return types 2023-06-08 17:44:06 +01:00
Jon Shallow b9d53ed3d4 keepalive: Fix timeouts when network issues
If keepalive is enabled, make sure that they continue when a server
stops / starts.  Limit the retry timeouts to the number of seconds
defined by coap_context_set_keepalive() so that interim NAT devices
are always kept "warm".

Addded in a new event COAP_EVENT_KEEPALIVE_FAILURE and updated docs
accordingly.
2023-05-05 10:35:39 +01:00
Jon Shallow 3ebbcde43a mcast_ips: Restore mcast ip for mcast sessions for each new coap_send()
If the server is responding to a mcast request with a packet that is a
part of larger body (i.e. responding with Block2 option) the requests
for the missing packets have to be using unicast, which continues
to be supported.

The application can determine the unicast remote address before the next
coap_send() by using coap_session_get_addr_remote().

Add in a new function coap_session_get_addr_mcast() to get the mcast IP
if the client session was set up to talk to a mcast address.
2023-05-01 16:28:44 +01:00
Jon Shallow ca609d221c Persist: Support tracking observe information over server restarts
Add in optional callbacks for when dynamic resources are setup and deleted.

Add in optional callbacks for when observe subscriptions start and stop.

Add in optional callbacks for when the observe counter is updated (can be
ratelimited) for a resource as well as track when a resource is deleted.

Add is support for new functions

Main functions with libcoap tracking support are
 coap_persist_startup()
 coap_persist_stop()

coap-server has -t option to track observe information.

UDP sessions supported, as well as OSCORE over UDP.

Documentation updated

libcoap tracking support (as opposed to application tracking) is configurable.
2023-04-22 11:07:21 +01:00
Jon Shallow e533b980fa coap_resolve_address_info: Move logic into function, simplifying server apps
Add in new function coap_get_available_scheme_hint_bits() to help as well.
2023-04-22 10:45:17 +01:00
Jon Shallow 964bd69481 MinGW: Initial compile environment support 2023-04-12 10:06:46 +01:00
Jon Shallow aee4c3fa6e logging: Support defining maximum logging level
This allows for code reduction if not all logging levels are required.

Done by defining ./configure --enable-max-logging-level=X, where X can have
the value of 0 through 8 inclusive.

COAP_LOG_EMERG is always logged.

Can save up to 40k bytes.
2023-04-12 09:55:13 +01:00
Jon Shallow 391803aebf WebSockets: Add in support for WebSockets layer
Follows RFC6455, as specified in RFC8323.

Make support configurable.

Add in example support.

Update other code to be aware of WebSockets as a CoAP protocol.
2023-04-10 14:38:56 +01:00
Jon Shallow 546f4203b1 examples: Clean up memory usage on error close down
Makes valgrind testing easier.

Note that it is unsafe to call coap_free_context() from with an atexit()
handler.
2023-04-08 18:02:16 +01:00
Jon Shallow 786149fb12 Unix Domain: Add in support for Unix Domains
Support the AF_UNIX address family for transporting CoAP internally within
an appliance.
2023-02-10 19:52:48 +00:00
Jon Shallow 47a83549a8 RFC8974: Add in support for Extended Tokens
Add in new function coap_context_set_max_token_size() to define
the maximum supported token size.

Track changes to PDU to support extended tokens.

Update documentation.
2023-02-04 11:08:32 +00:00
Jon Shallow 0a5d80ad66 coap_address.[ch]: Add coap_resolve_address_info() and coap_free_address_info()
coap_resolve_address_info() emulates getaddrinfo() but has the extensibility to
support other socket types based on the address to resolve.

coap-client, coap-server and lwip/client updated to use this new functionality.

coap_address(3) updated to include the new functions.
2023-02-03 09:53:24 +00:00
Jon Shallow ba2fada8f2 documentation: Tidy up man pages
Add in new coap_address(3) man page.
Tidy up endpoint documentation.
Fix other minor nits in the documentation.
2023-01-21 13:42:59 +00:00
Jon Shallow dac6bd3b60 RFC8613: Add in OSCORE support
Based on work done in https://gitlab.informatik.uni-bremen.de/obergman/libcoap

New directories with files
 include/oscore
 src/oscore

New files
 include/coap3/coap_oscore.h
 include/coap3/coap_crypto_internal.h
 include/coap3/coap_oscore_internal.h
 man/coap-oscore-conf.txt.in
 man/coap_oscore.txt.in
 src/coap_oscore.c
 tests/test_oscore.c
 tests/test_oscore.h

Supported by new option (enabled by default)
 ./configure --enable-oscore
 cmake .. -DENABLE_OSCORE=ON

Requires a TLS library configured to do the OSCORE encryption and hashing.
2023-01-14 10:26:20 +00:00
Jon Shallow 3552b53be4 Copyright: Update copyright date to end 2023 as appropriate 2023-01-02 11:45:10 +00:00
Jon Shallow 4882641b95 documentation: Tidy up / correct documentation 2022-12-30 10:55:29 +00:00
Jon Shallow 4821daf366 documentation: Tidy up documentation
Provide consistency across all of the man pages as per :-

Provide missing function headers for functions.

Hyper link the function definitions.

Hyper link RFC references (except in code blocks).

Use https://rfc-editor.org/rfc/rfc.... instead of
https://tools.ietf.org/html/rfc.... for the RFC links.

Use https://rfc-editor.org/rfc/rfc.... instead of
https://datatracker.ietf.org/doc/html/rfc.... for the RFC links.
2022-12-20 20:34:37 +00:00
Jon Shallow 68f1a6eff3 log_levels: Replace usage of syslog LOG_ with COAP_LOG_
This removes the reliance of syslog definitions in libcoap by using libcoap's
version.
2022-12-17 12:38:31 +00:00
Jon Shallow 4b54c0d9ef logging: Use new logging macros for examples and man pages
Drop the use of syslog LOG_DEBUG etc. for coap_log() and use the
coap_log_debug() etc. macros which make use of COAP_LOG_DEBUG etc.

Application examples updated, as well as the man page examples.
2022-12-09 14:55:39 +00:00