Depending on the TLS library being used (which may be none), the
code that depends on other TLS libraries is not compiled. Because
some compilers are not happy compiling empty modules, each of these
files contains an empty static inline function dummy() that gets
compiled instead. As clang happens to emit a warning for this
function when -Wunused-function is set, this change introduces
a GCC pragma (sic!) to suppress this warning for the dummy function.
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.
This change replaces the call of abs(v - ref) to avoid a compiler
warning for -Wabsolute-value:
test_session.c:95:11: warning: taking the absolute value of unsigned type 'unsigned int' has no effect
[-Wabsolute-value]
return (abs(v - ref) / 100.0) <= FP_ERR_THRESHOLD;
General:
Embolden -lcoap linking definitions
Embolden NOTE:
man/Makefile:
Reduce data written into missing .3 files
man/coap_attribute.txt.in:
Fix a typo
Where appropriate in general
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
Remove unnecessary type casting
Remove unneeded WITH_LWIP wrappers to select coap_malloc_type() or memp_malloc()
as underlying coap_malloc_type() is correctly selected in include/coap/mem.h
src/block.c:
Replace coap_opt_const_value() with coap_opt_value()
src/coap_io.c:
Due to the definations of struct iovec and struct msghdr, and const parameters
getting passed in, as this is a write of data function, the pointers are
copied into the 2 structures to get around the cast-qual warnings
src/net.c:
Release any sessions (so that they may get freed off) in coap_free_context()
src/option.c:
coap_option_filter_get() had to be downgraded as coap_option_filter_op() is
used by set functions as well.
src/pdu.c:
Remove const out of next_option_safe() parameters
As coap_resource_init() has a const uri_path parameter passed into it, it is not
possible to have these values legally freed off if flags is set to
COAP_RESOURCE_FLAGS_RELEASE_URI.
coap_resource_init_release() has been created to handle this. However, as it
is likely to be called with a coap_string_t generated from a call to
coap_get_uri_path(), the string must be correctly freed off. Hence the
use of coap_string_t as a parameter.
coap_add_attr_release() has been added in as well, using coap_string_t* as
parameters, to allow the coap_string_t to be freed off correctly.
Add in coap_log warning if the functions coap_resource_init*() and
coap_add_attr*() are called incorrectly.
Update src
Commented out coap_opt_block_set_m() as it is not used anywhere, and needs
to get rewritten if needed.
Removed / changed references to coap_opt_const_value()
Created a new struct coap_str_const_t to handle const parameters
Add in 2 new functions to create / delete the new string type
coap_new_str_const()
coap_delete_str_const()
Added in coap_make_str_const() to help create the necessary string equivalents
of the ascii test string. Note that the byte array must be in the
local scope.
Make coap_string_equal() a macro to handle differing string types
Made uri_path a pointer in coap_resource_t
Made name and value a pointer in coap_attribute_t
Reasoning behind this was triggerred by test t_wellknown3() creating a
number of resources, all using the same string buffer, so they all ended up
with the same uri-path (last update to uri-path). In the days of hashing
uri-path for the lookup would have worked, but the wrong uri-path
presented from the resource. Now we always allocate uri-path if
application does not want it freed off - and always free it off at time
or resource removal. The same is also true for coap_add_attr().
Updated coap_resource_init(), coap_add_attr() and coap_find_attr() to
pass in string parameters, rather than use a pointer to data and a length.
Where appropriate
Replace 'unsigned char' with 'const uint8_t'
Replace 'str' with 'coap_str_const_t'
Replace 'str' with 'coap_string_t'
Prefix with 'const' some type casts
Remove 'const' prefix from some type casts
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()]
As gcc 7 complains that coap_register_handler() is too large to
be inlined automatically, the function definition now has been
moved to resource.c.
This change also updates the symbol mappings accordingly.
/*
* 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
*/
Updated man/coap.txt.in
Updated configure.ac
Updated man/Makefile.am
Also include the man pages where there are more than 9 definitions in the
SYNOPSIS as we are limited to 10 in hte NAMES section
man/coap_attribute.txt.in: Tidy up output
man/coap_context.txt.in: Correct ports and protocols in the examples
man/coap_observe.txt.in: Update with the new optlist functions
man/coap_recovery.txt.in: Include how recovery times are calculated
man/coap_resource.txt.in: Tidy up output
man/coap_tls_library.txt.in: Tidy up output
man/coap_handler.txt.in: Update with new library naming
Fix compiler warning for index variable being also a string function
Add in optlist functions
coap_new_optlist()
coap_add_optlist_pdu()
coap_insert_optlist()
coap_delete_optlist()
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, )