Deleting the pkg-config file and also the *.map and *.sym file in a
clean-local target isn't correct as we have no default automatic way to
regenerate *.map and *.sym files before the build of the libcoap is
starting.
Currently there is no need for such a automatic rebuild, the user
normaly doesn't need to do anything on those files. They even don't
should be rebuild by the users in normal cases.
Adding or removing symbols is a sensible thing and the maintenance is
probably up to the developers. Beside that there is the target
'update-map-file' that is used by the developers to (re)build this two
files if needed.
This commit is also adding a new helper target 'dist-local' with a
depency on 'update-map-file' so we are sure to have actual *.map and
*.sym file if we create a tarball for a release.
Moving the .PHONY targets to the end of the Makefile.am as this is the
typical place.
The No-Response option can be used in a request to express disinterest
or interest in certain response classes. This modification adds
No-Response handling for unicast messages and provides basic
functionality for handling multicast responses
When the No-Response became RFC 7967, the numeric value was changed
to better reflect its characteristics. This modification fixes the
reference in the documentation the option value.
The documentation for Observe and Block1/Block2 referenced
outdated Internet Drafts which have become RFCs some time ago.
This change now mentions the correct RFC numbers.
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.
The default build environment lacks pkg-config support for CUnit
causing the new configure script to fail when checking dependencies.
This change also adds docbook-xsl for building the man pages.
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'.
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.
To get more in sync with the existing output from the default helping
text by various autotools/automake stuff improving a little bit the
existing helper text of some configure arguments.
The CUNIT_LIBS are already used, the CUNIT_CFLAGS are also needed to
ensure that get also header files that are not inside the default search
patch of the compiler. For example header within /usr/local/include
instead /usr/include.
CUNIT_LIBS and CUNIT_CFLAGS are generated by PKG_CHECK_MODULES([CUNIT] ...
in configure.ac.
The old behaviour on testing for CUnit library and header files (that
are needed while building the internal testbinary) was done on manually
search for the header and the library file without a real need because
CUnit ships a pkg-config file with a version for longer time.
By using the PKG_CHECK_MODULES macro the check is much easier as the
pkg-config file is serving all the needed information like the search
path for the header files as also LDFLAGS for linking against. This
ensures the environment variables are always setup correctly.
Note that FreeBSD uses for example /usr/include and /user/local/include
for the header files, the pkg-config files can be found in
/usr{/local}/libdata/pkgconfig. The pkg-config file will pick up the
right places then.
As FreeBSD uses default the csh (C-shell) or the tcsh (Tennex-shell)
with some different output redirection than bash for example, and the
user might have installed a other shell we need to grep the version from
the dot binary by a csh shell call because this shell be always available.
Happily the 'dot -V' command is quite the same on FreeBSD and Linux
systems. Maybe we need to change this in the future again.
On FreeBSD the default ctags binary isn't usable for getting the tags
from the header files, we need to take the binary exctags explicitly.
Also before the check can be done we need to know on which platform we
running.
No technical changes.
We have mixed indention styles, there are spaces and tabs used,
switching all tab indentions into spaces.
This increasing readability of configure.ac on systems with especially
tabwidth>4.
Joel Sandin has pointed out that a buffer flow was possible in
coap_write_block_opt() as the block number is encoded without
range check into the local variable buf. As the block number is
stored in 20 bits, the buffer is enlarged to 4 bytes to fix this.
As a second counter-measure against wrong block numbers, the function
coap_get_block() is modified to check the decoded Block option.
Numbers larger than 0xFFFFF (20 bits) cause this option to be ignored.
cmdline_subscribe() has used the global variable optarg instead of
the local argument that was passed to this function. Changing this
as intended also makes __attribute__((unused)) unneeded.
Some autotools/m4 versions seem to lack support of '+=' for appending
data to existing variables. This modification fixes this for the
final CFLAGS construction.
Issue #37 [0] argued that coap_split_uri() should not change the
string that was passed as its first argument. The old behavior
was to normalize the scheme and the host part of the given URI by
converting both to lower case. This commit drops that normalization
step and leaves the original string as is. As a consequence,
implementations that employ virtual hosts now must canonicalize
the host part by themselves.
CAUTION: The constness is not (yet) reflected in the str components
of the result parameter of type coap_uri_t. Care must be taken not
to accidently change an immutable component of the coap_uri_t object.
[0] https://github.com/obgm/libcoap/issues/37
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.
Apparently, the vpath magic in the lwip examples' Makefile requires
the lwip files to exist before the server is built. Thus, the build
script now calls make twice: First, to clone the lwip repositories,
and second, to create the actual server application.
note on coap_read removal: as the lwip implementation currently launches
the package handling right from the recv callback, a coap_read function
is not meaningful (as it is in posix or contiki where it actively
fetches the messages from the network buffer).
This drops the cumbersome mintapif mechanisms from server.c, fixes
header troubles that have popped up probably during the header cleanups,
drops old workarounds and enables IPv6.
config includes can't be handled with the usual strictness ("No config
includes in public header files", notwithstanding discussion of whether
lwippools is one) because the lwip compilation unit for the memory pools
needs to know about the configured sizeof the various CoAP objects.
The include is not required, as the `struct ud_pcb *` pointer doesn't
require the struct to be known yet, but caused trouble when the include
led to an inclusion loop back again to libcoap via the lwippools. (The
loop was caught by include guards and caused undeclared type errors
because the later parts of the headers were not yet processed).
The wrong sequence caused segfaults instead of regular error returns
using LWIP (where the error is visible eg. when binding to a different
address type than the socket was created for).
The free in the error path is fixed as well. (coap_malloc_type requires
a coap_free_type as per documentation, although some implementations
might not be strict about it).
Old gcc versions such as 4.3.x do not support -Wunused-result, so
instead of unconditionally using this warning, only use it if supported
by the compiler.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
handle_periodic_timer() in rpl-timers.c relies on the optimizer to
remove the if(0)-guarded call to rpl_ns_periodic() when storing
mode is selected. This does not happen with clang's default options
and thus leads to an error for the undefined reference at link time.
This modification adds -Os to fix this.
The debug function for printing lladdress have been renamed and moved
to net-debug.h. This change now includes this header and uses the
appropriate macros instead.
This modification fixes a bug in coap_opt_setheader() that could
have caused the function's return value to be larger than the
value passed as buffer size. As this function is called by
make_decoded_option() in uri.c, the subsequent assert() will fire
in that case. The bug occurred in the rare case that the contents
of a query option were longer 13 bytes and the buffer was smaller
than the number of bytes that were needed to encode the content
length.
This bug has been reported by Oscar Novo.
Doxygen creates various hashfiles (*.md5) to check which files needs to
be re created if the input files has been changed. The user don't need
those hashfiles so let's remove these from final install target.
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).