Use CoAP over DTLS, with optional reliability.
More...
Use CoAP over DTLS, with optional reliability.
Module. Specify USEMODULE += unicoap_driver_dtls in your application's Makefile.
Include these headers required for managing DTLS credentials.
(D)TLS credentials management module definitions
DTLS session management module definition.
Then, in your application, call sock_dtls_add_credential to add a DTLS credential. If you need to access the DTLS socket, call unicoap_transport_dtls_get_socket(). You must add DTLS credentials yourself. To change the UDP port unicoap is listening on, modify CONFIG_UNICOAP_DTLS_PORT. The CoAP over DTLS driver uses the same socket both for client and server functionality.
- See also
- UNICOAP_PROTO_DTLS
-
unicoap_rfc7252_message_type_t
This is the dependency graph of this driver:
unicoap_driver_dtls
├── unicoap_driver_rfc7252_common
│ ├── unicoap_driver_rfc7252_common_messaging
│ └── unicoap_driver_rfc7252_common_pdu
├── unicoap_sock_support
│ ├── sock_async
│ ├── sock_async_event
│ ├── sock_aux_local
│ └── sock_util
├── ... (operating system networking modules)
.
◆ CONFIG_UNICOAP_DTLS_HANDSHAKE_TIMEOUT_MS
| #define CONFIG_UNICOAP_DTLS_HANDSHAKE_TIMEOUT_MS (3 * MS_PER_SEC) |
Timeout for the DTLS handshake process.
Set to 0 for infinite time
Default: 3 ms
Definition at line 392 of file config.h.
◆ CONFIG_UNICOAP_DTLS_MINIMUM_AVAILABLE_SESSION_SLOTS
| #define CONFIG_UNICOAP_DTLS_MINIMUM_AVAILABLE_SESSION_SLOTS (1) |
Number of minimum available session slots.
If the count of available sessions falls below this threshold, the oldest used session will be closed after a timeout time. Set to 0 to deactivate this feature.
Default: 1
Definition at line 403 of file config.h.
◆ CONFIG_UNICOAP_DTLS_MINIMUM_AVAILABLE_SESSION_SLOTS_TIMEOUT_MS
| #define CONFIG_UNICOAP_DTLS_MINIMUM_AVAILABLE_SESSION_SLOTS_TIMEOUT_MS (15 * MS_PER_SEC) |
Timeout for freeing up a session when minimum number of available session slots is not available anymore.
Default: 15 ms
Definition at line 413 of file config.h.
◆ CONFIG_UNICOAP_DTLS_PORT
◆ unicoap_transport_dtls_add_socket()
Adds DTLS socket for client and server functionality.
- Precondition
- Sockets must be pre-allocated and must remain allocated until the DTLS driver has been deinitialized or the socket is closed by you.
- Parameters
-
| [in,out] | socket | Pre-allocated socket to use |
| [in,out] | base_socket | Pre-allocated UDP base socket to use |
| [in] | local | Initialized endpoint, does not need to outlive this function call |
You can call this function at any time after unicoap has been initialized.
- Returns
0 on success or negative error value otherwise. The error value depends on the DTLS implementation.
◆ unicoap_transport_dtls_remove_socket()
| int unicoap_transport_dtls_remove_socket |
( |
sock_dtls_t * | socket | ) |
|
Removes DTLS socket previously added manually.
- Parameters
-
- Returns
0, indicating a success. Future versions of this API may return a negative error.