Commit Graph
111 Commits
Author SHA1 Message Date
obgm 8a30adefa5 Merge pull request #108 from spinetix/log-handler
Add a log handler callback.
2017-09-09 01:22:13 +02:00
obgm abddc07559 Merge pull request #107 from spinetix/handler-lost-con
Add handler for lost CON messages.
2017-09-09 01:21:32 +02:00
jcmichelou d89159fdb4 debug.[hc]: Add a log handler callback. 2017-09-08 20:12:39 +02:00
jcmichelou 25732fc8e6 coap_session.[ch], net.c: Add handler for lost CON messages.
Add a slot for storing application-specifc data in session object.
Make the library resilient against client session released in a callback.
2017-09-08 20:02:22 +02:00
jcmichelou 30619691e2 resource.[ch], uri.c[ch]: Query string dependent observe.
Remember the query string used during the observe request and pass it to the resource handler.
Support partial notification of observers based on the query string.
2017-09-08 19:50:34 +02:00
Olaf Bergmann 3feee38045 uthash.h: fix compiler warning for missing default case in switch statement
Added a no-op default case to switch statement in macro HASH_JEN in order
to fix compiler warning.
2017-08-31 13:14:01 +02:00
Olaf Bergmann 2133742f84 utlist.h, uthash.h: updated to fix compiler warnings
With gcc 7.2.0, new compiler warnings related to utlist.h and
uthash.h have occured. Several have been fixed by updating the
header files to the latest version from [1].

[1] https://github.com/troydhanson/uthash
2017-08-31 12:49:47 +02:00
Olaf Bergmann 5c079b72d9 coap_session.[hc]: make message id session-local
The message id in the CoAP header is used for reliability when
transferring a CoAP PDU over a non-reliable transport protocol
such as UDP. For message de-duplication, it is useful to have
a monotonously increasing number space within a session. Therefore,
the context-global value has been moved to coap_session_t.
The function coap_new_message_id() now takes a coap_session_t
object as its argument.
2017-08-18 14:15:20 +02:00
Olaf Bergmann d9a0b4019d pdu.h: added content format definitions from RFC 8152
See https://tools.ietf.org/html/rfc8152#section-16.10
2017-08-02 21:54:31 +02:00
Olaf Bergmann 7dfeb91978 coap.h.in: avoid C++ name mangling for functions in libcoap.h
To avoid function names being mangled when compiling with C++,
the inclusion of libcoap.h has been moved into the extern "C"
declaration for coap.h.
2017-08-02 21:11:17 +02:00
obgm 96e536006f Merge pull request #99 from Trilliant/feature/fixHandlersForNewVerbs
resource.h: increase method_handler structure to hold new methods (FETCH, PATCH, IPATCH)
2017-07-10 17:25:07 +02:00
Jean-Michel Julien 8abf63b867 resource.h: increase method_handler structure to hold new methods (FETCH,PATCH,IPATCH) 2017-07-06 15:11:10 -04:00
jcmichelou ab04f3924f Fix compilation warnings with gcc. 2017-06-29 19:20:39 +02:00
jcmichelou 7fb4ace2b7 Fix for the signedness warning with gcc.
Compact coap_address_t.
Use coap_queue_t for all queues.
OpenSSL warning for close alert should be info level.
Fix OpenSSL log level not working.
Use the application defined MTU in OpenSSL.
coap_log() optimization to avoid generating the log message text before testing the log level.
coap_can_exit() should check the new retransmit queues.
Fix retransmit time sometimes not correctly computed relative to sendqueue_basetime.
Add coap_write() API call for applications with their own main loop.
2017-06-29 18:12:46 +02:00
jcmichelou 4d4f3ba54f Fix compilation with gcc 2017-06-26 17:42:27 +02:00
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