Commit Graph
1750 Commits
Author SHA1 Message Date
Olaf Bergmann 50530704df tinydtls: update to latest version
This change points the submodule to the changed tinydtls repository
which now lives at https://github.com/eclipse/tinydtls and updates
to the latest development HEAD.

Closes PR #531. [1]

[1] https://github.com/obgm/libcoap/pull/531
2020-07-23 09:58:09 +02:00
Olaf Bergmann 6fc3a7315f configure.ac: Bump version to 4.2.1, fix spelling errors v4.2.1 2019-11-05 21:09:06 +01:00
Olaf Bergmann d52c26642e doc/main.md: Small fixes in documentation main page
* Updated copyright year.
* Use EN_US for consistency.
2019-11-05 14:07:00 +01:00
Olaf Bergmann bb797c04a2 Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-11-05 12:10:41 +01:00
obgm 3be41b0b9d Merge pull request #416 from mrdeep1/openssl_ciphers
OpenSSL: Update ciphers
2019-11-05 12:10:04 +01:00
Jon Shallow 5d01cf3139 OpenSSL: Update ciphers
src/coap_openssl.c:

Remove NULL as a valid cipher from the cipher list.

Add in TLSv1.3 ciphers if OpenSSL 1.1.1 (they are already included in
TLSv1.2 definition, but this is to document this is happening).

Remove the TLSv1.0 deprecated ciphers.

Cipher strings can now be overridden during compilation by
using -DCOAP_OPENSSL_CIPHERS=xxx compiler option where xxx is the
cipher string as defined in
https://www.openssl.org/docs/man1.1.0/man1/ciphers.html

Explicit PSK cipher strings can now be overridden during compilation
by using -DCOAP_OPENSSL_PSK_CIPHERS=xxx compiler option where xxx is the
cipher string.

Log the client ciphers presented, and the cipher chosen.

include/coap2/coap_debug.h:
src/coap_debug.c:

Add in COAP_LOG_CIPHERS as a debug level (value 9) which matches getting the
cipher information reported in GnuTLS, and is now used for OpenSSL.

man/coap-client.txt.in:
man/coap-rd.txt.in:
man/coap-server.txt.in:

Include OpenSSL for verbosity > 7.
2019-11-05 10:19:45 +00:00
Olaf Bergmann d4219549d4 Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-11-04 17:01:02 +01:00
obgm 0389a6c0ae Merge pull request #398 from mrdeep1/epoll_timing
Fix timing window in epoll logic
2019-11-04 17:00:51 +01:00
Olaf Bergmann e8a2a6643e Revert "ext/tinydtls: Updated to latest develop version"
This reverts commit 118bdaba9c.
2019-10-30 10:30:49 +01:00
Olaf Bergmann 608249263d Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-10-30 10:30:04 +01:00
obgm a3361b7062 Merge pull request #415 from cgudrian/fix-epoll-detection
Fix epoll detection
2019-10-30 10:29:07 +01:00
Christian Gudrian f8a6debe81 Fix epoll detection
The "ac_cv_header-..." macros are either set to "yes" or "no" and never to
the empty string.
2019-10-25 23:20:55 +02:00
Olaf Bergmann 118bdaba9c ext/tinydtls: Updated to latest develop version 2019-10-02 23:20:04 +02:00
Olaf Bergmann 7858c57919 Add unit tests for coap_encode/decode_var_safe/safe8 2019-10-02 16:57:57 +02:00
obgm 9b09c7dd2f Merge pull request #408 from mrdeep1/encode8
encode.c: Support encoding/decoding 8 byte options
2019-10-02 16:57:30 +02:00
obgm f93aa9977a Merge pull request #410 from mrdeep1/windows_building
BUILDING: Update adding Windows build information
2019-09-23 15:59:22 +02:00
obgm 9767659950 Merge pull request #411 from mrdeep1/vs2019
Update Windows projects to VS Independent
2019-09-23 15:47:38 +02:00
Jon Shallow 4dec5225c0 Update Windows projects to VS independent.
win32/coap-client/coap-client.vcxproj:
win32/coap-rd/coap-rd.vcxproj:
win32/coap-server/coap-server.vcxproj:
win32/install/install.vcxproj:
win32/libcoap.vcxproj:
win32/testdriver/testdriver.vcxproj:

Update WindowsTargetPlatformVersion to $(LatestTargetPlatformVersion)
and PlatformToolset to $(DefaultPlatformToolset).
2019-09-23 10:21:32 +01:00
Jon Shallow 5ac269755a BUILDING: Update adding Windows build information
Add in instructions as to how to build libcoap on a Windows platform
as well as update the other information with how to get the libcoap
code.
2019-09-20 21:02:53 +01:00
obgm f697b7b67a Merge pull request #409 from mrdeep1/asserts
Add --disable-assert support for the library
2019-09-20 16:35:05 +02:00
Jon Shallow 8faa8c28ff Add --disable-assert support for the library
Let configure enable (the default) or disable assert() code.

