Commit Graph
96 Commits
Author SHA1 Message Date
jcmichelou b2fe4a64de Make MTU configurable.
Use static or stack storage for coap_packet_t.
2017-06-26 17:34:01 +02:00
jcmichelou 6e97dbafcf Add facility for the removal of all queued messages and observations of a session. Apply it to client-side destination unreachable notification. 2017-06-24 17:10:50 +02:00
jcmichelou 4d45219fe5 Add session expiration based on inactivity period and maximum number of idle sessions per endpoint.
Server sessions for which a close notify has been received are garbage collected immediately.
2017-06-22 19:13:20 +02:00
jcmichelou f6047c8e77 Fix gcc warning messages. 2017-06-22 16:13:38 +02:00
jcmichelou 9490a0c8ab Fix bug in setting the OpenSSL log level make its use consistent with tinydtls
Rename session.c and session.h to coap_session.c and coap_session.h
Use length to PSK hint and identity
Improve packet loss testing
2017-06-22 16:02:03 +02:00
jcmichelou 99925a1a97 Add init function for DTLS library.
Match dummy functions in coap_notls.c with their prototypes.
2017-06-21 20:57:12 +02:00
jcmichelou adf1238eae Add DTLS retransmit and recovery.
Add lossy networks debug option in examples.
2017-06-21 20:40:15 +02:00
jcmichelou ae13e5127b Compile with tinydtls and remove warning message with gcc. 2017-06-19 20:37:11 +02:00
jcmichelou b389a5f6aa Add skeleton support for tinydtls with new API. 2017-06-19 16:58:12 +02:00
jcmichelou 8353417afb Added session management with simpler DTLS lib API.
Added DTLS support with OpenSSL.
2017-06-18 20:09:47 +02:00
jcmichelou 5b1a8f67bf Implement coap_session_t concept for POSIX. 2017-06-15 18:42:42 +02:00
jcmichelou b2ab881ad4 Fix the result of dtls branch merge so that all the examples work (DTLS support not enabled yet) 2017-06-13 14:38:30 +02:00
jcmichelou 1c79a4b977 Merge remote-tracking branch 'remotes/obgm/dtls' into dtls-dev with tinydtls support
# Conflicts:
#	Makefile.am
#	configure.ac
#	examples/client.c
#	examples/coap-rd.c
#	examples/coap-server.c
#	include/coap/address.h
#	include/coap/coap_io.h
#	include/coap/net.h
#	include/coap/prng.h
#	libcoap-1.map
#	libcoap-1.sym
#	src/net.c
#	src/platform/posix/coap_io.c
2017-06-12 17:26:25 +02:00
jcmichelou ba68ba85c0 Do not make exported symbols different between release and debug builds, this breaks the ABI of the DLL.
Do not make reference to NDEBUG in public headers to modify the ABI. This macro is defined automatically in all windows projects and will create a lot of confusion.
2017-05-07 18:18:33 +02:00
jcmichelou 95d8e2c8e0 Use C-style prototypes for coap_statup and coap_cleanup 2017-05-06 18:25:10 +02:00
jcmichelou e2c2dc5326 Make LIBCOAP_PACKAGE_XXX macros usables in code 2017-05-06 18:24:59 +02:00
jcmichelou 9b3cf894fc Use crypto secure version of rand to generate the message ids on windows. 2017-05-05 20:46:29 +02:00
jcmichelou 9b647d5d05 Add visual studio 2015 solution and project files for building libcoap on windows.
Merge changes from PR #47 related to windows platform support.
Add full windows platform support including correct error checking and working regression tests and examples.
Remove need to build applications using libcoap with -DWITH_POSIX and to include coap_config.h. This applies to the examples as well.
2017-05-05 20:29:10 +02:00
Olaf Bergmann ac94964b45 pdu.h: new methods FETCH, PATCH, iPATCH from RFC 8132 2017-04-07 10:14:22 +02:00
Pawel Winogrodzki 6112604569 Makingcoap_transaction_id() always use the peer for ID generation. 2017-04-04 02:32:45 -07:00
Pawel Winogrodzki b130109c04 Applying agreed changes. 2017-03-29 02:51:21 -07:00
Pawel Winogrodzki 9adc4eb6a7 Fixing /W4 warnings for Windows builds.
Removing all of the /W4 level warnings from the code.
No functional changes.

Signed-off-by: Pawel Winogrodzki <pawelwi@microsoft.com>
2017-03-20 15:48:33 -07:00
Olaf Bergmann 292b0f0790 address.[hc]: Fixed byteorder in coap_is_mcast() on platform posix
As IN_MULTICAST does a 32 bit comparison in host byte order,
sin_addr.s_addr needs to be converted using ntohl(). This change
also moves the coap_is_mcast() implementation to address.c because
it has become too complex for inlining.
2016-12-15 11:12:22 +01:00
Olaf Bergmann 11e905ed52 address.h: added missing includes
libcoap.h must be included to ensure that platform-specific headers
for the target system are available.
2016-11-19 17:06:36 +01:00
Olaf Bergmann 2c7efb77b9 pdu.h: fixed option number for No-Reponse (RFC 7967)
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.
2016-11-16 21:27:01 +01:00
Olaf Bergmann 4585701640 pdu.h: updated RFC numbers in option number comments
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.
2016-11-16 21:24:22 +01: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
Jean-Michel Julien 02c3e67175 resource.h: Add documentation for flags used in resources creation. 2016-09-22 12:39:54 +02: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 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
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
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
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
Olaf Bergmann b34e56cba2 coap_keystore.h: bugfix: do not expose coap_config.h in public API 2016-04-08 15:14:20 +02:00
Olaf Bergmann b734208ed2 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-04-08 15:14:20 +02:00
Olaf Bergmann 578b38dbfa 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-04-08 15:14:20 +02:00
Olaf Bergmann 655e84c040 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-04-08 15:14:20 +02:00
Olaf Bergmann 90fb5fdffc 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-04-08 15:14:20 +02:00
Olaf Bergmann e3b82756c0 dtls: create DTLS session for outgoing NON messages 2016-04-08 15:14:20 +02:00
Olaf Bergmann 39698f7ba7 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-04-08 15:14:20 +02:00
Olaf Bergmann 73aa574f16 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-04-08 15:14:20 +02:00
Olaf Bergmann 3d7c0d22ea address.h: added missing includes for POSIX 2016-04-08 15:14:20 +02:00
Olaf Bergmann c031e99dfc net.h: added missing prototypes
The prototypes for coap_attach_endpoint() and coap_detach_endpoint()
were missing from this header file.
2016-04-08 15:14:20 +02:00
Olaf Bergmann 9a538f43f4 pdu.h: added coaps default port 2016-04-08 15:14:20 +02:00
Olaf Bergmann 3a127a3816 uri.[hc]: improved support for 'coaps' URI scheme 2016-04-08 15:14:20 +02:00
Olaf Bergmann 63f51418c5 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-04-08 15:14:20 +02:00
Olaf Bergmann 3d3eb02ad8 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-04-08 15:14:20 +02:00
Olaf Bergmann 96d572d309 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-04-08 15:14:20 +02:00
Olaf Bergmann 2cedbd3aeb coap_bits.h: remove inclusion of <sys/types.h> 2016-02-16 15:50:34 +01:00