sock_dtls_types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef SOCK_DTLS_TYPES_H
20 #define SOCK_DTLS_TYPES_H
21 
22 #include "dtls.h"
23 #include "net/sock/udp.h"
24 #include "net/credman.h"
25 #include "net/sock/dtls/creds.h"
26 #ifdef SOCK_HAS_ASYNC
27 #include "net/sock/async/types.h"
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef SOCK_DTLS_MBOX_SIZE
35 #define SOCK_DTLS_MBOX_SIZE (4)
36 #endif
37 
41 struct sock_dtls {
42  dtls_context_t *dtls_ctx;
44 #if defined(SOCK_HAS_ASYNC) || defined(DOXYGEN)
48  void *buf_ctx;
55  void *async_cb_arg;
56  session_t async_cb_session;
57 #if defined(SOCK_HAS_ASYNC_CTX) || defined(DOXYGEN)
64 #endif
65 #endif
73  struct {
74  uint8_t *data;
75  size_t datalen;
76  session_t *session;
77  } buffer;
80  unsigned tags_len;
81  dtls_peer_type role;
84 };
85 
90  session_t dtls_session;
91 };
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* SOCK_DTLS_TYPES_H */
(D)TLS credentials management module definitions
DTLS sock definitions.
uint16_t credman_tag_t
Tag of the credential.
Definition: credman.h:96
void(* sock_dtls_cb_t)(sock_dtls_t *sock, sock_async_flags_t flags, void *arg)
Event callback for sock_dtls_t.
Definition: types.h:68
#define CONFIG_DTLS_PSK_ID_HINT_MAX_SIZE
Default maximum size for the PSK Identity hint string.
Definition: creds.h:38
#define CONFIG_DTLS_CREDENTIALS_MAX
Default buffer size for TLS credential tags.
Definition: creds.h:45
credman_tag_t(* sock_dtls_client_psk_cb_t)(sock_dtls_t *sock, sock_udp_ep_t *ep, credman_tag_t tags[], unsigned tags_len, const char *hint, size_t hint_len)
Pre-Shared Key client callback.
Definition: creds.h:62
credman_tag_t(* sock_dtls_rpk_cb_t)(sock_dtls_t *sock, sock_udp_ep_t *ep, credman_tag_t tags[], unsigned tags_len)
Raw Public Key callback.
Definition: creds.h:77
UDP sock definitions.
#define SOCK_DTLS_MBOX_SIZE
Size of DTLS sock mailbox.
Mailbox struct definition.
Definition: mbox.h:41
Describes a message object which can be sent between threads.
Definition: msg.h:196
Asynchronous context for Asynchronous sock with event API.
Information about remote client connected to the server.
session_t dtls_session
TinyDTLS session.
Information about DTLS sock.
msg_t mbox_queue[SOCK_DTLS_MBOX_SIZE]
Queue for struct sock_dtls::mbox.
sock_dtls_cb_t async_cb
Asynchronous event callback.
session_t async_cb_session
asynchronous callback session
char psk_hint[CONFIG_DTLS_PSK_ID_HINT_MAX_SIZE]
PSK Identity hint.
mbox_t mbox
Mailbox for internal event handling.
dtls_context_t * dtls_ctx
TinyDTLS context for sock.
unsigned tags_len
Number of tags in the list 'tags'.
void * async_cb_arg
asynchronous callback arg
struct sock_dtls::@295 buffer
Buffer used to pass decrypted data and its session information.
sock_async_ctx_t async_ctx
Asynchronous event context.
session_t * session
Session information.
sock_udp_t * udp_sock
Underlying UDP sock to use.
credman_tag_t tags[CONFIG_DTLS_CREDENTIALS_MAX]
Tags of the available credentials.
size_t datalen
data length
uint8_t * data
Pointer to the decrypted data.
dtls_peer_type role
DTLS role of the socket.
void * buf_ctx
Network stack internal buffer context.
sock_dtls_rpk_cb_t rpk_cb
Callback to determine RPK credential for session.
sock_dtls_client_psk_cb_t client_psk_cb
Callback to determine PSK credential for session.
UDP sock type.
Definition: sock_types.h:128
Definitions for sock extension for asynchronous access.