include/coap2/net.h:
src/net.c:
Update code using #587 as a base to fix potential issues.
Fixes CID 1502429
CMakeLists.txt:
cmake_coap_config.h.in:
Test for <net/if.h>
examples/coap-rd.c:
examples/coap-server.c:
man/coap-rd.txt.in:
man/coap-server.txt.in:
Add in -G option to support specifying interface to use for multicasting.
Otherwise, the interface allocated by the O/S is used depending on the
address (if any) bound to.
man/Makefile.am:
man/coap_context.txt.in:
Document the coap_join_mcast_group_intf() function.
src/coap_debug.c:
Make sure that coap_print_addr() returns a NULL terminated buffer.
src/coap_tinydtls.c:
Replace UNUSED with COAP_UNUSED that got missed from a merge.
man/examples-code-check.c:
src/pdu.c:
tests/oss-fuzz/pdu_parse_target.c:
Fix trailing white space.
win32/libcoap.vcxproj:
win32/testdriver/testdriver.vcxproj:
Correct include/coap2 paths.
CoAP transaction id was formerly defined as a hash of the remote address and
message id of the CoAP PDU. It now only refers to, and is used as, the
message id.
Replace occurences of 'transaction id' with 'message id' to reflect naming in
RFC7252.
Correct the definition of coap_tid_t to what it actually represents.
Replace occurrences of coap_tid_t with coap_mid_t.
Replace uses of tid with mid
Remove unused function coap_find_transaction().
Correctly track the tokens so that the token that application sees in the
response is the same token as used in the initial request.
Update coap-server so that response data can be sent back to echo the data
that was in the request.
Fixes
CID 1502431
CID 1502428
CID 1502422
.github/workflows/main.yml:
Build all the cmake TLS variants.
CMakeLists.txt:
Add in missing file.
examples/tiny.c:
include/coap2/encode.h:
Move COAP_PSEUDOFP_ENCODE_8_4 functions from encode.h to tiny.c.
Fix COAP_PSEUDOFP_ENCODE_8_4_DOWN 'ls' ordering complaint.
man/examples-code-check.c:
Fix compile warning, allow 'Unused but set variables' in examples and set
-Werror when compling the examples.
examples/lwip/Makefile:
Remove compilation option -fpack-struct
Create a new include/coap2/coap_resource_internal.h to hold all the information
not available to applications.
Makefile.am:
Include coap_resource_internal.h in EXTRA_DIST.
Remove functions no longer visible from CTAGS_IGNORE.
examples/coap-rd.c:
examples/contiki/server.c:
examples/etsi_iot_01.c:
tests/test_wellknown.c
Replace direct access to coap_resource_t variables with functions as
appropriate.
include/coap2/resource.h:
include/coap2/subscribe.h:
include/coap2/coap_resource_internal.h: (New)
include/coap2/coap_subscribe_internal.h:
Move coap_resource_t, coap_addr_t, non API #defines and non API functions from
resource.h into coap_resource_internal.h, coap_subscribe_internal.h and
subscribe.h.
Replace inline functions accessing coap_resource_t with actual function
definitions.
Add new functions coap_resource_release_userdata_handler() and
coap_attr_get_value().
include/coap2/block.h:
Use coap_resource_t typedef.
include/coap2/coap_forward_decls.h:
Include coap_resource_t and coap_addr_t typedefs. Also typedef coap_context_t
to get rid of #include circular requirements.
include/coap2/coap_internal.h:
win32/libcoap.vcxproj:
win32/libcoap.vcxproj.filters:
Include coap_resource_internal.h.
include/coap2/net.h:
Remove "typedef struct coap_context_t" and do this in coap_forward_decls.h.
src/resource.c:
Update with the replaced inline functions. Add in the new functions
coap_resource_release_userdata_handler() and coap_attr_get_value().
libcoap-2.map:
libcoap-2.sym:
Update with new function visibility.
man/Makefile.am:
man/coap_attribute.txt.in:
man/coap_observe.txt.in:
man/coap_resource.txt.in:
Update with the new coap_resource_t and coap_attr_t usage.
In handle_response() the ACK is sent before calling ctx->response_handler() so
if the response_handler() wants to send RST the server ignores it as the ACK
has already been received.
By updating coap_response_handler_t to return a value, this can be used to
send the ACK (return of COAP_RESPONSE_OK) or a RST (return of COAP_RESPONSE_FAIL)
after ctx->response_handler() is called.
include/coap2/net.h:
man/coap_handler.txt.in:
Create a new enum coap_response_t for use as the return value for
coap_response_handler_t.
Update coap_response_handler_t and associated documentation.
src/net.c:
Send CoAP ACK or RST depending on return value of ctx->response_handler().
examples/client.c:
Update message_handler() to use the new coap_response_handler_t return values
(coap_response_t).
Remove block handling logic from coap-client and coap-server and make use of the
new libcoap functionality.
Add in new -L option to be able to define how libcoap is to work with block
handling. Update documentation accordingly.
This change removes the need for applications having to know about handling
requests for the next block etc. It also gives the application the ability
to pass a large body of data to be transmitted and be told when this body is
no longer required.
This logic is enabled in libcoap by setting COAP_BLOCK_USE_LIBCOAP using
coap_context_set_block_mode()
This change breaks down into 4 specific areas
1) Client doing a PUT/POST etc. of a large amount of data (BLOCK1).
coap_add_data_large_request() is used which provides a 'finished with data'
callback function as well as adding required options to the PDUs. This
function calls coap_add_data_large_internal().
Internal coap_handle_response_send_block() sends off the subsequent blocks
(using session->lg_xmit).
2) Server receiving PUT/POST etc. of a large amount of data (BLOCK1).
Internal coap_handle_request_get_block() acknowledges the appropriate blocks
(using session->lg_srcv) and either passes in the individual blocks or the body
depending on whether COAP_BLOCK_SINGLE_BODY is set or not using
coap_context_set_block_mode().
3) Server sending a large data response to GET / observe (BLOCK2)
coap_add_data_large_response() is used which provides a 'finished with data'
callback function. This function calls coap_add_data_large_internal() as well
as filling in the necessary options for each PDU.
Interal coap_handle_request_send_block() will then send the next requested block
(using session->lg_xmit).
4) Client receiving a large data response (BLOCK2)
coap_send_large() for the initial request sets this up.
Internal coap_handle_response_get_block() will then request the next block when
previous block received (using session->lg_crcv) and either passes the
individual blocks or the body depending on COAP_BLOCK_SINGLE_BODY being set in
coap_context_set_block_mode().
----
The following new internal functions have been added
coap_handle_request_get_block()
coap_handle_request_send_block()
coap_handle_response_get_block()
coap_handle_response_send_block()
coap_add_data_large_internal()
The following new functions have been added.
coap_add_data_large_request()
coap_add_data_large_response()
coap_context_set_block_mode()
coap_get_data_large()
coap_pdu_duplicate()
coap_send_large()
coap_session_init_token()
coap_session_new_token()
The coap_session_init_token() and coap_session_new_token() were added to make
the handling of unique tokens for each request/response easier.
https://datatracker.ietf.org/doc/html/draft-ietf-core-echo-request-tag-10#section-4
New files
include/coap2/coap_block_internal.h:
man/coap_block.txt.in:
New memory types
COAP_LG_XMIT
COAP_LG_SRCV
COAP_LG_CRCV
CoAP response codes in examples represented by non-human-readable magic
numbers. It makes code harder to read, understand, and maintain.
Magic numbers there where replaced by human-readable enums.
Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
The use of the verify_peer_cert and require_peer_cert variables in the
coap_dtls_pki_t structure was giving inconsistent results across all the
TLS libraries. This primarily was down to the large numbers of options
available to control the TLS handshakes in OpenSSL compared to the limited
control available to mbedTLS port which followed later. require_peer_cert is
not easy to control in mbedTLS as it is an implicit configuration based on how
other, not always related, items were configured.
require_peer_cert was used by the server to control whether the client could
use anonymous certificates or not. This is now controlled by verify_peer_cert.
require_peer_cert variable has been replaced with check_common_ca, so that
the OpenSSL functionality can continue, but enable GnuTLS / mbedTLS to
produce the same results. This allows peers to mutually authenticate (because
the peer certs are signed by the same common CA) or not which was in effect
controlled by verify_peer_cert previously.
If check_common_ca is set, then allow_self_signed is ignored.
If is_rpk_not_cert is set, then all certificate validation is ignored.
In the examples, use of the -R option unsets check_common_ca, so disables
mutual authentication support by having a common CA. This was needed as
mbedTLS and GnuTLS only have a single trust store for CAs.
configure.ac:
Increase the number of mbed libraries to use when checking for mbedTLS.
examples/client.c:
examples/coap-rd.c:
examples/coap-server.c:
Add in -n (unset verify_peer_cert) option. In the case of coap-server and
coap-rd, make -n refer to verify_peer_cert.
Add in TLS library capabilites in usage().
Update usage() documentation as appropriate, with some changes to fit
everything into a 80 column output.
include/coap2/coap_dtls.h:
include/coap2/net.h:
Update with variable changes, and make the coap_dtls_pki_t parameter const for
the *_context_set_pki() functions.
man/coap-client.txt.in:
man/coap-rd.txt.in:
man/coap-server.txt.in:
Update documentation to reflect the examples option usage.
man/coap_context.txt.in:
man/coap_encryption.txt.in:
man/coap_session.txt.in:
Update with the new variable name and document as appropriate.
src/coap_gnutls.c
src/coap_mbedtls.c
src/coap_notls.c
src/coap_openssl.c
coap_tinydtls.c
Update to make variable usage consistent. Update logging from LOG_WARNING to
LOG_INFO where there is an override of a PKI check failure by one of the
coap_dtls_pki_t variables.
Timing window closed for TLS where the peer does not like a certificate, sends
fatal alert and closes connection. local then fails on writing the next
handshake - but now also reads in alert and reports on it.
src/coap_io.c:
Update logging from LOG_WARNING to LOG_INFO for EPIPE or ECONNRESET errors in
coap_socket_write().
src/net.c:
Handle the const coap_dtls_pki_t parameter in coap_context_set_pki() function.
Make documentation more consistent across doxygen output.
Add in caching module.
Add in encoding/decoding module.
Add in application i/o internal module.
Move deprecated items out of respective modules.
See https://sourceforge.net/p/libcoap/mailman/message/37039434/
Works for
Computer: Windows 10 64 bit & CYGWIN_NT-10.0 x86_64
Cygwin: 3.1.5-1
OpenSSL: 1.1.1g
gcc:9.3.0
and gcc-10.2.0 + openssl1.1.1f
configure.ac:
Support cygwin build environment. If so, set -D_CYGWIN_ENV in CFLAGS.
libtool: warning: undefined symbols not allowed in x86_64-pc-cygwin shared libraries; building static only
still to be fixed.
.gitignore:
Ignore *.exe filenames
src/coap_io.c:
define ipi_spec_dst as ipi_addr if _CYGWIN_ENV
examples/client.c:
examples/coap-rd.c:
examples/coap-server.c:
examples/etsi_iot_01.c
man/examples-code-check.c:
src/coap_io.c:
src/coap_tcp.c:
Fix compiler warnings.
sizeof(socklen_t) != sizeof(size_t) [-Wsign-compare]
isdigit() etc. complain about byte size array subscripts [-Wchar-subscripts]
snprintf size checks [-Wformat-truncation=]
Update
examples/client.c:
Add in -w option to add in a NL at end of receiving data - including after
re-assembling a BLOCK2 set of data.
man/coap-client.txt.in:
Document -w option.
Request raised by Issue #473.
Add code to better support the Proxy-Uri: and Proxy-Scheme: CoAP Options.
examples/client.c:
Make sure that the Proxy-Uri: option is added (if set) when clearing down an
observation (fixes#112).
Check that Proxy-Uri: option has a maximum data length of 1034 bytes.
Handle user defined Proxy-Scheme: option correctly.
Update -P option to include scheme to be used when connecting to the proxy.
examples/coap-server.c:
Add in hnd_proxy_uri() handler function. This has support for a direct or ongoing
proxy connection for the coap* protocols. The ongoing connection is set up as a
different CoAP session and is assocated with the incoming session for relaying
requests / responses.
Internal functions taken from client.c are used where appropriate.
Proxy support code has a SERVER_CAN_PROXY wrapper, so footprint can easily be
reduced if required.
New -P and -u options added to support ongoing connections.
include/coap2/net.h:
Add in tracking the proxy uri handler into coap_context_t.
include/coap2/resource.h:
Track whether a resource definition is for Proxy-Uri:/Proxy-Scheme:.
Define the coap_resource_proxy_uri_init() function for handling the Proxy-Uri:
option or Proxy-Scheme: option in an incoming request.
include/coap2/uri.h:
Add in COAP_URI_SCHEME_HTTP and COAP_URI_SCHEME_HTTPS as valid Proxy-Uri:
schemes.
Define the coap_split_proxy_uri() function (similar to coap_split_uri() but
supports the proxy extras. Both now use a common sub function internally.
libcoap-2.map:
libcoap-2.sym:
Expose the new coap_resource_proxy_uri_init() and coap_split_proxy_uri()
functions.
man/Makefile.am:
Handle coap_resource_get_userdata(3) now being over the 10 definition limit
in man/coap_resource.txt.in.
man/coap-client.txt.in:
Update documentation for the -P option.
man/coap-server.txt.in:
Document the new -P proxy option.
Document the new -u user option.
man/coap_resource.txt.in:
Include documentation for coap_resource_proxy_uri_init().
src/coap_debug.c:
Output the Proxy-Scheme: Option as text.
src/net.c:
Sanity check and handle COAP_OPTION_PROXY_URI and COAP_OPTION_PROXY_SCHEME
in handle_request().
src/resource.c:
Add in coap_resource_proxy_uri_init() function.
Handle the addition of a proxy uri handler in coap_add_resource().
src/uri.c:
Rename coap_split_uri() to coap_split_uri_sub() and add in extra proxy
handling support based on input parameters.
Create new coap_split_uri() and coap_split_proxy_uri() which call
coap_split_uri_sub() appropriately.
TODO:
Remove reference to Proxy support required
src/coap_gnutls.c:
Fix a double deallocate found during testing
Support of COAP_PKI_KEY_PEM requires reading files which may not be supported
in libcoap running in a non Posix environment.
Remove RPK support when using PKI key type COAP_PKI_KEY_PEM. Update
coap-server and coap-client to read the optional .pem files into memory and
use PKI key type COAP_PKI_KEY_PEM_BUF instead.
Currently OpenSSL and MBedTLS do not support RFC7250. See
https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations#Extensions
last column.
GnuTLS >= 3.6.6 required.
TinyDTLS update required.
New option is_rpk_not_cert added to PKI setup structure which is enabled
in coap-client and coap-server by the -M option and the use of a PUBLIC KEY
instead of a CERTIFICATE in the cert file. If file is EC PRIVATE KEY, then
it can be used for both the public and private key files.
man/coap-client.txt.in:
man/coap-server.txt.in:
Document -M option.
man/coap_encryption.txt.in:
man/coap-server.txt.in:
man/coap_context.txt.in:
Add in documentation for RPK.
examples/client.c:
examples/coap-server.c:
Add in support for is_rpk_not_cert and -M option.
Stop sending ::1 for SNI - use localhost instead.
include/coap2/coap_dtls.h:
Add in is_rpk_not_cert option.
include/coap2/str.h:
src/str.c:
libcoap-2.map:
libcoap-2.sym:
Add in coap_new_binary() and coap_delete_binary() functions.
src/coap_openssl.c:
Report RPK is not supported if invoked.
Check that all received data is used up for error recovery.
src/coap_mbedtls.c:
Report RPK is not supported if invoked.
Handle more MbedTLS generated errors.
Check that all received data is used up for error recovery.
src/coap_gnutls.c:
Add in support for RPK.
Add in sending Hello Verify if not cookie match in Client Hello
Check that all received data is used up for error recovery.
src/coap_tinydtls.c:
Add in support for RPK.
HOWTO.pkcs11:
Update for use with RPK.
Use .der file for '-C ca_file' definitions as later GnuTLS needs CA
to be trusted in HSM.
This updates the initial work done for adding in cache support
include/coap2/coap_cache.h: (new)
include/coap2/coap_cache_internal.h: (new)
src/coap_cache.c: (new)
New files to support cache support.
CMakeLists.txt:
Makefile.amMakefile.am:
Makefile.libcoap:
configure.ac:
examples/lwip/Makefile:
include/coap2/coap.h.in:
include/coap2/coap.h.windows:
win32/libcoap.vcxproj:
win32/libcoap.vcxproj.filters:
Add in the new files.
examples/client.c:
Fix valgrind reported memory leak.
examples/coap-server.c:
Add in new example_data resource that uses the new caching logic.
Update hnd_put() to use the new cache logic for BLOCK1 PUTs.
include/coap2/coap_forward_decls.h:
include/coap2/coap_internal.h:
include/coap2/coap_session.h:
include/coap2/net.h:
Add in new cache support.
libcoap-2.map:
libcoap-2.sym:
Include the new functions.
man/Makefile.am:
man/coap.txt.in:
man/coap_cache.txt.in: (new)
Update documentation.
src/coap_io.c:
Idle timeout cache entries.
src/coap_session.c:
Delete cache entry when session is deleted.
src/net.c:
Delete cache entries when context is freed off.
src/coap_gnutls.c:
src/coap_mbedtls.c:
src/coap_notls.c:
src/coap_openssl.c:
src/coap_tinydtls.c:
Add in SHA256 digest support.
Add in coap_new_binary() and coap_delete_binary() functions which operate
in the same way as coap_new_string() and coap_delete_string() but work on
coap_binary_t objects.
include/coap2/str.h:
src/str.c:
Add in the coap_new_binary(), coap_resize_binary() and coap_delete_binary()
functions.
configure.ac:
man/Makefile.am:
man/coap.txt.in:
man/coap_string.txt.in: (new)
Add in documentation for the coap_string functions.
libcoap-2.map:
libcoap-2.sym:
Update with new functions.
coap_config.h.contiki:
include/coap2/lwippools.h:
include/coap2/mem.h:
src/mem.c:
Add support for fixed memory allocations for Cacke-Key and Cache-Entry
All this is handled by libcoap with coap-client having the ability to define
an initial Hop Count value for testing. No other application support is
required.
Incoming requests are checked for the Hop Limit option - if found, the value
is decremented in the PDU before passing it up to the application. If it
decrements to 0, a 5.08 response is generated.
coap_add_option() checks if this is a Proxy option for a request. If so, and
Hop Limit option does not exist, then the Hop Limit option is inserted into
the PDU with the default value (16).
coap_send() checks if it is a 5.08 response and if so, prepends the diagnostic
data with the IP address of the transmitting interface. If the IP address
already exists, then the PDU is dropped as the return path for the 5.08 response
is looping. An alternative method for return path looping check is also
used by initially setting, then testing and then decrementing the Hop Limit
value as response packets pass back through the proxies. If a proxy does not
copy the Hop Limit options when returning the 5.08 response, then the IP address
duplication is used.
Makefile.am:
Hide the coap_insert_option(), coap_update_option and coap_pdu_check_resize()
function from applications.
README.md:
Add in RFC8768 is supported by libcoap.
examples/client.c:
Add in the -H hoplimit option.
include/coap2/pdu.h:
Add in the default Hop-Limit: option COAP_OPTION_HOP_LIMIT.
Re-organize the COAP_OPTION_ descriptions to include
the C, U, N, R, E, I and U flags.
Expose the internal coap_pdu_check_resize() function so src/net.c can use it.
Define the two new internal functions coap_insert_option() and
coap_update_option() and expose them so that the test suites can use them.
man/coap-client.txt.in:
Document the new -H hoplimit option.
man/coap.txt.in:
Include the new RFC8768.
man/coap_pdu_setup.txt.in:
Update documentation for the CoAP options.
src/coap_debug.c:
Add in support for printing out COAP_OPTION_HOP_LIMIT.
src/net.c:
Make sure that COAP_OPTION_HOP_LIMIT is not returned in an error response.
Decrement received Hop-limit in handle_request() and generate 5.08 response
if appropriate.
Update coap_send() to prepend IP in 5.08 response.
Support COAP_OPTION_HOP_LIMIT being used in the 5.08 response message.
src/pdu.c:
Report on CoAP options that are repeated, but not defined as repeatable.
Define new (5.08) Hop Limit Reached error response.
Add in new internal coap_insert_option() function. This now means that
callers of coap_add_option() no longer have to have the options in the
correct order.
Add in new internal coap_update_option() function that updates the value of
an option.
Make coap_pdu_check_resize() non-static.
tests/test_pdu.c:
Check that options are getting inserted in the correct order when using
coap_insert_option(), even though they are provided in a random order.
Test the coap_update_option() function.
Support observe for both GET and FETCH.
Correct coap-client programatic addition of observe establish option which
"happened" to work previously because COAP_OBSERVE_ESTABLISH was 0.
Add in a new PKI_KEY type for PKCS11 URI to get the PKI information from a
smart card or HSM device.
Currently only OpenSSL and GnuTLS are supported.
Makefile.am:
Do not expose coap_dtls_shutdown() function.
examples/client.c:
examples/coap-server.c:
Add in support for using pkcs11: URIs for defining the Certificates and
Private Keys.
include/coap2/coap_dtls.h:
Add in COAP_PKI_KEY_PKCS11 Key type.
man/coap-client.txt.in:
man/coap-server.txt.in:
Update documentation for supporting PKCS11.
man/coap_encryption.txt.in:
Add in documentation for COAP_PKI_KEY_PKCS11.
Correct some typos.
HOWTO.dual.gnutls (new):
HOWTO.dual.openssl (new):
HOWTO.dual.softhsm2 (new):
HOWTO.pkcs11 (new):
HowTo information.
src/coap_gnutls.c:
src/coap_openssl.c:
Add in PKCS11 support.
src/coap_mbedtls.c:
PKCS11 not yet supported.
Add in no-op coap_dtls_shutdown() function.
src/coap_notls.c:
src/coap_tinydtls.c:
Add in no-op coap_dtls_shutdown() function.
src/net.c:
Invoke coap_dtls_shutdown() function in coap_cleanup().
NOTE: There are memory leaks after cleanly closing down. These are not within
libcoap as far as can be determined. These leaks are a work in progress.
man/coap_attribute.txt.in:
man/coap_context.txt.in:
man/coap_encryption.txt.in:
man/coap_handler.txt.in:
man/coap_io.txt.in:
man/coap_keepalive.txt.in:
man/coap_logging.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_recovery.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:
man/coap_tls_library.txt.in:
Make sure the full list is defined in the NAME section
[Gives a2x warnings that there are more than 10 entries, but this is OK]
Update where BUGS can be reported to.
man/Makefile.am:
Remove EXTRA_PAGES as all the names are now defined A2X_EXTRA_PAGES.
There needs to be an easy way to validate that the examples provided in the
man pages compile without errors.
This PR provides a new executable examples-code-check that can be run against
the .txt.in files that are in the man directory. It abstracts the code for
each example and then runs the compiler against that stub code reporting errors
and warnings as appropriate for subsequent fixing in the man page.
.gitignore:
Ignore the new executable and the files it generates.
Makefile.am:
configure.ac:
Remove MAN_DIR and hard code in the man directory so that examples-code-check
is always built.
autogen.sh:
Make sure that all the temporary stub code files are cleaned up.
man/Makefile.am:
Support building and clean-up of the new examples-code-check.
man/examples-code-check.c: (new)
The code that parses the man pages, looking for examples and the gets
the examples compiled, testing for errors.
The function definitions in the SYNOPSIS section are also included in the
compilation of the examples.
scripts/build.sh:
If WITH_TESTS is set, check that the man page examples compile.
man/coap_encryption.txt.in:
man/coap_io.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:
Correct the SYNOPSIS function definitions.
examples/coap-server.c:
Track time spent in the epoll branch for the select() and coap_io_process()
calls to correctly adjust wait_ms.
Adjust wait_ms to be the remaining amount in the current second, so that
any 'time' observers get the updated time just after the new second starts.
include/coap2/net.h:
Add in support to track that an observe is pending transmission - primarily
a saving of needing to look up if a observe needs to be sent.
include/coap2/resource.h:
Add in support to track the context that 'owns' a resource.
src/resource.c:
Track the context that 'owns' a resource in coap_add_resource().
Track the fact that when we are making a resource partially dirty by recording
that an observe is pending in coap_notify_observers().
In the epoll case, make sure that timerfd triggers immediately when a pending
observe is set so that the application will return immediately from any select()
etc. call to process the libcoap outstanding activity (in particular pending
observes) in coap_resource_notify_observers().
Only call coap_notify_observers() in coap_check_notify if there are any
observes pending.
man/coap_observe.txt.in:
Minor clarifications in the examples.
coap_session_str(3) is defined in both coap_session.txt.in and
coap_logging.txt.in. This fix removes the duplicate so that it is
only part of coap_logging.txt.in.
Other minor corrections and including definition for coap_is_tcp_supported.
man/Makefile.am:
Correct EXTRA_PAGES definition.
man/coap_session.txt.in:
Remove references to coap_session_str definitions.
Add in coap_is_tcp_supported() definition.
man/coap_tls_library.txt.in:
Correct some typos.
Replace COAP_RUN_BLOCK with COAP_IO_WAIT and COAP_RUN_NOBLOCK with
COAP_IO_NO_WAIT for naming clarity.
Instead of COAP_IO_NO_WAIT being 1, make it -1 to fix 1ms busy loop.
Handle the case when coap_io_prepare_io returns 0 to prevent indefinite
select() wait.
include/coap2/net.h:
Make the timeout_ms parameter uint32_t in coap_io_process*() functions to
make sure special case of COAP_IO_NO_BLOCK is correctly handled on different
architectures.
Update COAP_IO_NO_BLOCK to -1.
src/coap_io.c:
Fix the 1ms busy loop and potential infinite wait in the non epoll case.
man/coap_io.txt.in:
Update documentation to reflect the changes.
examples/coap-server.c:
examples/contiki/server.c:
Update to use COAP_IO WAIT and COAP_IO_NO_WAIT as appropriate.
coap_read(), coap_write() and coap_run_once() are confusing in their names
and do not really describe what they do.
For example, coap_read() does both reading and writing, coap_write() may
do some writing, but primarily is used to determine what should be monitored
and for how long to wait in the following select() or epoll_wait() calls.
coap_run_once() implies that the code is only to be run once - again confusing.
By renaming coap_read() to coap_io_do_io(), this better describes what this
function does.
By renaming coap_write() to coap_io_prepare_io() this better describes what this
function does.
By renaming coap_run_once() to coap_io_process(), this better describes what
this function does.
By renaming coap_io_do_events() to coap_io_do_epoll(), this better describes what
this function does and is associated with.
A wrapper function coap_io_prepare_epoll() has been created, using
coap_io_prepare_io() with some preset values to simplify function usage.
include/coap2/net.h:
Update with the new function names, and deprecate the old functions. Also
document the fact that coap_io_prepare_io(), coap_io_do_io(),
coap_io_prepare_epoll(), and coap_io_do_epoll() are really internal functions.
Create app_io module for Doxygen.
libcoap-2.map:
libcoap-2.sym:
Expose the new functions to applications.
examples/client.c:
examples/coap-rd.c:
examples/coap-server.c:
examples/contiki/coap-observer.c:
examples/contiki/server.c:
examples/etsi_iot_01.c:
man/coap_io.txt.in:
man/coap_observe.txt.in:
src/coap_io.c:
src/coap_io_lwip.c:
src/net.c:
src/pdu.c:
Update using the new function names.
Setting the etimer has been moved out of coap_io_process() into
coap_io_do_epoll(), making the logic easier for applications to use
coap_io_do_epoll() should they need to. This also gets rid of a
potential timing window where a pending etimer event gets missed.
coap_io_do_epoll() now calls coap_io_prepare_epoll() if the etimer has
triggered removing the need for applications using coap_io_do_epoll() to
set up their own loops if etimer is triggered.
man/coap_attribute.txt.in:
man/coap_context.txt.in:
man/coap_encryption.txt.in:
man/coap_handler.txt.in:
man/coap_logging.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_recovery.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:
man/coap_tls_library.txt.in:
Add in reference to MbedTLS where appropriate.
man/coap_encryption.txt.in:
Add in PKI Key type COAP_PKI_KEY_PEM_BUF for passing in PEM information
that is held in memory instead of in a file.
https://tools.ietf.org/html/rfc7641#section-4.5 requires that non-confirmable
observe responses should be sent as confirmable at least once every 24 hours.
However there is a requirement to override this periodical confirmable sending
behavior in lossy under DDoS attack type environments.
https://tools.ietf.org/html/draft-ietf-dots-signal-channel-41#section-4.4.2.1
Add in support for, and document, a new coap_resource_init() flag
COAP_RESOURCE_FLAGS_NOTIFY_NON_ALWAYS to handle this non RFC7641 requirement.