Commit Graph
56 Commits
Author SHA1 Message Date
Jon Shallow 993c12ac92 Copyright: Update to 2025 where appropriate 2025-09-16 11:41:41 +01:00
Jon Shallow e220c371be coap.h: Remove need for different coap.h files for different OS
./autogen.sh and ./configure no longer need to be run prior to running
make for Contiki, LwIP or RIOT from the appropriate examples sub-directory.

scripts/fix_version.sh now handles updating coap.h for the different
LIBCOAP_ and PACKAGE_ definitions.
2024-08-23 10:39:37 +01:00
Jon Shallow 79e6fcdb26 examples: Do CI pre-commit checks on man page examples 2024-08-16 13:16:11 +01:00
Jon Shallow 83718a6d2f Cleanup building header files for different OS
'make distclean' removes header files built from the .in files, which
means that they are not available for different OS builds.

The same is true for CMakeLists.txt.

Remove the need for the .in files and update for libcoap revisions
by using a new script scripts/fix_version.sh created from
scripts/fix_version.sh.in.

CI has been updated to check revisions have been updated in the
appropriate places.

Do not remove libcoap-3.sym and libcoap-3.map when doing 'make distclean'
as they are git tracked files.
2024-08-06 16:56:19 +01:00
Jon Shallow 485a7c4570 check-missing-updates.sh: Clarify what needs to be done when there is an issue 2024-05-20 15:31:03 +01:00
Jon Shallow d58bd90238 checks: Check for missing file updates 2024-05-17 15:33:44 +01:00
Jon Shallow e3a662a934 wolfSSL: Set up initial port
Includes some porting ideas from qursa-uc3m libcoap-wolfssl work.

Some common ASN1 code moved from coap_gnutls.c to coap_asn1.c to support RPK.

WolfSSL build
$ ./configure --enable-all --enable-dtls13 CFLAGS="-DBUILD_TLS_PSK_WITH_AES_128_CCM -DHAVE_RPK"

Interoperability requirements

DTLS1.3 downgrade requires
https://github.com/eclipse/tinydtls/pull/230
https://github.com/wolfSSL/wolfssl/pull/7367

TLS1.3 downgrade requires
https://github.com/wolfSSL/wolfssl/pull/7367

(D)TLS1.2 use of RPK requires
https://github.com/wolfSSL/wolfssl/pull/7375

MbedTLS using TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 requires
https://github.com/wolfSSL/wolfssl/pull/7132

GnuTLS using PSK and TLS1.3 requires
https://github.com/wolfSSL/wolfssl/pull/7407
2024-04-16 11:03:24 +01:00
Jon Shallow 8237c1d801 Copyright: Update to 2024 2024-01-02 08:45:59 +00:00
Jon Shallow 9fbce393d9 Windows: Fix workflows OpenSSL install 2023-10-04 22:03:49 +01:00
Jon Shallow 8d869fff04 RIOT: Update to support latest libcoap code
Add in examples and pkg/build information
2023-06-05 12:47:15 +01:00
Jon Shallow 964bd69481 MinGW: Initial compile environment support 2023-04-12 10:06:46 +01:00
Jon Shallow 3552b53be4 Copyright: Update copyright date to end 2023 as appropriate 2023-01-02 11:45:10 +00:00
Jon Shallow 7b39908e82 LwIP: Add in TinyDTLS support
The dtls versions of the server and client are built as
server-dtls and client-dtls.

Add in flexible option support for server and client.  These are
a subset of the coap-server and coap-client options.
2022-10-29 13:26:43 +01:00
Jon Shallow de1bc9f3cb LwIP: Add in support for client
New demo client app.

Update some of the memory sizes.
New coap_lwip_dump_memory_pools() to dump LwIP memory pool usage.

Add in logic to handle new client sessions.

New coap_io_process() to handle LwIP which can invoke a callback handler
to wait / timeout for the next input handler.
New coap_lwip_set_input_wait_handler() to define this handler.

Update coap_io_prepare_io() to handle LwIP.

Support re-use of pbuf for PDU re-transmissions.

Make sure that NSTART is correctly obeyed.

Build the client with client only libcoap code.

Build the server with server only libcoap code.

Update LwIP source to latest stable release.

