
1: =pod 2: 3: =head1 NAME 4: 5: SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection 6: 7: =head1 SYNOPSIS 8: 9: #include <openssl/ssl.h> 10: 11: void SSL_set_shutdown(SSL *ssl, int mode); 12: 13: int SSL_get_shutdown(const SSL *ssl); 14: 15: =head1 DESCRIPTION 16: 17: SSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>. 18: 19: SSL_get_shutdown() returns the shutdown mode of B<ssl>. 20: 21: =head1 NOTES 22: 23: The shutdown state of an ssl connection is a bitmask of: 24: 25: =over 4 26: 27: =item 0 28: 29: No shutdown setting, yet. 30: 31: =item SSL_SENT_SHUTDOWN 32: 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. 35: 36: =item SSL_RECEIVED_SHUTDOWN 37: 38: A shutdown alert was received form the peer, either a normal "close notify" 39: or a fatal error. 40: 41: =back 42: 43: SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time. 44: 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)|SSL_clear(3)> or L<SSL_free(3)|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 52: is closed). 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)|SSL_shutdown(3)>). 55: 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)|SSL_shutdown(3)> or SSL_set_shutdown() itself. 59: 60: =head1 RETURN VALUES 61: 62: SSL_set_shutdown() does not return diagnostic information. 63: 64: SSL_get_shutdown() returns the current setting. 65: 66: =head1 SEE ALSO 67: 68: L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, 69: L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, 70: L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> 71: 72: =cut