# include "internal/quic_record_tx.h"
# include "internal/quic_wire.h"
# include "internal/quic_predef.h"
+# include "internal/qlog.h"
# include "internal/time.h"
# include "internal/thread.h"
int is_server;
SSL *tls;
+
+ /* Whether to use QLOG. */
+ int use_qlog;
} QUIC_CHANNEL_ARGS;
/* Represents the cause for a connection's termination. */
DEFINE_LHASH_OF_EX(QUIC_SRT_ELEM);
+QUIC_NEEDS_LOCK
+static QLOG *ch_get_qlog(QUIC_CHANNEL *ch)
+{
+#ifndef OPENSSL_NO_QLOG
+ QLOG_TRACE_INFO qti = {0};
+
+ if (ch->qlog != NULL)
+ return ch->qlog;
+
+ if (!ch->use_qlog)
+ return NULL;
+
+ qti.odcid = ch->init_dcid;
+ qti.title = NULL;
+ qti.description = NULL;
+ qti.group_id = NULL;
+ qti.is_server = ch->is_server;
+ qti.now_cb = get_time;
+ qti.now_cb_arg = ch;
+ if ((ch->qlog = ossl_qlog_new_from_env(&qti)) == NULL) {
+ ch->use_qlog = 0; /* don't try again */
+ return NULL;
+ }
+
+ return ch->qlog;
+#else
+ return NULL;
+#endif
+}
+
/*
* QUIC Channel Initialization and Teardown
* ========================================
ossl_list_ch_remove(&ch->port->channel_list, ch);
ch->on_port_list = 0;
}
+
+#ifndef OPENSSL_NO_QLOG
+ if (ch->qlog != NULL)
+ ossl_qlog_flush(ch->qlog); /* best effort */
+
+ ossl_qlog_free(ch->qlog);
+#endif
}
QUIC_CHANNEL *ossl_quic_channel_new(const QUIC_CHANNEL_ARGS *args)
ch->tls = args->tls;
ch->lcidm = args->lcidm;
ch->srtm = args->srtm;
+#ifndef OPENSSL_NO_QLOG
+ ch->use_qlog = args->use_qlog;
+#endif
if (!ch_init(ch)) {
OPENSSL_free(ch);
/* SRTM we register SRTs with. */
QUIC_SRTM *srtm;
+ /* Optional QLOG instance (or NULL). */
+ QLOG *qlog;
+
/*
* The transport parameter block we will send or have sent.
* Freed after sending or when connection is freed.
/* Are we on the QUIC_PORT linked list of channels? */
unsigned int on_port_list : 1;
+ /* Has QLOG been requested? */
+ unsigned int use_qlog : 1;
+
/* Saved error stack in case permanent error was encountered */
ERR_STATE *err_state;
QUIC_RAISE_NON_NORMAL_ERROR(NULL, ERR_R_INTERNAL_ERROR, NULL);
return 0;
}
+#ifndef OPENSSL_NO_QLOG
+ args.use_qlog = 1; /* disabled if env not set */
+#endif
port_args.channel_ctx = qc->ssl.ctx;
qc->port = ossl_quic_engine_create_port(qc->engine, &port_args);