configure.ac:

Add in --enable-assert (the default) / --disable-assert support in libcoap.
Previously this was always enabled unless -DNDEBUG was passed in as a compiler
option.  Now NDEBUG is set or unset as appropriate in coap_config.h
This does not affect how assert()s work within the examples etc., only in the
library.

TODO:

HAVE_ASSERT_H is now cleaned up, so remove entry.

include/coap2/coap_internal.h:

Include assert.h for the library.

include/coap2/coap_io.h:
include/coap2/net.h:
include/coap2/resource.h:
src/address.c:
src/block.c:
src/coap_debug.c:
src/encode.c:
src/mem.c:
src/option.c:
src/pdu.c:
src/subscribe.c:
src/uri.c:

Remove un-needed '#include <assert.h>'
Note: address.h and utlist.h still include assert.h as there are assert()
within the header files.

examples/client.c:
src/coap_io.c:
src/coap_session.c:
src/net.c:
src/pdu.c:
src/resource.c:
src/str.c:

Remove any '#ifndef NDEBUG' wrappers for coap_log() output as they were true
before, but may not be now.
2019-09-20 13:09:56 +01:00
Olaf Bergmann 98cf51eae2 README.md: Added status badge for OSS-Fuzz
OSS-Fuzz [1] is a decentralized fuzzing service for open-source
software projects. This badge shows the status of libcoap wrt to the
latest fuzzer runs.

[1] https://google.github.io/oss-fuzz/
2019-09-19 09:50:38 +02:00
Jon Shallow 851cb374e8 encode.c: Support encoding/decoding 8 byte options
Options such as COAP_OPTION_ETAG are up to 8 bytes in size.  While
being opaque, they can internally be represented as an 8 byte number.

include/coap2/encode.h:
libcoap-2.map:
libcoap-2.sym:
src/encode.c:

Create 8 byte versions coap_decode_var_bytes8() and coap_encode_var_safe8().
2019-09-18 11:55:33 +01:00
obgm 1ccd3685ee Merge pull request #407 from mrdeep1/readme_update
README.md: Add in further information about libcoap
2019-09-17 12:58:37 +02:00
Jon Shallow 6e25d9df91 README.md: Add in further information about libcoap
Add in information on Documentation and Building.
Update the Package contents.

LICENCE:

Update date.
2019-09-17 11:19:58 +01:00
Jon Shallow 23a6daf1e5 Fix timing window in epoll logic
It is possible to miss a packet retransmission if it is just about to happen
and the coap_run_once() logic takes the time past the packet retransmission.
The retransmission will take place when coap_run_once() is next run, but that
could be significantly later.

1) Create a new coap_io_prepare_epoll() function that calls coap_write(), but
sets the etimer within this function instead of at the end of coap_run_once().

2) Handle the etimer trigger within coap_io_do_events() rather than loop
checking coap_io_do_events() within coap_run_once().

include/coap2/net.h:

Define coap_io_prepare_epoll().
Update coap_io_do_events() to be type void.

src/coap_io.c:

Add in coap_io_prepare_epoll().
Update coap_run_once() to use new/updated functions.

src/net.c:

Update coap_io_do_events().
Make coap_new_context() always fail if there is an epoll logic setup failure
libcoap compiled for epoll will not continue to run.
Give a runtime warning if coap_read() or coap_io_do_events() are called when
libcoap is compiled or not compiled respectively for using epoll.
[Both coap_read() and coap_io_do_events() need to be in libcoap-2.{map|sym} to
support when compiling with or without epoll support]

libcoap-2.map:
libcoap-2.sym:

Make coap_io_prepare_epoll() application accessible.
2019-09-13 21:08:04 +01:00
Olaf Bergmann 4e626d53a4 .travis.yml: Expand build matrix with EPOLL and SMALL_STACK
Some builds now have epoll support disabled and small stack enabled.
2019-09-13 14:04:05 +02:00
Olaf Bergmann 4a13437b69 scripts/build.sh: Additional options for epoll and small stack
* Passing EPOLL=no disables the epoll interface usage. Other values
  default to yes, i.e. epoll is used if available.
