Commit Graph
800 Commits
Author SHA1 Message Date
Olaf Bergmann 45349d5bf3 Makefile.am: bugfix: replaced makefile variable by m4-expanded symbol
As automake processing prevents using makefile variables in prefixed
automake constructs such as *la_SOURCES, platform-specific locations
must be spelled out literally.

This fixes issue #30, see https://github.com/obgm/libcoap/issues/30
2016-04-08 15:08:10 +02:00
Olaf Bergmann ca0f3f3188 plaform/posix/{coap_io,run}.c: fixed LWS in source
Removed trailing whitespace and reformatted indentation as suggested by
Carsten in [1].

[1] https://sourceforge.net/p/libcoap/mailman/message/34988221/
2016-04-05 16:34:10 +02:00
Olaf Bergmann b223d9f422 coap_dtls.c: Discard DTLS session on fatal error
When a fatal error is detected for an ongoing DTLS session, any
retransmission is stopped and the session object is released.
2016-03-31 14:32:52 +02:00
Olaf Bergmann ecadf05cf5 configure.ac: bugfix: removed empty AC_SEARCH_LIBS 2016-03-30 17:45:23 +02:00
Olaf Bergmann 0909d1d699 coap_keystore.h: bugfix: do not expose coap_config.h in public API 2016-03-30 17:44:46 +02:00
Olaf Bergmann ae8a68cf9d ext/tinydtls: updated to HEAD of branch develop 2016-03-29 16:07:09 +02:00
Olaf Bergmann 3427bb2783 libcoap-1.{map,sym}: updated map files 2016-03-29 15:55:48 +02:00
Olaf Bergmann 2633479bd7 net.c: moved DTLS-specific code to coap_send_impl()
coap_send_impl() now decides if outbound data is passed to coap_dtls_send()
or to the registered network_send callback function.

For coap_send_confirmed() this implies that retransmitted PDUs are
passed to coap_dtls_send() as well, causing retransmissions on the
DTLS layer when the session is established. As long as the DTLS handshake
is not complete, coap_dtls_send() caches the outbound application data
for this particular PDU hence avoiding duplicate messages.
2016-03-29 15:34:34 +02:00
Olaf Bergmann 42aa0d7833 coap-server.c: DTLS server with default credentials for PSK
The example server creates a new endpoint for DTLS-secured traffic.
The secure endpoint is bound to the port number of the unsecure
port plus one (i.e. if the default port number 5683 is used for
cleartext CoAP traffic, the secure port is bound to 5684).

This server uses the credentials "Client_identity" as user name and
"secretPSK" as password for testing. DO NOT USE THIS FOR PRODUCTION.
2016-03-22 14:50:39 +01:00
Olaf Bergmann ec89b066b6 client.c: added command line options for DTLS credentials
The new option -u allows setting the user name (aka PSK identity) and
-k is used to specify the corresponding secret (the PSK).
2016-03-22 14:48:28 +01:00
Olaf Bergmann 69f3d97dce coap_dtls.c: bugfix: set correct error code for wrong credentials
get_psk_info() now returns appropriate error codes.
2016-03-22 14:37:30 +01:00
Olaf Bergmann 2c8da3586a net.c: bugfix: call coap_read_endpoint() only when data available
coap_read_endpoint() should not be called when no data is available
on the attached endpoint.
2016-03-17 15:22:46 +01:00
Olaf Bergmann 467284605d coap_event.[hc]: pass library events to application
An application can register a callback function of type
coap_event_handler_t that will be called by the library on certain
events. Currently, the DTLS implementation invokes coap_handle_event()
with session-specific events such as session close or
renegotiation.
2016-03-16 11:49:47 +01:00
Olaf Bergmann 6adf25f077 coap_dtls.[hc]: improved session handling
The handling of DTLS sessions has been improved so that calling
coap_dtls_send() buffers data for later delivery in case of a
successful handshake.
2016-03-16 11:44:59 +01:00
Olaf Bergmann 452407c14c net.[hc]: Changed interface for coap_handle_message()
The local endpoint object, peer address and data buffer address and
length now are passed as arguments to coap_handle_message(). This
change reverts a previous attempt to provide a more concise interface
for this function that hides the actual implementation-specific data.