Reserve memory for a response PDU.

New coap_lwip(3) man page.

Update directory structures for config files.

Update files contained in "make dist" and check lwip rebuilds
in the github workflows.
2022-09-22 10:14:48 +01:00
Jon Shallow 43bfbea924 Copyright: Update dates to 2022 where appropriate 2022-08-18 13:23:36 +01:00
Jon Shallow df72a53f2d coap_openssl.c: Support Microsoft VS builds
Correct reported errors

Update workflow for ms-build to include OpenSSL.
2022-02-21 12:37:44 +00:00
Jon Shallow 19928e81bd builds: Set CFLAGS += -Werror in all linux subdirectory compilations 2022-02-18 14:23:43 +00:00
Jon Shallow 5b32d716fa github workflow: Support windows-2022
The provided host for windows-latest is migrating across from
windows-2019 to windows-2022 on github.  This allows things to be built on
a windows-2022 system.
2022-02-09 21:44:37 +00:00
Olaf Bergmann 7791897e8f api-version-bump.sh: Added missing changes for win32
This change adds replacements for additional files in the win32
subdirectory tree according to commit 166ef51e (see [1]).

[1] https://github.com/obgm/libcoap/pull/763
2021-10-18 09:48:56 +02:00
Olaf Bergmann cc2a3d3d28 api-version-bump.sh: Add missing files to update
.gitignore, autogen.sh, and Dockerfiles
2021-04-21 16:06:22 +02:00
Olaf Bergmann 6d8aaa9b90 scripts/api-version-bump.sh: fix missing file
Fix API version in files generated from man/examples-code-check.c.

Call autoreconf after updating configure.ac to ensure configure is
re-run the next time make is executed.
2021-04-15 12:04:56 +02:00
Olaf Bergmann 8efab74066 scripts/api-version-bump.sh: require explicit version parameter
To avoid accidentally changing the API version, the script now aborts
if no new version other than the current API version has been
specified.
2021-04-14 13:06:15 +02:00
Olaf Bergmann 145d86f96d scripts/api-version-bump.sh: Adjust hard-coded API version
This script is called from the package's top directory to adjust
all places where the current API version is hard-coded. The
current version is detected from the LIBCOAP_API_VERSION in
configure.ac. The target version is LIBCOAP_API_VERSION + 1 if no
parameter is provided on the command line. Otherwise, the given
value is used as target version.

Note that calling this script also results in 'git mv' operations.
git commit must be called manually after running this script.
2021-04-08 14:32:52 +02:00
Jon Shallow a524b2341c build: Add in Visual Studio build
Update Windows build files to include a build that does not use OpenSSL
(called NoTLS).

Include this build in the github workflow.
2021-03-17 16:55:07 +00:00
Jon Shallow dc6c5e6b00 workflow: Add in distribution and CMake checks
.github/workflows/main.yml:

Do a 'make check' for matrix builds.
Move documentation into separate job to reduce matrix build times
Add in CMake job.
Add in distribution job.
Add in tinydtls job.
Add in contiki/lwip job.

scripts/github_dist.sh:

Do the distribution checks using a script.

examples/etsi_iot_01.c:
examples/tiny.c:

Fix include coap.h directory in old examples.

README.md:

Update status badges to get only the branch actions and remove CMake
status badge.
2021-02-24 18:15:25 +00:00
Olaf Bergmann 57a5a7e089 [CI] main.yml: basic build steps 2021-02-12 12:09:01 +01:00
Jon Shallow 7812efb1eb Man examples: Add in support to check that the man example's code compiles
There needs to be an easy way to validate that the examples provided in the
man pages compile without errors.

This PR provides a new executable examples-code-check that can be run against
the .txt.in files that are in the man directory.  It abstracts the code for
each example and then runs the compiler against that stub code reporting errors
and warnings as appropriate for subsequent fixing in the man page.

.gitignore:

Ignore the new executable and the files it generates.

Makefile.am:
configure.ac:

Remove MAN_DIR and hard code in the man directory so that examples-code-check
is always built.

autogen.sh:

Make sure that all the temporary stub code files are cleaned up.

man/Makefile.am:

Support building and clean-up of the new examples-code-check.

man/examples-code-check.c: (new)

