diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-07-26 18:10:16 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-08-10 18:19:45 +0100 |
commit | 40c8c756c86fc17751b989426aa66fb33319c4ca (patch) | |
tree | 77eae277108a725e7ea4d2b7c52cd4fb05f49d05 /include | |
parent | d56b81ac9f02dd55ecf3281d16fdb156897b4d8d (diff) |
QUIC APL/CHANNEL: Wire up connection closure reason
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21565)
Diffstat (limited to 'include')
-rw-r--r-- | include/internal/quic_channel.h | 18 | ||||
-rw-r--r-- | include/openssl/ssl.h.in | 8 |
2 files changed, 21 insertions, 5 deletions
diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index e36acb4eeb..2524a65fe7 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -149,6 +149,21 @@ typedef struct quic_terminate_cause_st { */ uint64_t frame_type; + /* + * Optional reason string. When calling ossl_quic_channel_local_close, if a + * reason string pointer is passed, it is copied and stored inside + * QUIC_CHANNEL for the remainder of the lifetime of the channel object. + * Thus the string pointed to by this value, if non-NULL, is valid for the + * lifetime of the QUIC_CHANNEL object. + */ + const char *reason; + + /* + * Length of reason in bytes. The reason is supposed to contain a UTF-8 + * string but may be arbitrary data if the reason came from the network. + */ + size_t reason_len; + /* Is this error code in the transport (0) or application (1) space? */ unsigned int app : 1; @@ -196,7 +211,8 @@ int ossl_quic_channel_set_mutator(QUIC_CHANNEL *ch, int ossl_quic_channel_start(QUIC_CHANNEL *ch); /* Start a locally initiated connection shutdown. */ -void ossl_quic_channel_local_close(QUIC_CHANNEL *ch, uint64_t app_error_code); +void ossl_quic_channel_local_close(QUIC_CHANNEL *ch, uint64_t app_error_code, + const char *app_reason); /* * Called when the handshake is confirmed. diff --git a/include/openssl/ssl.h.in b/include/openssl/ssl.h.in index beedd8956d..66ebaa4784 100644 --- a/include/openssl/ssl.h.in +++ b/include/openssl/ssl.h.in @@ -2339,10 +2339,10 @@ __owur int SSL_get_stream_read_error_code(SSL *ssl, uint64_t *app_error_code); __owur int SSL_get_stream_write_error_code(SSL *ssl, uint64_t *app_error_code); typedef struct ssl_conn_close_info_st { - uint64_t error_code; - char *reason; - size_t reason_len; - int is_local, is_transport; + uint64_t error_code; + const char *reason; + size_t reason_len; + int is_local, is_transport; } SSL_CONN_CLOSE_INFO; __owur int SSL_get_conn_close_info(SSL *ssl, |