SSL_set_shutdown.pod 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. =pod
  2. =head1 NAME
  3. SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. void SSL_set_shutdown(SSL *ssl, int mode);
  7. int SSL_get_shutdown(const SSL *ssl);
  8. =head1 DESCRIPTION
  9. SSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>.
  10. SSL_get_shutdown() returns the shutdown mode of B<ssl>.
  11. =head1 NOTES
  12. The shutdown state of an ssl connection is a bit-mask of:
  13. =over 4
  14. =item Z<>0
  15. No shutdown setting, yet.
  16. =item SSL_SENT_SHUTDOWN
  17. A close_notify shutdown alert was sent to the peer, the connection is being
  18. considered closed and the session is closed and correct.
  19. =item SSL_RECEIVED_SHUTDOWN
  20. A shutdown alert was received form the peer, either a normal close_notify
  21. or a fatal error.
  22. =back
  23. SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.
  24. The shutdown state of the connection is used to determine the state of
  25. the ssl session. If the session is still open, when
  26. L<SSL_clear(3)> or L<SSL_free(3)> is called,
  27. it is considered bad and removed according to RFC2246.
  28. The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN
  29. (according to the TLS RFC, it is acceptable to only send the close_notify
  30. alert but to not wait for the peer's answer, when the underlying connection
  31. is closed).
  32. SSL_set_shutdown() can be used to set this state without sending a
  33. close alert to the peer (see L<SSL_shutdown(3)>).
  34. If a close_notify was received, SSL_RECEIVED_SHUTDOWN will be set,
  35. for setting SSL_SENT_SHUTDOWN the application must however still call
  36. L<SSL_shutdown(3)> or SSL_set_shutdown() itself.
  37. SSL_set_shutdown() is not supported for QUIC SSL objects.
  38. =head1 RETURN VALUES
  39. SSL_set_shutdown() does not return diagnostic information.
  40. SSL_get_shutdown() returns the current shutdown state as set or based
  41. on the actual connection state.
  42. SSL_get_shutdown() returns 0 if called on a QUIC stream SSL object. If it
  43. is called on a QUIC connection SSL object, it returns a value with
  44. SSL_SENT_SHUTDOWN set if CONNECTION_CLOSE has been sent to the peer and
  45. it returns a value with SSL_RECEIVED_SHUTDOWN set if CONNECTION_CLOSE
  46. has been received from the peer or the QUIC connection is fully terminated
  47. for other reasons.
  48. =head1 SEE ALSO
  49. L<ssl(7)>, L<SSL_shutdown(3)>,
  50. L<SSL_CTX_set_quiet_shutdown(3)>,
  51. L<SSL_clear(3)>, L<SSL_free(3)>
  52. =head1 COPYRIGHT
  53. Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
  54. Licensed under the Apache License 2.0 (the "License"). You may not use
  55. this file except in compliance with the License. You can obtain a copy
  56. in the file LICENSE in the source distribution or at
  57. L<https://www.openssl.org/source/license.html>.
  58. =cut