~ubuntu-branches/ubuntu/precise/openssl098/precise

« back to all changes in this revision

Viewing changes to doc/ssl/SSL_get_session.pod

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2011-03-23 19:50:31 UTC
  • Revision ID: james.westby@ubuntu.com-20110323195031-6h9crj4bymhhr8b8
Tags: upstream-0.9.8o
ImportĀ upstreamĀ versionĀ 0.9.8o

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=pod
 
2
 
 
3
=head1 NAME
 
4
 
 
5
SSL_get_session - retrieve TLS/SSL session data
 
6
 
 
7
=head1 SYNOPSIS
 
8
 
 
9
 #include <openssl/ssl.h>
 
10
 
 
11
 SSL_SESSION *SSL_get_session(const SSL *ssl);
 
12
 SSL_SESSION *SSL_get0_session(const SSL *ssl);
 
13
 SSL_SESSION *SSL_get1_session(SSL *ssl);
 
14
 
 
15
=head1 DESCRIPTION
 
16
 
 
17
SSL_get_session() returns a pointer to the B<SSL_SESSION> actually used in
 
18
B<ssl>. The reference count of the B<SSL_SESSION> is not incremented, so
 
19
that the pointer can become invalid by other operations.
 
20
 
 
21
SSL_get0_session() is the same as SSL_get_session().
 
22
 
 
23
SSL_get1_session() is the same as SSL_get_session(), but the reference
 
24
count of the B<SSL_SESSION> is incremented by one.
 
25
 
 
26
=head1 NOTES
 
27
 
 
28
The ssl session contains all information required to re-establish the
 
29
connection without a new handshake.
 
30
 
 
31
SSL_get0_session() returns a pointer to the actual session. As the
 
32
reference counter is not incremented, the pointer is only valid while
 
33
the connection is in use. If L<SSL_clear(3)|SSL_clear(3)> or
 
34
L<SSL_free(3)|SSL_free(3)> is called, the session may be removed completely
 
35
(if considered bad), and the pointer obtained will become invalid. Even
 
36
if the session is valid, it can be removed at any time due to timeout
 
37
during L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>.
 
38
 
 
39
If the data is to be kept, SSL_get1_session() will increment the reference
 
40
count, so that the session will not be implicitly removed by other operations
 
41
but stays in memory. In order to remove the session
 
42
L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> must be explicitly called once
 
43
to decrement the reference count again.
 
44
 
 
45
SSL_SESSION objects keep internal link information about the session cache
 
46
list, when being inserted into one SSL_CTX object's session cache.
 
47
One SSL_SESSION object, regardless of its reference count, must therefore
 
48
only be used with one SSL_CTX object (and the SSL objects created
 
49
from this SSL_CTX object).
 
50
 
 
51
=head1 RETURN VALUES
 
52
 
 
53
The following return values can occur:
 
54
 
 
55
=over 4
 
56
 
 
57
=item NULL
 
58
 
 
59
There is no session available in B<ssl>.
 
60
 
 
61
=item Pointer to an SSL
 
62
 
 
63
The return value points to the data of an SSL session.
 
64
 
 
65
=back
 
66
 
 
67
=head1 SEE ALSO
 
68
 
 
69
L<ssl(3)|ssl(3)>, L<SSL_free(3)|SSL_free(3)>,
 
70
L<SSL_clear(3)|SSL_clear(3)>,
 
71
L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>
 
72
 
 
73
=cut