dtls.h File Reference

DTLS sock definitions. More...

Detailed Description

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include "net/sock.h"
#include "net/sock/udp.h"
#include "net/credman.h"
#include "sock_dtls_types.h"
+ Include dependency graph for dtls.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP   8
 Default buffer size for DTLS handshake (as exponent of 2^n) More...
 
#define DTLS_HANDSHAKE_BUFSIZE   (1 << CONFIG_DTLS_HANDSHAKE_BUFSIZE_EXP)
 Size buffer used in handshake to hold credentials.
 
#define SOCK_DTLS_HANDSHAKE   (EXDEV)
 Return value for a successful handshake.
 

Typedefs

typedef struct sock_dtls sock_dtls_t
 Type for a DTLS sock object. More...
 
typedef struct sock_dtls_session sock_dtls_session_t
 Information about a created session.
 

Functions

void sock_dtls_init (void)
 Called exactly once during auto_init. More...
 
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. More...
 
sock_udp_tsock_dtls_get_udp_sock (sock_dtls_t *sock)
 Get underlying UDP sock. More...
 
int sock_dtls_session_init (sock_dtls_t *sock, const sock_udp_ep_t *ep, sock_dtls_session_t *remote)
 Initialize session handshake. More...
 
void sock_dtls_session_destroy (sock_dtls_t *sock, sock_dtls_session_t *remote)
 Destroys an existing DTLS session. More...
 
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. More...
 
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. More...
 
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. More...
 
void sock_dtls_close (sock_dtls_t *sock)
 Closes a DTLS sock. More...
 
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. More...
 
enum  { SOCK_DTLS_1_0 = 1, SOCK_DTLS_1_2 = 2, SOCK_DTLS_1_3 = 3 }
 DTLS version number. More...
 
enum  { SOCK_DTLS_CLIENT = 1, SOCK_DTLS_SERVER = 2 }
 DTLS role. More...