Update of linux-ppc. Contributed by MATSUURA Takanori
[openssl.git] / doc / ssl / SSL_shutdown.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_shutdown - shut down a TLS/SSL connection
6
7 =head1 SYNOPSIS
8
9  #include <openssl/ssl.h>
10
11  int SSL_shutdown(SSL *ssl);
12
13 =head1 DESCRIPTION
14
15 SSL_shutdown() shuts down an active TLS/SSL connection. It sends the shutdown
16 alert to the peer. The behaviour of SSL_shutdown() depends on the underlying
17 BIO. 
18
19 If the underlying BIO is B<blocking>, SSL_shutdown() will only return once the
20 handshake has been finished or an error occurred.
21
22 If the underlying BIO is B<non-blocking>, SSL_shutdown() will also return
23 when the underlying BIO could not satisfy the needs of SSL_shutdown()
24 to continue the handshake. In this case a call to SSL_get_error() with the
25 return value of SSL_shutdown() will yield B<SSL_ERROR_WANT_READ> or
26 B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after
27 taking appropriate action to satisfy the needs of SSL_shutdown().
28 The action depends on the underlying BIO. When using a non-blocking socket,
29 nothing is to be done, but select() can be used to check for the required
30 condition. When using a buffering BIO, like a BIO pair, data must be written
31 into or retrieved out of the BIO before being able to continue.
32
33 =head1 RETURN VALUES
34
35 The following return values can occur:
36
37 =over 4
38
39 =item 1
40
41 The shutdown was successfully completed.
42
43 =item 0
44
45 The shutdown was not successful. Call SSL_get_error() with the return
46 value B<ret> to find out the reason.
47
48 =item -1
49
50 The shutdown was not successful because a fatal error occurred either
51 at the protocol level or a connection failure occurred. It can also occur of
52 action is need to continue the operation for non-blocking BIOs.
53 Call SSL_get_error() with the return value B<ret> to find out the reason.
54
55 =back
56
57 =head1 SEE ALSO
58
59 L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>,
60 L<SSL_accept(3)|SSL_accept(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>
61
62 =cut