Because of time accuracy of COAP_TICKS_PER_SECOND (usually 1000
ticks per second on platform POSIX), the pong response may have
the same timestamp as the ping request. To be reliable, the pong
timestamp must be tracked separately from the general last RX/TX
timestamp.
According to documentation, coap_resource_notify_observers() must return 0 if
no observer will be notified. This can help an application release resources
associated to that resource for observation.
Add new event types to report the TCP connection status and CSM exchange
status to the application. Add optional auto send of ping messages for
reliable client sessions. Add default timeout of 30s for receiving a CSM
message from the remote host after connect.
Gcov[1] is a tool to investigate test code coverage. To collect
runtime statistics, certain compiler options must be set, i.e.
-fprofile-arcs, -ftest-coverage, and --coverage. Currently, only
the Gnu C Compiler is known to support the gcov instrumentation.
This change adds the configure option --enable-gcov that checks if
the compiler supports the aforementioned compiler flags and enables
these.
[1] https://gcc.gnu.org/onlinedocs/gcc/Gcov.html
Re-arrange checks in coap_new_client_session_pki() to prevent possible
dereference of setup_data before checking for NULL.
This fixes coverity CID 1472107.
This Makefile will be invoked from the OSS Fuzzer to create the
fuzzing executables. Invocation:
make -C tests/oss-fuzz -f Makefile.oss-fuzz
This change closes issue #231 [1].
[1] https://github.com/obgm/libcoap/issues/231
This change extends the continuous integration Makefile.ci with
new rules for creating the executables for OSS-Fuzz [1].
Object files and linked executables are now created in the directory
$OUT which is set to '.' by default.
[1] https://github.com/google/oss-fuzz
As C++ forbides returning a pointer to a temporary object, the
creation of a coap_str_const_t to wrap the character-array and
size done in coap_make_str_const() does not work.
This change therefore creates a C++ class CoAPStrConst in namespace
libcoap in a way that allows the default constructor to be used with
aggregate initialization.
This commit closes issue #233 [2].
[1] https://en.cppreference.com/w/cpp/language/aggregate_initialization
[2] https://github.com/obgm/libcoap/issues/233
New struct coap_binary_t - same as coap_string_t, used for tokens
Deprecate struct str with the intent of removing it downstream as it
polutes namespace.
Make end of coap_string_t data a NUL.
Updated coap_make_str_const(), removing .length= and .s= to keep upstream
compilers happy.
Update Doxygen for str.h
Files:
examples/client.c
examples/coap-rd.c
examples/coap-server.c
examples/contiki/server.c
examples/etsi_iot_01.c
include/coap/resource.h
include/coap/str.h
include/coap/subscribe.h
man/coap_observe.txt.in
src/net.c
src/resource.c
src/str.c
src/uri.c
tests/test_options.c
Update
This better describes what is going on here (as they are created by
coap_session_delay_pdu() and are only released off this queue when
either the session becomes established, or the outstanding CON requests
falls below COAP_DEFAULT_NSTART (a value of 1).
This is to remove confusion with the use of coap_context_t sendqueue
which is used for retransmitting data after no response detected for a
CON request.
include/coap/coap_session.h
src/coap_io.c
src/coap_session.c
src/net.c
The sub-directory tests/oss-fuzz contains single files that are
used from the Open Source Software Fuzzer [1]. This change provides
a template Makefile with the proper flags for compiling libcoap
applications in a continuous integration environment such as travis.
Intended usage from top_srcdir is:
make -C test/oss-fuzz -f Makefile.ci check clean
[1] https://github.com/google/oss-fuzz/
Delayed PDUs (found by the limiting of 1 CON request outstanding) are
added to session->sendqueue by coap_session_delay_pdu().
The session->sendqueue is only flushed out when a session becomes established
by calling coap_session_connected().
This fix now calls coap_session_connected() whenever the current CON count
is decremented.
Additionally, CON tracking now only tracks UDP & DTLS sessions.
coap_session_connected() is updated to not sent out more than one CON
request.
If a loss level is configured using coap_debug_set_packet_loss(), it
is not possible to restore full flow using 0% - as 0 is rejected as
being invalid. This fix allows 0% to restore full traffic flows again.
Add in -d max option, which then causes coap_resource_unknown_init() to get
called.
Number of dynamic resoures is limited by 'max'. The current set of resources
can be determined by using .well-known/core
If max is reached, 4.06 is returned.
Fixed typo in man coap_resource(3) in example for unknown resources
Updated to support the new coap_dtls_pki_t.
Add in new -C and -R options to support / test PKI mutual authentication
Make sure time resource is triggered no more frequently than once a sec.
Split out old coap_context(3) into coap_context(3), coap_encryption(3) and
coap_session(3) with coap_encryption(3) primarily updated to reflect the
updated PKI configuration options.
coap-client.txt.in
coap-server.txt.in
Update with new options making use of updated PKI interface
Update calls to coap_dtls_context_set_*() functions
"\n" terminate coap_log() calls
src/coap_session.c:
coap_session_disconnected() Report the session disconnected reason
Warn if coap_new_client_session_psk() called without both key and
identity defined (OpenSSL cannot handle this)
src/net.c:
coap_context_set_pki_root_cas(): New function
coap_dtls_context_set_pki_root_cas(): New function
coap_dtls_context_set_psk(): Remove unused parameters, add in server parameter
coap_dtls_context_set_pki(): Add in server parameter
coap_dtls_context_check_keys_enabled(): Add in UNUSED
src/coap_tinydtls.c:
coap_dtls_free_session() set coap_session->tls = NULL
coap_context_set_pki_root_cas(): New
coap_dtls_context_set_psk(): remove unused parameters, add in server parameter
coap_dtls_context_set_pki(): add in server parameter
coap_dtls_pki_t: Additional configuration parameters
coap_dtls_security_setup_t: Updated
coap_dtls_cn_callback_t: New
coap_dtls_sni_callback_t: New
coap_pki_key_t: New
coap_pki_key_pem_t: New
coap_pki_key_asn1_t: New
coap_dtls_sni_t: New
Comments tidy up.
Better Doxygen comments for coap_dtls.h and net.h
Doxygen fix for debug.h (introduced by #219 merge)
Doxygen update coap_endpoint_new_dtls_session() for in coap_session.h
coap_dtls_pki_t struct has been enhanced to have more configuration options.
These configuruation options then tell libcoap what needs to get checked by
the underlying OpenSSL library rather than the user application has to do it.
There still is support for the user application to do all the Certificate
checking etc.
A late change to the PKI Pull request got missed for the TLS case
in coap_dtls_context_set_pki() for the mapping of private key types to
the OpenSSL version. Have now pulled common DTLS and TLS code into a seperate
function
Fixed coap_(d)tls_free_session to not shut down a session that is not yet
fully started, as well as calling SSL_shutdown() twice if appropriate
The ssl parameter is set to NULL after closedown
Made coap_dtls_context_set_psk() smarter in what was updated, depending on
whether called by a client or server
Make sure that coap_dtls_psk_client_callback is defined in
coap_dtls_context_set_psk() in case coap_dtls_context_set_pki() was called
first. This fixes the first time issue after startup where a PSK client
was unable to establish a DTLS session - subsequent times were successful
Added in a set of callbacks, invoked from coap_dtls_context_set_pki(), so that
a server can differentiate between an incoming PSK or PKI connection request.
These are only invoked if no full_call_back was defined in the setup_data
Add in a set of user definable callbacs for checking CN and SNI provided
information
Add in support for the generation and detection of ALPN externsion
Output error message if PKI or PSK was not set up before a server endpoint was
set up and (D)TLS is being used.
Allow a client to talk to a server that is PKI enabled without the need for
a PreShared Key or PKI Certificate
Set the SSL information at the SSL, not the CTX level when it is a client
coap_show_pdu()'s API is now coap_show_pdu(coap_log_t, coap_pdu_t*)
New function void coap_set_show_pdu_output(int use_fprintf)
Default is use fprintf() instead of coap_log()
The output buffer size can be configuring -DCOAP_DEBUG_BUF_SIZE
Output COAP_OPTION_SIZE2 option as well
For binary data, output ascii readable equivalent immediately under the
hex output for ease of debugging.
include/coap/debug.h
src/debug.c
Update coap_show_pdu() API
New function coap_set_show_pdu_output()
Update coap_show_pdu() code
include/coap/pdu.h
Define the coap debug output debug buffer size
COAP_DEBUG_BUF_SIZE
examples/client.c
examples/contiki/coap-observer.c
src/net.c
tests/test_wellknown.c
tests/test_pdu.c
Update coap_show_pdu() calls
libcoap-2.map
libcoap-2.sym
New function coap_set_show_pdu_output()
If multiple GET requests for the same URI + QUERY with different tokens and
Observe =0 is set, then for each GET there is an increment of the
subscriptions.
Currently, if the application is not clearing out the duplicate subscribers,
then the subscriber list gets large and eventually runs out of memory.
This fix stops duplicate subscriptions for the same session with the same
URI + QUERY, deleting the original entry and replacing it with a new
subscription.