creds.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2021 HAW Hamburg
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
20 #include "net/sock/udp.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
33 #ifndef CONFIG_DTLS_PSK_ID_HINT_MAX_SIZE
34 #define CONFIG_DTLS_PSK_ID_HINT_MAX_SIZE 32
35 #endif
36 
40 #ifndef CONFIG_DTLS_CREDENTIALS_MAX
41 #define CONFIG_DTLS_CREDENTIALS_MAX 4
42 #endif
59  credman_tag_t tags[], unsigned tags_len,
60  const char* hint, size_t hint_len);
61 
74  credman_tag_t tags[], unsigned tags_len);
75 
87 int sock_dtls_set_server_psk_id_hint(sock_dtls_t *sock, const char *hint);
88 
101 
114 
124 
133 
142 
143 #ifdef __cplusplus
144 }
145 #endif
146 
uint16_t credman_tag_t
Tag of the credential.
Definition: credman.h:92
int sock_dtls_set_server_psk_id_hint(sock_dtls_t *sock, const char *hint)
Sets the PSK Identity hint to be sent to clients during handshake.
void sock_dtls_set_client_psk_cb(sock_dtls_t *sock, sock_dtls_client_psk_cb_t cb)
Sets the callback function for clients to specify a credential to use for a given connection.
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:58
void sock_dtls_set_rpk_cb(sock_dtls_t *sock, sock_dtls_rpk_cb_t cb)
Sets the callback function to specify a credential to use for a given connection, when using Raw Publ...
size_t sock_dtls_get_credentials(sock_dtls_t *sock, const credman_tag_t **out)
Returns an array of tags of the registered credentials in sock.
int sock_dtls_remove_credential(sock_dtls_t *sock, credman_tag_t tag)
Removes a credential tag of the list of available credentials for sock.
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:73
int sock_dtls_add_credential(sock_dtls_t *sock, credman_tag_t tag)
Adds a credential tag to list of available credentials for sock.
UDP sock definitions.
Common IP-based transport layer end point.
Definition: sock.h:211
Information about DTLS sock.