The code that parses the man pages, looking for examples and the gets
the examples compiled, testing for errors.
The function definitions in the SYNOPSIS section are also included in the
compilation of the examples.

scripts/build.sh:

If WITH_TESTS is set, check that the man page examples compile.

man/coap_encryption.txt.in:
man/coap_io.txt.in:
man/coap_observe.txt.in:
man/coap_pdu_setup.txt.in:
man/coap_resource.txt.in:
man/coap_session.txt.in:

Correct the SYNOPSIS function definitions.
2020-05-04 14:47:36 +01:00
Carlos Gomes Martinho e191e2d726 build: add cmake support 2020-04-22 17:07:24 +02:00
Jon Shallow 8abd8fa677 Add mbedtls build into Travis builds
.travis.yml
build-env/Dockerfile.build-env
build-env/Dockerfile.develop
scripts/build.sh
scripts/dist.sh

Update with mbedtls information
2020-01-16 09:38:43 +00: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 d873b1f752 scripts/build.sh: Disable silent rules by default
As discussed in PR #370 [1], silent rules are disabled for travis
builds.

[1] https://github.com/obgm/libcoap/pull/370
2019-07-02 09:33:38 +02:00
Jon Shallow ff8f8d2c6b Stop valgrind errors when using OpenSSL 1.1.1c
Issue introduced by OpenSSL 1.1.1c causes valgrind errors to be reported.  See
https://www.mail-archive.com/openssl-commits@openssl.org/msg21701.html and
https://github.com/openssl/openssl/pull/8606 which did not make 1.1.1c

scripts/build.sh:
tests/valgrind_suppression:

Temporarily suppress valgrind errors when SSL_CTS_new() is called when running
the tests.

Note: This suppression will also need to be applied when running valgrind
against other CoAP executables using OpenSSL 1.1.1c to prevent the valgrind
errors getting reported.

src/coap_openssl.c:

memset cookie_secret to 0 to stop valgrind warning.
2019-06-25 20:26:43 +01:00
Jon Shallow 40c1ddbb24 Travis tests/testdriver fails with libtinydtls.so missing error
When building tinydtls version, Travis fails with the following error

tests/testdriver: error while loading shared libraries: libtinydtls.so:
cannot open shared object file: No such file or directory

The new version of TinyDTLS now builds a libtinydtls.so file which is
linked against in preference to libtinydtls.a when using -ltinydtls,
but Travis does not have an installed version libtinydtls.so to load
during execution of tests/testbriver - hence failure.

scripts/build.sh:

Add in LD_LIBRARY_PATH=ext/tinydtls if building tinydtls.

BUILDING:
configure.ac:

With libtinydtls.so being available, there is no need to enforce
--disable-shared for tinydtls.  Remove this requirement.
If --disable-shared is set, link in with libtinydtls.a.
2019-03-30 13:04:04 +00:00
Jon Shallow 0bcbd3fb5c Update scripts/build.sh to build coap-etsi_iot_01 and coap-tiny examples
Travis now checks exmples continue to build, even if there is an API
change.
2018-12-07 20:22:56 +00:00
Jon Shallow e172e6865b Include GnuTLs in the Travis build
.travis.yml

Add in the gnutls build.

build-env/Dockerfile.build-env
build-env/Dockerfile.develop

Add in libgnutls28-dev to the apt-get list.

scripts/build.sh
scripts/dist.sh

Support TLS set to gnutls for building.
2018-11-27 15:33:52 +00:00
Olaf Bergmann 5bd36c1526 scripts/dist.sh: CI-script for testing make dist
This script creates a libcoap archive, unpacks it and does an
out-of-tree build and installation afterwards. The environment
variables PLATFORM, TESTS, TLS and DOCS control the build
configuration. Suggested invocation from travis CI is:

  PLATFORM=posix TESTS=yes TLS=no DOCS=yes scripts/dist.sh
