Go to the documentation of this file.
471 #ifndef NET_SOCK_DTLS_H
472 #define NET_SOCK_DTLS_H
477 #include <sys/types.h>
481 #if defined (__clang__)
482 # pragma clang diagnostic push
483 # pragma clang diagnostic ignored "-Wtypedef-redefinition"
507 #ifndef CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP
508 #define CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP 8
515 #ifndef DTLS_HANDSHAKE_BUFSIZE
516 #define DTLS_HANDSHAKE_BUFSIZE (1 << CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP)
522 #define SOCK_DTLS_HANDSHAKE (EXDEV)
555 #if defined (__clang__)
556 # pragma clang diagnostic pop
663 void *data,
size_t maxlen, uint32_t timeout);
706 void **data,
void **buf_ctx, uint32_t timeout);
741 const void *data,
size_t len, uint32_t timeout);
(D)TLS credentials management module definitions
sock_udp_t * sock_dtls_get_udp_sock(sock_dtls_t *sock)
Get underlying UDP sock.
#define assert(cond)
abort the program if assertion is false
@ SOCK_DTLS_1_3
DTLS version 1.3.
POSIX.1-2008 compliant version of the assert macro.
void sock_dtls_init(void)
Called exactly once during auto_init.
static int sock_dtls_session_create(sock_dtls_t *sock, const sock_udp_ep_t *ep, sock_dtls_session_t *remote, unsigned timeout)
Creates a new DTLS session.
@ SOCK_DTLS_CLIENT
Endpoint client role.
sock_udp_ep_t ep
Remote endpoint the session is connected to.
@ SOCK_DTLS_1_0
DTLS version 1.0.
#define DTLS_HANDSHAKE_BUFSIZE
Size buffer used in handshake to hold credentials.
void sock_dtls_session_destroy(sock_dtls_t *sock, sock_dtls_session_t *remote)
Destroys an existing DTLS session.
Information about DTLS sock.
#define SOCK_DTLS_HANDSHAKE
Return value for a successful handshake.
void sock_dtls_close(sock_dtls_t *sock)
Closes a DTLS sock.
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.
Common IP-based transport layer end point.
Information about remote client connected to the server.
tinydtls-specific types and functions definitions
@ SOCK_DTLS_SERVER
Endpoint server role.
int sock_dtls_session_init(sock_dtls_t *sock, const sock_udp_ep_t *ep, sock_dtls_session_t *remote)
Initialize session handshake.
uint16_t credman_tag_t
Tag of the credential.
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.
@ SOCK_DTLS_1_2
DTLS version 1.2.
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_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.
Common sock API definitions.