5 SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection
9 #include <openssl/ssl.h>
11 void SSL_set_shutdown(SSL *ssl, int mode);
13 int SSL_get_shutdown(const SSL *ssl);
17 SSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>.
19 SSL_get_shutdown() returns the shutdown mode of B<ssl>.
23 The shutdown state of an ssl connection is a bit-mask of:
29 No shutdown setting, yet.
31 =item SSL_SENT_SHUTDOWN
33 A close_notify shutdown alert was sent to the peer, the connection is being
34 considered closed and the session is closed and correct.
36 =item SSL_RECEIVED_SHUTDOWN
38 A shutdown alert was received form the peer, either a normal close_notify
43 SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.
45 The shutdown state of the connection is used to determine the state of
46 the ssl session. If the session is still open, when
47 L<SSL_clear(3)> or L<SSL_free(3)> is called,
48 it is considered bad and removed according to RFC2246.
49 The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN
50 (according to the TLS RFC, it is acceptable to only send the close_notify
51 alert but to not wait for the peer's answer, when the underlying connection
53 SSL_set_shutdown() can be used to set this state without sending a
54 close alert to the peer (see L<SSL_shutdown(3)>).
56 If a close_notify was received, SSL_RECEIVED_SHUTDOWN will be set,
57 for setting SSL_SENT_SHUTDOWN the application must however still call
58 L<SSL_shutdown(3)> or SSL_set_shutdown() itself.
60 SSL_set_shutdown() is not supported for QUIC SSL objects.
64 SSL_set_shutdown() does not return diagnostic information.
66 SSL_get_shutdown() returns the current shutdown state as set or based
67 on the actual connection state.
69 SSL_get_shutdown() returns 0 if called on a QUIC stream SSL object. If it
70 is called on a QUIC connection SSL object, it returns a value with
71 SSL_SENT_SHUTDOWN set if CONNECTION_CLOSE has been sent to the peer and
72 it returns a value with SSL_RECEIVED_SHUTDOWN set if CONNECTION_CLOSE
73 has been received from the peer or the QUIC connection is fully terminated
78 L<ssl(7)>, L<SSL_shutdown(3)>,
79 L<SSL_CTX_set_quiet_shutdown(3)>,
80 L<SSL_clear(3)>, L<SSL_free(3)>
84 Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
86 Licensed under the Apache License 2.0 (the "License"). You may not use
87 this file except in compliance with the License. You can obtain a copy
88 in the file LICENSE in the source distribution or at
89 L<https://www.openssl.org/source/license.html>.