]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC TSERVER: Allow STOP_SENDING/RESET_STREAM to be queried
authorHugo Landau <hlandau@openssl.org>
Tue, 18 Apr 2023 18:30:56 +0000 (19:30 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 12 May 2023 13:47:13 +0000 (14:47 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20765)

include/internal/quic_tserver.h
ssl/quic/quic_tserver.c

index 662b1c09796e6cbdaddc20707db66c0d3502848d..a42bbaa6847d38cc655d2b494d0bddb96b540a11 100644 (file)
@@ -129,6 +129,22 @@ int ossl_quic_tserver_stream_new(QUIC_TSERVER *srv,
 
 BIO *ossl_quic_tserver_get0_rbio(QUIC_TSERVER *srv);
 
+/*
+ * Returns 1 if the peer has sent a STOP_SENDING frame for a stream.
+ * app_error_code is written if this returns 1.
+ */
+int ossl_quic_tserver_stream_has_peer_stop_sending(QUIC_TSERVER *srv,
+                                                   uint64_t stream_id,
+                                                   uint64_t *app_error_code);
+
+/*
+ * Returns 1 if the peer has sent a RESET_STREAM frame for a stream.
+ * app_error_code is written if this returns 1.
+ */
+int ossl_quic_tserver_stream_has_peer_reset_stream(QUIC_TSERVER *srv,
+                                                   uint64_t stream_id,
+                                                   uint64_t *app_error_code);
+
 # endif
 
 #endif
index 46d39c9d90fb894e7ba80604f49ee45ff4d3b4b1..cd24d5c59e87fb77511bbe3cac5593f96facecf9 100644 (file)
@@ -363,3 +363,37 @@ BIO *ossl_quic_tserver_get0_rbio(QUIC_TSERVER *srv)
 {
     return srv->args.net_rbio;
 }
+
+int ossl_quic_tserver_stream_has_peer_stop_sending(QUIC_TSERVER *srv,
+                                                   uint64_t stream_id,
+                                                   uint64_t *app_error_code)
+{
+    QUIC_STREAM *qs;
+
+    qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(srv->ch),
+                                        stream_id);
+    if (qs == NULL)
+        return 0;
+
+    if (qs->peer_stop_sending && app_error_code != NULL)
+        *app_error_code = qs->peer_stop_sending_aec;
+
+    return qs->peer_stop_sending;
+}
+
+int ossl_quic_tserver_stream_has_peer_reset_stream(QUIC_TSERVER *srv,
+                                                   uint64_t stream_id,
+                                                   uint64_t  *app_error_code)
+{
+    QUIC_STREAM *qs;
+
+    qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(srv->ch),
+                                        stream_id);
+    if (qs == NULL)
+        return 0;
+
+    if (qs->peer_reset_stream && app_error_code != NULL)
+        *app_error_code = qs->peer_reset_stream_aec;
+
+    return qs->peer_reset_stream;
+}