xref: /onnv-gate/usr/src/common/openssl/doc/ssl/SSL_set_shutdown.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/ssl.h>
10*2175Sjp161948
11*2175Sjp161948 void SSL_set_shutdown(SSL *ssl, int mode);
12*2175Sjp161948
13*2175Sjp161948 int SSL_get_shutdown(const SSL *ssl);
14*2175Sjp161948
15*2175Sjp161948=head1 DESCRIPTION
16*2175Sjp161948
17*2175Sjp161948SSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>.
18*2175Sjp161948
19*2175Sjp161948SSL_get_shutdown() returns the shutdown mode of B<ssl>.
20*2175Sjp161948
21*2175Sjp161948=head1 NOTES
22*2175Sjp161948
23*2175Sjp161948The shutdown state of an ssl connection is a bitmask of:
24*2175Sjp161948
25*2175Sjp161948=over 4
26*2175Sjp161948
27*2175Sjp161948=item 0
28*2175Sjp161948
29*2175Sjp161948No shutdown setting, yet.
30*2175Sjp161948
31*2175Sjp161948=item SSL_SENT_SHUTDOWN
32*2175Sjp161948
33*2175Sjp161948A "close notify" shutdown alert was sent to the peer, the connection is being
34*2175Sjp161948considered closed and the session is closed and correct.
35*2175Sjp161948
36*2175Sjp161948=item SSL_RECEIVED_SHUTDOWN
37*2175Sjp161948
38*2175Sjp161948A shutdown alert was received form the peer, either a normal "close notify"
39*2175Sjp161948or a fatal error.
40*2175Sjp161948
41*2175Sjp161948=back
42*2175Sjp161948
43*2175Sjp161948SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.
44*2175Sjp161948
45*2175Sjp161948The shutdown state of the connection is used to determine the state of
46*2175Sjp161948the ssl session. If the session is still open, when
47*2175Sjp161948L<SSL_clear(3)|SSL_clear(3)> or L<SSL_free(3)|SSL_free(3)> is called,
48*2175Sjp161948it is considered bad and removed according to RFC2246.
49*2175Sjp161948The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN
50*2175Sjp161948(according to the TLS RFC, it is acceptable to only send the "close notify"
51*2175Sjp161948alert but to not wait for the peer's answer, when the underlying connection
52*2175Sjp161948is closed).
53*2175Sjp161948SSL_set_shutdown() can be used to set this state without sending a
54*2175Sjp161948close alert to the peer (see L<SSL_shutdown(3)|SSL_shutdown(3)>).
55*2175Sjp161948
56*2175Sjp161948If a "close notify" was received, SSL_RECEIVED_SHUTDOWN will be set,
57*2175Sjp161948for setting SSL_SENT_SHUTDOWN the application must however still call
58*2175Sjp161948L<SSL_shutdown(3)|SSL_shutdown(3)> or SSL_set_shutdown() itself.
59*2175Sjp161948
60*2175Sjp161948=head1 RETURN VALUES
61*2175Sjp161948
62*2175Sjp161948SSL_set_shutdown() does not return diagnostic information.
63*2175Sjp161948
64*2175Sjp161948SSL_get_shutdown() returns the current setting.
65*2175Sjp161948
66*2175Sjp161948=head1 SEE ALSO
67*2175Sjp161948
68*2175Sjp161948L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>,
69*2175Sjp161948L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>,
70*2175Sjp161948L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)>
71*2175Sjp161948
72*2175Sjp161948=cut
73