summaryrefslogtreecommitdiffstats
path: root/src/plugins/quic/quic.h
diff options
context:
space:
mode:
authorAloys Augustin <aloaugus@cisco.com>2019-04-09 11:36:40 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-04-16 17:54:24 +0000
commit39d04099467414175803273433c95a96c0276252 (patch)
treed1a0be5d758b4388316e6683d59c28d84b4b7c96 /src/plugins/quic/quic.h
parentb3b267cf59682560846847c96dbd62b453ad0d01 (diff)
QUIC: Initial multi stream support
To connect a stream, apps should call connect while passing the id of the QUIC connection in the new transport_opts field in session_endpoint_cfg_t. Apps are notified of new streams with their accept callback, which is called each time a peer opens a stream. Change-Id: I0f82ec344db58008d54641553eddec2973768435 Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
Diffstat (limited to 'src/plugins/quic/quic.h')
-rw-r--r--src/plugins/quic/quic.h57
1 files changed, 38 insertions, 19 deletions
diff --git a/src/plugins/quic/quic.h b/src/plugins/quic/quic.h
index 0c0147c6053..a4615946d94 100644
--- a/src/plugins/quic/quic.h
+++ b/src/plugins/quic/quic.h
@@ -22,10 +22,12 @@
#include <vppinfra/tw_timer_1t_3w_1024sl_ov.h>
#include <quicly.h>
+#include <quicly/streambuf.h>
-#define QUIC_DEBUG 1
-#define QUIC_DEBUG_LEVEL_CLIENT 0
-#define QUIC_DEBUG_LEVEL_SERVER 0
+
+#define QUIC_DEBUG 0
+#define QUIC_DEBUG_LEVEL_CLIENT 0
+#define QUIC_DEBUG_LEVEL_SERVER 0
#define QUIC_DEFAULT_CA_CERT_PATH "/etc/ssl/certs/ca-certificates.crt"
@@ -45,24 +47,41 @@
#define QUIC_CONN_STATE_HANDSHAKE 0
#define QUIC_CONN_STATE_READY 1
+enum quic_session_type_t
+{
+ QUIC_SESSION_TYPE_QUIC = 0,
+ QUIC_SESSION_TYPE_STREAM = 1,
+ QUIC_SESSION_TYPE_LISTEN = INT32_MAX,
+};
+
/* *INDENT-OFF* */
typedef CLIB_PACKED (struct quic_ctx_id_
{
- session_handle_t app_session;
- session_handle_t quic_session;
- u32 parent_app_wrk_idx;
+ u32 parent_app_wrk_id;
u32 parent_app_id;
- u32 listener_ctx_id;
- u32 timer_handle;
- quicly_conn_t *conn;
- u8 udp_is_ip4;
- u8 conn_state;
+ union {
+ CLIB_PACKED (struct {
+ session_handle_t quic_session_handle; // TODO: remove
+ session_handle_t udp_session_handle;
+ quicly_conn_t *conn;
+ u32 listener_ctx_id;
+ u8 udp_is_ip4;
+ });
+ CLIB_PACKED (struct {
+ session_handle_t stream_session_handle; // TODO: remove
+ quicly_stream_t *stream;
+ u32 quic_connection_ctx_id;
+ });
+ };
+ u8 is_stream;
}) 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
@@ -70,31 +89,33 @@ typedef struct quic_ctx_
transport_connection_t connection;
quic_ctx_id_t c_quic_ctx_id;
};
-
- quicly_stream_t *stream;
u8 *srv_hostname;
u32 client_opaque;
+ u32 timer_handle;
+ u8 conn_state;
u8 is_listener;
} quic_ctx_t;
+typedef struct quic_stream_data_
+{
+ quicly_streambuf_t streambuf;
+ u32 ctx_id;
+} quic_stream_data_t;
+
typedef struct quic_worker_ctx_
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
u32 time_now; /**< worker time */
tw_timer_wheel_1t_3w_1024sl_ov_t timer_wheel; /**< worker timer wheel */
- u32 *tx_buffers; /**< tx buffer free list */
} quic_worker_ctx_t;
typedef struct quic_main_
{
u32 app_index;
- quic_ctx_t *half_open_ctx_pool;
quic_ctx_t **ctx_pool;
- clib_rwlock_t half_open_rwlock;
quic_worker_ctx_t *wrk_ctx;
f64 tstamp_ticks_per_clock;
-
/*
* Config
*/
@@ -105,8 +126,6 @@ typedef struct quic_main_
char *ca_cert_path;
} quic_main_t;
-quic_main_t *vnet_quic_get_main (void);
-
#endif /* __included_quic_h__ */
/*