Commit Graph
547 Commits
Author SHA1 Message Date
Jon Shallow 9cde7cdee1 Update version to release 4.3.3 2023-09-14 09:55:47 +01:00
Jon Shallow f67f44516a Update version to release 4.3.2 2023-09-07 11:51:24 +01:00
Daniel Mangum a9808ade42 Define coap_mutex_t as sys_mutex on Zephyr
Changes definition of coap_mutex_t as k_mutex to sys_mutex to build
properly with Zephyr.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-09-04 10:35:57 +01:00
Jon Shallow f176bf3c53 release 4.3.2rc2: Release candidate for 4.3.2 2023-08-14 09:37:23 +01:00
Jon Shallow cd7b5de109 Mutexes: Clean up / simplify use of mutexes
Not all OS implementations properly support static initializations.
2023-07-29 11:31:22 +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 cb78d5fd85 release 4.3.2rc1: Release candidate for 4.3.2 2023-07-22 09:29:32 +01:00
Jon Shallow 9763b3a25a Documentation: Fix typos 2023-07-22 09:27:00 +01:00
Jon Shallow 15473b037e layers: Update coap_layer_func_t function names to be prefixed with l_
Prevents issues with things such as '#define write lwip_write'.
2023-07-20 15:25:05 +01:00
Jon Shallow 4f164dcb2f coap_mutex_internal.h: Support LwIP ! NO_SYS mutexes 2023-07-20 15:02:25 +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 e2910a5bf1 naming: Rename remaining *.[ch] files that are not prefixed with coap_
include/coap3/block.h -> include/coap3/coap_block.h
include/coap3/pdu.h -> include/coap3/coap_pdu.h
include/coap3/resource.h -> include/coap3/coap_resource.h
src/block.c -> src/coap_block.c
src/net.c -> src/coap_net.c
src/pdu.c -> src/coap_pdu.c
src/resource.c -> src/coap_resource.c
2023-07-13 08:59:22 +01:00
Jon Shallow 8f068c0bbf pre-commit: Include re-styled include files to checks 2023-07-11 20:17:10 +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 ca1e4098b0 pre-commit: Include re-styled OSCORE files to checks 2023-07-05 10:50:25 +01:00
Jon Shallow 64450b6ec8 coap_mbedtls.c: Add in Connection ID support (RFC9146)
Requires MbedTLS 3.2.0 or later and MBEDTLS_SSL_DTLS_CONNECTION_ID defined
(which is the default in later versions of MbedTLS).
2023-07-03 08:54:56 +01:00
Jon Shallow a9b179ab32 Coding: Remove blank lines at ends of files 2023-06-29 09:34:52 +01:00
Jon Shallow 31f692b8b2 man: Document WebSockets support 2023-06-28 21:16:11 +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 5c1e7cae34 Async: Invert WITHOUT_ASYNC define to COAP_ASYNC_SUPPORTED for clarity
Prevents possibility of name clashes when integrating with other code / OS.
2023-06-15 11:01:22 +01:00
Jon Shallow b442140bb3 Oscore: Change HAVE_OSCORE define to COAP_OSCORE_SUPPORT for clarity
Prevents possibility of name clashes when integrating with other code.
2023-06-14 12:55:25 +01:00
Jon Shallow 1d81256fc1 ipv[46]: Add in configurable support for IPv4, IPv6 and AF_UNIX
Move some existing header inline code into source files.

Update coap_resolve_address_info() to remove need for client based app
code to have to understand IPv4/IPv6 code.

Remove IPv4/IPv6 specific code from examples code.
2023-06-12 14:55:09 +01:00
Jon Shallow b3ec5b83c3 Windows: Fix resolve issues / remove warnings
Handle Windows x68 size_t being only 32 bits.
2023-06-09 12:07:10 +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 6c05d34fc6 bcast: Support IPv4 broadcast as multicast
See https://datatracker.ietf.org/doc/html/draft-ietf-core-groupcomm-bis-08#section-3.9.5
2023-06-08 17:47:56 +01:00
Jon Shallow f4666c2ea9 LwIP: Support disabling LwIP's IPv6 support 2023-06-08 17:40:08 +01:00
Jon Shallow 8d869fff04 RIOT: Update to support latest libcoap code
Add in examples and pkg/build information
2023-06-05 12:47:15 +01:00
Jon Shallow dbf78b526f block.h: Make COAP_OPT_BLOCK_* functions safe against NULL indirects
COAP_OPT_BLOCK_LAST(opt) may return NULL, so doing *COAP_OPT_BLOCK_LAST(opt)
is unsafe. Replace indirect with COAP_OPT_BLOCK_END_BYTE(opt).
2023-05-11 09:00:53 +01:00
Jon Shallow 9d66e47241 coap_debug.c: Split out coap_print_ip_addr() from coap_print_addr()
Sometimes just the IP address is required, not the port as well.
2023-05-05 12:00:33 +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
Olaf Bergmann 77cfb9c99e pdu.h: Remove COAP_MEDIATYPE_ANY
Closes #757 [1]

[1] https://github.com/obgm/libcoap/issues/757
2023-04-24 15:34:01 +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 3ba0f0756c coap_config.h.windows.in: Add in header information 2023-04-22 10:44:07 +01:00
Jon Shallow 191cd5cf40 Layers: Move layer index table into coap_layers.c 2023-04-15 19:33:18 +01:00
Jon Shallow 621fd20c2b CBOR: Check for buffer overruns when reading in CBOR data 2023-04-13 10:16:38 +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
hasheddan 3133a1e4b7 oscore.h: Fix misspelling of Environment
Fixes a misspelling of Environment.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2023-04-11 20:54:53 +01:00
Jon Shallow 281f12107a coap_internal.h: Support builds with WebSockets and without OSCORE 2023-04-11 11:25:11 +01:00
Jon Shallow a4bbac4a60 coap_mutex_internal.h: Convert tabs to spaces 2023-04-10 14:56:03 +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 f0f20c285d syslog.h: Leave in conditional LOG_ definitions for now 2023-04-10 14:19:09 +01:00
Jon Shallow 6599297edb syslog.h: Remove all references to syslog.h
syslog.h is no longer required for libcoap as all LOG_ usage has been replaced
with COAP_LOG_.

Added #include <stdio.h> to example code for code-client and coap-server as
a hint should application code be using LOG_.
2023-04-10 14:03:13 +01:00
Jon Shallow c041af0b2b WebSockets: Add in libcoap infrastructure
Add in stub Websockets files.

Add in coap_crypto_hash(0 function.

Actual WebSocket support for applications will follow.
2023-03-24 09:49:00 +00:00
Jon Shallow 29c65c9d44 layers: Simplify and be more rigorous in layer separation
Tidy up send/receive reporting at each layer.
2023-03-23 19:04:55 +00:00
Jon Shallow adb8a3f5e2 layers: Add in protocol layers support
Current stack:-

Application
CoAP
CoAP-Session
DTLS
Netif
Sockets
Network Stack

Depending on the CoAP protocol, indexing functions through coap_layers_coap[]
(in src/coap_io.c) will invoke the correct layer function when used at the
CoAP and DTLS layers.

It is then easy to add in another protocol layer by updating coap_layers_coap[].
2023-03-20 10:49:02 +00:00