summaryrefslogtreecommitdiffstats
path: root/src/plugins/quic
diff options
context:
space:
mode:
authorAloys Augustin <aloaugus@cisco.com>2019-04-08 17:54:39 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-04-24 17:54:38 +0000
commitcdb7170ab44affe51c574eb2218744fff1bdd369 (patch)
tree56b852f5a203f96126df528198324baaead9317e /src/plugins/quic
parent689f5b5425ea0f179f7c5400e79440927b10198c (diff)
Add get_endpoint in transport vft
This allows QUIC & TLS specific logic to be implemented, and meaningfull IP/port to be returned when connection is overridden. Change-Id: Id79c59fe4d7b16d36f0e96ad3e281c4026b5fe65 Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
Diffstat (limited to 'src/plugins/quic')
-rw-r--r--src/plugins/quic/quic.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index a2aa17a3ca8..c066b0d955e 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1620,6 +1620,40 @@ quic_app_rx_callback (session_t * udp_session)
return 0;
}
+always_inline void
+quic_common_get_transport_endpoint (quic_ctx_t * ctx, ip46_address_t * ip,
+ u16 * port, u8 * is_ip4, u8 is_lcl)
+{
+ session_t *udp_session;
+ QUIC_DBG (2, "Called quic_get_transport_endpoint");
+ if (ctx->c_quic_ctx_id.is_stream)
+ *is_ip4 = 255; /* well this is ugly */
+ else
+ {
+ udp_session =
+ session_get_from_handle (ctx->c_quic_ctx_id.udp_session_handle);
+ session_get_endpoint (udp_session, ip, port, is_ip4, is_lcl);
+ }
+}
+
+static void
+quic_get_transport_listener_endpoint (u32 listener_index, ip46_address_t * ip,
+ u16 * port, u8 * is_ip4, u8 is_lcl)
+{
+ quic_ctx_t *ctx;
+ ctx = quic_ctx_get (listener_index);
+ quic_common_get_transport_endpoint (ctx, ip, port, is_ip4, is_lcl);
+}
+
+static void
+quic_get_transport_endpoint (u32 ctx_index, u32 thread_index,
+ ip46_address_t * ip, u16 * port, u8 * is_ip4,
+ u8 is_lcl)
+{
+ quic_ctx_t *ctx;
+ ctx = quic_ctx_get_w_thread (ctx_index, thread_index);
+ quic_common_get_transport_endpoint (ctx, ip, port, is_ip4, is_lcl);
+}
/*****************************************************************************
* END TRANSPORT PROTO FUNCTIONS
@@ -1650,6 +1684,8 @@ const static transport_proto_vft_t quic_proto = {
.format_connection = format_quic_connection,
.format_half_open = format_quic_half_open,
.format_listener = format_quic_listener,
+ .get_transport_endpoint = quic_get_transport_endpoint,
+ .get_transport_listener_endpoint = quic_get_transport_listener_endpoint,
};
/* *INDENT-ON* */