diff options
Diffstat (limited to 'include/internal')
-rw-r--r-- | include/internal/quic_channel.h | 37 | ||||
-rw-r--r-- | include/internal/quic_tserver.h | 7 |
2 files changed, 40 insertions, 4 deletions
diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h index a4039d8c02..4048bcd9c9 100644 --- a/include/internal/quic_channel.h +++ b/include/internal/quic_channel.h @@ -64,6 +64,34 @@ typedef struct quic_channel_args_st { typedef struct quic_channel_st QUIC_CHANNEL; +/* Represents the cause for a connection's termination. */ +typedef struct quic_terminate_cause_st { + /* + * If we are in a TERMINATING or TERMINATED state, this is the error code + * associated with the error. This field is valid iff we are in the + * TERMINATING or TERMINATED states. + */ + uint64_t error_code; + + /* + * If terminate_app is set and this is nonzero, this is the frame type which + * caused the connection to be terminated. + */ + uint64_t frame_type; + + /* Is this error code in the transport (0) or application (1) space? */ + unsigned int app : 1; + + /* + * If set, the cause of the termination is a received CONNECTION_CLOSE + * frame. Otherwise, we decided to terminate ourselves and sent a + * CONNECTION_CLOSE frame (regardless of whether the peer later also sends + * one). + */ + unsigned int remote : 1; +} QUIC_TERMINATE_CAUSE; + + /* * Create a new QUIC channel using the given arguments. The argument structure * does not need to remain allocated. Returns NULL on failure. @@ -158,9 +186,12 @@ QUIC_STREAM *ossl_quic_channel_get_stream_by_id(QUIC_CHANNEL *ch, uint64_t stream_id); /* Returns 1 if channel is terminating or terminated. */ -int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch); -int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch); -int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch); +int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch, + QUIC_TERMINATE_CAUSE *cause); +int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch, + QUIC_TERMINATE_CAUSE *cause); +int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch, + QUIC_TERMINATE_CAUSE *cause); int ossl_quic_channel_is_active(const QUIC_CHANNEL *ch); int ossl_quic_channel_is_handshake_complete(const QUIC_CHANNEL *ch); diff --git a/include/internal/quic_tserver.h b/include/internal/quic_tserver.h index 0d564d8c21..cd26c81042 100644 --- a/include/internal/quic_tserver.h +++ b/include/internal/quic_tserver.h @@ -12,6 +12,7 @@ # include <openssl/ssl.h> # include "internal/quic_stream.h" +# include "internal/quic_channel.h" # ifndef OPENSSL_NO_QUIC @@ -54,8 +55,12 @@ int ossl_quic_tserver_tick(QUIC_TSERVER *srv); int ossl_quic_tserver_is_connected(QUIC_TSERVER *srv); /* Returns 1 if the server is in any terminating or terminated state */ -int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv); +int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv, + QUIC_TERMINATE_CAUSE *cause); +/* Returns 1 if the server is in a terminated state */ +int ossl_quic_tserver_is_terminated(QUIC_TSERVER *srv, + QUIC_TERMINATE_CAUSE *cause); /* * Attempts to read from stream 0. Writes the number of bytes read to * *bytes_read and returns 1 on success. If no bytes are available, 0 is written |