Commit Graph
106 Commits
Author SHA1 Message Date
Jon Shallow 55aeaa6cc1 Update Keepalive support to include unreliable sessions
Add in support for both reliable and unreliable sessions when calling
coap_context_set_keepalive().

include/coap2/coap_session.h:

Track the last ping mid in coap_session_t.

src/coap_io.c:
src/coap_session.c:

Support both reliable and unreliable sending of pings in coap_write().

src/net.c:

Determine whether RST packet response is associated with a CoAP Empty Ping
that was sent and handle accordingly.

configure.ac:
examples/client.c:
include/coap2/net.h:
man/Makefile.am:
man/coap-client.txt.in:
man/coap.txt.in:
man/coap_handler.txt.in:
man/coap_keepalive.txt.in: (New)
man/coap_observe.txt.in:

Add in a new man page (coap_keepalive).
Update documentation to remove references to TCP and reliable only.
2019-07-11 11:14:15 +02:00
Jon Shallow 8e2acba4f2 configure.ac: Enable silent compiles by default
Add in option so default is to only output the compile line as in

  CC     src/libcoap_2-openssl_la-coap_event.lo

instead of

/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.    -fPIC
 -fPIE -I./include/coap2 -I./include/coap2 -pedantic -Wall -Wcast-qual -Wextra
 -Wformat-security -Winline -Wmissing-declarations -Wmissing-prototypes
 -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wswitch-default
 -Wswitch-enum -Wunused -Wwrite-strings  -Wlogical-op -I/opt/openssl/include
 -std=c99 -ggdb3 -DCOAP_CONSTRAINED_STACK -DDTLS_CONSTRAINED_STACK
 -D_GNU_SOURCE -MT src/libcoap_2-openssl_la-coap_event.lo -MD -MP
 -MF src/.deps/libcoap_2-openssl_la-coap_event.Tpo -c
 -o src/libcoap_2-openssl_la-coap_event.lo `test -f 'src/coap_event.c' ||
 echo './'`src/coap_event.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -fPIC -I./include/coap2
 -I./include/coap2 -pedantic -Wall -Wcast-qual -Wextra -Wformat-security
 -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs
 -Wpointer-arith -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum
 -Wunused -Wwrite-strings -Wlogical-op -I/opt/openssl/include -std=c99 -ggdb3
 -DCOAP_CONSTRAINED_STACK -DDTLS_CONSTRAINED_STACK -D_GNU_SOURCE
 -MT src/libcoap_2-openssl_la-coap_event.lo -MD -MP
 -MF src/.deps/libcoap_2-openssl_la-coap_event.Tpo -c src/coap_event.c -fPIE
 -o src/libcoap_2-openssl_la-coap_event.o
mv -f src/.deps/libcoap_2-openssl_la-coap_event.Tpo
 src/.deps/libcoap_2-openssl_la-coap_event.Plo

making it much easier to find compile time warnings.

Old version of output can still be obtained with

 make V=1

or

 ./configure --disable-silent-rules
2019-07-01 10:13:32 +01:00
Jon Shallow 173f160498 Handle platforms that do not have 'struct cmsghdr' defined
configure.ac:

Test for the presence of 'struct cmsghdr' and set HAVE_STRUCT_CMSGHDR
if appropriate.

src/coap_io.c:

Revert to recvfrom() and sendto() if HAVE_STRUCT_CMSGHDR is not defined,
instead of using recvmsg() and sendmsg().
2019-04-26 13:34:16 +01:00
Jon Shallow 9028574ee3 Fix GNU make extension complaint in man/Makefile.am
Currently the following complaint is in the build logs