2018-10-26 17:46:08 +02:00
Olaf Bergmann 3c2413eac7 build.sh: control documentation build
If the environment variable DOCS is set to yes, --enable-documentation
will be set during configure, --disable-documentation otherwise (the
previous default).
2018-10-26 17:45:04 +02:00
Jon Shallow d766f9d8ee Update code to build LwIP and Contiki from the examples directory
Update code to use new APIs
[Some code changes modelled on PR #202, some code being moved between files]
Remove #ifdef WITH_LWIP from coap_io.c as file is not used
Add in resource time to lwip
Update for Travis build
Report on Contiki memory allocate failures to ease debugging
Make the different memory type counts configurable by using the -D option
included in a CFLAGS definition to the ./configure command line

.travis.yml
BUILDING
Makefile.libcoap
examples/contiki/Makefile
examples/contiki/README     new
examples/contiki/server.c
examples/contiki/.gitignore (new)
examples/lwip/Makefile
examples/lwip/README
examples/lwip/lwipopts.h
examples/lwip/server-coap.c
examples/lwip/server.c
include/coap/address.h
include/coap/coap_io.h
include/coap/lwippools.h
include/coap/pdu.h
scripts/build.sh
src/address.c
src/coap_io.c
src/coap_io_lwip.c
src/coap_session.c
src/mem.c
src/net.c
src/pdu.c
2018-07-27 15:30:37 +01:00
Olaf Bergmann 93f9ee61b3 build.sh: integrate OSS-Fuzz syntax checks in CI build 2018-07-26 12:35:27 +02:00
Jon Shallow 96d8877606 Fix reported issues #212, #214 and refix #199, add in valgrind to do the testing
build-env/Dockerfile.build-env
scripts/build.sh

Add in valgrind testing of the tests

src/option.c

Issue #199 Better fix of ADVANCE_OPT_CHECK()

src/pdu.c

Issue #214 Validate token length in coap_pdu_parse_header()

src/uri.c

Issue #212 Check not reading off end of buffer in dots()

tests/test_pdu.c
tests/test_uri.c

Tests updated to include tests for #212 & #214
2018-07-12 15:30:17 +01:00
Olaf Bergmann 82c9ccc75b build.sh: bugfix for tinydtls build
When TLS=tinydtls is set, configure must be called with --disable-shared.

Thanks to Michael Zimmer for pointing this out.
2018-01-18 15:30:26 +01:00
Olaf Bergmann bea82fef30 build.sh: disable documentation to speedup continuous integration 2017-10-16 17:53:00 +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 5a2d68f145 scripts/build.sh: re-enable pkg-config fix for CUnit
The Trusty build environment comes with a pkg-config file for CUnit
which lacks a version number and has a syntax error. The build script
now calls scripts/fix-cunit.sh to create a fixed version of the
existing cunit.pc file and point the configure script to this file.
2016-10-31 13:39:33 +01:00
Olaf Bergmann 4920a46021 scripts/build.sh: removed non-working cunit.pc fix
Now, PKG_CONFIG_PATH is not set to local version, hoping that the
installed version works without version check.

Added more debug output instead.
2016-10-26 18:56:27 +02:00
Olaf Bergmann 79212255a1 scripts/build.sh: more debug output
This change outputs the config.log when configure failed.
Moreover, a local cunit.pc will be output to see why the build still
fails.
2016-10-26 18:47:08 +02:00
Olaf Bergmann 58ff2feabb scripts/fix-unit.sh: make script executable
Forgot chmod +x scripts/fix-unit.sh.
2016-10-26 18:40:04 +02:00
Olaf Bergmann ab198868f1 scripts/build.sh: added fix for broken cunit.pc in travis CI environment
The pkgconfig specification for libcunit1-dev version 2.1-2 is
horribly broken. build.sh (invoked by the travis CI system,
see .travis.yml) now runs a new script fix-cunit.sh when TESTS is
set to 'yes'.
2016-10-26 18:32:44 +02:00
Olaf Bergmann 24500483f7 build.sh: bugfix: use LDLIBS for linking 2016-06-22 15:22:32 +02:00
Olaf Bergmann 4f24417d59 build.sh: set LDFLAGS=-lrt for glibc < 2.17 in lwip build
The link step for the native lwip build fails on platforms that
use a glibc version prior 2.17. The reason is that librt is needed
for clock_gettime() in that environment. configure detects this
correctly but the lwip example comes with a simple hand-craftet
Makefile that does not use the configure results.

This quick hack checks for the output of the check for clock_gettime()
and includes the required libraries in order to fix the travis build.
2016-06-22 14:26:46 +02:00