QLOG: Events: Implement connectivity:connection_started
authorHugo Landau <hlandau@openssl.org>
Fri, 8 Sep 2023 11:21:47 +0000 (12:21 +0100)
committerHugo Landau <hlandau@openssl.org>
Fri, 2 Feb 2024 11:49:34 +0000 (11:49 +0000)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22037)

include/internal/qlog_event_helpers.h [new file with mode: 0644]
include/internal/qlog_events.h
ssl/quic/build.info
ssl/quic/qlog_event_helpers.c [new file with mode: 0644]
ssl/quic/quic_channel.c

diff --git a/include/internal/qlog_event_helpers.h b/include/internal/qlog_event_helpers.h
new file mode 100644 (file)
index 0000000..e26f420
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OSSL_QLOG_EVENT_HELPERS_H
+# define OSSL_QLOG_EVENT_HELPERS_H
+
+# include <openssl/ssl.h>
+# include "internal/qlog.h"
+# include "internal/quic_types.h"
+
+/* connectivity:connection_started */
+void ossl_qlog_event_connectivity_connection_started(QLOG *qlog,
+                                                     const QUIC_CONN_ID *init_dcid);
+
+#endif
index efaec6cc497e65fdf4a2f8c16910ff0eeaa853a3..d9542d9f5adcb8a1f3251d2e9e9cbe818bf489e3 100644 (file)
@@ -6,3 +6,4 @@
  * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
  */
+QLOG_EVENT(connectivity, connection_started)
index ec31f25306fc1c672aa4eb0f54d1b178cd63f079..231e6bc4e8816e9a99d399b43318f07df6fb157e 100644 (file)
@@ -17,6 +17,7 @@ SOURCE[$LIBSSL]=quic_trace.c
 SOURCE[$LIBSSL]=quic_srtm.c quic_srt_gen.c
 SOURCE[$LIBSSL]=quic_lcidm.c quic_rcidm.c
 SOURCE[$LIBSSL]=quic_types.c
+SOURCE[$LIBSSL]=qlog_event_helpers.c
 IF[{- !$disabled{qlog} -}]
   SOURCE[$LIBSSL]=json_enc.c qlog.c
   SHARED_SOURCE[$LIBSSL]=../../crypto/getenv.c
diff --git a/ssl/quic/qlog_event_helpers.c b/ssl/quic/qlog_event_helpers.c
new file mode 100644 (file)
index 0000000..0cbd616
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include "internal/qlog_event_helpers.h"
+#include "internal/common.h"
+#include "internal/quic_channel.h"
+
+void ossl_qlog_event_connectivity_connection_started(QLOG *qlog,
+                                                     const QUIC_CONN_ID *init_dcid)
+{
+#ifndef OPENSSL_NO_QLOG
+    QLOG_EVENT_BEGIN(qlog, connectivity, connection_started)
+        QLOG_STR("protocol", "quic");
+        QLOG_CID("dst_cid", init_dcid);
+    QLOG_EVENT_END()
+#endif
+}
index eb731f2c531eb4e1c3ce97327a04eb3a5fb93f8b..5b1610ee40857151ce42b06bcb510a290c50f25f 100644 (file)
@@ -14,6 +14,7 @@
 #include "internal/quic_rx_depack.h"
 #include "internal/quic_lcidm.h"
 #include "internal/quic_srtm.h"
+#include "internal/qlog_event_helpers.h"
 #include "../ssl_local.h"
 #include "quic_channel_local.h"
 #include "quic_port_local.h"
@@ -2451,6 +2452,9 @@ int ossl_quic_channel_start(QUIC_CHANNEL *ch)
     ch->state                   = QUIC_CHANNEL_STATE_ACTIVE;
     ch->doing_proactive_ver_neg = 0; /* not currently supported */
 
+    ossl_qlog_event_connectivity_connection_started(ch_get_qlog(ch),
+                                                    &ch->init_dcid);
+
     /* Handshake layer: start (e.g. send CH). */
     if (!ch_tick_tls(ch, /*channel_only=*/0))
         return 0;