man/Makefile.am:56: warning: ':='-style assignments are not portable
man/Makefile.am:56: warning: shell for fil in $(TXT3: non-POSIX variable name
man/Makefile.am:56: (probably a GNU make extension)

Correct issue by using

configure.ac:
AC_SUBST([DOLLAR_SIGN],[$])

man/Makefile.am:
to substiture for $ as in $(shell ...
and replace := with =
2019-03-31 14:55:19 +01:00
Olaf Bergmann e65135f49a configure.ac: Fixed comment for LT_INIT
Commit 40c1ddb enables shared and static libraries to be used for
testing hence the comment before LT_INIT was updated accordingly.
2019-03-31 14:29:21 +02: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
Olaf Bergmann cfec0d072c configure.ac: bumped version number to 4.2.0 2019-03-02 11:58:05 +01:00
yr2004 fe92eb7d23 Update configure.ac
fix a configure.ac error for tinydtls
2019-02-02 10:33:22 +08:00
Olaf Bergmann bcff6dec61 configure.ac: bounce version number to 4.2.0rc4 2019-01-29 11:04:56 +01:00
Olaf Bergmann d52de2b8e9 configure.ac: set release state to rc3 2018-12-20 14:29:08 +01:00
Jon Shallow 8a3b46eee4 Bump minimum GnuTLS version to 3.3.0
Makefile.am

Include src/coap_gnutls.c

configure.ac

Update minimum GnuTLS version to 3.3.0
2018-11-27 11:42:21 +00:00
Jon Shallow 3d932bdcd4 Revert out commit c362d56 disabling gnutls support
Re-enable building with --with-gnutls
2018-11-27 11:42:21 +00:00
Olaf Bergmann 3c75958f33 configure.ac: fix typo for tinydtls build
In the overview at the end of configure, tinyDTLS was incorrectly
listed as "OpenSSL around".
2018-11-08 11:27:59 +01:00
Carsten Schoenert c362d561fd configure.ac: disable the usage of GnuTLS library
The libcoap development isn't currently ready to also use the GnuTLS
cryptography library and development files within the release of 4.2.0.
An available configure option '--with-gnutls' or the preferred automatic
usage of the GnuTLS cryptography functions within the libcoap library
without some real usability would confuse users for sure.

This commit removes the visible implementation of the additional
configure option '--with-gnutls' but also some internal checking and
logic of variables to control the linking of libcoap.

This commit can simply be reverted once 4.2.0 is released and the usage
of the needed cryptography functions from the GnuTLS library will get
implemented.

Note: Normally the part of the source that is now commented out would
      would just get removed as we are working with git, but I dropped
      that so it's probably easier to see without the usage of git what
      was changed.
2018-11-06 17:37:55 +01:00
Carsten Schoenert 5ae059faa8 configure.ac: small spelling fixups
No functional changes, just some orthography corrections.
2018-11-06 17:37:55 +01:00
Carsten Schoenert d3bed24f3c configure.ac: fix evaluate logic for library suffix
If a user isn't explicitly disabling the DTLS support for libcoap or
requesting the usage of tinydtls then instead the configure script needs
to detect at least the development files for GnuTLS or OpenSSL.
If not the script must break and give up with an error message.

Because of some wrong logic within the evaluation if one of both TLS
libraries was found configure was *not* stopping with an error message.

The logic to check the possibilities of an automatic usage of the TLS
libraries was different, the check for GnuTLS was correct but on
OpenSSL a wrong check condition chain was used, it should and must have
been the same on both libraries. This commit is fixing this.
As all conditions must the true in theses check to set the correct
variables which are used later within configure.

But the sanity check at the end was also not completely correct and
failing so configure was not running into the desired error break.
2018-11-06 17:37:55 +01:00
Olaf Bergmann 00486a4f46 configure.ac: set release state to rc2 2018-10-25 11:06:20 +02:00
Jon Shallow ca17e3ab55 Update to patches to make doc/ builds work out of tree
configure.ac:
remove reference to doc/build_man_files.sh as it is no longer used

doc/Makefile.am:
Correct BASE definition to be that of the filename without any suffix so
Doxygen can properly @ref the file
Remove usage of 'cat'
Tidy up debug comments and indentation
Make sure cp overwrites destination files if they exist
Support building doc/ if asciidoc (a2x) is not available (the nam pages will
not get generated and included though.
2018-10-18 14:09:59 +02:00
Carsten Schoenert 5108566fd5 libcoap-2.{map, sym}: create file in the top_builddir
If you are working out of tree you get a deadloop because you are unable
to recreate the *.{map,sym} file in your current working directory.

configure is thinking the source is already configured in another folder
if you want to call the configure script outside the top_sourcedir and
is requireing a "make distclean' call in top_sourcedir which is also
deleting libcoap-2.{map,sym}. But the source is *always* building these
two files in the top_sourcedir.

This commit is pointing the build of these two files into top_builddir
which is also top_sourcedir if you are doing a in tree build.
2018-10-18 13:43:46 +02:00
Jon Shallow f8bdac31db Update doc build to support out of path builds
Use a new template doc/build_man_files.sh.in to include @top_srcdir@/doc
@top_srcdir@/man as appropropriate.

Update doc/Doxyfile.in in a similar way (and coap/ to coap2/)

Makefile.am autogen.sh configure.ac taught about doc/build_man_files.sh.in

Update doc/Makefile.am to include $(top_srcdir) and $(top_builddir)
2018-10-18 13:41:58 +02:00
Olaf Bergmann 5f00f0e7b1 configure.ac: bumped version prefix to rc1 2018-10-04 12:43:00 +02:00
Carsten Schoenert 13fa0dfcdf configure.ac: use the changed new include path for coap.h
The headers are now placed in include/coap2 and automake need to create
the core header file coap.h here.
2018-10-04 12:21:12 +02:00
Jon Shallow f5367ef3de Delete trailing spaces from files, replace TAB with 8*SPACE
"git diff -w" shows no differences

TAB left alone in files that are not C based files or documentation
2018-09-28 17:34:07 +01:00
Olaf Bergmann 7dc5c9d822 configure.ac: add option for gcov flags
Gcov[1] is a tool to investigate test code coverage. To collect
runtime statistics, certain compiler options must be set, i.e.
-fprofile-arcs, -ftest-coverage, and --coverage. Currently, only
the Gnu C Compiler is known to support the gcov instrumentation.

This change adds the configure option --enable-gcov that checks if
the compiler supports the aforementioned compiler flags and enables
these.

[1] https://gcc.gnu.org/onlinedocs/gcc/Gcov.html
2018-08-01 20:31:08 +02:00
obgm e1491dee77 Merge pull request #226 from mrdeep1/logging-doc
New coap_logging(3) and updated Doxygen comments for logging
2018-07-26 14:08:25 +02:00
Olaf Bergmann 315067add0 configure.ac: add creation of tests/oss-fuzz/Makefile.ci 2018-07-26 12:29:13 +02:00
Jon Shallow c695dea7cd New coap_logging(3) and updated Doxygen comments for logging
Documentation changes/updates only - no code changes.

configure.ac
include/coap/coap_dtls.h
include/coap/coap_session.h
include/coap/debug.h
man/Makefile.am
man/coap.txt.in
man/coap_context.txt.in
man/coap_logging.txt.in (new)
2018-07-25 09:48:02 +01:00
Jon Shallow 9a1f0ab475 man pages: New coap_encryption(3) and coap_session(3)
Split out old coap_context(3) into coap_context(3), coap_encryption(3) and
coap_session(3) with coap_encryption(3) primarily updated to reflect the
updated PKI configuration options.

coap-client.txt.in
coap-server.txt.in

Update with new options making use of updated PKI interface
2018-07-24 14:49:04 +01:00
Jon Shallow af84f2049b configure.ac: Add -Wcast-qual to WARNING_OPTIONS 2018-05-25 14:11:04 +01:00
Olaf Bergmann a2d263356e configure.ac: enable -Wwrite-strings
As discussed in bug #185 [1], const strings should be protected
from being overwritten. This change adds -Wwrite-strings to the
compiler warning flags and fixes resulting warnings by making
static strings const.

[1] https://github.com/obgm/libcoap/issues/185
2018-05-19 09:27:50 +02:00
Jon Shallow c187fbd508 man/coap_pdu_setup.txt.in: New man page
Updated man/coap.txt.in

Updated configure.ac

Updated man/Makefile.am
Also include the man pages where there are more than 9 definitions in the
SYNOPSIS as we are limited to 10 in hte NAMES section
2018-05-17 19:00:40 +01:00
Olaf Bergmann 072357c780 configure.ac: check if a2x can be used for manual page creation
This change adds a new m4 macro AX_CHECK_A2X_TO_MANPAGE that
invokes the a2x program passed in the environment variable A2X
to create a minimal manual page. If A2X is set correctly, failing
this test is a good indicator that the docbook DTD or the
docbook XSL stylesheets are missing.
2018-05-03 13:56:25 +02:00
Jon Shallow ae5765af2f configure.ac: Bump LIBCOAP_API_VERSION and create LIBCOAP_NAME_SUFFIX
Make LIBCOAP_API_VERSION=2

Set LIBCOAP_NAME_SUFFIX to be $LIBCOAP_API_VERSION{-openssl,-gnutls,-tinydtls}
as appropriate based on the configure build options.

This means that library files will be named
libcoap-2-openssl.a
libcoap-2-openssl.so*
libcoap-2-gnutls.a
libcoap-2-gnutls.so*
libcoap-2-tinydtls.a
libcoap-2.a
libcoap-2.so*

Fix some typos

Use $withval instead of yes so that, say, --without-openssl works as expected.
2018-04-13 08:43:37 +01:00
Jon Shallow d21e0532bc configure.ac: Add in man page building with --enable-manpages
Create a new --enable-doxygen

Make --enable-documentation include both --enable-manpages and --enable-doxygen
and --disable-documentation include --disable-manpages and --disable-doxygen
2018-04-07 11:34:44 +01:00
Diego Santa Cruz fde93fca90 configure.ac: fix linker version script detection
The detection of linker's support for version scripts fails
when building outside the source tree due to missing source
path to the linker script.
2017-09-20 10:54:02 +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 a070a8b3bc Merge remote-tracking branch 'tijuca/4upstream' into develop 2017-07-10 14:11:34 +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 b159565774 Add check for ioctl header file. 2017-06-24 16:20:18 +02:00
jcmichelou 1c79a4b977 Merge remote-tracking branch 'remotes/obgm/dtls' into dtls-dev with tinydtls support
# Conflicts:
#	Makefile.am
#	configure.ac
#	examples/client.c
#	examples/coap-rd.c
#	examples/coap-server.c
#	include/coap/address.h
#	include/coap/coap_io.h
#	include/coap/net.h
#	include/coap/prng.h
#	libcoap-1.map
#	libcoap-1.sym
#	src/net.c
#	src/platform/posix/coap_io.c
2017-06-12 17:26:25 +02:00
Carsten Schoenert aafb87e50d configure.ac: fix broken ctags detection
While adding the freebsd platform into the supported build environments
the check for the needed ctags binary was modified
(aa7256a812), unfortunately the changes
made aren't correct and due this the target check_ctags in the toplevel
makefile was always assuming the correct ctags binary is around.

This was resulting in broken libcoap-1.{map,sym} files if 'make dist'
was called in case the user hasn't installed exuberant-ctags like ctags.
2017-06-06 15:38:36 +02:00
Carsten Schoenert 0dafde8564 configure.ac: adjust the library vision +1
We are going into a new release cycle which will provide new so we need
new symbols and interfaces. Because of the new added symbols we need to
increase LT_LIBCOAP_CURRENT to '1'.
And we will be backward compatible and existing binaries linked against
the previous version will also working with that new planned library
release. To show this setting tune LT_LIBCOAP_AGE also to '1' as we are
now one version backward compatible.
2017-05-30 10:33:05 +02:00
Carsten Schoenert 90270db356 configure.ac: be more helpful on the libtool versioning
The versioning by libtool is sometimes a bit confusing and seems
complex. But it's really important to do a proper versioning of the
library.
Rephrase the part about how to check the needed versioning to be a bit
more informative how to do that.

Some more in deep explanation about the meaning of the libtool version
number can be found on:

* https://autotools.io/libtool/version.html
* http://www.informit.com/articles/article.aspx?p=19553
* https://developer.gnome.org/programming-guidelines/stable/versioning.html.en
2017-05-30 10:32:29 +02:00
Carsten Schoenert b432fa5f26 configure.ac: adding a release-state string
To do a more finely graduated versioning a extra new field for the
release-state is added. The purpose is mainly to add some extra
information about the development state of libcoap like a alpha state
right after a final release or marking the state as a release candidate
before a planned release.

Starting with a string 'alpha' as we are in a really early development
state for the upcoming release.
2017-05-30 10:31:25 +02:00
Carsten Schoenert 9aa7ee9d3a configure.ac: bumping version to 4.2.0
The next version will be 4.2.0 with some more new features and a license
change as well. More to come later.
2017-05-30 10:26:44 +02:00
tijuca 1ba4fd0cec Cross compilation issue (#31)
The error that happen while cross compiling is quite logical if you
know what the check AC_FUNC_MALLOC is made for. The behavior isn't
really wrong (for me) because autoconf can't really test the created
code due it's for another platform. Some nice explanation about the
whole problem can be found here:
http://wiki.buici.com/xwiki/bin/view/Programing+C+and+C%2B%2B/Autoconf+and+RPL_MALLOC

As long as libcoap uses malloc from the libc we need a check for
the proper implementation for this cases. So removing AC_FUNC_MALLOC
isn't solving the problem. We need at least a check for a malloc
functionality which can be done by AC_CHECK_FUNC(S).

(cherry picked from commit 04d806fe4d)
2017-04-18 16:39:27 +02:00