examples/client.c
Add in support for using PKI certificates
examples/coap-server.c
Add in support for using PKI certificates
remove default PSK key
Add in '-h hint' option
Make Usage reflect actual options available to use
man/coap-client.txt.in
Include the missing options
Update -A option to be a single entity
Sort the options into ascending order as reported by Usage
man/coap-server.txt.in
Include the missing options
Add in '-h hint' option
To document that uri.port input to coap_encode_var_safe() never
has more than 16 bits, an explicit bit mask has been added. This
change is supposed to avoid the false positive CID 1469635.
cmdline_content_type() treated option numbers as 8-bit integers and
therefore could not parse values >255. Now, option numbers are
represented as uint16_t to allow for numbers between 0 and 65535.
Moreover, as RFC 7252 has made the Accept option non-repeatable,
cmdline_content_type() now will only add a single Accept option.
Calling strncpy() on the variable (and erroneous) calculated token
length in cmdline_token() has caused stringop-overflow warning by
GCC 8. This change fixes the error and replaces strncpy() by
memcpy() to quieten the compiler.
Update code / examples / man pages with the updated function.
include/coap/libcoap.h:
Add in new define COAP_DEPRECATED to generate compiler warnings when used
include/coap/encode.h
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.
Make coap_encode_var_bytes() a wrapper for coap_encode_var_safe() and
mark it as COAP_DEPRECATED for backwards compatability
src/encode.c:
New coap_encode_var_safe() function that includes the size of the output
buffer as a parameter.
examples/coap-server.c:
examples/contiki/server.c:
Make the ticks resource consistent in case
The function is not used because most of the timer handling has
been moved to coap_run_once().
This change avoids clang to emit a warning due to -Wunused-function.
coap_add_optlist_pdu() sorted the options for insertion, but did not update
the coap_optlist_t head (whch may then no longer point to the first entry in the
sorted chain) and so when coap_delete_optlist() was called, the first few
entries of the sorted chain may not get deleted.
Fixed by making it
coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t** optlist_chain)
instead of
coap_add_optlist_pdu(coap_pdu_t *pdu, coap_optlist_t* optlist_chain)
Additionally deleted options_start() and options_next() as they are not
required - Issue #184.
examples/client.c:
Fix coap_add_optlist_pdu() call
include/coap/options.h:
Fix coap_add_optlist_pdu() call
libcoap-2.{map|sym}:
Delete options_start()
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
Update docmentation
src/option.c:
Update coap_add_optlist_pdu()
tests/test_pdu.c:
New tests for checkout out coap_insert_optlist() and coap_add_optlist_pdu()
functions
Created new 'CU_ASSERT_PTR_EQUAL_C(actual, expected)' to handle const variable matching
Where appropriate
Replace 'unsigned char' with 'const uint8_t'
Replace 'str' with 'coap_str_c_t'
Replace 'str' with 'coap_string_t'
Prefix with 'const' some type casts
Update coap_add_attr() calls inline with updated API
Update coap_resource_init() calls inline with updated API
Make use of coap_make_str_const() for defining parameters
tests*/.c
Update code to stop memory leaks (as found by valgrind)
examples/coap-rd.c
Track the fact that uri_path in coap_resource_t is now a pointer
As discussed in bug #185 [1], const strings should be protected
from being overwritten. This change adds -Wwrite-strings to the
compiler warning flags and fixes resulting warnings by making
static strings const.
[1] https://github.com/obgm/libcoap/issues/185
The input value for time in hnd_put_time() is not sanity checked for the
upper limit. If too large, gmtime() etc. functions will return a failure
(errno is EOVERFLOW).
Validate the input value to hnd_put_time(). Return 4.00 if failure
Verify return from gmtime() in hnd_get_time() before trying to convert to
ascii readable string. Return 4.04 if failure.
[Time may just be valid when updated in hnd_put_time(), but then
increments to be too large - hence check also in hnd_get_time()]
/*
* examples/coap_list.[ch] are DEPRECATED. You should be using
* struct coap_optlist_t instead with the following functions which are a part
* of libcoap.
*
* coap_new_optlist()
* coap_insert_optlist()
* coap_delete_optlist()
* coap_add_optlist_pdu()
*
* See 'man coap_pdu_setup' for further information.
*
* examples/coap_list.[ch] files will be removed in a future release
* They are left here to support building backward compatability of old versions
* of coap-client
*/
Remove coap_list_t structure and replace with coap_optlist_t to maintain
backward code compatability.
Make use of the new coap_optlist_* functions
Use the new coap_optlist_t structure
Remove unneeded header includes
warn() -> coap_log(LOG_WARNING, )
debug() -> coap_log(LOG_DEBUG, )
As coap_send() automatically releases the specified pdu, it must
not be accessed after coap_send() has returned.
This change fixes CID 1458399 reported by Coverity scan.
The value of the observe option is kept for each resource rather than being global to the context.
The value of the observe option must wrap to be stay below 2^24.
The value of the observe option must be different from the initial value when a notification is sent.
Make coap_pdu-t independent of the header style.
Use C99 sized types when applicable.
Use transaction ids in host byte order in the library.
Make coap_pdu_t payload storage grow on demand.
Add parsing and encoding of PDUs with UDP or TCP style headers.
Adapt examples and unit tests to the new PDU format.
When building outside the source tree compilation fails on
examples, because the libcoap headers expect to be all in the
same directory but coap.h is generated under the build
directory, so it is necessary to add an extra include path
for it.
Also, build directories should always appear before source
directories in the include path, so that any leftover
generated files in the source tree are ignored.
Remember the query string used during the observe request and pass it to the resource handler.
Support partial notification of observers based on the query string.
The message id in the CoAP header is used for reliability when
transferring a CoAP PDU over a non-reliable transport protocol
such as UDP. For message de-duplication, it is useful to have
a monotonously increasing number space within a session. Therefore,
the context-global value has been moved to coap_session_t.
The function coap_new_message_id() now takes a coap_session_t
object as its argument.
In the main of examples/coap-server.c wait_ms was set to
COAP_RESOURCE_CHECK_TIME * 1000, then coap_run_once() was invoked
with parameter timeout_ms as COAP_RESOURCE_CHECK_TIME * wait_ms,
i.e., squaring the resource check time.
This bug has been fixed by removing COAP_RESOURCE_CHECK_TIME from
the call to coap_run_once().
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
coap-client now prints PDUs that are sent and received in log level
INFO so that these are output with '-v6' or higher. These messages
are now visible without turning on the full debug.
coap_async_state_t now contains a reference to the session that is
associated with the respective async state. As the response must
be sent over this session, the local_if parameter of check_async()
is not used anymore and can be removed.
coap_send() now takes ownership of the coap_pdu_t object passed
as second argument. Therefore, it is no longer necessary to release
the PDU structure in case of an error.
Zero-length strings passed to -u are valid user names for DTLS.
The function cmdline_read_user() therefore returns 0 when the
argument passed with option '-u' is an empty string.