NAME
SSLgetsession - retrieve TLS/SSL session data
SYNOPSIS
#include
SSLSESSION *SSLgetsession(const SSL *ssl); SSLSESSION *SSLget0session(const SSL *ssl); SSLSESSION *SSLget1session(SSL *ssl);DESCRIPTION
SSLgetsession() returns a pointer to the SSSSLLSSEESSSSIIOONN actually used in ssssll. The reference count of the SSSSLLSSEESSSSIIOONN is not incremented, so that the pointer can become invalid by other operations. SSLget0session() is the same as SSLgetsession(). SSLget1session() is the same as SSLgetsession(), but the reference count of the SSSSLLSSEESSSSIIOONN is incremented by one. NNOOTTEESSThe ssl session contains all information required to re-establish the
connection without a new handshake. SSLget0session() 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 SSLclear(3) or SSLfree(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 SSLCTXflushsessions(3). If the data is to be kept, SSLget1session() 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 SSLSESSIONfree(3) must be explicitly called once to decrement the reference count again. SSLSESSION objects keep internal link information about the session cache list, when being inserted into one SSLCTX object's session cache. One SSLSESSION object, regardless of its reference count, must therefore only be used with one SSLCTX object (and the SSL objects created from this SSLCTX 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
ssl(3), SSLfree(3), SSLclear(3), SSLSESSIONfree(3)0.9.7l 2005-03-30 SSLgetsession(3)