
#use wml::openssl-macros area=docs page=SSL_set_shutdown

<title>Documents, SSL_set_shutdown(3)</title>

<h1>SSL_set_shutdown(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL
connection

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/ssl.h&gt;
</PRE>
<PRE> void SSL_set_shutdown(SSL *ssl, int mode);
</PRE>
<PRE> int SSL_get_shutdown(const SSL *ssl);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>SSL_set_shutdown()</CODE> sets the shutdown state of <STRONG>ssl</STRONG> to <STRONG>mode</STRONG>.

</P>
<P>
<CODE>SSL_get_shutdown()</CODE> returns the shutdown mode of <STRONG>ssl</STRONG>.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
The shutdown state of an ssl connection is a bitmask of:

</P>
<DL>
<DT><STRONG><A NAME="item_0">0</A></STRONG><DD>
<P>
No shutdown setting, yet.

</P>
<DT><STRONG><A NAME="item_SSL_SENT_SHUTDOWN">SSL_SENT_SHUTDOWN</A></STRONG><DD>
<P>
A ``close notify'' shutdown alert was sent to the peer, the connection is
being considered closed and the session is closed and correct.

</P>
<DT><STRONG><A NAME="item_SSL_RECEIVED_SHUTDOWN">SSL_RECEIVED_SHUTDOWN</A></STRONG><DD>
<P>
A shutdown alert was received form the peer, either a normal ``close
notify'' or a fatal error.

</P>
</DL>
<P>
SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.

</P>
<P>
The shutdown state of the connection is used to determine the state of the
ssl session. If the session is still open, when
<A HREF="../ssl/SSL_clear.html#">SSL_clear(3)</A> or <A HREF="../ssl/SSL_free.html#">SSL_free(3)</A> is called, it is considered bad and removed according to RFC2246. The
actual condition for a correctly closed session is SSL_SENT_SHUTDOWN
(according to the TLS RFC, it is acceptable to only send the ``close
notify'' alert but to not wait for the peer's answer, when the underlying
connection is closed). <CODE>SSL_set_shutdown()</CODE> can be used to set
this state without sending a close alert to the peer (see <A HREF="../ssl/SSL_shutdown.html#">SSL_shutdown(3)</A>).

</P>
<P>
If a ``close notify'' was received, SSL_RECEIVED_SHUTDOWN will be set, for
setting SSL_SENT_SHUTDOWN the application must however still call
<A HREF="../ssl/SSL_shutdown.html#">SSL_shutdown(3)</A> or <CODE>SSL_set_shutdown()</CODE> itself.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
<CODE>SSL_set_shutdown()</CODE> does not return diagnostic information.

</P>
<P>
<CODE>SSL_get_shutdown()</CODE> returns the current setting.

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../ssl/ssl.html#">ssl(3)</A>, <A HREF="../ssl/SSL_shutdown.html#">SSL_shutdown(3)</A>,
<A HREF="../ssl/SSL_CTX_set_quiet_shutdown.html#">SSL_CTX_set_quiet_shutdown(3)</A>,
<A HREF="../ssl/SSL_clear.html#">SSL_clear(3)</A>, <A HREF="../ssl/SSL_free.html#">SSL_free(3)</A>



</P>
:}


