SSL_shutdown.pod revision 68651
168651Skris=pod
268651Skris
368651Skris=head1 NAME
468651Skris
568651SkrisSSL_shutdown - shut down a TLS/SSL connection
668651Skris
768651Skris=head1 SYNOPSIS
868651Skris
968651Skris #include <openssl/ssl.h>
1068651Skris
1168651Skris int SSL_shutdown(SSL *ssl);
1268651Skris
1368651Skris=head1 DESCRIPTION
1468651Skris
1568651SkrisSSL_shutdown() shuts down an active TLS/SSL connection. It sends the shutdown
1668651Skrisalert to the peer. The behaviour of SSL_shutdown() depends on the underlying
1768651SkrisBIO. 
1868651Skris
1968651SkrisIf the underlying BIO is B<blocking>, SSL_shutdown() will only return once the
2068651Skrishandshake has been finished or an error occurred.
2168651Skris
2268651SkrisIf the underlying BIO is B<non-blocking>, SSL_shutdown() will also return
2368651Skriswhen the underlying BIO could not satisfy the needs of SSL_shutdown()
2468651Skristo continue the handshake. In this case a call to SSL_get_error() with the
2568651Skrisreturn value of SSL_shutdown() will yield B<SSL_ERROR_WANT_READ> or
2668651SkrisB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after
2768651Skristaking appropriate action to satisfy the needs of SSL_shutdown().
2868651SkrisThe action depends on the underlying BIO. When using a non-blocking socket,
2968651Skrisnothing is to be done, but select() can be used to check for the required
3068651Skriscondition. When using a buffering BIO, like a BIO pair, data must be written
3168651Skrisinto or retrieved out of the BIO before being able to continue.
3268651Skris
3368651Skris=head1 RETURN VALUES
3468651Skris
3568651SkrisThe following return values can occur:
3668651Skris
3768651Skris=over 4
3868651Skris
3968651Skris=item 1
4068651Skris
4168651SkrisThe shutdown was successfully completed.
4268651Skris
4368651Skris=item 0
4468651Skris
4568651SkrisThe shutdown was not successful. Call SSL_get_error() with the return
4668651Skrisvalue B<ret> to find out the reason.
4768651Skris
4868651Skris=item -1
4968651Skris
5068651SkrisThe shutdown was not successful because a fatal error occurred either
5168651Skrisat the protocol level or a connection failure occurred. It can also occur of
5268651Skrisaction is need to continue the operation for non-blocking BIOs.
5368651SkrisCall SSL_get_error() with the return value B<ret> to find out the reason.
5468651Skris
5568651Skris=back
5668651Skris
5768651Skris=head1 SEE ALSO
5868651Skris
5968651SkrisL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>,
6068651SkrisL<SSL_accept(3)|SSL_accept(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>
6168651Skris
6268651Skris=cut
63