Commit Graph
41 Commits
Author SHA1 Message Date
Olaf Bergmann a6f7fc76fb Makefile.am, coap.h.in: Remove obsolete header t_list.h
t_list.h has been replaced entirely by utlist.h and thus is not
used anymore. This change removes the last traces.
2016-01-11 18:34:37 +01:00
Carsten Schoenert 5032b292e4 libcoap.h: introduce new header file for libcoap
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.
2016-01-10 17:49:07 +01:00
Carsten Schoenert 0e59edc231 i/c/*.h: more public header cleanup
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!
2016-01-10 17:49:07 +01:00
Carsten Schoenert 489eb73f0c i/c/*.h: remove obsolete #ifdef HAVE_* constructs
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.
2016-01-10 17:49:07 +01:00
Olaf Bergmann 683337890e bugfix: add flag for CON/NON notification messages
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.
2015-09-29 09:03:18 +02:00
Carsten Schoenert ea9c1cbedb i/c/*.h: remove references to coap_config.h
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.
2015-07-04 19:35:02 +02:00
Olaf Bergmann 1baa8163b5 coap_time.[hc]: make ticks relative to global offset for POSIX
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.
2015-06-28 15:04:52 +02:00
Olaf Bergmann e4519daf14 pdu.h: new coap_send() result code for dropped responses
The new coap_tid_t code COAP_DROPPED_RESPONSE can be used to
indicate that a response has been dropped by coap_send_impl().
2015-06-10 17:52:14 +02:00
Olaf Bergmann 3c84f5c012 net.c, pdu.h: ensure that valid transaction ids are positive
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.
2015-06-10 17:46:53 +02:00
Olaf Bergmann e4e2e57218 option.[hc]: new option filter implementation
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.
2015-06-07 12:21:58 +02:00
Olaf Bergmann c5a1faad0c pdu.h: Added code for No-Response option
IANA has reserved 284 for No-Response, described in
http://www.iana.org/go/draft-tcs-coap-no-response-option

See also:
http://www.iana.org/assignments/core-parameters/core-parameters.xhtml#option-numbers

As a side-effect, COAP_MAX_OPT was set to 65535.
2015-06-07 12:21:57 +02:00
Olaf Bergmann 81d4297b50 option.[hc]: Fix type of option parameter
Since CoAP options can have a numeric type between 0 and 65535, the
type parameter of coap_check_option() must be at least 16 bits.
2015-06-07 12:21:57 +02:00
Carsten Schoenert d01e1cad2e expand i/c/coap.h to include additional information
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.
2015-06-02 20:41:37 +02:00
Olaf Bergmann 8a96bfa5c2 net.h: fixed ugly macro usage in coap_new_message_id()
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.
2015-05-23 13:58:41 +02:00
Carsten Schoenert a4c163937a i/c/subribe.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:43 +02:00
Carsten Schoenert 1d79a041ba i/c/str.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:42 +02:00
Carsten Schoenert a21adde03e i/c/resource.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:40 +02:00
Carsten Schoenert d15ecb60ec i/c/prng.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:38 +02:00
Carsten Schoenert 5d7c25c289 i/c/pdu.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:36 +02:00
Carsten Schoenert 6588dfe810 i/c/option.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:35 +02:00
Carsten Schoenert 8d22cd6544 i/c/net.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:34 +02:00
Carsten Schoenert c43a47578c i/c/mem.h: fix doxygen warnings, no functional changes
Just fixing up the warning from doxygen so the documentation will be
more usable. Also fixing up some whitespace, punctiation marking and
indentation issues.
2015-04-14 16:05:32 +02:00
Carsten Schoenert 5fca704c4e i/c/hashkey.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:31 +02:00
Carsten Schoenert 9ab6d050e6 i/c/encode.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:05:28 +02:00
Carsten Schoenert 62ddbd232c i/c/debug.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:01:34 +02:00
Carsten Schoenert 7af8edf8a9 i/c/coap_time.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:01:33 +02:00
Carsten Schoenert 54abde5943 i/c/coap_io.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues
2015-04-14 16:01:31 +02:00
Carsten Schoenert 9da72684c8 i/c/coap.h: whitespace cleanup, reformatting, no changes
Just some whitespace cleanup.
2015-04-14 16:01:29 +02:00
Carsten Schoenert 4d7752ddf0 i/c/block.h: whitespace cleanup, reformatting, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:01:17 +02:00
Carsten Schoenert e2683eb218 i/c/bits.h: whitespace cleanup, reformating, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 16:01:09 +02:00
Carsten Schoenert e256844253 i/c/async.h: whitespace cleanup, reformating, no changes
Just some cleanup like whitespace, punctuation marking and indentation
issues.
2015-04-14 15:55:24 +02:00
Carsten Schoenert ed59118841 i/c/address.h: whitespace cleanup, reformating, no changes
Just some cleanup like whitespace, punctiation marking and indentation
issues.
2015-04-14 15:54:33 +02:00
Olaf Bergmann 2250db4c95 address.[hc]: make coap_address_equals() not inline on POSIX
gcc-4.8 -Winline keeps complaining about the function's size, so
it is now placed into address.c.
2015-03-11 16:08:58 +01:00
Olaf Bergmann ecda1426ac resource.c: Increase use of coap_malloc_type() and coap_free_type()
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.
2015-03-11 14:59:40 +01:00
Olaf Bergmann 65620fde3e resource.[hc]: Replaced custom list structures by utlist macros.
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.
2015-03-11 14:28:24 +01:00
Olaf Bergmann 0c53e63a3d Fixed URI parser bug and removed broken parser iterator
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.
2015-03-09 17:49:21 +01:00
Olaf Bergmann 8894f2ffec Fixed a couple of warnings from doxygen. 2015-03-09 14:53:01 +01:00
Olaf Bergmann 4ca91190d6 Revised time-related functions to get rid of clock_offset for POSIX platform.
* 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().
2015-03-08 15:14:43 +01:00
Olaf Bergmann 71de08ac5f Fix warnings in resource.c
Internal functions are now static. print_wellknown() is exported
as coap_print_wellknown() to make it accessible from net.c and
for unit tests.
2015-03-04 14:55:26 +01:00
Olaf Bergmann e297a0ca76 Fix warnings in net.[hc]
Internal functions are now static. wellknown_response() is exported
as coap_wellknown_response() to make it accessible for unit tests.
2015-03-04 14:43:42 +01:00
Carsten Schoenert fc9b47167a moving library related files to new folders
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/.
2015-03-03 19:21:43 +01:00