Commit Graph
1054 Commits
Author SHA1 Message Date
obgm abddc07559 Merge pull request #107 from spinetix/handler-lost-con
Add handler for lost CON messages.
2017-09-09 01:21:32 +02:00
obgm 746cd397a6 Merge pull request #106 from spinetix/observe-with-query-string
Query string dependent observe.
2017-09-09 01:20:51 +02:00
jcmichelou 25732fc8e6 coap_session.[ch], net.c: Add handler for lost CON messages.
Add a slot for storing application-specifc data in session object.
Make the library resilient against client session released in a callback.
2017-09-08 20:02:22 +02:00
jcmichelou 30619691e2 resource.[ch], uri.c[ch]: Query string dependent observe.
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.
2017-09-08 19:50:34 +02:00
Olaf Bergmann 1d5ecb3690 .travis.yml: use default dist (= trusty)
As described in [1], trusty now is the default distribution for
travis-ci, so the explicit "dist: trusty" can be removed.

[1] https://blog.travis-ci.com/2017-08-31-trusty-as-default-status
2017-09-07 12:43:25 +02:00
Olaf Bergmann 4dd5e0c19d .travis.yml: add branch travis-test to build list 2017-09-07 12:43:12 +02:00
Olaf Bergmann 00338ff502 async.c: fixed signature of dummy functions
The signature of several dummy functions that are defined to make
compilers happy that complain on empty modules was not standards
compliant. To avoid related compiler warnings, the formal argument
list of this function now is explicitly declared as void.
2017-09-05 17:18:29 +02:00
Olaf Bergmann 8ad4abb6d8 coap_notls.c: fix compiler warning regarding unused parameter 2017-08-31 15:41:43 +02:00
Olaf Bergmann ced706e66d .travis.yml: added flag for TLS library selection
The environment variable TLS now controls the DTLS-specific configuration
options. The following values are defined:

  no       turn off DTLS support
  openssl  use OpenSSL library
  gnutls   use GnuTLS library
  tinydtls use tinydtls library

Any other value will be mapped to gnutls which is the default.
2017-08-31 14:01:26 +02:00
Olaf Bergmann d4bb044afa Merge commit 'ea58f259d' into develop 2017-08-31 13:32:20 +02:00
Olaf Bergmann 0145710670 option.c: split comment to fall through to quiet compiler warning
Shut up warning from -Wimplicit-fallthrough by placing "fall through"
in comment on its one line.
2017-08-31 13:21:29 +02:00
Olaf Bergmann 3feee38045 uthash.h: fix compiler warning for missing default case in switch statement
Added a no-op default case to switch statement in macro HASH_JEN in order
to fix compiler warning.
2017-08-31 13:14:01 +02:00
Olaf Bergmann 318eec25b5 async.c: included macro SEARCH_PAIR from commit 5b1a8f67
Commit 5b1a8f67 added two macros LL_SEARCH_PAIR and LL_SEARCH_PAIR2
to utlist.h which is maintained at [1]. To simplify updates of this
file, the macros have been moved into async.c as this is the only
place where they are used. To avoid confusion with linked list macros
from utlist.h, the prefix "LL_" has been removed from the custom
macros.

[1] https://github.com/troydhanson/uthash
2017-08-31 13:06:17 +02:00
Olaf Bergmann 2133742f84 utlist.h, uthash.h: updated to fix compiler warnings
With gcc 7.2.0, new compiler warnings related to utlist.h and
uthash.h have occured. Several have been fixed by updating the
header files to the latest version from [1].

[1] https://github.com/troydhanson/uthash
2017-08-31 12:49:47 +02:00
Thadeus Fleming ea58f259d7 Remove return 0 in coap_dtls_handle_timeout in coap_notls.c
Fixes #102.
2017-08-28 09:59:03 -05:00
Olaf Bergmann 5c079b72d9 coap_session.[hc]: make message id session-local
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.
2017-08-18 14:15:20 +02:00
John Carter d7ebf14395 coap-server.c: fixed wait time for coap_run_once() invocation
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>
2017-08-08 12:23:41 +02:00
Olaf Bergmann 50da9f1d97 libcoap-1.{sym,map}: re-generated symbol maps for dynamic linking 2017-08-04 15:27:52 +02:00
Olaf Bergmann 627e8ca2e3 Makefile.am: add coap_socket_send_pdu to CTAGS_IGNORE
ctags is being used to create the symbol maps for dynamic library
generation. Exported symbols from other platforms such as LWIP
must be excluded from these maps to avoid linker errors for undefined
symbols.

