dsm.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2021 ML!PA Consulting GmbH
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
29 #include <stdint.h>
30 
31 #include "dtls.h"
32 #include "net/sock/dtls.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
41 #ifndef CONFIG_DSM_PEER_MAX
42 #define CONFIG_DSM_PEER_MAX (CONFIG_DTLS_PEER_MAX)
43 #endif
44 
48 typedef enum {
49  NO_SPACE = -1,
50  SESSION_STATE_NONE = 0,
51  SESSION_STATE_HANDSHAKE,
52  SESSION_STATE_ESTABLISHED
53 } dsm_state_t;
54 
60 void dsm_init(void);
61 
79  dsm_state_t new_state, bool restore);
80 
90 
97 
104 
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
void dsm_remove(sock_dtls_t *sock, sock_dtls_session_t *session)
Removes a session.
dsm_state_t dsm_store(sock_dtls_t *sock, sock_dtls_session_t *session, dsm_state_t new_state, bool restore)
Stores a session.
uint8_t dsm_get_num_maximum_slots(void)
Returns the maximum number of sessions slots.
uint8_t dsm_get_num_available_slots(void)
Returns the number of available session slots.
ssize_t dsm_get_least_recently_used_session(sock_dtls_t *sock, sock_dtls_session_t *session)
Returns the least recently used session.
void dsm_init(void)
Initialize the DTLS session management.
dsm_state_t
Session management states.
Definition: dsm.h:48
DTLS sock definitions.
Information about remote client connected to the server.
Information about DTLS sock.