MINOR: mux-quic: add trace event for frame sending
Define a new qmux event QMUX_EV_SEND_FRM. This allows to pass a
quic_frame as an extra argument. Depending on the frame type, a special
format can be used to log the frame content.
Currently this event is only used in qc_send_max_streams. Thus the
handler is only able to handle MAX_STREAMS frames.
diff --git a/src/mux_quic.c b/src/mux_quic.c
index 8496df7..2d8addb 100644
--- a/src/mux_quic.c
+++ b/src/mux_quic.c
@@ -46,6 +46,8 @@
{ .mask = QMUX_EV_STRM_SEND, .name = "strm_send", .desc = "sending data for stream" },
#define QMUX_EV_STRM_END (1ULL << 12)
{ .mask = QMUX_EV_STRM_END, .name = "strm_end", .desc = "detaching app-layer stream" },
+#define QMUX_EV_SEND_FRM (1ULL << 13)
+ { .mask = QMUX_EV_SEND_FRM, .name = "send_frm", .desc = "sending QUIC frame" },
{ }
};
@@ -813,6 +815,7 @@
frm->type = QUIC_FT_MAX_STREAMS_BIDI;
frm->max_streams_bidi.max_streams = qcc->lfctl.ms_bidi +
qcc->lfctl.cl_bidi_r;
+ TRACE_DEVEL("sending MAX_STREAMS frame", QMUX_EV_SEND_FRM, qcc->conn, NULL, frm);
LIST_APPEND(&frms, &frm->list);
if (qc_send_frames(qcc, &frms))
@@ -1140,6 +1143,24 @@
}
+static void qmux_trace_frm(const struct quic_frame *frm)
+{
+ switch (frm->type) {
+ case QUIC_FT_MAX_STREAMS_BIDI:
+ chunk_appendf(&trace_buf, " max_streams=%lu",
+ frm->max_streams_bidi.max_streams);
+ break;
+
+ case QUIC_FT_MAX_STREAMS_UNI:
+ chunk_appendf(&trace_buf, " max_streams=%lu",
+ frm->max_streams_uni.max_streams);
+ break;
+
+ default:
+ break;
+ }
+}
+
/* quic-mux trace handler */
static void qmux_trace(enum trace_level level, uint64_t mask,
const struct trace_source *src,
@@ -1163,6 +1184,9 @@
const uint64_t *id = a3;
chunk_appendf(&trace_buf, " id=%lu", *id);
}
+
+ if (mask & QMUX_EV_SEND_FRM)
+ qmux_trace_frm(a3);
}
}