This module provides functionality to store and retrieve session information of DTLS connections.
More...
This module provides functionality to store and retrieve session information of DTLS connections.
dsm allows to store necessary session information so that not every application has to provide the potentially maximum number of possible session objects. Session storage can be offloaded to this generic module.
\
|
file | dsm.h |
| DTLS session management module definition.
|
|
|
enum | dsm_state_t { NO_SPACE = -1
, SESSION_STATE_NONE = 0
, SESSION_STATE_HANDSHAKE
, SESSION_STATE_ESTABLISHED
} |
| Session management states. More...
|
|
◆ CONFIG_DSM_PEER_MAX
Maximum number of maintained DTLS sessions (tinyDTLS)
Definition at line 46 of file dsm.h.
◆ dsm_state_t
Session management states.
Definition at line 52 of file dsm.h.
◆ dsm_get_least_recently_used_session()
Returns the least recently used session.
- Parameters
-
[in] | sock | sock_dtls_t, which the session is created on |
[out] | session | Oldest used session |
- Returns
- 1, on success
-
-1, when no session is stored
◆ dsm_get_num_available_slots()
uint8_t dsm_get_num_available_slots |
( |
void |
| ) |
|
Returns the number of available session slots.
- Returns
- Number of available session slots in the session management.
◆ dsm_get_num_maximum_slots()
uint8_t dsm_get_num_maximum_slots |
( |
void |
| ) |
|
Returns the maximum number of sessions slots.
- Returns
- Number of session slots.
◆ dsm_init()
Initialize the DTLS session management.
Must call once before first use.
◆ dsm_remove()
Removes a session.
Removes a given session in the internal storage of the session management.
- Parameters
-
[in] | sock | sock_dtls_t, which the session is created on |
[in] | session | Session to store |
◆ dsm_store()
Stores a session.
Stores a given session in the internal storage of the session management. If the session is already stored only the state will be updated when the session gets established.
- Parameters
-
[in] | sock | sock_dtls_t, which the session is created on |
[in] | session | Session to store |
[in] | new_state | New state of the session |
[in] | restore | Indicates, whether the session object should be restored when an already established session is found |
- Returns
- Previous state of the session. If no session existed before it returns SESSION_STATE_NONE. If no space is available it returns NO_SPACE.