session: extend connect api for internal apps
[vpp.git] / src / vnet / session / session.h
index 1e08ccc..4d46596 100644 (file)
@@ -195,7 +195,7 @@ struct _session_manager_main
   clib_rwlock_t *peekers_rw_locks;
 
   /** Per-proto, per-worker enqueue epoch counters */
-  u32 *current_enqueue_epoch[TRANSPORT_N_PROTO];
+  u64 *current_enqueue_epoch[TRANSPORT_N_PROTO];
 
   /** Per-proto, per-worker thread vector of sessions to enqueue */
   u32 **session_to_enqueue[TRANSPORT_N_PROTO];
@@ -215,6 +215,12 @@ struct _session_manager_main
   /** per-worker session context */
   session_tx_context_t *ctx;
 
+  /** Our approximation of a "complete" dispatch loop period */
+  f64 *dispatch_period;
+
+  /** vlib_time_now last time around the track */
+  f64 *last_vlib_time;
+
   /** vpp fifo event queue */
   svm_msg_q_t **vpp_event_queues;
 
@@ -308,6 +314,7 @@ stream_session_is_valid (u32 si, u8 thread_index)
 stream_session_t *session_alloc (u32 thread_index);
 int session_alloc_fifos (segment_manager_t * sm, stream_session_t * s);
 void session_free (stream_session_t * s);
+void session_free_w_fifos (stream_session_t * s);
 
 always_inline stream_session_t *
 session_get (u32 si, u32 thread_index)
@@ -493,6 +500,18 @@ transport_tx_fifo_size (transport_connection_t * tc)
   return s->server_tx_fifo->nitems;
 }
 
+always_inline f64
+transport_dispatch_period (u32 thread_index)
+{
+  return session_manager_main.dispatch_period[thread_index];
+}
+
+always_inline f64
+transport_time_now (u32 thread_index)
+{
+  return session_manager_main.last_vlib_time[thread_index];
+}
+
 always_inline u32
 session_get_index (stream_session_t * s)
 {
@@ -551,7 +570,7 @@ void stream_session_reset_notify (transport_connection_t * tc);
 int stream_session_accept (transport_connection_t * tc, u32 listener_index,
                           u8 notify);
 int session_open (u32 app_index, session_endpoint_t * tep, u32 opaque);
-int session_listen (stream_session_t * s, session_endpoint_extended_t * sep);
+int session_listen (stream_session_t * s, session_endpoint_cfg_t * sep);
 int session_stop_listen (stream_session_t * s);
 void stream_session_disconnect (stream_session_t * s);
 void stream_session_disconnect_transport (stream_session_t * s);