As the DTLS implementation needs to deal with this implementation-
specific parts, it has to be made explicit, either by making the
packet abstraction public or passing the relevant parameters
explicitely to coap_handle_message(). As this has worked smoothly
before, this approach has been taken.

This change breaks the LWIP implementation (for now). It will be fixed
when integrating the DTLS code with LWIP in this branch.
2016-03-16 11:34:44 +01:00
Olaf Bergmann 66cf06ae76 dtls: Added basic keystore implementation
coap_keystore.[hc] provides a simple data structure for managing
credentials to be used during DTLS handshake. Each coap_context_t
has its own keystore object that is independent of the actual
DTLS context. Applications can access the keystore during the
entire lifetime of the coap context. The existing implementation
is not thread-safe.
2016-03-16 11:17:26 +01:00
Olaf Bergmann 4eef59702b dtls: create DTLS session for outgoing NON messages 2016-03-08 13:24:32 +01:00
Olaf Bergmann 1c99d22d89 dtls: added initial boilerplate for dtls support
coap_dtls.h defines a generic API for DTLS communication. The
initial version will use tinydtls as implementation.
2016-03-08 13:22:02 +01:00
Olaf Bergmann c2e4660f5f coap_io.c: make socket non-blocking for platform posix
Making the posix sockets non-blocking was missing from coap_new_endpoint().
This wasn't much of a problem because recvmsg() was called only after
select() had indicated that data is available. Setting this flag explicitly
would also allow for peeking into the socket.
2016-03-08 13:17:10 +01:00
Olaf Bergmann 0320739d53 coap_io.h: define flag to indicate that data is available
Non-blocking sockets can set COAP_ENDPOINT_HAS_DATA in flags to tell
coap_read() that this endpoint has new data available for reading.
2016-03-08 13:08:15 +01:00
Olaf Bergmann ef9ce640af address.h: added missing includes for POSIX 2016-03-08 13:05:24 +01:00
Olaf Bergmann 5825e63da4 net.h: added missing prototypes
The prototypes for coap_attach_endpoint() and coap_detach_endpoint()
were missing from this header file.
2016-03-08 13:03:18 +01:00
Olaf Bergmann 6521a5d516 pdu.h: added coaps default port 2016-03-08 12:58:26 +01:00
Olaf Bergmann 6be0340727 uri.[hc]: improved support for 'coaps' URI scheme 2016-03-08 12:57:06 +01:00
Olaf Bergmann ab24b37ddf Updated tinydtls 2016-03-08 12:52:50 +01:00
Olaf Bergmann 5ffe22c416 examples/*.c: Use coap_run*() in examples 2016-02-26 18:26:03 +01:00
Olaf Bergmann 237c60adb2 configure.ac: Test for sys/select.h 2016-02-26 18:26:03 +01:00
Olaf Bergmann fb1054d6cf run.[hc]: Add new functions for main loop
This modification provides two new functions, coap_run_once() and
coap_run(), that can be used by applications to drive the library's
I/O logic.
2016-02-26 18:26:03 +01:00
Olaf Bergmann d1e3ecdf6e net.[hc]: allow multiple endpoints in single context
Endpoints will be attached to the context object using a new function
coap_attach_endpoint(). The sockfd component has been removed from
coap_context_t as it is accessible by the endpoint.
coap_endpoint_t has a new field 'context' that refers to the context
object the respective endpoint has been associated with, or NULL
if it is not attached to any context. An endpoint can be attached
to at least one context at a time.
2016-02-26 18:26:03 +01:00
Olaf Bergmann ff74ebe176 coap_io.c: Moved to platform/posix/ 2016-02-26 18:26:03 +01:00
Olaf Bergmann efa64153a8 prng.c: move platform-specific PRNG invocation into separate files
This change introduces a new subtree in the library's directory structure.
Platform-specific code now should be placed into the corresponding directory
in src/platform/. To illustrate this, prng.h has been split into three
distinct files, one for each platform (contiki, lwip, posix) and moved into
the respective subdirectory.
2016-02-26 18:26:03 +01:00
Olaf Bergmann 2d6f52686c 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-02-26 18:09:36 +01: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