Commit Graph
788 Commits
Author SHA1 Message Date
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 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
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
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
Olaf Bergmann 7dea55099f resource.c: bugfix: Memory leak from hash table
The function coap_delete_all_resources() did not free the hash buckets
created by HASH_ADD. Thus, the iterator must call HASH_DELETE to free
the allocated storage.

This bug has been discovered  by
Jean-Michel Julien <Jean-Michel.Julien@trilliantinc.com>
who also provided this fix. See [1] for more information.

[1] https://sourceforge.net/p/libcoap/mailman/message/34994226/
2016-04-06 12:43:27 +02:00
Olaf Bergmann 4a5f381978 src/net.c: bugfix: remove observer on cancel before invoking resource handler
When a client sends a GET request with Observe: 1, it must be removed from
the list of observers before the resource handler is called. Otherwise, it
will add an Observe option to its response.
2016-04-05 14:51:48 +02:00
Carsten Schoenert 8763228e2b libcoap-1.pc.in: (re)adding the API version to 'Libs'
The API version was missed to the 'Libs' entry in commit
  45760a922d
We need the the correct API version in the *.pc file as pkgconfig can't
find the required libray without.
2016-04-02 21:08:25 +02:00
Olaf Bergmann 52b98489b5 Changelog: update 2016-02-16 16:43:04 +01:00
Olaf Bergmann e3ace443c4 .travis.yml: Removed platform lwip due to server issues
At least two out of three attempts to clone the lwip or lwip-contrib
repository from savannah fail, so this platform has been removed
from CI.
2016-02-16 16:28:25 +01:00
Olaf Bergmann 6bf7cdcc45 examples/lwip/Makefile: fixed lwip branch
This example now uses LwIP release 1.4.1 as the devel branch seems
to have disappeared from the git repository. Moreover, we just do
a shallow clone so maybe the server does not kick us that often.
2016-02-16 16:22:45 +01:00
Olaf Bergmann 2cedbd3aeb coap_bits.h: remove inclusion of <sys/types.h> 2016-02-16 15:50:34 +01:00
Vlad Lungu 0d8fbe3020 Define address macros for LWIP properly
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-02-16 15:45:03 +01:00
Vlad Lungu 81865503a1 Use LWIP_PLATFORM_DIAG for LWIP
fprintf() is not guaranteed to be available. Or even printf().

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-02-16 15:44:59 +01:00
Vlad Lungu 75d00c8a50 Use LWIP_RAND() when available
rand()/srand() might not be available for LWIP

Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-02-16 15:44:55 +01:00
Olaf Bergmann 0afbf5ecba examples/lwip/Makefile: fixed lwip build flags
Since configure does not set WITH_LWIP, we need to tell the compiler.
This change also replaces the deprecated -I. -I- by -iquote.
2016-02-16 15:13:52 +01:00
Olaf Bergmann 1bb223013c scripts/build.sh: fixed action for Contiki build
With the new Makefile layout, we can simply use the default
parameters for the build.
2016-02-16 14:27:14 +01:00
Olaf Bergmann 0f062e557e Makefile: fixed build infrastructure for Contiki examples
The new structure of libcoap allows to clone Contiki in a
subdirectory. The example build now uses Makefile to first clone
Contiki and then invoke Makefile.contiki for the actual build.
The TARGET is set to minimal-net by default but can be changed to
any other (tested) target.
2016-02-16 14:19:11 +01:00
Olaf Bergmann 4c299f9da6 Makefile.contiki: Fixed build flags for Contiki-3.0
Some configuration flags have been changed since Contiki version 3.
The Makefile.contiki for building a server example that uses libcoap
as a Contiki app has been fixed. The following builds now succeed:

