530#ifndef NET_SOCK_DTLS_H
531#define NET_SOCK_DTLS_H
537#include <sys/types.h>
541#if defined (__clang__)
542# pragma clang diagnostic push
543# pragma clang diagnostic ignored "-Wtypedef-redefinition"
567#ifndef CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP
568#define CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP 8
575#ifndef DTLS_HANDSHAKE_BUFSIZE
576#define DTLS_HANDSHAKE_BUFSIZE (1 << CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP)
582#define SOCK_DTLS_HANDSHAKE (EXDEV)
587#ifndef CONFIG_DTLS_FORCE_EXTENDED_MASTER_SECRET
588#define CONFIG_DTLS_FORCE_EXTENDED_MASTER_SECRET 1
594#ifndef CONFIG_DTLS_FORCE_RENEGOTIATION_INFO
595#define CONFIG_DTLS_FORCE_RENEGOTIATION_INFO 1
629#if defined (__clang__)
630# pragma clang diagnostic pop
791 void *data,
size_t maxlen, uint32_t timeout,
823 void *data,
size_t maxlen,
872 void **data,
void **buf_ctx, uint32_t timeout,
917 void **data,
void **buf_ctx,
958 const iolist_t *snips, uint32_t timeout,
997 const void *data,
size_t len,
1051 const void *data,
size_t len,
1119#ifdef MODULE_SOCK_DTLS
POSIX.1-2008 compliant version of the assert macro.
(D)TLS credentials management module definitions
uint16_t credman_tag_t
Tag of the credential.
static ssize_t sock_dtls_recv_buf(sock_dtls_t *sock, sock_dtls_session_t *remote, void **data, void **buf_ctx, uint32_t timeout)
Decrypts and provides stack-internal buffer space containing a message from a remote peer.
int sock_dtls_create(sock_dtls_t *sock, sock_udp_t *udp_sock, credman_tag_t tag, unsigned version, unsigned role)
Creates a new DTLS sock object.
static ssize_t sock_dtls_sendv(sock_dtls_t *sock, sock_dtls_session_t *remote, const iolist_t *snips, uint32_t timeout)
Encrypts and sends a message to a remote peer with non-continous payload.
static ssize_t sock_dtls_send_aux(sock_dtls_t *sock, sock_dtls_session_t *remote, const void *data, size_t len, uint32_t timeout, sock_dtls_aux_tx_t *aux)
Encrypts and sends a message to a remote peer.
ssize_t sock_dtls_recv_buf_aux(sock_dtls_t *sock, sock_dtls_session_t *remote, void **data, void **buf_ctx, uint32_t timeout, sock_dtls_aux_rx_t *aux)
Decrypts and provides stack-internal buffer space containing a message from a remote peer.
void sock_dtls_close(sock_dtls_t *sock)
Closes a DTLS sock.
void sock_dtls_init(void)
Called exactly once during auto_init.
void sock_dtls_session_destroy(sock_dtls_t *sock, sock_dtls_session_t *remote)
Destroys an existing DTLS session.
static ssize_t sock_dtls_send(sock_dtls_t *sock, sock_dtls_session_t *remote, const void *data, size_t len, uint32_t timeout)
Encrypts and sends a message to a remote peer.
int sock_dtls_session_init(sock_dtls_t *sock, const sock_udp_ep_t *ep, sock_dtls_session_t *remote)
Initialize session handshake.
sock_udp_t * sock_dtls_get_udp_sock(sock_dtls_t *sock)
Get underlying UDP sock.
static ssize_t sock_dtls_recv(sock_dtls_t *sock, sock_dtls_session_t *remote, void *data, size_t maxlen, uint32_t timeout)
Receive handshake messages and application data from remote peer.
ssize_t sock_dtls_recv_aux(sock_dtls_t *sock, sock_dtls_session_t *remote, void *data, size_t maxlen, uint32_t timeout, sock_dtls_aux_rx_t *aux)
Receive handshake messages and application data from remote peer.
sock_udp_aux_rx_t sock_dtls_aux_rx_t
Auxiliary data provided when receiving using an DTLS sock object.
sock_udp_aux_tx_t sock_dtls_aux_tx_t
Auxiliary data provided when sending using an DTLS sock object.
void sock_dtls_session_get_udp_ep(const sock_dtls_session_t *session, sock_udp_ep_t *ep)
Get the remote UDP endpoint from a session.
void sock_dtls_session_set_udp_ep(sock_dtls_session_t *session, const sock_udp_ep_t *ep)
Set the remote UDP endpoint from a session.
ssize_t sock_dtls_sendv_aux(sock_dtls_t *sock, sock_dtls_session_t *remote, const iolist_t *snips, uint32_t timeout, sock_dtls_aux_tx_t *aux)
Encrypts and sends a message to a remote peer with non-continous payload.
@ SOCK_DTLS_1_0
DTLS version 1.0.
@ SOCK_DTLS_1_2
DTLS version 1.2.
@ SOCK_DTLS_1_3
DTLS version 1.3.
@ SOCK_DTLS_CLIENT
Endpoint client role.
@ SOCK_DTLS_SERVER
Endpoint server role.
Common sock API definitions.
tinydtls-specific types and functions definitions
Common IP-based transport layer end point.
iolist structure definition
void * iol_base
ptr to this list entries data
Information about remote client connected to the server.
Information about DTLS sock.
Auxiliary data provided when receiving using an UDP sock object.
Auxiliary data provided when sending using an UDP sock object.