Commit Graph
32 Commits
Author SHA1 Message Date
Jon Shallow 7623e0f085 OSCORE: Add in interopability tests
See https://core-wg.github.io/oscore/test-spec5.html

Add in new test server oscore-interop-server to provide the necessary
functionality.

Add in script and configuration files to run the tests locally.
2023-01-14 10:26:20 +00:00
Jon Shallow dac6bd3b60 RFC8613: Add in OSCORE support
Based on work done in https://gitlab.informatik.uni-bremen.de/obergman/libcoap

New directories with files
 include/oscore
 src/oscore

New files
 include/coap3/coap_oscore.h
 include/coap3/coap_crypto_internal.h
 include/coap3/coap_oscore_internal.h
 man/coap-oscore-conf.txt.in
 man/coap_oscore.txt.in
 src/coap_oscore.c
 tests/test_oscore.c
 tests/test_oscore.h

Supported by new option (enabled by default)
 ./configure --enable-oscore
 cmake .. -DENABLE_OSCORE=ON

Requires a TLS library configured to do the OSCORE encryption and hashing.
2023-01-14 10:26:20 +00:00
Jon Shallow 3552b53be4 Copyright: Update copyright date to end 2023 as appropriate 2023-01-02 11:45:10 +00:00
Jon Shallow 43bfbea924 Copyright: Update dates to 2022 where appropriate 2022-08-18 13:23:36 +01:00
Jon Shallow 19928e81bd builds: Set CFLAGS += -Werror in all linux subdirectory compilations 2022-02-18 14:23:43 +00:00
Jon Shallow f026f5701e client+server: Reduce code size by building libcoap for client or server only
Add in new ./configure options --enable-client-mode or
--enable-server-mode which by default are enabled.

If --disable-client-mode is set, then disable all the client specific code.
[ COAP_CLIENT_SUPPORT is not defined ]

If --disable-server-mode is set, then disable all the server specific code.
[ COAP_SERVER_SUPPORT is not defined ]

Functions and variables are only #ifdef'd out in the include/coap3/*_internal.h
files.  They cannot be #ifdef'd out in the other include files as
COAP_CLIENT_SUPPORT and COAP_SERVER_SUPPORT are not available for application
compilations. The result of this is if, say, client only API functons are used
in a server application and COAP_CLIENT_SUPPORT is not defined, there will be
linking issues (missing functions).  Providing stub functions unecessarily
increases the code size.

For coap-server, if it is able to provide proxy support, requires both
COAP_SERVER_SUPPORT and COAP_CLIENT_SUPPORT to set up the ongoing sessions.
So, the build environment deliberatly sets SERVER_CAN_PROXY=0 if
COAP_CLIENT_SUPPORT is not available to allow linking.

Some of the tests have to be disabled if COAP_SERVER_SUPPORT or
COAP_CLIENT_SUPPORT is not set.

Code size change indications

   text    data     bss     sum   filename
 155912    1728   12080  169720   libcoap-3-notls.a
 138300    1728   12080  152108   libcoap-3-notls.a --disable-client-mode
 106734    1632   10304  118670   libcoap-3-notls.a --disable-server-mode

 180485    1733   12080  194298   libcoap-3-openssl.a
 160306    1733   12080  174119   libcoap-3-openssl.a --disable-client-mode
 125543    1637   10304  137484   libcoap-3-openssl.a --disable-server-mode

 181755    1728   12080  195563   libcoap-3-gnutls.a
 160972    1728   12080  174780   libcoap-3-gnutls.a --disable-client-mode
 127178    1632   10304  139114   libcoap-3-gnutls.a --disable-server-mode

 165879    1855   12128  179862   libcoap-3-tinydtls.a
 147022    1855   12128  161005   libcoap-3-tinydtls.a --disable-client-mode
 115618    1759   10352  127729   libcoap-3-tinydtls.a --disable-server-mode

 171690    1728   13744  187162   libcoap-3-mbedtls.a
 152099    1728   13712  167539   libcoap-3-mbedtls.a --disable-client-mode
 118786    1632   11984  132402   libcoap-3-mbedtls.a --disable-server-mode
2021-09-30 16:10:52 +01:00
Olaf Bergmann 60421db0a5 Add SPDX-License-Identifier to source files
This change adds 'SPDX-License-Identifier: BSD-2-Clause' [1] to
the source code files that originate in the libcoap project.

