+always_inline svm_queue_t *
+session_manager_get_vpp_event_queue (u32 thread_index)
+{
+ return session_manager_main.vpp_event_queues[thread_index];
+}
+
+int session_manager_flush_enqueue_events (u8 proto, u32 thread_index);
+
+always_inline u64
+listen_session_get_handle (stream_session_t * s)
+{
+ ASSERT (s->session_state == SESSION_STATE_LISTENING);
+ return ((u64) s->session_type << 32) | s->session_index;
+}
+
+always_inline stream_session_t *
+listen_session_get_from_handle (u64 handle)
+{
+ session_manager_main_t *smm = &session_manager_main;
+ stream_session_t *s;
+ u32 type, index;
+ type = handle >> 32;
+ index = handle & 0xFFFFFFFF;
+
+ if (pool_is_free_index (smm->listen_sessions[type], index))
+ return 0;
+
+ s = pool_elt_at_index (smm->listen_sessions[type], index);
+ ASSERT (s->session_state == SESSION_STATE_LISTENING);
+ return s;
+}
+
+always_inline stream_session_t *
+listen_session_new (session_type_t type)
+{
+ stream_session_t *s;
+ pool_get_aligned (session_manager_main.listen_sessions[type], s,
+ CLIB_CACHE_LINE_BYTES);
+ memset (s, 0, sizeof (*s));
+
+ s->session_type = type;
+ s->session_state = SESSION_STATE_LISTENING;
+ s->session_index = s - session_manager_main.listen_sessions[type];
+
+ return s;
+}
+
+always_inline stream_session_t *
+listen_session_get (session_type_t type, u32 index)
+{
+ return pool_elt_at_index (session_manager_main.listen_sessions[type],
+ index);
+}
+
+always_inline void
+listen_session_del (stream_session_t * s)
+{
+ pool_put (session_manager_main.listen_sessions[s->session_type], s);
+}
+
+transport_connection_t *listen_session_get_transport (stream_session_t * s);
+
+int
+listen_session_get_local_session_endpoint (stream_session_t * listener,
+ session_endpoint_t * sep);
+
+always_inline stream_session_t *
+session_manager_get_listener (u8 session_type, u32 index)
+{
+ return
+ pool_elt_at_index (session_manager_main.listen_sessions[session_type],
+ index);
+}
+
+/**
+ * Set peek or dequeue function for given session type
+ *
+ * Reliable transport protocols will probably want to use a peek function
+ */
+always_inline void
+session_manager_set_transport_rx_fn (session_type_t type, u8 is_peek)
+{
+ session_manager_main.session_tx_fns[type] = (is_peek) ?
+ session_tx_fifo_peek_and_snd : session_tx_fifo_dequeue_and_snd;
+}
+
+always_inline u8
+session_manager_is_enabled ()
+{
+ return session_manager_main.is_enabled == 1;
+}
+
+#define session_cli_return_if_not_enabled() \
+do { \
+ if (!session_manager_main.is_enabled) \
+ return clib_error_return(0, "session layer is not enabled"); \
+} while (0)
+
+void session_node_enable_disable (u8 is_en);
+