X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fapplication_interface.h;h=686b4181a7c2c08fb5b65294c1973473408c2fe8;hb=7999e83a41ebad8a3f02cfcb2809cdb3aae919ba;hp=2c4975315337c83767ee3cab400860c11011b4ac;hpb=6cf30adc2cd3aa818e5d97cf71ea8b2fc2aaefa7;p=vpp.git diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 2c497531533..686b4181a7c 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -22,16 +22,18 @@ #include #include -typedef enum _session_api_proto -{ - SESSION_PROTO_TCP, - SESSION_PROTO_UDP -} session_api_proto_t; - typedef struct _vnet_app_attach_args_t { + /** Binary API client index */ u32 api_client_index; + + /** Application and segment manager options */ u64 *options; + + /* Namespace id */ + u8 *namespace_id; + + /** Session to application callback functions */ session_cb_vft_t *session_cb_vft; /* @@ -54,11 +56,7 @@ typedef struct _vnet_bind_args_t union { char *uri; - struct - { - transport_endpoint_t tep; - session_api_proto_t proto; - }; + session_endpoint_t sep; }; u32 app_index; @@ -84,20 +82,14 @@ typedef struct _vnet_unbind_args_t typedef struct _vnet_connect_args { - union - { - char *uri; - struct - { - transport_endpoint_t tep; - session_api_proto_t proto; - }; - }; + char *uri; + session_endpoint_t sep; u32 app_index; u32 api_context; /* Used for redirects */ void *mp; + u64 session_handle; } vnet_connect_args_t; typedef struct _vnet_disconnect_args_t @@ -110,35 +102,55 @@ typedef struct _vnet_disconnect_args_t typedef enum { APP_EVT_QUEUE_SIZE, - SESSION_OPTIONS_FLAGS, + APP_OPTIONS_FLAGS, + APP_OPTIONS_PREALLOC_FIFO_PAIRS, + APP_OPTIONS_PRIVATE_SEGMENT_COUNT, + APP_OPTIONS_PRIVATE_SEGMENT_SIZE, + APP_OPTIONS_NAMESPACE, + APP_OPTIONS_NAMESPACE_SECRET, + APP_OPTIONS_PROXY_TRANSPORT, SESSION_OPTIONS_SEGMENT_SIZE, SESSION_OPTIONS_ADD_SEGMENT_SIZE, SESSION_OPTIONS_RX_FIFO_SIZE, SESSION_OPTIONS_TX_FIFO_SIZE, + SESSION_OPTIONS_PREALLOCATED_FIFO_PAIRS, SESSION_OPTIONS_ACCEPT_COOKIE, SESSION_OPTIONS_N_OPTIONS } app_attach_options_index_t; -/** Server can handle delegated connect requests from local clients */ -#define SESSION_OPTIONS_FLAGS_USE_FIFO (1<<0) +#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_PROXY, "Application is proxying") \ + _(USE_GLOBAL_SCOPE, "App can use global session scope") \ + _(USE_LOCAL_SCOPE, "App can use local session scope") -/** Server wants vpp to add segments when out of memory for fifos */ -#define SESSION_OPTIONS_FLAGS_ADD_SEGMENT (1<<1) +typedef enum _app_options +{ +#define _(sym, str) APP_OPTIONS_##sym, + foreach_app_options_flags +#undef _ +} app_options_t; -#define VNET_CONNECT_REDIRECTED 123 +typedef enum _app_options_flags +{ +#define _(sym, str) APP_OPTIONS_FLAGS_##sym = 1 << APP_OPTIONS_##sym, + foreach_app_options_flags +#undef _ +} app_options_flags_t; -int vnet_application_attach (vnet_app_attach_args_t * a); +clib_error_t *vnet_application_attach (vnet_app_attach_args_t * a); int vnet_application_detach (vnet_app_detach_args_t * a); int vnet_bind_uri (vnet_bind_args_t *); int vnet_unbind_uri (vnet_unbind_args_t * a); -int vnet_connect_uri (vnet_connect_args_t * a); +clib_error_t *vnet_connect_uri (vnet_connect_args_t * a); int vnet_disconnect_session (vnet_disconnect_args_t * a); -int vnet_bind (vnet_bind_args_t * a); -int vnet_connect (vnet_connect_args_t * a); -int vnet_unbind (vnet_unbind_args_t * a); -int vnet_disconnect (vnet_disconnect_args_t * a); +clib_error_t *vnet_bind (vnet_bind_args_t * a); +clib_error_t *vnet_connect (vnet_connect_args_t * a); +clib_error_t *vnet_unbind (vnet_unbind_args_t * a); int api_parse_session_handle (u64 handle, u32 * session_index,