aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/quic/quic.h
diff options
context:
space:
mode:
authorAloys Augustin <aloaugus@cisco.com>2019-07-25 17:08:32 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-07-30 16:29:05 +0000
commit1c2af06852fb6d7788f0f4926d062c11e5869ead (patch)
tree43eb02a3137b7057f7f00ea0ed79835e2b7adeac /src/plugins/quic/quic.h
parentf25e7cfa5c615e1972d5823b65ca579f951d68a5 (diff)
quic: cleanup and refactorisation
Change-Id: I031a60ac010b55110f32f0a08e19b1156aeda268 Type: refactor Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
Diffstat (limited to 'src/plugins/quic/quic.h')
-rw-r--r--src/plugins/quic/quic.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/plugins/quic/quic.h b/src/plugins/quic/quic.h
index de27f2ac7d5..a7ce4dd57ad 100644
--- a/src/plugins/quic/quic.h
+++ b/src/plugins/quic/quic.h
@@ -83,37 +83,30 @@ typedef enum quic_ctx_flags_
QUIC_F_IS_LISTENER = (1 << 1),
} quic_ctx_flags_t;
-/* *INDENT-OFF* */
-typedef struct quic_ctx_id_
+/* This structure is used to implement the concept of VPP connection for QUIC.
+ * We create one per connection and one per stream. */
+typedef struct quic_ctx_
{
- union { /** QUIC ctx case */
- struct {
+ union
+ {
+ transport_connection_t connection;
+ struct
+ { /** QUIC ctx case */
quicly_conn_t *conn;
u32 listener_ctx_id;
u32 client_opaque;
u8 *srv_hostname;
u8 conn_state;
u8 udp_is_ip4;
+ u8 _qctx_end_marker; /* Leave this at the end */
};
- struct { /** STREAM ctx case */
+ struct
+ { /** STREAM ctx case */
quicly_stream_t *stream;
u32 quic_connection_ctx_id;
+ u8 _sctx_end_marker; /* Leave this at the end */
};
};
-} quic_ctx_id_t;
-/* *INDENT-ON* */
-
-STATIC_ASSERT (sizeof (quic_ctx_id_t) <= 42, "ctx id must be less than 42");
-
-/* This structure is used to implement the concept of VPP connection for QUIC.
- * We create one per connection and one per stream. */
-typedef struct quic_ctx_
-{
- union
- {
- transport_connection_t connection;
- quic_ctx_id_t c_quic_ctx_id;
- };
session_handle_t udp_session_handle;
u32 timer_handle;
u32 parent_app_wrk_id;
@@ -121,6 +114,17 @@ typedef struct quic_ctx_
u8 flags;
} quic_ctx_t;
+/* Make sure our custom fields don't overlap with the fields we use in
+ .connection
+*/
+STATIC_ASSERT (offsetof (quic_ctx_t, _qctx_end_marker) <=
+ TRANSPORT_CONN_ID_LEN,
+ "connection data must be less than TRANSPORT_CONN_ID_LEN bytes");
+STATIC_ASSERT (offsetof (quic_ctx_t, _sctx_end_marker) <=
+ TRANSPORT_CONN_ID_LEN,
+ "connection data must be less than TRANSPORT_CONN_ID_LEN bytes");
+
+
typedef struct quic_stream_data_
{
u32 ctx_id;