summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-04-18 19:30:54 +0100
committerHugo Landau <hlandau@openssl.org>2023-05-12 14:47:11 +0100
commitf20fdd16d817a095f58f9c016044abef24e50e58 (patch)
tree24d8ac2709db424c03f1825f02a9ab4ba25a25c7 /include
parent2dbc39deacf9d5850eecef515cbc50331750dd22 (diff)
downloadopenssl-new-f20fdd16d817a095f58f9c016044abef24e50e58.tar.gz
QUIC CHANNEL: Handle incoming remotely-created streams
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
Diffstat (limited to 'include')
-rw-r--r--include/internal/quic_channel.h13
-rw-r--r--include/internal/quic_stream_map.h27
2 files changed, 37 insertions, 3 deletions
diff --git a/include/internal/quic_channel.h b/include/internal/quic_channel.h
index 7ccf6e0bb2..084c465c3a 100644
--- a/include/internal/quic_channel.h
+++ b/include/internal/quic_channel.h
@@ -273,9 +273,18 @@ CRYPTO_MUTEX *ossl_quic_channel_get_mutex(QUIC_CHANNEL *ch);
/*
* Creates a new locally-initiated stream in the stream mapper, choosing an
* appropriate stream ID. If is_uni is 1, creates a unidirectional stream, else
- * creates a bidirectional stream.
+ * creates a bidirectional stream. Returns NULL on failure.
*/
-QUIC_STREAM *ossl_quic_channel_new_stream(QUIC_CHANNEL *ch, int is_uni);
+QUIC_STREAM *ossl_quic_channel_new_stream_local(QUIC_CHANNEL *ch, int is_uni);
+
+/*
+ * Creates a new remotely-initiated stream in the stream mapper. The stream ID
+ * is used to confirm the initiator and determine the stream type. The stream is
+ * automatically added to the QSM's accept queue. A pointer to the stream is
+ * also returned. Returns NULL on failure.
+ */
+QUIC_STREAM *ossl_quic_channel_new_stream_remote(QUIC_CHANNEL *ch,
+ uint64_t stream_id);
# endif
diff --git a/include/internal/quic_stream_map.h b/include/internal/quic_stream_map.h
index 0bdd7e88cf..78ec703fbc 100644
--- a/include/internal/quic_stream_map.h
+++ b/include/internal/quic_stream_map.h
@@ -36,6 +36,7 @@ struct quic_stream_list_node_st {
struct quic_stream_st {
QUIC_STREAM_LIST_NODE active_node; /* for use by QUIC_STREAM_MAP */
+ QUIC_STREAM_LIST_NODE accept_node; /* accept queue of remotely-created streams */
/* Temporary link used by TXP. */
QUIC_STREAM *txp_next;
@@ -132,7 +133,8 @@ int ossl_quic_stream_reset(QUIC_STREAM *s, uint64_t aec);
typedef struct quic_stream_map_st {
LHASH_OF(QUIC_STREAM) *map;
QUIC_STREAM_LIST_NODE active_list;
- size_t rr_stepping, rr_counter;
+ QUIC_STREAM_LIST_NODE accept_list;
+ size_t rr_stepping, rr_counter, num_accept;
QUIC_STREAM *rr_cur;
uint64_t (*get_stream_limit_cb)(int uni, void *arg);
void *get_stream_limit_cb_arg;
@@ -232,6 +234,29 @@ void ossl_quic_stream_map_update_state(QUIC_STREAM_MAP *qsm, QUIC_STREAM *s);
void ossl_quic_stream_map_set_rr_stepping(QUIC_STREAM_MAP *qsm, size_t stepping);
/*
+ * Adds a stream to the accept queue.
+ */
+void ossl_quic_stream_map_push_accept_queue(QUIC_STREAM_MAP *qsm,
+ QUIC_STREAM *s);
+
+/*
+ * Returns the next item to be popped from the accept queue, or NULL if it is
+ * empty.
+ */
+QUIC_STREAM *ossl_quic_stream_map_peek_accept_queue(QUIC_STREAM_MAP *qsm);
+
+/*
+ * Removes a stream from the accept queue.
+ *
+ * Precondition: s is in the accept queue.
+ */
+void ossl_quic_stream_map_remove_from_accept_queue(QUIC_STREAM_MAP *qsm,
+ QUIC_STREAM *s);
+
+/* Returns the length of the accept queue. */
+size_t ossl_quic_stream_map_get_accept_queue_len(QUIC_STREAM_MAP *qsm);
+
+/*
* QUIC Stream Iterator
* ====================
*