This modification adds the LWIP-specific function coap_socket_send_pdu()
to the exclusion list.
2017-08-04 15:24:32 +02:00
Olaf Bergmann e77c3565cb client.c: show outgoing and received PDUs in log level INFO
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.
2017-08-03 15:24:36 +02:00
Olaf Bergmann 59f9745c04 debug.c: added media type names from RFC 8152
print_content_format() converts numeric Content-Format specifiers
to readable media type names. This change adds the new content
formats from RFC 8152 to this list.
2017-08-03 15:22:08 +02:00
Olaf Bergmann d9a0b4019d pdu.h: added content format definitions from RFC 8152
See https://tools.ietf.org/html/rfc8152#section-16.10
2017-08-02 21:54:31 +02:00
Olaf Bergmann f2ebb4f926 coap-rd.c: removed unused signal handler 2017-08-02 21:30:46 +02:00
Olaf Bergmann 8f37e20f85 coap-server.c: removed parameter local_if from check_async()
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.
2017-08-02 21:26:55 +02:00
Olaf Bergmann 5f7f043ad6 client.c: fix compiler warning for unused transaction id
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.
2017-08-02 21:20:25 +02:00
Olaf Bergmann 8423ebbe8b client.c: allow empty user names
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.
2017-08-02 21:17:07 +02:00
Olaf Bergmann a061428eb6 coap_openssl.c: fix compiler warning for coap_dtls_new_context() 2017-08-02 21:14:06 +02:00
Olaf Bergmann 7dfeb91978 coap.h.in: avoid C++ name mangling for functions in libcoap.h
To avoid function names being mangled when compiling with C++,
the inclusion of libcoap.h has been moved into the extern "C"
declaration for coap.h.
2017-08-02 21:11:17 +02:00
Olaf Bergmann 44f392d29a client.c: added new method names from RFC 8132
Updated the method names for coap-client option '-m' to include
FETCH, PATCH, IPATCH (see [1]).

[1] https://tools.ietf.org/html/rfc8132
2017-07-18 11:43:23 +02:00
Olaf Bergmann 4e7f909037 Makefile.am: added missing files, fixed ordering 2017-07-11 17:03:04 +02:00
Olaf Bergmann df62452cca libcoap-1.{map,sym}: updated symbol table
The recent API change has triggered the update-map-file target.
2017-07-11 13:01:25 +02:00
Olaf Bergmann ef778403a6 Makefile.am: added missing files to EXTRA_DIST 2017-07-11 13:00:50 +02:00
Olaf Bergmann 036842f669 COPYING: updated text
The old text referred to LICENSE.BSD which has been extended and
renamed to LICENSE. The new text now reflects this update.
2017-07-11 12:59:09 +02:00
Olaf Bergmann b524316c19 libcoap-1.pc.in: Add DTLS-specific flags 2017-07-10 18:14:12 +02:00
obgm 96e536006f Merge pull request #99 from Trilliant/feature/fixHandlersForNewVerbs
resource.h: increase method_handler structure to hold new methods (FETCH, PATCH, IPATCH)
2017-07-10 17:25:07 +02:00
Olaf Bergmann 81c0dec8dd ChangeLog: updated changelog 2017-07-10 16:37:21 +02:00
Olaf Bergmann 684c27ea13 README.md, LICENSE: Updated licensing information
* Add license information for getopt.c (required for the Windows port, only).
* Add license information for GnuTLS, OpenSSL, tinyDTLS
2017-07-10 16:35:49 +02:00
Olaf Bergmann 9b76de1a3c configure.ac: Add tinydtls configuration option
The new option '--with-tinydtls' allows selecting tinydtls as
DTLS implementation. This option must be combined with '--disable-shared'
as tinydtls supports only static linkage. Unlike GnuTLS and OpenSSL,
tinydtls is not enabled automatically during configuration.
2017-07-10 15:35:45 +02:00
Olaf Bergmann 5687681d71 {tests/examples}/Makefile.am: add DTLS variables for static linkage
Statically linked executables require DTLS_CFLAGS and DTLS_LIBS.
2017-07-10 15:33:39 +02:00
Olaf Bergmann 4c38c6a7b2 test_{sendqueue,wellknown}.c: use new session-specific API
Sendqueue nodes and send operations now require a session object.
This modification calls coap_new_client_session() on a global
coap_context_t object to create a fake session on the loopback
interface.
2017-07-10 14:21:36 +02:00
Olaf Bergmann a070a8b3bc Merge remote-tracking branch 'tijuca/4upstream' into develop 2017-07-10 14:11:34 +02:00
Jean-Michel Julien 8abf63b867 resource.h: increase method_handler structure to hold new methods (FETCH,PATCH,IPATCH) 2017-07-06 15:11:10 -04:00
jcmichelou 87126f35c1 Add minimum timeout of 100ms for global DTLS timeout. Remove the peer from tinydtls retransmit list when the coap session is reset. 2017-07-01 17:09:14 +02:00
Carsten Schoenert 383a636cdd configure.ac: using more variables for binary versions
Adjusting version numbers in various places for dot and doxygen is
tedious and error prune. So set up the required versions right before
the code block for those checks.
2017-06-30 20:46:05 +02:00
Carsten Schoenert c8a97f91e2 configure.ac: fix up typos and indentation
No technical changes, only correction of typos and indentation oon some
parts.
2017-06-30 20:46:05 +02:00
Carsten Schoenert 7286a52474 DTLS support: export and use related flags to main Makefile
To be able to use the collected CFLAGS and LIBS variables in the main
Makefile substitute DTLS_CFLAGS and DTLS_LIBS with the found values from
previous made checks and exporting them to autoconfigure.
Also define the found development crypto library into the configuration
header file 'coap_config.h.

