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 
30 #ifndef NET_DSM_H
31 #define NET_DSM_H
32 
33 #include <stdint.h>
34 
35 #include "dtls.h"
36 #include "net/sock/dtls.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
45 #ifndef CONFIG_DSM_PEER_MAX
46 #define CONFIG_DSM_PEER_MAX (CONFIG_DTLS_PEER_MAX)
47 #endif
48 
52 typedef enum {
53  NO_SPACE = -1,
54  SESSION_STATE_NONE = 0,
55  SESSION_STATE_HANDSHAKE,
56  SESSION_STATE_ESTABLISHED
57 } dsm_state_t;
58 
64 void dsm_init(void);
65 
83  dsm_state_t new_state, bool restore);
84 
94 
101 
108 
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif /* NET_DSM_H */
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:52
DTLS sock definitions.
Information about remote client connected to the server.
Information about DTLS sock.