176866Skris=pod
276866Skris
376866Skris=head1 NAME
476866Skris
576866SkrisSSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection
676866Skris
776866Skris=head1 SYNOPSIS
876866Skris
976866Skris #include <openssl/ssl.h>
1076866Skris
1176866Skris void SSL_set_shutdown(SSL *ssl, int mode);
1276866Skris
13160814Ssimon int SSL_get_shutdown(const SSL *ssl);
1476866Skris
1576866Skris=head1 DESCRIPTION
1676866Skris
1776866SkrisSSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>.
1876866Skris
1976866SkrisSSL_get_shutdown() returns the shutdown mode of B<ssl>.
2076866Skris
2176866Skris=head1 NOTES
2276866Skris
2376866SkrisThe shutdown state of an ssl connection is a bitmask of:
2476866Skris
2576866Skris=over 4
2676866Skris
27264278Sjkim=item Z<>0
2876866Skris
2976866SkrisNo shutdown setting, yet.
3076866Skris
3176866Skris=item SSL_SENT_SHUTDOWN
3276866Skris
3376866SkrisA "close notify" shutdown alert was sent to the peer, the connection is being
3476866Skrisconsidered closed and the session is closed and correct.
3576866Skris
3676866Skris=item SSL_RECEIVED_SHUTDOWN
3776866Skris
3876866SkrisA shutdown alert was received form the peer, either a normal "close notify"
3976866Skrisor a fatal error.
4076866Skris
4176866Skris=back
4276866Skris
4376866SkrisSSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.
4476866Skris
4576866SkrisThe shutdown state of the connection is used to determine the state of
4676866Skristhe ssl session. If the session is still open, when
4776866SkrisL<SSL_clear(3)|SSL_clear(3)> or L<SSL_free(3)|SSL_free(3)> is called,
4876866Skrisit is considered bad and removed according to RFC2246.
4989837SkrisThe actual condition for a correctly closed session is SSL_SENT_SHUTDOWN
5089837Skris(according to the TLS RFC, it is acceptable to only send the "close notify"
5189837Skrisalert but to not wait for the peer's answer, when the underlying connection
5289837Skrisis closed).
5376866SkrisSSL_set_shutdown() can be used to set this state without sending a
5476866Skrisclose alert to the peer (see L<SSL_shutdown(3)|SSL_shutdown(3)>).
5576866Skris
5676866SkrisIf a "close notify" was received, SSL_RECEIVED_SHUTDOWN will be set,
5776866Skrisfor setting SSL_SENT_SHUTDOWN the application must however still call
5876866SkrisL<SSL_shutdown(3)|SSL_shutdown(3)> or SSL_set_shutdown() itself.
5976866Skris
6076866Skris=head1 RETURN VALUES
6176866Skris
6276866SkrisSSL_set_shutdown() does not return diagnostic information.
6376866Skris
6476866SkrisSSL_get_shutdown() returns the current setting.
6576866Skris
6676866Skris=head1 SEE ALSO
6776866Skris
6876866SkrisL<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>,
6989837SkrisL<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>,
7076866SkrisL<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)>
7176866Skris
7276866Skris=cut
73