We may need to add the flags also to examples/Makefiles.am too.
2017-06-30 20:45:10 +02:00
Carsten Schoenert 9b2505772e configure.ac: adding info output about DTLS configuration
Giving some more information to the user than the output of the
configure with it's calls itself. By adding this output function the
user will see which library with which version etc will be used.
2017-06-30 20:25:11 +02:00
Carsten Schoenert 4bbf6b8a08 configure.ac: adding logic and options for dtls support
DTLS features are needing external cryptographic libraries for proper
working. There are some possibilities to use existing libraries of that
kind.
Based on discussions on the ML and also the issue tracker on GitHub we
found some consensus to use and support GnuTLS and OpenSSL at least in
the beginning of implementing DTLS support. The added code is using
GnuTLS 3.2.0 and OpenSSL 1.1.0 as required minimum versions.

This commit is adding a new configure option '--enable-dtls' which is
turned on by default to build libcoap by default with DTLS
functionality.
It's adding also two more additional options that let the user decide
which cryptographic library should be used for DTLS support. The two
optional options are '--with-gnutls' and '--with-openssl'.

These two options are optional and a user doesn't need to set any of
them if he doesn't care which library should be used. If these options
are not given the logic will first try to find the GnuTLS library for
usage and if not found do a fallback to OpenSSL.

The following behaviour is now implemented into configure by this commit:

  $ ./configure --disable-dtls
   or
  $ ./configure --enable-dtls=no

   Both options configuring the source to not implement any DTLS
   support.

  $ ./configure     # without additionally options '--with-gnutls' or '--with-openssl'

   The configure script is trying first to find GnuTLS for DTLS.
   If the system hasn't GnuTLS development files the configure script is
   moving over to OpenSSL and try to find the development files of
   OpenSSL. If any files can't be found the script will break with a error
   message.

  $ ./configure --with-gnutls

   The development files for GnuTLS will be explicit searched and used even
   if also OpenSSL is available and usable.

  $ ./configure --with-openssl

   Like before but with the needing for OpenSSL development files. A
   optional availability of GnuTLS on the host will be ignored.
2017-06-30 20:24:50 +02:00
jcmichelou 1d2e985364 Fix missing pointer. 2017-06-30 19:26:55 +02:00
jcmichelou 42f68764f1 Safely separate the coap_address_t type from the tinydtls session_t type. 2017-06-30 19:15:00 +02:00