SSL_get_session 3 2005-04-23 0.9.9-dev OpenSSL

NAME

SSL_get_session - retrieve TLS/SSL session data

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 SSL_SESSION *SSL_get_session(const SSL *ssl);
 SSL_SESSION *SSL_get0_session(const SSL *ssl);
 SSL_SESSION *SSL_get1_session(SSL *ssl);

DESCRIPTION

_S_S_L___g_e_t___s_e_s_s_i_o_n_(_) returns a pointer to the SSSSLL__SSEESSSSIIOONN actually used in ssssll. The reference count of the SSSSLL__SSEESSSSIIOONN is not incremented, so that the pointer can become invalid by other operations.

_S_S_L___g_e_t_0___s_e_s_s_i_o_n_(_) is the same as _S_S_L___g_e_t___s_e_s_s_i_o_n_(_).

_S_S_L___g_e_t_1___s_e_s_s_i_o_n_(_) is the same as _S_S_L___g_e_t___s_e_s_s_i_o_n_(_), but the reference count of the SSSSLL__SSEESSSSIIOONN is incremented by one.

NOTES

The ssl session contains all information required to re-establish the connection without a new handshake.

_S_S_L___g_e_t_0___s_e_s_s_i_o_n_(_) returns a pointer to the actual session. As the reference counter is not incremented, the pointer is only valid while the connection is in use. If _S_S_L___c_l_e_a_r(3) or _S_S_L___f_r_e_e(3) is called, the session may be removed completely (if considered bad), and the pointer obtained will become invalid. Even if the session is valid, it can be removed at any time due to timeout during _S_S_L___C_T_X___f_l_u_s_h___s_e_s_s_i_o_n_s(3).

If the data is to be kept, _S_S_L___g_e_t_1___s_e_s_s_i_o_n_(_) will increment the reference count, so that the session will not be implicitly removed by other operations but stays in memory. In order to remove the session _S_S_L___S_E_S_S_I_O_N___f_r_e_e(3) must be explicitly called once to decrement the reference count again.

SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object).

RETURN VALUES

The following return values can occur:
NULL There is no session available in ssssll.
Pointer to an SSL The return value points to the data of an SSL session.

SEE ALSO

_s_s_l(3), _S_S_L___f_r_e_e(3), _S_S_L___c_l_e_a_r(3), _S_S_L___S_E_S_S_I_O_N___f_r_e_e(3)