SSL_set_shutdown.3ossl 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "SSL_SET_SHUTDOWN 3ossl"
  58. .TH SSL_SET_SHUTDOWN 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. SSL_set_shutdown, SSL_get_shutdown \- manipulate shutdown state of an SSL connection
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. .Vb 1
  68. \& #include <openssl/ssl.h>
  69. \&
  70. \& void SSL_set_shutdown(SSL *ssl, int mode);
  71. \&
  72. \& int SSL_get_shutdown(const SSL *ssl);
  73. .Ve
  74. .SH DESCRIPTION
  75. .IX Header "DESCRIPTION"
  76. \&\fBSSL_set_shutdown()\fR sets the shutdown state of \fBssl\fR to \fBmode\fR.
  77. .PP
  78. \&\fBSSL_get_shutdown()\fR returns the shutdown mode of \fBssl\fR.
  79. .SH NOTES
  80. .IX Header "NOTES"
  81. The shutdown state of an ssl connection is a bit-mask of:
  82. .IP 0 4
  83. No shutdown setting, yet.
  84. .IP SSL_SENT_SHUTDOWN 4
  85. .IX Item "SSL_SENT_SHUTDOWN"
  86. A close_notify shutdown alert was sent to the peer, the connection is being
  87. considered closed and the session is closed and correct.
  88. .IP SSL_RECEIVED_SHUTDOWN 4
  89. .IX Item "SSL_RECEIVED_SHUTDOWN"
  90. A shutdown alert was received form the peer, either a normal close_notify
  91. or a fatal error.
  92. .PP
  93. SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.
  94. .PP
  95. The shutdown state of the connection is used to determine the state of
  96. the ssl session. If the session is still open, when
  97. \&\fBSSL_clear\fR\|(3) or \fBSSL_free\fR\|(3) is called,
  98. it is considered bad and removed according to RFC2246.
  99. The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN
  100. (according to the TLS RFC, it is acceptable to only send the close_notify
  101. alert but to not wait for the peer's answer, when the underlying connection
  102. is closed).
  103. \&\fBSSL_set_shutdown()\fR can be used to set this state without sending a
  104. close alert to the peer (see \fBSSL_shutdown\fR\|(3)).
  105. .PP
  106. If a close_notify was received, SSL_RECEIVED_SHUTDOWN will be set,
  107. for setting SSL_SENT_SHUTDOWN the application must however still call
  108. \&\fBSSL_shutdown\fR\|(3) or \fBSSL_set_shutdown()\fR itself.
  109. .PP
  110. \&\fBSSL_set_shutdown()\fR is not supported for QUIC SSL objects.
  111. .SH "RETURN VALUES"
  112. .IX Header "RETURN VALUES"
  113. \&\fBSSL_set_shutdown()\fR does not return diagnostic information.
  114. .PP
  115. \&\fBSSL_get_shutdown()\fR returns the current shutdown state as set or based
  116. on the actual connection state.
  117. .PP
  118. \&\fBSSL_get_shutdown()\fR returns 0 if called on a QUIC stream SSL object. If it
  119. is called on a QUIC connection SSL object, it returns a value with
  120. SSL_SENT_SHUTDOWN set if CONNECTION_CLOSE has been sent to the peer and
  121. it returns a value with SSL_RECEIVED_SHUTDOWN set if CONNECTION_CLOSE
  122. has been received from the peer or the QUIC connection is fully terminated
  123. for other reasons.
  124. .SH "SEE ALSO"
  125. .IX Header "SEE ALSO"
  126. \&\fBssl\fR\|(7), \fBSSL_shutdown\fR\|(3),
  127. \&\fBSSL_CTX_set_quiet_shutdown\fR\|(3),
  128. \&\fBSSL_clear\fR\|(3), \fBSSL_free\fR\|(3)
  129. .SH COPYRIGHT
  130. .IX Header "COPYRIGHT"
  131. Copyright 2001\-2023 The OpenSSL Project Authors. All Rights Reserved.
  132. .PP
  133. Licensed under the Apache License 2.0 (the "License"). You may not use
  134. this file except in compliance with the License. You can obtain a copy
  135. in the file LICENSE in the source distribution or at
  136. <https://www.openssl.org/source/license.html>.