Commit Graph
2735 Commits
Author SHA1 Message Date
Olaf Bergmann 635fe8d33a .travis.yml: added missing packages for documentation
The configure script now uses pkg-config for dependencies checks.
2016-10-26 13:30:13 +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
Carsten Schoenert 65090de7c8 configure.ac: adapt the output of doxygen compare check
Adapting the text output on the doxygen version compare to the dot check
so the user is seeing more informative things on configure run.
2016-10-26 10:46:50 +02:00
Carsten Schoenert af48b3b31a configure.ac: let configure found the sed binary 2016-10-26 10:46:50 +02:00
Carsten Schoenert 524381eafe configure.ac: normalize helping output for AC_ARG_ENABLE
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.
2016-10-26 10:46:50 +02:00
Carsten Schoenert 7df48fc897 tests/Makefile.am: adding CUNIT_CFLAGS to AM_CFLAGS
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.
2016-10-26 10:46:50 +02:00
Carsten Schoenert 2be9ec9dff configure.ac: simplify the CUnit check by pkg-config
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.
2016-10-26 10:46:50 +02:00
Carsten Schoenert de80514661 configure.ac: improve the ERROR message if a2x is missed
Giving the user a better hint if the a2x check isn't succesfull.
2016-10-26 10:46:50 +02:00
Carsten Schoenert 87e30a4e25 configure.ac: adjust a specific FreeBSD test for dot
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.
2016-10-26 10:46:50 +02:00
Carsten Schoenert c95e1f0917 configure.ac: adding FreeBSD to the detectable platforms 2016-10-26 10:46:50 +02:00
Carsten Schoenert aa7256a812 configure.ac: splitting ctags check into freebsd specific detection
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.
2016-10-26 10:46:50 +02:00
Carsten Schoenert 717b19cede configure.ac: changing tabs into spaces
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.
2016-10-26 10:46:50 +02:00
Olaf Bergmann c2dd6b4917 encode.h: fix one-letter pre-processor symbol to avoid conflicts
It was suggested to pick a more specific name for the
pre-processor symbol E in encode.h to prevent name clashes,
see https://github.com/obgm/libcoap/issues/46.
2016-09-22 15:22:28 +02:00
Olaf Bergmann c16918dfff block.c: fixed possible buffer overflow in coap_write_block_opt()
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.
2016-09-22 14:39:12 +02:00
Olaf Bergmann d737344b52 client.c: use function parameter in cmdline_subscribe()
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.
2016-09-22 12:43:27 +02:00
Olaf Bergmann 2c36cf4ade client.c: fixed malformed mode-line 2016-09-22 12:41:19 +02:00
Jean-Michel Julien 02c3e67175 resource.h: Add documentation for flags used in resources creation. 2016-09-22 12:39:54 +02:00
Olaf Bergmann 538170628a coap_dtls.c: Fixed dummy functions for --disable-dtls build
When compiled without support for DTLS, coap_dtls.c contains a set
of dummy functions to make certain compilers and linkers happy. As
the function signature now differs from the prototype, the attribute
has been removed entirely (causing a set of warnings that report the
unused parameters.)
2016-07-18 22:03:22 +02:00
Nikos Fotiou 3c83ec8087 flags option in coap_resource_init documented 2016-07-18 21:58:00 +03:00
Lucien Guimier edf42a6a53 Add missing LOG_ERR log level
The fallback used when <syslog.h> is not available was missing the error level.
2016-07-17 13:56:27 +02:00
Olaf Bergmann 6a5b12a775 configure.ac: fix CFLAGS append
Some autotools/m4 versions seem to lack support of '+=' for appending
data to existing variables. This modification fixes this for the
final CFLAGS construction.
2016-07-07 12:11:57 +02:00
Olaf Bergmann cb6d3c43ed uri.[hc]: make 1st argument of coap_split_uri() const
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
2016-07-06 12:48:21 +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
Olaf Bergmann ebbdc30a52 build.sh: split build steps for platform lwip
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.
2016-06-22 13:41:49 +02:00
Olaf Bergmann 40be72a350 CI: enable platform lwip 2016-06-22 13:22:48 +02:00
chrysn d43d92e40b examples/lwip: depend on coap.h
The handcrafted Makefile will not attempt to build the coap.h, but will
indicate to the user how to generate it.
2016-06-22 12:51:46 +02:00
chrysn 6b6840599a lwip: cleanups of leftover variables and similar compiler warnings
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).
2016-06-22 12:38:01 +02:00
chrysn 909d863a4e lwip: Use latest version
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.
2016-06-22 12:37:27 +02:00
chrysn 816d37d402 lwip: Include coap_config.h in lwippools.h
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.
2016-06-22 12:36:47 +02:00
chrysn 0f3be6128b lwip: Drop include in coap_io.h
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).
2016-06-22 12:36:23 +02:00
chrysn 0e7e269ecb net: Fix coap_new_endpoint error handling
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).
2016-06-22 12:36:13 +02:00
Thomas Petazzoni 748b788e72 configure: only add -Wunused-result if supported by the compiler
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>
2016-06-21 16:16:02 +02:00
Olaf Bergmann 48e694f3ba Merge branch 'dtls' of github.com:obgm/libcoap into dtls 2016-06-15 17:41:11 +02:00
obgm f64e72bae1 Merge pull request #34 from malinengineer/dtls
dtls branch - ignored some generated files
2016-06-15 17:40:52 +02:00
Alin Micu 3038c7c250 Updated .gitmodules to ignore untracked files in the 'tinydtls' submodule 2016-06-15 18:11:45 +03:00
Alin Micu c96d47d0b0 updated the .gitignore file to ignore 'tags' files generated by ctags for a Sublime Text plugin 2016-06-15 18:05:58 +03:00
Alin Micu 0494efcba2 Updated .gitignore to ignore the *.o *.lo files in the subfolders of src as well (e.g. src/platform/posix) 2016-06-15 18:05:08 +03:00
Olaf Bergmann 392deff2d7 Makefile.contiki: Added -Os to remove undefined symbol
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.
2016-06-10 16:41:53 +02:00
Olaf Bergmann 68d910f4fe examples/contiki/Makefile: use --depth 1 for cloning Contiki
This change avoids cloning the entire Contiki history when building
the Contiki server example.
2016-06-10 15:10:02 +02:00
Olaf Bergmann a267d3a2b0 server.c: fixed Contiki-related debug functions
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.
2016-06-10 15:07:25 +02:00
Olaf Bergmann 5567ea3613 test_uri.c: additional unit tests for option encoding
These tests cover the Uri-Query encoding bug.
2016-06-10 13:43:38 +02:00
Olaf Bergmann fa69aeec79 option.c: fixed off-by-one error in Uri-Query encoder
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.
2016-06-10 13:34:51 +02:00
Olaf Bergmann a692789685 net.[hc]: Added storage for application-specific data to coap_context_t
The new functions coap_set_app_data() and coap_get_app_data() can be
used to store application-specific data with a given coap_context_t
object.
2016-04-26 17:38:32 +02:00
Carsten Schoenert c909bf8020 doc/Makefile.am: remove *.md5 files after installation
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.
2016-04-26 08:29:42 +02:00
tijuca 04d806fe4d 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).
2016-04-25 12:59:03 +02:00
Olaf Bergmann d3d48a99e8 libcoap-1.{map,sym}: Updated map file
Added the functions coap_dtls_set_log_level() and coap_dtls_get_log_level()
2016-04-15 13:19:33 +02:00
Olaf Bergmann 5f9579b01f client.c: Pass coap log level to DTLS library
The log level now is set by the new function coap_dtls_set_log_level().
2016-04-15 13:18:31 +02:00
Olaf Bergmann d77b4b0215 coap_dtls.[hc]: Encapsulate DTLS log level manipulation
The new function coap_dtls_set_log_level() can be used to control
the logging facility of the underlying DTLS library. The argument's
semantics are defined by the library itself.

coap_dtls_get_log_level() returns the current log level of the
underlying DTLS library.
2016-04-15 13:16:22 +02:00
c.schoenert@t-online.de 7d5ac9edaf configure.ac: fixup small typo in option description
To: libcoap-developers <libcoap-developers@lists.sourceforge.net>
Date: Sat,  9 Apr 2016 21:50:45 +0200 (1 day, 11 hours, 38 minutes ago)

From: Carsten Schoenert <c.schoenert@t-online.de>
2016-04-11 11:57:40 +02:00