* Passing SMALL_STACK=yes enables some values stored in static
variables instead pushing on the stack. This usually requires
mutex support in the operating system.
2019-09-13 12:44:55 +02:00
Olaf Bergmann 45b5d23665 .travis.yml: Move Contiki and LwIP to separate stage
Special handling of platforms other than POSIX reduces the build
matrix and thus speeds up CI once additional configure options
need to be checked.
2019-09-13 12:28:45 +02:00
obgm f5cf6ef5cc Merge pull request #405 from mrdeep1/small_stack
configure.ac: Make COAP_CONSTRAINED_STACK configurable
2019-09-13 11:26:18 +02:00
obgm 9893c7222b Merge pull request #402 from mrdeep1/windows_project
Fix Windows builds
2019-09-12 13:01:48 +02:00
Jon Shallow c5ab99369f Fix Windows builds
coap_config.h.windows:

Windows has struct cmsghdr so use it.
Update libcoap versions.

include/coap2/coap.h.windows:

Update libcoap versions.
Bring in line with build include/coap2/coap.h.

include/coap2/coap_session.h:

Include coap_forward_decls.h so things build correctly.

win32/libcoap.vcxproj:
win32/libcoap.vcxproj.filters:

Add in missing include files.
2019-09-12 11:49:26 +01:00
Jon Shallow 75e3e8595d configure.ac: Make COAP_CONSTRAINED_STACK configurable
Add in support for --enable-small-stack to define
COAP_CONSTRAINED_STACK in coap_config.h
2019-09-11 15:41:14 +01:00
obgm 3266e6cfcc Merge pull request #404 from obgm/pthread-configure-check
Pthread configure check
2019-09-11 12:03:01 +02:00
Olaf Bergmann abec5b8228 coap_mutex.h: Use pthread mutexes if detected by configure
On systems that support pthread mutexes, stack usage can be minimized
with the use of static variables. Concurrent access is protected
on these systems with mutexes. Platforms that do not have pthread
support must map the coap_mutex_* macros accordingly.
2019-09-10 13:28:44 +02:00
Olaf Bergmann 07156ea048 configure.ac: Check for pthread.h and pthread_mutex_lock 2019-09-10 13:14:50 +02:00
Olaf Bergmann 30583fbed9 coap_session.h: Adjust whitespace 2019-09-09 17:17:49 +02:00
Olaf Bergmann d49d38849e Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-09-09 17:17:05 +02:00
obgm 49867a8c48 Merge pull request #400 from mrdeep1/reverse_enums
Revert out changes to make 1 byte enums
2019-09-09 17:16:50 +02:00
Olaf Bergmann da1ac8572c Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-09-09 14:31:25 +02:00
obgm a584864bcf Merge pull request #397 from mrdeep1/configure_epoll
Make epoll support configurable if O/S supports epoll
2019-09-09 14:31:11 +02:00
Jon Shallow 209c8a9267 Revert out changes to make 1 byte enums
include/coap2/coap_dtls.h
include/coap2/coap_session.h
include/coap2/pdu.h
man/coap_encryption.txt.in
src/net.c

Revert out all the #define -> enum in #386 that require the enum to be
one byte long.
2019-09-09 09:59:44 +01:00
Jon Shallow 480aa73bd7 Make epoll support configurable if O/S supports epoll
Add in --with-epoll as a ./configure option
2019-09-06 13:03:52 +01:00
Olaf Bergmann 859f953c5b Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-09-05 15:22:05 +02:00
obgm 228a800f9d Merge pull request #395 from mrdeep1/inline_warnings
Fix -Winline compiler warnings about inlining failed
2019-09-05 15:21:50 +02:00
Jon Shallow 9f9a197e95 Fix -Winline compiler warnings about inlining failed
This is compiler version dependent when doing static inline expansions.

examples/client.c:

Make hex2char() just static.

examples/etsi_iot_01.c:

Make coap_add_payload() just static.

include/coap2/address.h:
src/address.c:

Make coap_address_init() an actual function.

libcoap-2.map:
libcoap-2.sym:

Expose coap_address_init() as a function.

Makefile.libcoap:

Include address.c as one of the libcoap files for Contiki.

examples/lwip/Makefile:

Include address.o as one of the libcoap files for LwIP.
2019-09-05 13:54:05 +01:00
Olaf Bergmann 1fc107b62c Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-09-05 14:42:53 +02:00
obgm 0138cd8f65 Merge pull request #396 from mrdeep1/bind_issue
Fix bind() address size for Mac OS X
2019-09-05 14:42:25 +02:00
Jon Shallow 22d078a854 Fix bind() address size for Mac OS X
It appears that MAC OX X (10.13.2) builds do not like the size of the sa to
be larger than the size of struct sockaddr_in when working with IP v4
addresses.

src/coap_io.c

Update the bind() calls to use the correct address size for IP v4.
2019-09-04 16:37:10 +01:00
Olaf Bergmann 183a5326ef Merge branch 'develop' of github.com:obgm/libcoap into develop 2019-09-03 13:40:32 +02:00