To get a proper public header setup for libcoap we need to split out the
static and platform related header files.
This commit is about creating the platform specific header file which
have to contain platform relevant header and or declarations and is
included by the coap.h header file.
Currently there is only Contiki as non Linux/BSD based platform we have
to take care. Potentially there is more to come.
Resume the cleaning of the public header files, no functional changes.
Reformatting the infos in the head of the header files, restructure header
inclusion check to be more generic. Reorder some include directives in a
alphabetical order. Remove including instructions for C++ stuff, it's
already done in the coap.h header, and the user only has to include this
header file.
Dropping the prefixing of the include guarding of uthash.h because it would
cause trouble with the macro handling in TinyDLS.
Thanks Olaf for reminding this!
The various variable checks within the public header files are not
useful as such checks doesn't have to be done in these files.
The public header files have only to provide the function declarations
and some macro definitions, any check for the availability of needed
other system header files has to be done by the user on his own.
TODO: The check for syslog.h in debug.h has to be moved out of the
public part into the source of the library later.
Two new flags COAP_RESOURCE_FLAGS_NOTIFY_NON and
COAP_RESOURCE_FLAGS_NOTIFY_CON have been added to control the
message type for notifications to send. The default type is
COAP_RESOURCE_FLAGS_NOTIFY_NON which can be changed with the
function coap_resource_set_mode().
The observer-specific flag has been removed.
The public header doesn't have to include a local dynamically created
header file from the autotools. This would break the usability of the
public header files.
For POSIX platforms, ticks have been absolute which caused an
overflow on 32-bit architectures. This modification makes values
returned by coap_ticks() relative to a global offset stored
internally in coap_clock_offset.
The calculation of transaction ids did not ensure that the result
is always greater or equal zero. To avoid conflicts with the error
codes returned by coap_send(), the calculation now masks out the
lower half.
The implementation of option filters based on coap_opt_filter_t
has changed to improve support for long option numbers. An option
filter is now a sparse field of a fixed size that can hold up to
COAP_OPT_FILTER_LONG options with a number larger than 255, and
up to COAP_OPT_FILTER_SHORT options with a number of 255 or less.
The space taken by coap_opt_filter_t is
2 * ((((COAP_OPT_FILTER_SHORT + 1) >> 1) + COAP_OPT_FILTER_LONG) + 1),
or 12 bytes with the default settings for COAP_OPT_FILTER_SHORT == 6
and COAP_OPT_FILTER_LONG == 2.
Three new functions have been added to the option filter API:
* coap_option_filter_set() to store an option number in a filter,
* coap_option_filter_get() to check if a filter contains a given
option number, and
* coap_option_filter_unset() to remove an option number from a
filter.
The previously existing functions coap_option_setb(), coap_option_getb(),
and coap_option_clrb() continue to work on the new option filter
unchanged but now are deprecated.
The header coap.h should be the only header file a user has to include
to get functions from the libcoap available. Bu we have to provide not
only the header interface to the user, the user needs also some extra
information like the libcoap version or upstream related infos.
To get these automated in to a shipped coap.h header file we simple can
use some autotool magic and expand some macros while configure is
running and pasing i/c/coap.h.in. By this we can currently add the
following macro variables:
LIBCOAP_PACKAGE_BUGREPORT -> upstream email contact
LIBCOAP_PACKAGE_NAME -> the used package name (libcoap)
LIBCOAP_PACKAGE_STRING -> package name + version
LIBCOAP_PACKAGE_URL -> upstream homepage
LIBCOAP_PACKAGE_VERSION -> the current used version
All these macros variables are expanded from the respective macro names
from the configure run. The variables are prefixed because this with
LIBCOAP_ to not get name clashing on the user side while running the
autotools of the users project.
There are probably more predefined macros needed, but they can be easily
added later into include/coap/coap.h.in.
context->message_id has been incremented as a side-effect of calling
the htons macro. To avoid potential issues with this, the increment
operation has been moved outside the macro call.
Just fixing up the warning from doxygen so the documentation will be
more usable. Also fixing up some whitespace, punctiation marking and
indentation issues.
coap_malloc_type() and coap_free_type() provide an abstract API for
dynamic memory management on different platforms. resource.c still
is in transition and needs more cleanup.
The CoAP resource management is based on uthash and utlist for
platform POSIX but used a custom list implementation for Contiki.
This modification replaces the list handling by utlist macros
entirely. A set of convenience macros has been defined to access
the resources stored in a CoAP context with respect to the
preprocessor symbol COAP_RESOURCES_NOHASH.
The parser iterator did not break up URIs correctly. As this
cannot be fixed easily, the parser iterator has been removed.
coap_split_path_impl() now operates directly on the message
buffer instead of the iterator abstraction.
This bug also caused t_parse_uri12() in the URI test suite
to fail.
* Removed tne preprocessor defines for coap_tick() and coap_clock_init() --
this made the code less readable and seemed to be of little use.
* Introduced the new type coap_time_t to represent wall clock time. On POSIX,
this is the number of seconds since the epoch, while on embedded systems
without a real time clock, this could be the number of seconds since the
last reboot. The new function coap_ticks_to_rt() is used to convert
coap_tick_t to coap_time.h. Currently, this is a division by COAP_TICKS_PER_SECOND
on all platforms.
* POSIX: coap_tick_t is now defined as unsigned long to avoid overflows in
coap_ticks().
In preparation for changing the make buildsystem to a fully autotools
controlled system moving the core libcoap source files to a better logical
place.
All the library related header files moving to include/coap/ to get
all the public and local header files in a separate place. Also moving
the C source files of the libcoap library to the folder src/.