Commit Graph
62 Commits
Author SHA1 Message Date
jcmichelou 9b647d5d05 Add visual studio 2015 solution and project files for building libcoap on windows.
Merge changes from PR #47 related to windows platform support.
Add full windows platform support including correct error checking and working regression tests and examples.
Remove need to build applications using libcoap with -DWITH_POSIX and to include coap_config.h. This applies to the examples as well.
2017-05-05 20:29:10 +02:00
Olaf Bergmann ac94964b45 pdu.h: new methods FETCH, PATCH, iPATCH from RFC 8132 2017-04-07 10:14:22 +02:00
Pawel Winogrodzki 6112604569 Makingcoap_transaction_id() always use the peer for ID generation. 2017-04-04 02:32:45 -07:00
Pawel Winogrodzki b130109c04 Applying agreed changes. 2017-03-29 02:51:21 -07:00
Pawel Winogrodzki 9adc4eb6a7 Fixing /W4 warnings for Windows builds.
Removing all of the /W4 level warnings from the code.
No functional changes.

Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
2017-03-20 15:48:33 -07:00
Olaf Bergmann 292b0f0790 address.[hc]: Fixed byteorder in coap_is_mcast() on platform posix
As IN_MULTICAST does a 32 bit comparison in host byte order,
sin_addr.s_addr needs to be converted using ntohl(). This change
also moves the coap_is_mcast() implementation to address.c because
it has become too complex for inlining.
2016-12-15 11:12:22 +01:00
Olaf Bergmann 11e905ed52 address.h: added missing includes
libcoap.h must be included to ensure that platform-specific headers
for the target system are available.
2016-11-19 17:06:36 +01:00
Olaf Bergmann 2c7efb77b9 pdu.h: fixed option number for No-Reponse (RFC 7967)
When the No-Response became RFC 7967, the numeric value was changed
to better reflect its characteristics. This modification fixes the
reference in the documentation the option value.
2016-11-16 21:27:01 +01:00
Olaf Bergmann 4585701640 pdu.h: updated RFC numbers in option number comments
The documentation for Observe and Block1/Block2 referenced
outdated Internet Drafts which have become RFCs some time ago.
This change now mentions the correct RFC numbers.
2016-11-16 21:24:22 +01:00
Olaf Bergmann c2dd6b4917 encode.h: fix one-letter pre-processor symbol to avoid conflicts
It was suggested to pick a more specific name for the
pre-processor symbol E in encode.h to prevent name clashes,
see https://github.com/obgm/libcoap/issues/46.
2016-09-22 15:22:28 +02:00
Jean-Michel Julien 02c3e67175 resource.h: Add documentation for flags used in resources creation. 2016-09-22 12:39:54 +02:00
Lucien Guimier edf42a6a53 Add missing LOG_ERR log level
The fallback used when <syslog.h> is not available was missing the error level.
2016-07-17 13:56:27 +02:00
Olaf Bergmann cb6d3c43ed uri.[hc]: make 1st argument of coap_split_uri() const
Issue #37 [0] argued that coap_split_uri() should not change the
string that was passed as its first argument. The old behavior
was to normalize the scheme and the host part of the given URI by
converting both to lower case. This commit drops that normalization
step and leaves the original string as is. As a consequence,
implementations that employ virtual hosts now must canonicalize
the host part by themselves.

CAUTION: The constness is not (yet) reflected in the str components
of the result parameter of type coap_uri_t. Care must be taken not
to accidently change an immutable component of the coap_uri_t object.

[0] https://github.com/obgm/libcoap/issues/37
2016-07-06 12:48:21 +02:00
chrysn 816d37d402 lwip: Include coap_config.h in lwippools.h
config includes can't be handled with the usual strictness ("No config
includes in public header files", notwithstanding discussion of whether
lwippools is one) because the lwip compilation unit for the memory pools
needs to know about the configured sizeof the various CoAP objects.
2016-06-22 12:36:47 +02:00
chrysn 0f3be6128b lwip: Drop include in coap_io.h
The include is not required, as the `struct ud_pcb *` pointer doesn't
require the struct to be known yet, but caused trouble when the include
led to an inclusion loop back again to libcoap via the lwippools. (The
loop was caught by include guards and caused undeclared type errors
because the later parts of the headers were not yet processed).
2016-06-22 12:36:23 +02:00
Olaf Bergmann 2cedbd3aeb coap_bits.h: remove inclusion of <sys/types.h> 2016-02-16 15:50:34 +01:00
Vlad Lungu 0d8fbe3020 Define address macros for LWIP properly
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-02-16 15:45:03 +01:00
Vlad Lungu 75d00c8a50 Use LWIP_RAND() when available
rand()/srand() might not be available for LWIP

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-02-16 15:44:55 +01:00
Carsten Schoenert 8a8790cfc3 fixup small typos, no functional changes
There are few miss spelled words 'reponse', fixed up into the meaned word
'response'.
2016-01-29 16:31:53 +01:00
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