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.
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.
Assemble all the blocks before checking for Observe registration
or de-registration.
Track all the tokens used for the large FETCH registration and
re-use them for the de-registration as the server can elect to use
any of them when re-assembling the body for the registration Token.
If multiple requests (apart from DELETE) are sent at the same time to
the same resource, and the responses need to make use of the Block2 option,
there is no way for the server to differentiate between which block set a
request (if there is a resource content change) is for unless a Request-Tag
is used.
Disable this functionality by setting COAP_BLOCK_NO_PREEMPTIVE_RTAG when
calling coap_context_set_block_mode(). Request-Tag will still be sent
with any request that includes Block1 option.
Clean up / simplify conditions for breaking out of the main coap_io_process()
loop. ready is no longer required here.
Handle mcast Observe requests by continuing to track the token
Make sure that all of the Observe (potentially blocked) response is received
before closing down.
Remove unecessary code.
coap_io_pending() checks to see if there are any PDUs pending transmission,
whether there are any large (block) transmissions in progress, whether
there are still expected response packets(client) or expected request
packets(server), and whether the client is expecting further observe
responses. If any of this is true, then it returns 1, else 0.
coap_io_pending() also invokes coap_io_process() to check that all that can
be transmitted is, as well as processes any impending input packets.
This takes coap_can_exit() a step further who only checks the transmit state.
coap_handle_response_get_block() has been updated to release the current
lg_crcv if all the fragmented body of a large transfer have been received.
Documentation updated.
Set up coap_log_t as an enum, using syslog variable names prefixed by
COAP_.
Add function coap_dtls_log() for logging information from (D)TLS libraries.
Update the log output to have use Lower-case variants for the logging levels to
indicate that output is from the (D)TLS library instead of the CoAP library.
(D)TLS libraries updated to be consistent in the usage of
coap_dtls_set_log_level()/coap_dtls_get_log_level().
Add in coap_log_emerg(), coap_log_alert() etc. as wrappers to reduce the line
length required for log entries. Updating all the coap_log() functions to
no longer use syslog variants will be a part of a separate PR.
Added in the "-V" option to the examples, with an initial default of
COAP_LOG_ERR, separating out the CoAP and (D)TLS logging levels.
Note: TinyDTLS log output will be consistent when built against a TinyDTLS
version that contains support for an external logging handler.
As well as adding in the DTLS_PSK wrappers in the appropriate place. add in
coap_dtls_psk_is_supported(), coap_dtls_pki_is_supported(),
coap_dtls_pkcs11_is_supported() and coap_dtls_rpk_is_supported() functions
to support better granularity of what capabilities are available in the
(D)TLS libraries.
Update coap_string_tls_support() to use these new functions.
Uppdated documentation for these new functions.
The dtls versions of the server and client are built as
server-dtls and client-dtls.
Add in flexible option support for server and client. These are
a subset of the coap-server and coap-client options.
Apart from debug log messages, there is no way for a user to be
notified when a message retransmission happens.
This event can be useful for diagnosing issues related to
lossy networks or unresponsive CoAP servers (e.g. user can
track total retransmissions as an indicator for general link
quality).
Assigned event ID to 0x5002 to avoid creating a new 0x6000
event group, and because it's similar to COAP_EVENT_BAD_PACKET (0x5001).
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.
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.
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.
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.
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.
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.
Add in new function coap_mcast_per_resource() to enable granularity of
handling multicast requests differently at the resource level.
The granularity is handled by how the flags variable is set up in
coap_resource_init(). These additional flags are ignored if
function coap_mcast_per_resource() has not been invoked.
Added 2 functions coap_resource_unknown_init2() and
coap_resource_proxy_uri_init2() that support defining the mcast flags as
per coap_resource_init().
Responses are now delayed rather than the request being delayed before being
passed to the request handler.
Update coap-server with the -r option to enable multicast on specific
resources.
Do not reset wait_ms in coap-client for Block2 transfers.
Create where appropriate default values for the Congestion control base
values and update the derived CC values accordingly.
Move derived value #define to coap_session_internal.h.
Update coap_session_t to hold the new CC values.
Update documentation for the new CC functions that update / get the
appropriate values.
NOTE: PROBING_WAIT is not currently checked in the code.
Always delete PDUs on error before return from coap_send() (aligning with
previous documentation).
Check that the socket is still available before continuing with the PDU
transmission in coap_send().
Update documentation to be clearer on non-usage of PDU on return from
coap_send().
Trap coap_send() errors in coap-client.
Move event handlers setup code to earlier in coap-client to trap events
early on in the CoAP setup process.
The example coap-client application was setting the SIGPIPE signal to
SIG_IGN too late.
For applications that do not handle SIGPIPE, set MSG_NOSIGNAL in send() flags
to stop SIGPIPE being generated (but send() still returns EPIPE).
Drop the logging level when a client session cannot be extablished.
Can be reproduced when server requires certificates, but client does not
provide any certificate when using coaps+tcp:// and Mbed TLS.
Window 1
$ coap-server -c server.pem -C ca.pem
Window 2
$ coap-client coaps+tcp://127.0.0.1
$ echo $?
Track the RCV mtu size separately from the XMT mtu, so that sufficiently
large PDUs can be built for receiving incoming data.
Wait until reliable session is complete and the initial CSM have been exchanged
before building any new PDUs for transmission so that they can hold the
appropriate amount of Max-Message-Size data.
Add in support into coap-server and coap-client for defining the
Max-Message-Size to use by adding in 2 new functions
coap_context_set_csm_max_message_size() and
coap_context_get_csm_max_message_size().
Add in flexibility into coap-server to control the initial example_data size.
Requires #844 to prevent recursive mutex locking when initiating proxy ongoing
session to upstream server.
This commit adds two new events (`COAP_EVENT_SERVER_SESSION_NEW`
and `COAP_EVENT_SERVER_SESSION_DEL`), which are triggered when the
IO loop creates or deletes server-side sessions.
This then allows any (D)TLS to be set up between sending off the requests and
better demonstrates how this can be done in user code.
Allocate separate data for each post/put PDU.
Hold off on starting timer for next transmission until after response has
been received from the server (handles relatively slow DTLS startup).
The CoAP Proxy may not know how to handle a Critical option, but if it
is safe to forward it should be able to handle this.
RFRC7252 5.4.1
Critical/elective rules apply to non-proxying endpoints. A proxy
processes options based on Unsafe/Safe-to-Forward classes as defined
in Section 5.7.
If this is an incoming proxy type request special case any
critical options that are safe to forward.
Track ongoing sessions from an enabled proxy server so unknown critical
response options can be passed back to the originating requestor.
Update coap-server to handle Proxy-Scheme for proxying.
Update tests to use critical option 25 instead of 9.
Prevent multiple coap_new_client_session*() calls that are connecting to
the same server/port being bound to the same local ip/port.
Update logging for session creation / removal to easily differentiate between
sessions that have the same 4-tuple.
Document that coap_new_endpoint() is not required in client based code.
If coap-client '-p port' but not '-a addr' is provided, fix code so that
the port is bound to.
Only remove outstanding CON requests with token matches if there is an
ACK response.
Update the logging to differentiate between the 6 occurrences where the mid
is removed.
If the server recieving a Proxy request determines that it is the final
endpoint of the request, the resource that the request was sent to
was wrong. The update to coap_get_uri_path() fixes this issue.
There is now also parameter support for the proxy definition for the
coap-server where any defined host is treated as being the final endpoint
is in:
coap-server -P ,
This allows any actual server to be the final endpoint of any proxy request
without have to define all the names or IP addresses that the coap-server is
known by. Note that if there is nothing following the , (comma), anything
before the , (comma) will never be used.
Documentation updated.
Add new function coap_package_build() which returns "git describe --tags"
if available at library build time, else standard package version.
The value of "git describe --tags" is created at run time and passed in as
a compiler -D definition.
Update copyright end dates for updated files.