Note that not all files are tagged because they are pulled in
from other sources and thus may fall under a different license.
More information about these is contained in the LICENSE file.

[1] https://spdx.org/licenses/BSD-2-Clause.html
2021-06-08 18:14:03 +02:00
Jon Shallow 7cff27fb7a examples: Fix RPM Package Manager complaining about duplicate objects
For example (when building OpenSSL variant), coap-client and
coap-client-openssl are identically built and debug information is being
abstracted, it complains that the two binaries are identical.

Make coap-server, coap-client and coap-rd non-installable, (they still need
to be built in the examples directory, so cannot use check_PROGRAMS) and then
soft-link them as appropriate in the target $(bindir).
2021-06-08 09:00:33 +01:00
Jon Shallow 7cd5bfa638 configure.ac: Add in --enable-add-default-names option
If --enable-add-default-names is set (the default), then the installed default
libraries and installed default example executables will point to the
appropriate object that has the (D)TLS library type in the name.  E.g.

libcoap-3.so -> libcoap-3-openssl.so
coap-client -> coap-client-openssl

If --enable-add-default-names is not set, then this will not happen.

As well as the libraries, the example binaries are now created with the (D)TLS
library extension in all cases.
2021-05-20 16:33:28 +01:00
Jon Shallow 939f7d4380 examples/Makefile.am: Revert commit f6eede8077
It is no longer needed now that uthash.h is no longer required by coap_rd.
2021-05-20 13:28:44 +01:00
Jon Shallow feb8c15b45 examples: Provide standalone source and simple Makefile for examples
Install in PREFIX/share/libcoap/examples the source for coap-client.c and
coap-server.c with a standalone Makefile for ease of standalone code
development.

Add in configure option --enable-examples-source.

Included is a README, LICENSE and COPYING.
2021-05-11 14:35:23 +01:00
Olaf Bergmann f6eede8077 examples/Makefile.am: fix include path
Example applications are built against the libcoap public API
and therefore prefix libcoap includes with "coap3)/".

The only exception is coap-rd which uses uthash.h from the internal
API. Therefore, "-Iinclude/coap3" is additionally passed as CPPFLAG
for coap-rd.
2021-04-29 13:16:10 +02:00
Jon Shallow a31dcba587 coap-client: Rename client.c to coap-client.c
Keep the examples source names and executables in the same form
for consistency.
2021-02-26 14:21:12 +00:00
Jon Shallow 78c59ff300 Add in support for building coap-etsi_iot_01 and coap-tiny examples
examples/Makefile.am

Support building the additional examples using 'make check'.

.gitignore

Ignore the new examples executables.
2018-12-07 20:22:56 +00:00
Olaf Bergmann 839bdc5418 Revert "examples/Makefile.am: remove $(DTLS_LIBS) variable"
This reverts commit 91bfd5b103 because
it introduced a wrong variable substitution:

The problem here is that top_srcdir is . in the top-level Makefile, so
the link command ends up having this:

  [...]   ../.libs/libcoap-2-tinydtls.a -L./ext/tinydtls -ltinydtls

Whereas, in examples/Makefile.am, top_srcdir is .., so using DTLS_LIBS
would be correctly replaced by

          ../.libs/libcoap-2-tinydtls.a -L../ext/tinydtls -ltinydtls

The same holds for the Makefile in the subdirectory tests.
2018-11-08 11:24:04 +01:00
Carsten Schoenert 91bfd5b103 examples/Makefile.am: remove $(DTLS_LIBS) variable
Using the variable $(DTLS_LIBS) in the *_LDADD isn't correct, for
controlling the linker flags the *.la file is normally holding all the
required information.

This was introduced by 5687681d71 and is
partially removed by this commit.
2018-11-06 17:37:55 +01:00
Carsten Schoenert 6dde2bc9a8 examples: use the coap2 folder for including coap.h
Due the changed installation folder we need to adjust the source path to
coap.h for the files within the files of the examples.
2018-10-04 12:23:14 +02:00
Jon Shallow 843f036b16 examples/Makefile.am: Remove coap_list.c from files needed for coap-client 2018-05-17 18:45:07 +01:00
Jon Shallow ef6c72bf44 examples/Makefile.am: Update for new libcoap library naming 2018-04-13 08:43:37 +01:00
Jon Shallow 20cd610c03 examples/Makefile.am: Remove building man pages
Delete building man pages as they are now a part of the man directory
2018-04-07 11:34:44 +01:00
Diego Santa Cruz 9b12571804 Makefile.am: fix building outside of source tree
When building outside the source tree compilation fails on
examples, because the libcoap headers expect to be all in the
same directory but coap.h is generated under the build
directory, so it is necessary to add an extra include path
for it.

