dsm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 ML!PA Consulting GmbH
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 
32 #include <stdint.h>
33 
34 #include "dtls.h"
35 #include "net/sock/dtls.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
44 #ifndef CONFIG_DSM_PEER_MAX
45 #define CONFIG_DSM_PEER_MAX (CONFIG_DTLS_PEER_MAX)
46 #endif
47 
51 typedef enum {
52  NO_SPACE = -1,
53  SESSION_STATE_NONE = 0,
54  SESSION_STATE_HANDSHAKE,
55  SESSION_STATE_ESTABLISHED
56 } dsm_state_t;
57 
63 void dsm_init(void);
64 
82  dsm_state_t new_state, bool restore);
83 
93 
100 
107 
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
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:51
DTLS sock definitions.
Information about remote client connected to the server.
Information about DTLS sock.