Commit Graph
139 Commits
Author SHA1 Message Date
obgm b6f6cb274c Merge pull request #141 from mrdeep1/coap-log-syntax
Add in GNU compiler checking of parameter syntax for coap_log() functions
2018-02-26 17:35:10 +01:00
obgm fafd4745b7 Merge pull request #136 from mrdeep1/ping-pong-handlers
Ping Pong handlers: Need for applications to see ping requests / pong responses
2018-02-26 17:17:54 +01:00
Jon Shallow b8b1c18ffd net.h: Update coap_context_set_pki() definition 2018-02-14 20:58:15 +00:00
Jon Shallow f820857315 coap_session.h: Move coap_new_client_session_pki() def from coap_dtls.h
Moving coap_dtls_security_setup_t into coap_dtls_pki_t helped with the previous
into its logical place.
2018-02-14 20:54:21 +00:00
Jon Shallow fa6f292997 coap_dtls.h: Move coap_dtls_security_setup_t into coap_dtls_pki_t
Update functions appropriately.
Move coap_new_client_session_pki() back into coap_session.h (its correct place)
Add in enum coap_asn1_privatekey_type_t
2018-02-14 20:50:43 +00:00
Jon Shallow 047c9fb082 Fix coap_notls.c, coap_tinydtls.c: after update merge from obgm/develop
Conficts created by Pull request #134
2018-02-14 19:24:58 +00:00
Jon Shallow 93c8471233 debug.h: Add in parameter format checking to coap_log_impl() for GNUC
For GNUC. make the function

void coap_log_impl(coap_log_t level,
               const char *format, ...) __attribute__ ((format(printf, 2, 3)));
2018-02-12 15:28:24 +00:00
Jon Shallow 0b88e51a88 net.h: Add in new function
New function coap_context_set_pki()

Update function coap_context_set_psk ()to return failure value
2018-02-11 20:04:04 +00:00
Jon Shallow 5b340adfb8 coap_dtls.h: Add support for setting up PKI
Define
coap_dtls_pki_t
coap_dtls_security_setup_t

Functions
coap_new_client_session_pki
coap_dtls_context_set_psk
coap_dtls_context_set_pki
coap_dtls_context_check_keys_enabled
2018-02-11 19:32:15 +00:00
Jon Shallow fbe814d905 net.h: Add function definitions for ping and TCP pong handlers
If the application needs to see CoAP ping requests or CoAP TCP pong responses
then there needs to be a handler that can be set up that is called
appropriately.
2018-02-10 20:54:17 +00:00
Jon Shallow e1fa280d88 coap_dtls.h: Add in TLS library determination support
A new function coap_get_tls_library_version() that returns a pointer to a
coap_tls_version_t structure that contains both the TLS library type libcoap
was compiled against as well as the current TLS library version.
2018-02-10 18:34:42 +00:00
Olaf Bergmann d3b5535960 pdu.[hc]: Export coap_pdu_resize() 2017-12-22 13:55:37 +01:00
Olaf Bergmann 0c837cdc77 pdu.h: increase Max-Message-Size by 256 B
To allow for 8 MiB payloads, the maximum message size value for
TCP has been increased by 256 B option space.
2017-11-11 10:06:16 +01:00
jcmichelou c93f535d4a openssl, session: Fix memory leaks. 2017-11-04 23:38:02 +01:00
Olaf Bergmann a569e16584 coap_time.h: cast COAP_TICKS_PER_SECOND to coap_tick_t for type safety
CID 1458396 detected by Coverity scan points out that integer
arithmetics may lead to an overflow without the typecast to
coap_tick_t.
2017-11-03 14:29:49 +01:00
jcmichelou 3f77c117ea resource: Fix issues #90, #91 and #92
The value of the observe option is kept for each resource rather than being global to the context.
The value of the observe option must wrap to be stay below 2^24.
The value of the observe option must be different from the initial value when a notification is sent.
2017-10-25 20:22:01 +02:00
jcmichelou e125888ded openssl: Handshake can also complete in SSL_accept and SSL_connect. 2017-10-21 19:16:23 +02:00
jcmichelou 68a9ea045d pdu: Use defines for TCP variable header message size constants. 2017-10-21 17:24:56 +02:00
jcmichelou d89c99f5f8 uri: Add coap+tcp:// and coaps+tcp:// schemes. 2017-10-21 16:52:02 +02:00
jcmichelou 75d89ab295 openssl, io: Fix linux compatibility 2017-10-21 16:11:16 +02:00
jcmichelou 854cc3147f openssl, session: Add TLS encryption. 2017-10-21 16:11:14 +02:00
jcmichelou 9bb8396b23 coap_session, net.c: Add debug messages on TCP RX/TX. 2017-10-21 16:11:14 +02:00
jcmichelou 58766a137e coap_dtls.h, openssl: Add function prototypes for TLS support. 2017-10-21 16:11:13 +02:00
jcmichelou 140580f0df session, pdu, option: Use exact message size calculation for TCP PDU. 2017-10-21 16:11:13 +02:00
jcmichelou f81cb43fd3 session, pdu: Enforce maximum message size. 2017-10-21 16:11:12 +02:00
jcmichelou c592c9d11f session, net, debug: Add TCP signaling messages. 2017-10-21 16:11:12 +02:00
jcmichelou dfff930805 io, net: Add TCP accept/connect/read/write 2017-10-21 16:11:12 +02:00
jcmichelou bcfd7a0753 pdu: add support for TCP-style headers
Make coap_pdu-t independent of the header style.
Use C99 sized types when applicable.
Use transaction ids in host byte order in the library.
Make coap_pdu_t payload storage grow on demand.
Add parsing and encoding of PDUs with UDP or TCP style headers.
Adapt examples and unit tests to the new PDU format.
2017-10-21 16:11:11 +02:00
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