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.
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().
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 =
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.
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.
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.
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.
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.
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)
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
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
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
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
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.
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.
Create a new --enable-doxygen
Make --enable-documentation include both --enable-manpages and --enable-doxygen
and --disable-documentation include --disable-manpages and --disable-doxygen
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.
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.
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.
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.
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.
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.
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.
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.
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)