session vcl: explit mq indices in ctrl messages
[vpp.git] / src / vnet / session / application_interface.h
index ba148e2..b10dd6c 100644 (file)
@@ -53,6 +53,9 @@ typedef struct session_cb_vft_
   /** Notify app that session or transport are about to be removed */
   void (*session_cleanup_callback) (session_t * s, session_cleanup_ntf_t ntf);
 
+  /** Notify app that half open state was cleaned up (optional) */
+  void (*half_open_cleanup_callback) (session_t *s);
+
   /** Notify app that session was reset */
   void (*session_reset_callback) (session_t * s);
 
@@ -114,9 +117,6 @@ typedef struct _vnet_bind_args_t
   /*
    * Results
    */
-  char *segment_name;
-  u32 segment_name_length;
-  u64 server_event_queue_address;
   u64 handle;
 } vnet_listen_args_t;
 
@@ -143,9 +143,16 @@ typedef struct _vnet_connect_args
   u32 wrk_map_index;
   u32 api_context;
 
-  session_handle_t session_handle;
+  /* Resulting session, or half-open session, if connect successful */
+  session_handle_t sh;
 } vnet_connect_args_t;
 
+typedef struct _vnet_shutdown_args_t
+{
+  session_handle_t handle;
+  u32 app_index;
+} vnet_shutdown_args_t;
+
 typedef struct _vnet_disconnect_args_t
 {
   session_handle_t handle;
@@ -216,15 +223,16 @@ typedef enum
   APP_OPTIONS_N_OPTIONS
 } app_attach_options_index_t;
 
-#define foreach_app_options_flags                              \
-  _(ACCEPT_REDIRECT, "Use FIFO with redirects")                        \
-  _(ADD_SEGMENT, "Add segment and signal app if needed")       \
-  _(IS_BUILTIN, "Application is builtin")                      \
-  _(IS_TRANSPORT_APP, "Application is a transport proto")      \
-  _(IS_PROXY, "Application is proxying")                       \
-  _(USE_GLOBAL_SCOPE, "App can use global session scope")      \
-  _(USE_LOCAL_SCOPE, "App can use local session scope")                \
-  _(EVT_MQ_USE_EVENTFD, "Use eventfds for signaling")          \
+#define foreach_app_options_flags                                             \
+  _ (ACCEPT_REDIRECT, "Use FIFO with redirects")                              \
+  _ (ADD_SEGMENT, "Add segment and signal app if needed")                     \
+  _ (IS_BUILTIN, "Application is builtin")                                    \
+  _ (IS_TRANSPORT_APP, "Application is a transport proto")                    \
+  _ (IS_PROXY, "Application is proxying")                                     \
+  _ (USE_GLOBAL_SCOPE, "App can use global session scope")                    \
+  _ (USE_LOCAL_SCOPE, "App can use local session scope")                      \
+  _ (EVT_MQ_USE_EVENTFD, "Use eventfds for signaling")                        \
+  _ (MEMFD_FOR_BUILTIN, "Use memfd for builtin app segs")
 
 typedef enum _app_options
 {
@@ -271,6 +279,7 @@ int vnet_application_detach (vnet_app_detach_args_t * a);
 int vnet_listen (vnet_listen_args_t * a);
 int vnet_connect (vnet_connect_args_t * a);
 int vnet_unlisten (vnet_unlisten_args_t * a);
+int vnet_shutdown_session (vnet_shutdown_args_t *a);
 int vnet_disconnect_session (vnet_disconnect_args_t * a);
 
 int vnet_app_add_cert_key_pair (vnet_app_add_cert_key_pair_args_t * a);
@@ -343,6 +352,7 @@ typedef struct session_bound_msg_
   uword tx_fifo;
   uword vpp_evt_q;
   u64 segment_handle;
+  u32 mq_index;
 } __clib_packed session_bound_msg_t;
 
 typedef struct session_unlisten_msg_
@@ -370,6 +380,7 @@ typedef struct session_accepted_msg_
   u64 segment_handle;
   uword vpp_event_queue_address;
   u32 mq_index;
+  transport_endpoint_t lcl;
   transport_endpoint_t rmt;
   u8 flags;
 } __clib_packed session_accepted_msg_t;
@@ -425,12 +436,17 @@ typedef struct session_connected_msg_
   uword ct_tx_fifo;
   u64 ct_segment_handle;
   uword vpp_event_queue_address;
-  u32 segment_size;
-  u8 segment_name_length;
-  u8 segment_name[64];
   transport_endpoint_t lcl;
+  u32 mq_index;
 } __clib_packed session_connected_msg_t;
 
+typedef struct session_shutdown_msg_
+{
+  u32 client_index;
+  u32 context;
+  session_handle_t handle;
+} __clib_packed session_shutdown_msg_t;
+
 typedef struct session_disconnect_msg_
 {
   u32 client_index;