Also, build directories should always appear before source
directories in the include path, so that any leftover
generated files in the source tree are ignored.
2017-09-20 10:48:54 +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 6d7ba61ae0 libcoap-1.pc: fix pkg-config include path
This change excludes the coap subdirectory from the include path
reported by pkg-config --cflags to avoid name conflicts with other
installed packages. Applications now must add the prefix 'coap/'
to include directives for libcoap header files, e.g.

  #include <coap/coap.h>

Jean-Claude Michelou has reported this problem in Bug #82 [1].

[1] https://github.com/obgm/libcoap/issues/82

A minimal Makefile now could look be written as:

  PKG_LIBCOAP=libcoap-1
  CPPFLAGS=$(shell pkg-config --cflags-only-I $(PKG_LIBCOAP)) -DWITH_POSIX
  LDFLAGS=$(shell pkg-config --libs-only-L $(PKG_LIBCOAP))
  LDLIBS=$(shell pkg-config --libs-only-l $(PKG_LIBCOAP))
2017-06-01 12:33:04 +02:00
Carsten Schoenert 18f2309759 make: enable out of tree build
The build environment was lacking the possibility to get libcoap
buildable out of tree, simply checkable by the running 'make distcheck'.
Without this fix the users are impossible to build libcoap in a own
folder that's independed from the source containing folder. Typical use
case would be:

  $ mkdir libcoap-build && cd libcoap-build
  $ /path/to/libcoap-source/configure \
      --srcdir=/path/to/libcoap-source \
      --prefix=/somethere/to-install

This commit enables the out of tree build by adding and changing some
needed variables.
2016-10-26 10:46:50 +02:00
Olaf Bergmann 2da31de732 configure.ac: fix disable options
The options --disable-documentation and --disable-examples did
not have the desired effect in some configurations. Now, if any
of documentation or examples is disabled, the manual pages in
the examples folder are not created.
2015-09-30 19:46:34 +02:00
Carsten Schoenert 141eefdbb6 a2x: adding a check for needed helper
The previous commit added some asciidoc based man pages that need a2x
from the asciidoc package. To ensure the build will not break due a not
available a2x binary we better check before.
2015-06-22 21:25:43 +02:00
Carsten Schoenert 3e9afb1460 examples/*: adding example binaries man page support
This commmit adds the build of man pages for the binaries from the
example/ folder, in detail these are coap-client.5, coap-rd.5 and
coap-server.5.
The source of the man pages is written in asciidoc so the build
environment must have access to a installed asciidoc package.
2015-06-22 21:25:43 +02:00
Carsten Schoenert 1043892391 rename the example binaries to more strict naming schema
To normalize (and in preparation for manpages) the currently used files
for the example implementation of a CoAP based client, server and a
resource directory various files and variables are rename to coap-*.
2015-06-19 20:53:47 +02:00
Carsten Schoenert 21431bcb2f examples/Makefile.am: small fix for the path declaration 2015-06-02 20:41:37 +02:00
Carsten Schoenert 47e0c25c38 examples/Makefile.am: changing header includes
The build of the examples is complaining about a function that are not
inline'd. The compiler is mentioned this because we use the '-I'
directive for pointing to the header files. Just say the compiler also
that the header files are system headers so the false positive is going
away.
2015-03-22 14:38:36 +01:00
Carsten Schoenert da3570cb41 examples/Makefile.am: fix not needed target
The target 'install-exec-am' is obviosly wrong and not really needed.
2015-03-22 13:37:28 +01:00
Carsten Schoenert 60030d0fb4 examples: adding the examples folder to the build
After including the doc/ and the tests/ folder under the hood of the
autotools now adding the examples/ foolder too.
The user is now able to add the build of the example binarys if
configure is called with '--enable-examples' as option. The example
binarys will not be build by default!

Currently only 'coap-client', 'coap-server' and 'rd' is build.
2015-03-12 11:25:26 +01:00