vcl/session: use mq for bind replies
[vpp.git] / src / vnet / session / application_interface.h
index daba169..1f481dc 100644 (file)
 
 typedef struct _vnet_app_attach_args_t
 {
-  /** Binary API client index */
-  u32 api_client_index;
-
-  /** Application name. Used by builtin apps */
-  u8 *name;
-
-  /** Application and segment manager options */
-  u64 *options;
-
-  /** ID of the namespace the app has access to */
-  u8 *namespace_id;
-
-  /** Session to application callback functions */
-  session_cb_vft_t *session_cb_vft;
-
-  /*
-   * Results
-   */
-  ssvm_private_t *segment;
-  u64 app_event_queue_address;
-  u32 app_index;
+#define _(_type, _name) _type _name;
+  foreach_app_init_args
+#undef _
+  ssvm_private_t * segment;
+  svm_msg_q_t *app_evt_q;
 } vnet_app_attach_args_t;
 
 typedef struct _vnet_app_detach_args_t
@@ -55,11 +39,13 @@ typedef struct _vnet_bind_args_t
 {
   union
   {
-    char *uri;
+    session_endpoint_extended_t sep_ext;
     session_endpoint_t sep;
+    char *uri;
   };
 
   u32 app_index;
+  u32 wrk_map_index;
 
   /*
    * Results
@@ -75,19 +61,22 @@ typedef struct _vnet_unbind_args_t
   union
   {
     char *uri;
-    u64 handle;
+    u64 handle;                        /**< Session handle */
   };
-  u32 app_index;
+  u32 app_index;               /**< Owning application index */
+  u32 app_wrk_index;           /**< App's local pool worker index */
 } vnet_unbind_args_t;
 
 typedef struct _vnet_connect_args
 {
   union
   {
+    session_endpoint_extended_t sep_ext;
+    session_endpoint_t sep;
     char *uri;
-    session_endpoint_extended_t sep;
   };
   u32 app_index;
+  u32 wrk_map_index;
   u32 api_context;
 
   session_handle_t session_handle;
@@ -138,6 +127,7 @@ typedef enum
   _(USE_GLOBAL_SCOPE, "App can use global session scope")      \
   _(USE_LOCAL_SCOPE, "App can use local session scope")                \
   _(USE_MQ_FOR_CTRL_MSGS, "Use message queue for ctr msgs")    \
+  _(EVT_MQ_USE_EVENTFD, "Use eventfds for signaling")          \
 
 typedef enum _app_options
 {
@@ -153,6 +143,27 @@ typedef enum _app_options_flags
 #undef _
 } app_options_flags_t;
 
+#define foreach_fd_type                                                \
+  _(VPP_MQ_SEGMENT, "Fd for vpp's event mq segment")           \
+  _(MEMFD_SEGMENT, "Fd for memfd segment")                     \
+  _(MQ_EVENTFD, "Event fd used by message queue")              \
+  _(VPP_MQ_EVENTFD, "Event fd used by vpp's message queue")    \
+
+typedef enum session_fd_type_
+{
+#define _(sym, str) SESSION_FD_##sym,
+  foreach_fd_type
+#undef _
+  SESSION_N_FD_TYPE
+} session_fd_type_t;
+
+typedef enum session_fd_flag_
+{
+#define _(sym, str) SESSION_FD_F_##sym = 1 << SESSION_FD_##sym,
+  foreach_fd_type
+#undef _
+} session_fd_flag_t;
+
 int vnet_bind_uri (vnet_bind_args_t *);
 int vnet_unbind_uri (vnet_unbind_args_t * a);
 clib_error_t *vnet_connect_uri (vnet_connect_args_t * a);
@@ -198,6 +209,22 @@ typedef struct
 #undef _
 } app_session_t;
 
+typedef struct session_bound_msg_
+{
+  u32 context;
+  u64 handle;
+  i32 retval;
+  u8 lcl_is_ip4;
+  u8 lcl_ip[16];
+  u16 lcl_port;
+  u64 rx_fifo;
+  u64 tx_fifo;
+  u64 vpp_evt_q;
+  u32 segment_size;
+  u8 segment_name_length;
+  u8 segment_name[128];
+} __clib_packed session_bound_msg_t;
+
 typedef struct session_accepted_msg_
 {
   u32 context;