1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimSSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection 6e71b7053SJung-uk Kim 7e71b7053SJung-uk Kim=head1 SYNOPSIS 8e71b7053SJung-uk Kim 9e71b7053SJung-uk Kim #include <openssl/ssl.h> 10e71b7053SJung-uk Kim 11e71b7053SJung-uk Kim void SSL_set_shutdown(SSL *ssl, int mode); 12e71b7053SJung-uk Kim 13e71b7053SJung-uk Kim int SSL_get_shutdown(const SSL *ssl); 14e71b7053SJung-uk Kim 15e71b7053SJung-uk Kim=head1 DESCRIPTION 16e71b7053SJung-uk Kim 17e71b7053SJung-uk KimSSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>. 18e71b7053SJung-uk Kim 19e71b7053SJung-uk KimSSL_get_shutdown() returns the shutdown mode of B<ssl>. 20e71b7053SJung-uk Kim 21e71b7053SJung-uk Kim=head1 NOTES 22e71b7053SJung-uk Kim 23*b077aed3SPierre ProncheryThe shutdown state of an ssl connection is a bit-mask of: 24e71b7053SJung-uk Kim 25e71b7053SJung-uk Kim=over 4 26e71b7053SJung-uk Kim 27e71b7053SJung-uk Kim=item Z<>0 28e71b7053SJung-uk Kim 29e71b7053SJung-uk KimNo shutdown setting, yet. 30e71b7053SJung-uk Kim 31e71b7053SJung-uk Kim=item SSL_SENT_SHUTDOWN 32e71b7053SJung-uk Kim 33c9cf7b5cSJung-uk KimA close_notify shutdown alert was sent to the peer, the connection is being 34e71b7053SJung-uk Kimconsidered closed and the session is closed and correct. 35e71b7053SJung-uk Kim 36e71b7053SJung-uk Kim=item SSL_RECEIVED_SHUTDOWN 37e71b7053SJung-uk Kim 38c9cf7b5cSJung-uk KimA shutdown alert was received form the peer, either a normal close_notify 39e71b7053SJung-uk Kimor a fatal error. 40e71b7053SJung-uk Kim 41e71b7053SJung-uk Kim=back 42e71b7053SJung-uk Kim 43e71b7053SJung-uk KimSSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time. 44e71b7053SJung-uk Kim 45e71b7053SJung-uk KimThe shutdown state of the connection is used to determine the state of 46e71b7053SJung-uk Kimthe ssl session. If the session is still open, when 47e71b7053SJung-uk KimL<SSL_clear(3)> or L<SSL_free(3)> is called, 48e71b7053SJung-uk Kimit is considered bad and removed according to RFC2246. 49e71b7053SJung-uk KimThe actual condition for a correctly closed session is SSL_SENT_SHUTDOWN 50c9cf7b5cSJung-uk Kim(according to the TLS RFC, it is acceptable to only send the close_notify 51e71b7053SJung-uk Kimalert but to not wait for the peer's answer, when the underlying connection 52e71b7053SJung-uk Kimis closed). 53e71b7053SJung-uk KimSSL_set_shutdown() can be used to set this state without sending a 54e71b7053SJung-uk Kimclose alert to the peer (see L<SSL_shutdown(3)>). 55e71b7053SJung-uk Kim 56c9cf7b5cSJung-uk KimIf a close_notify was received, SSL_RECEIVED_SHUTDOWN will be set, 57e71b7053SJung-uk Kimfor setting SSL_SENT_SHUTDOWN the application must however still call 58e71b7053SJung-uk KimL<SSL_shutdown(3)> or SSL_set_shutdown() itself. 59e71b7053SJung-uk Kim 60e71b7053SJung-uk Kim=head1 RETURN VALUES 61e71b7053SJung-uk Kim 62e71b7053SJung-uk KimSSL_set_shutdown() does not return diagnostic information. 63e71b7053SJung-uk Kim 64e71b7053SJung-uk KimSSL_get_shutdown() returns the current setting. 65e71b7053SJung-uk Kim 66e71b7053SJung-uk Kim=head1 SEE ALSO 67e71b7053SJung-uk Kim 68e71b7053SJung-uk KimL<ssl(7)>, L<SSL_shutdown(3)>, 69e71b7053SJung-uk KimL<SSL_CTX_set_quiet_shutdown(3)>, 70e71b7053SJung-uk KimL<SSL_clear(3)>, L<SSL_free(3)> 71e71b7053SJung-uk Kim 72e71b7053SJung-uk Kim=head1 COPYRIGHT 73e71b7053SJung-uk Kim 74*b077aed3SPierre ProncheryCopyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. 75e71b7053SJung-uk Kim 76*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 77e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 78e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 79e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 80e71b7053SJung-uk Kim 81e71b7053SJung-uk Kim=cut 82