creds.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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 
9 #pragma once
10 
23 #include "net/sock/udp.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
36 #ifndef CONFIG_DTLS_PSK_ID_HINT_MAX_SIZE
37 #define CONFIG_DTLS_PSK_ID_HINT_MAX_SIZE 32
38 #endif
39 
43 #ifndef CONFIG_DTLS_CREDENTIALS_MAX
44 #define CONFIG_DTLS_CREDENTIALS_MAX 4
45 #endif
62  credman_tag_t tags[], unsigned tags_len,
63  const char* hint, size_t hint_len);
64 
77  credman_tag_t tags[], unsigned tags_len);
78 
90 int sock_dtls_set_server_psk_id_hint(sock_dtls_t *sock, const char *hint);
91 
104 
117 
127 
136 
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
uint16_t credman_tag_t
Tag of the credential.
Definition: credman.h:95
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:61
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:76
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:214
Information about DTLS sock.