168651Skris=pod 268651Skris 368651Skris=head1 NAME 468651Skris 568651SkrisSSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect 668651Skris 768651Skris=head1 SYNOPSIS 868651Skris 968651Skris #include <openssl/ssl.h> 1068651Skris 1168651Skris int SSL_set_session(SSL *ssl, SSL_SESSION *session); 1268651Skris 1368651Skris=head1 DESCRIPTION 1468651Skris 1568651SkrisSSL_set_session() sets B<session> to be used when the TLS/SSL connection 1668651Skrisis to be established. SSL_set_session() is only useful for TLS/SSL clients. 1768651SkrisWhen the session is set, the reference count of B<session> is incremented 1868651Skrisby 1. If the session is not reused, the reference count is decremented 1989837Skrisagain during SSL_connect(). Whether the session was reused can be queried 2089837Skriswith the L<SSL_session_reused(3)|SSL_session_reused(3)> call. 2168651Skris 2268651SkrisIf there is already a session set inside B<ssl> (because it was set with 2368651SkrisSSL_set_session() before or because the same B<ssl> was already used for 2468651Skrisa connection), SSL_SESSION_free() will be called for that session. 2568651Skris 2689837Skris=head1 NOTES 2789837Skris 2889837SkrisSSL_SESSION objects keep internal link information about the session cache 2989837Skrislist, when being inserted into one SSL_CTX object's session cache. 3089837SkrisOne SSL_SESSION object, regardless of its reference count, must therefore 3189837Skrisonly be used with one SSL_CTX object (and the SSL objects created 3289837Skrisfrom this SSL_CTX object). 3389837Skris 3468651Skris=head1 RETURN VALUES 3568651Skris 3668651SkrisThe following return values can occur: 3768651Skris 3868651Skris=over 4 3968651Skris 40261037Sjkim=item Z<>0 4168651Skris 4268651SkrisThe operation failed; check the error stack to find out the reason. 4368651Skris 44261037Sjkim=item Z<>1 4568651Skris 4668651SkrisThe operation succeeded. 4768651Skris 4868651Skris=back 4968651Skris 5068651Skris=head1 SEE ALSO 5168651Skris 5272613SkrisL<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, 5389837SkrisL<SSL_get_session(3)|SSL_get_session(3)>, 5489837SkrisL<SSL_session_reused(3)|SSL_session_reused(3)>, 5572613SkrisL<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> 5668651Skris 5768651Skris=cut 58