session: api to add new transport types
Type: feature
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: If4dee6dba1ea942daa921d566b35cdecdda680ee
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 486c976..0a72f97 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -91,7 +91,7 @@
vlib_main_t *vm;
/** Per-proto vector of sessions to enqueue */
- u32 *session_to_enqueue[TRANSPORT_N_PROTO];
+ u32 **session_to_enqueue;
/** Context for session tx */
session_tx_context_t ctx;
@@ -158,6 +158,8 @@
* Trade memory for speed, for now */
u32 *session_type_to_next;
+ transport_proto_t last_transport_proto_type;
+
/*
* Config parameters
*/
@@ -203,6 +205,9 @@
#define SESSION_Q_PROCESS_FLUSH_FRAMES 1
#define SESSION_Q_PROCESS_STOP 2
+#define TRANSPORT_PROTO_INVALID (session_main.last_transport_proto_type + 1)
+#define TRANSPORT_N_PROTOS (session_main.last_transport_proto_type + 1)
+
static inline session_evt_elt_t *
session_evt_elt_alloc (session_worker_t * wrk)
{
@@ -459,9 +464,22 @@
void session_transport_reset_notify (transport_connection_t * tc);
int session_stream_accept (transport_connection_t * tc, u32 listener_index,
u32 thread_index, u8 notify);
+/**
+ * Initialize session layer for given transport proto and ip version
+ *
+ * Allocates per session type (transport proto + ip version) data structures
+ * and adds arc from session queue node to session type output node.
+ *
+ * @param transport_proto transport proto to be registered
+ * @param vft virtual function table for transport
+ * @param is_ip4 flag that indicates if transports uses ipv4
+ * as underlying network layer
+ * @param output_node output node for transport
+ */
void session_register_transport (transport_proto_t transport_proto,
const transport_proto_vft_t * vft, u8 is_ip4,
u32 output_node);
+transport_proto_t session_add_transport_proto (void);
int session_tx_fifo_peek_bytes (transport_connection_t * tc, u8 * buffer,
u32 offset, u32 max_bytes);
u32 session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes);