diff options
author | Florin Coras <fcoras@cisco.com> | 2020-03-13 04:44:51 +0000 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-03-25 18:56:27 +0000 |
commit | 07063b8ea39b05d5d7bb00ad2a2363b11792c571 (patch) | |
tree | 2df1cd5b5df869c729f534f093dea664eb059f3a /src/vnet/session/session.h | |
parent | 4e783b9c901cf90e58c3f921bb17170ab23e540a (diff) |
session: api to add new transport types
Type: feature
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: If4dee6dba1ea942daa921d566b35cdecdda680ee
Diffstat (limited to 'src/vnet/session/session.h')
-rw-r--r-- | src/vnet/session/session.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index 486c976cdf5..0a72f97a2f8 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -91,7 +91,7 @@ typedef struct session_worker_ 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 @@ typedef struct session_main_ * Trade memory for speed, for now */ u32 *session_type_to_next; + transport_proto_t last_transport_proto_type; + /* * Config parameters */ @@ -203,6 +205,9 @@ extern vlib_node_registration_t session_queue_pre_input_node; #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_closed_notify (transport_connection_t * tc); 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); |