aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMathiasRaoul <mathias.raoul@gmail.com>2019-09-26 09:17:13 +0000
committerDave Wallace <dwallacelf@gmail.com>2019-10-01 23:43:06 +0000
commitdd4d8ac29202fe54e74a13ce86d1ba3f79d1555f (patch)
tree339b1ee334de973ce29b813005fa401055748919 /src
parentff1f6faaa90cd446545a8d0c0b0baa85d69efa35 (diff)
quic: Create custom event logger
Type: feature Change-Id: I20acfe6a53cf9f15e3e4b8847b6f76757962f1c7 Signed-off-by: MathiasRaoul <mathias.raoul@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/quic/quic.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 3d0da256fb6..4aaed1a4ec2 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -237,6 +237,43 @@ quic_increment_counter (u8 evt, u8 val)
vlib_node_increment_counter (vm, quic_input_node.index, evt, val);
}
+struct st_quic_event_log_t
+{
+ quicly_event_logger_t super;
+};
+
+void
+quic_event_log (quicly_event_logger_t * _self, quicly_event_type_t type,
+ const quicly_event_attribute_t * attributes,
+ size_t num_attributes)
+{
+ if (type == QUICLY_EVENT_TYPE_PACKET_LOST)
+ {
+ QUIC_DBG (1, "QUIC packet loss");
+ quic_increment_counter (QUIC_ERROR_PACKET_DROP, 1);
+ }
+}
+
+quicly_event_logger_t *
+quic_new_event_logger ()
+{
+ struct st_quic_event_log_t *self;
+
+ if ((self = clib_mem_alloc (sizeof (*self))) == NULL)
+ return NULL;
+ /* *INDENT-OFF* */
+ *self = (struct st_quic_event_log_t) {{quic_event_log}};
+ /* *INDENT-ON* */
+ return &self->super;
+}
+
+void
+quic_free_event_logger (quicly_event_logger_t * _self)
+{
+ struct st_quicly_default_event_log_t *self = (void *) _self;
+ clib_mem_free (self);
+}
+
/**
* Called when quicly return an error
* This function interacts tightly with quic_proto_on_close
@@ -935,8 +972,8 @@ quic_store_quicly_ctx (application_t * app, u8 is_client)
quicly_ctx->now = &quicly_vpp_now_cb;
quicly_amend_ptls_context (quicly_ctx->tls);
- quicly_ctx->event_log.mask = 0; /* logs */
- quicly_ctx->event_log.cb = quicly_new_default_event_logger (stderr);
+ quicly_ctx->event_log.mask = UINT64_MAX; /* logs */
+ quicly_ctx->event_log.cb = quic_new_event_logger ();
quicly_ctx->transport_params.max_data = QUIC_INT_MAX;
quicly_ctx->transport_params.max_streams_uni = (uint64_t) 1 << 60;