SSL_get_conn_close_info.pod 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. =pod
  2. =head1 NAME
  3. SSL_get_conn_close_info, SSL_CONN_CLOSE_FLAG_LOCAL,
  4. SSL_CONN_CLOSE_FLAG_TRANSPORT - get information about why a QUIC connection was
  5. closed
  6. =head1 SYNOPSIS
  7. #include <openssl/ssl.h>
  8. #define SSL_CONN_CLOSE_FLAG_LOCAL
  9. #define SSL_CONN_CLOSE_FLAG_TRANSPORT
  10. typedef struct ssl_conn_close_info_st {
  11. uint64_t error_code, frame_type;
  12. char *reason;
  13. size_t reason_len;
  14. uint32_t flags;
  15. } SSL_CONN_CLOSE_INFO;
  16. int SSL_get_conn_close_info(SSL *ssl, SSL_CONN_CLOSE_INFO *info,
  17. size_t info_len);
  18. =head1 DESCRIPTION
  19. The SSL_get_conn_close_info() function provides information about why and how a
  20. QUIC connection was closed.
  21. Connection closure information is written to I<*info>, which must be non-NULL.
  22. I<info_len> must be set to C<sizeof(*info)>.
  23. The following fields are set:
  24. =over 4
  25. =item I<error_code>
  26. This is a 62-bit QUIC error code. It is either a 62-bit application error code
  27. (if B<SSL_CONN_CLOSE_FLAG_TRANSPORT> not set in I<flags>) or a 62-bit standard
  28. QUIC transport error code (if B<SSL_CONN_CLOSE_FLAG_TRANSPORT> is set in
  29. I<flags>).
  30. =item I<frame_type>
  31. If B<SSL_CONN_CLOSE_FLAG_TRANSPORT> is set, this may be set to a QUIC frame type
  32. number which caused the connection to be closed. It may also be set to 0 if no
  33. frame type was specified as causing the connection to be closed. If
  34. B<SSL_CONN_CLOSE_FLAG_TRANSPORT> is not set, this is set to 0.
  35. =item I<reason>
  36. If non-NULL, this is intended to be a UTF-8 textual string briefly describing
  37. the reason for connection closure. The length of the reason string in bytes is
  38. given in I<reason_len>. While, if non-NULL, OpenSSL guarantees that this string
  39. will be zero terminated, consider that this buffer may originate from the
  40. (untrusted) peer and thus may also contain zero bytes elsewhere. Therefore, use
  41. of I<reason_len> is recommended.
  42. While it is intended as per the QUIC protocol that this be a UTF-8 string, there
  43. is no guarantee that this is the case for strings received from the peer.
  44. =item B<SSL_CONN_CLOSE_FLAG_LOCAL>
  45. If I<flags> has B<SSL_CONN_CLOSE_FLAG_LOCAL> set, connection closure was locally
  46. triggered. This could be due to an application request (e.g. if
  47. B<SSL_CONN_CLOSE_FLAG_TRANSPORT> is unset), or (if
  48. I<SSL_CONN_CLOSE_FLAG_TRANSPORT> is set) due to logic internal to the QUIC
  49. implementation (for example, if the peer engages in a protocol violation, or an
  50. idle timeout occurs).
  51. If unset, connection closure was remotely triggered.
  52. =item B<SSL_CONN_CLOSE_FLAG_TRANSPORT>
  53. If I<flags> has B<SSL_CONN_CLOSE_FLAG_TRANSPORT> set, connection closure was
  54. triggered for QUIC protocol reasons. Otherwise, connection closure was triggered
  55. by the local or remote application.
  56. =back
  57. =head1 RETURN VALUES
  58. SSL_get_conn_close_info() returns 1 on success and 0 on failure. This function
  59. fails if called on a QUIC connection SSL object which has not yet been
  60. terminated. It also fails if called on a QUIC stream SSL object or a non-QUIC
  61. SSL object.
  62. =head1 SEE ALSO
  63. L<SSL_shutdown_ex(3)>
  64. =head1 HISTORY
  65. This function was added in OpenSSL 3.2.
  66. =head1 COPYRIGHT
  67. Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.
  68. Licensed under the Apache License 2.0 (the "License"). You may not use
  69. this file except in compliance with the License. You can obtain a copy
  70. in the file LICENSE in the source distribution or at
  71. L<https://www.openssl.org/source/license.html>.
  72. =cut