make -f Makefile.contiki TARGET=minimal-net
make -f Makefile.contiki TARGET=econotag
make -f Makefile.contiki TARGET=mbxxx
2016-02-16 13:12:26 +01:00
Olaf Bergmann 283f48eac7 .travis.yml: Re-enabled tests for platform POSIX 2016-02-16 12:17:32 +01:00
Olaf Bergmann 8bb7ec80e7 scripts/build.sh: bugfix: stay in top directory for non-posix platforms
When TESTS=yes is given, the scripts invokes the test driver from
the top build directory. Platform-specific actions hence must ensure
that they stay in that directory and keep the last exit code.
2016-02-16 12:13:18 +01:00
Olaf Bergmann 5b094eb432 .travis.yml: Added package docbook-xml
a2x (asciidoc) depends on the Docbook XML DTD contained in the
docbook-xml package.
2016-02-16 12:03:56 +01:00
Olaf Bergmann 3afe2e94ac build.sh: pass exit code to caller 2016-02-15 18:25:00 +01:00
Olaf Bergmann 693c648830 .travis.yml: bugfix: package name libcunit1-dev 2016-02-15 16:36:45 +01:00
Olaf Bergmann ec1d463927 .travis.yml: Added travis CI script
This file specifies a travis build matrix.
2016-02-15 16:13:30 +01:00
Olaf Bergmann 641b8ed196 scripts/build.sh: Added build script to facilitate CI
The build script invokes configure and make with different
parameters depending on the environment variables PLATFORM
and TESTS. PLATFORM currently must be one of 'posix', 'contiki', or
'lwip'. If TESTS is set to 'yes' or 'true', the option --enable-tests
will be passed to configure and tests/testdriver will be invoked
after configuration and make.
2016-02-15 16:04:59 +01:00
Carsten Schoenert 8a8790cfc3 fixup small typos, no functional changes
There are few miss spelled words 'reponse', fixed up into the meaned word
'response'.
2016-01-29 16:31:53 +01:00
obgm 20a8c5567f Merge pull request #25 from onovo1/patch-2
Fixed: return 4.00 Bad Request in case of a malformed /.well-known/core (Update net.c)
2016-01-28 14:46:42 +01:00
obgm 4ae33c8f7e Merge pull request #24 from onovo1/patch-1
Fix typo in the attribute parameter to the right format "core.rd". (Update coap-rd.c)
2016-01-28 14:45:29 +01:00
onovo1 4c5c0e6c61 Update net.c 2016-01-28 13:57:00 +02:00
onovo1 fe69ba5fb6 Update coap-rd.c
According to the Core Resource directory draft [1]. The discovery of the registration should be done using the /.well-known/core and including a Resource Type (rt) with the value "core.rd". Like that:
GET /.well-known/core?rt=core.rd
There is a typo in the libcoap which accept the "core-rd" instead of the "core.rd" parameter. Fixing that in this version.

[1] - https://tools.ietf.org/html/draft-ietf-core-resource-directory-05#section-5.1
2016-01-28 10:34:14 +02:00
Carsten Schoenert 90e245e9fe remarking the change of the projects homepage
As started with other commits put on some more variables with the
changed location of the project.

in addition to 7452d7d50f
2016-01-15 23:33:53 +01:00
Olaf Bergmann a6f7fc76fb Makefile.am, coap.h.in: Remove obsolete header t_list.h
t_list.h has been replaced entirely by utlist.h and thus is not
used anymore. This change removes the last traces.
2016-01-11 18:34:37 +01:00
Olaf Bergmann 7452d7d50f coap-server.c: updated URI to libcoap's homepage in resource '/' 2016-01-10 18:06:26 +01:00
Carsten Schoenert b4973f1d73 fixup argument list for uip_ds6_prefix_add
uip_ds6_prefix_add is using 6 arguments, better use explicit argument
list than let the compiler decide. Some compiler will complain if some
optionally arguments are missed.
2016-01-10 17:49:07 +01:00
Carsten Schoenert 4f1515ab09 Contiki: undefine COAP_MAX_BLOCK_SZX before redefine
COAP_MAX_BLOCK_SZX is defined to "2" already before a define rule for
CONTIKI_TARGET_CC2538DK, just add a simply undefine line before the
redefine of COAP_MAX_BLOCK_SZX to make the compiler happy.
2016-01-10 17:49:07 +01:00
Carsten Schoenert f4166a536f coap.h: adding main header file into various source files
After splitting of the platform header part within libcoap some source
files that use functions of the network stack need to include coap.h
(which is including the libcoap.h) to get the platform specific header file
for the network stack.
Sort list of included headers in alphabetical order.
2016-01-10 17:49:07 +01:00
Carsten Schoenert eb7ae9b461 Makefile.am: adding libcoap.h to the install targets
After the creation of the new header file libcoap.h we need to add this
file to the installation of libcoap.
2016-01-10 17:49:07 +01:00