aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2024-02-12 09:49:32 +0000
committerTomas Mraz <tomas@openssl.org>2024-02-19 10:15:46 +0100
commit410270d1ac7f9a089d63d68be2e7c714045191fc (patch)
tree62a61e6bb2065870989da93585af860b95927737
parent4a2e39dc1ce52bbee6571f48548a47f04bd857b4 (diff)
downloadopenssl-410270d1ac7f9a089d63d68be2e7c714045191fc.tar.gz
QUIC FIFD: Allow QLOG instance retrieval via callback
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23535)
-rw-r--r--include/internal/quic_fifd.h9
-rw-r--r--ssl/quic/quic_fifd.c22
-rw-r--r--test/quic_fifd_test.c2
3 files changed, 24 insertions, 9 deletions
diff --git a/include/internal/quic_fifd.h b/include/internal/quic_fifd.h
index 0f5462c2a3..a0354bdf78 100644
--- a/include/internal/quic_fifd.h
+++ b/include/internal/quic_fifd.h
@@ -46,7 +46,8 @@ struct quic_fifd_st {
void (*sstream_updated)(uint64_t stream_id,
void *arg);
void *sstream_updated_arg;
- QLOG *qlog;
+ QLOG *(*get_qlog_cb)(void *arg);
+ void *get_qlog_cb_arg;
};
int ossl_quic_fifd_init(QUIC_FIFD *fifd,
@@ -72,13 +73,15 @@ int ossl_quic_fifd_init(QUIC_FIFD *fifd,
void (*sstream_updated)(uint64_t stream_id,
void *arg),
void *sstream_updated_arg,
- QLOG *qlog);
+ QLOG *(*get_qlog_cb)(void *arg),
+ void *get_qlog_cb_arg);
void ossl_quic_fifd_cleanup(QUIC_FIFD *fifd); /* (no-op) */
int ossl_quic_fifd_pkt_commit(QUIC_FIFD *fifd, QUIC_TXPIM_PKT *pkt);
-void ossl_quic_fifd_set0_qlog(QUIC_FIFD *fifd, QLOG *qlog);
+void ossl_quic_fifd_set_qlog_cb(QUIC_FIFD *fifd, QLOG *(*get_qlog_cb)(void *arg),
+ void *arg);
# endif
diff --git a/ssl/quic/quic_fifd.c b/ssl/quic/quic_fifd.c
index 0abc8cb628..89e0c3ca01 100644
--- a/ssl/quic/quic_fifd.c
+++ b/ssl/quic/quic_fifd.c
@@ -36,7 +36,8 @@ int ossl_quic_fifd_init(QUIC_FIFD *fifd,
void (*sstream_updated)(uint64_t stream_id,
void *arg),
void *sstream_updated_arg,
- QLOG *qlog)
+ QLOG *(*get_qlog_cb)(void *arg),
+ void *get_qlog_cb_arg)
{
if (cfq == NULL || ackm == NULL || txpim == NULL
|| get_sstream_by_id == NULL || regen_frame == NULL)
@@ -53,7 +54,8 @@ int ossl_quic_fifd_init(QUIC_FIFD *fifd,
fifd->confirm_frame_arg = confirm_frame_arg;
fifd->sstream_updated = sstream_updated;
fifd->sstream_updated_arg = sstream_updated_arg;
- fifd->qlog = qlog;
+ fifd->get_qlog_cb = get_qlog_cb;
+ fifd->get_qlog_cb_arg = get_qlog_cb_arg;
return 1;
}
@@ -110,6 +112,14 @@ static void on_acked(void *arg)
ossl_quic_txpim_pkt_release(fifd->txpim, pkt);
}
+static QLOG *fifd_get_qlog(QUIC_FIFD *fifd)
+{
+ if (fifd->get_qlog_cb == NULL)
+ return NULL;
+
+ return fifd->get_qlog_cb(fifd->get_qlog_cb_arg);
+}
+
static void on_lost(void *arg)
{
QUIC_TXPIM_PKT *pkt = arg;
@@ -120,7 +130,7 @@ static void on_lost(void *arg)
QUIC_CFQ_ITEM *cfq_item, *cfq_item_next;
int sstream_updated;
- ossl_qlog_event_recovery_packet_lost(fifd->qlog, pkt);
+ ossl_qlog_event_recovery_packet_lost(fifd_get_qlog(fifd), pkt);
/* STREAM and CRYPTO stream chunks, FIN and stream FC frames */
for (i = 0; i < num_chunks; ++i) {
@@ -294,7 +304,9 @@ int ossl_quic_fifd_pkt_commit(QUIC_FIFD *fifd, QUIC_TXPIM_PKT *pkt)
return ossl_ackm_on_tx_packet(fifd->ackm, &pkt->ackm_pkt);
}
-void ossl_quic_fifd_set0_qlog(QUIC_FIFD *fifd, QLOG *qlog)
+void ossl_quic_fifd_set_qlog_cb(QUIC_FIFD *fifd, QLOG *(*get_qlog_cb)(void *arg),
+ void *get_qlog_cb_arg)
{
- fifd->qlog = qlog;
+ fifd->get_qlog_cb = get_qlog_cb;
+ fifd->get_qlog_cb_arg = get_qlog_cb_arg;
}
diff --git a/test/quic_fifd_test.c b/test/quic_fifd_test.c
index e560e5a253..6a70843ceb 100644
--- a/test/quic_fifd_test.c
+++ b/test/quic_fifd_test.c
@@ -339,7 +339,7 @@ static int test_fifd(int idx)
regen_frame, NULL,
confirm_frame, NULL,
sstream_updated, NULL,
- NULL)))
+ NULL, NULL)))
goto err;
for (i = 0; i < OSSL_NELEM(info.sstream); ++i)