Loading...
Searching...
No Matches
DTLS Session Management (DSM)

This module provides functionality to store and retrieve session information of DTLS connections. More...

Detailed Description

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.

\

Files

file  dsm.h
 DTLS session management module definition.
 

Macros

#define CONFIG_DSM_PEER_MAX   (CONFIG_DTLS_PEER_MAX)
 Maximum number of maintained DTLS sessions (tinyDTLS)
 

Enumerations

enum  dsm_state_t { NO_SPACE = -1 , SESSION_STATE_NONE = 0 , SESSION_STATE_HANDSHAKE , SESSION_STATE_ESTABLISHED }
 Session management states. More...
 

Functions

void dsm_init (void)
 Initialize the DTLS session management.
 
dsm_state_t dsm_store (sock_dtls_t *sock, sock_dtls_session_t *session, dsm_state_t new_state, bool restore)
 Stores a session.
 
void dsm_remove (sock_dtls_t *sock, sock_dtls_session_t *session)
 Removes 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.
 

Macro Definition Documentation

◆ CONFIG_DSM_PEER_MAX

#define CONFIG_DSM_PEER_MAX   (CONFIG_DTLS_PEER_MAX)

Maximum number of maintained DTLS sessions (tinyDTLS)

Definition at line 46 of file dsm.h.

Enumeration Type Documentation

◆ dsm_state_t

Session management states.

Definition at line 52 of file dsm.h.

Function Documentation

◆ dsm_get_least_recently_used_session()

ssize_t dsm_get_least_recently_used_session ( sock_dtls_t sock,
sock_dtls_session_t session 
)

Returns the least recently used session.

Parameters
[in]socksock_dtls_t, which the session is created on
[out]sessionOldest 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()

void dsm_init ( void  )

Initialize the DTLS session management.

Must call once before first use.

◆ dsm_remove()

void dsm_remove ( sock_dtls_t sock,
sock_dtls_session_t session 
)

Removes a session.

Removes a given session in the internal storage of the session management.

Parameters
[in]socksock_dtls_t, which the session is created on
[in]sessionSession to store

◆ dsm_store()

dsm_state_t dsm_store ( sock_dtls_t sock,
sock_dtls_session_t session,
dsm_state_t  new_state,
bool  restore 
)

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]socksock_dtls_t, which the session is created on
[in]sessionSession to store
[in]new_stateNew state of the session
[in]restoreIndicates, 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.