diff options
author | Florin Coras <fcoras@cisco.com> | 2017-10-02 00:18:51 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-10-10 20:42:50 +0000 |
commit | cea194d8f973a2f2b5ef72d212533057174cc70a (patch) | |
tree | 6fdd2e8a929c62625d1ad35bfbec342129989aef /src/vnet/session/application_interface.h | |
parent | 1f36a93d3d68f5ba6dcda08809394ce757cefd72 (diff) |
session: add support for application namespacing
Applications are now provided the option to select the namespace they
are to be attached to and the scope of their attachement. Application
namespaces are meant to:
1) constrain the scope of communication through the network by
association with source interfaces and/or fib tables that provide the
source ips to be used and limit the scope of routing
2) provide a namespace local scope to session layer communication, as
opposed to the global scope provided by 1). That is, sessions can be
established without assistance from transport and network layers.
Albeit, zero/local-host ip addresses must still be provided in session
establishment messages due to existing application idiosyncrasies. This
mode of communication uses shared-memory fifos (cut-through sessions)
exclusively.
If applications request no namespace, they are assigned to the default
one, which at its turn uses the default fib. Applications can request
access to both local and global scopes for a namespace. If no scope is
specified, session layer defaults to the global one.
When a sw_if_index is provided for a namespace, zero-ip (INADDR_ANY)
binds are converted to binds to the requested interface.
Change-Id: Ia0f660bbf7eec7f89673f75b4821fc7c3d58e3d1
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/application_interface.h')
-rw-r--r-- | src/vnet/session/application_interface.h | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h index 1d63f6cc102..5e1fe8ee528 100644 --- a/src/vnet/session/application_interface.h +++ b/src/vnet/session/application_interface.h @@ -30,12 +30,12 @@ typedef struct _vnet_app_attach_args_t /** Application and segment manager options */ u64 *options; + /* Namespace id */ + u8 *namespace_id; + /** Session to application callback functions */ session_cb_vft_t *session_cb_vft; - /** Flag that indicates if app is builtin */ - u8 builtin; - /* * Results */ @@ -58,7 +58,7 @@ typedef struct _vnet_bind_args_t char *uri; struct { - transport_endpoint_t tep; + session_endpoint_t sep; transport_proto_t proto; }; }; @@ -91,7 +91,7 @@ typedef struct _vnet_connect_args char *uri; struct { - transport_endpoint_t tep; + session_endpoint_t sep; transport_proto_t proto; }; }; @@ -119,6 +119,8 @@ typedef enum APP_OPTIONS_PREALLOC_FIFO_PAIRS, APP_OPTIONS_PRIVATE_SEGMENT_COUNT, APP_OPTIONS_PRIVATE_SEGMENT_SIZE, + APP_OPTIONS_NAMESPACE, + APP_OPTIONS_NAMESPACE_SECRET, SESSION_OPTIONS_SEGMENT_SIZE, SESSION_OPTIONS_ADD_SEGMENT_SIZE, SESSION_OPTIONS_RX_FIFO_SIZE, @@ -129,10 +131,12 @@ typedef enum } app_attach_options_index_t; #define foreach_app_options_flags \ - _(USE_FIFO, "Use FIFO with redirects") \ + _(ACCEPT_REDIRECT, "Use FIFO with redirects") \ _(ADD_SEGMENT, "Add segment and signal app if needed") \ _(BUILTIN_APP, "Application is builtin") \ - _(IS_PROXY, "Application is proxying") + _(IS_PROXY, "Application is proxying") \ + _(USE_GLOBAL_SCOPE, "App can use global session scope") \ + _(USE_LOCAL_SCOPE, "App can use local session scope") typedef enum _app_options { @@ -148,25 +152,17 @@ typedef enum _app_options_flags #undef _ } app_options_flags_t; -///** Server can handle delegated connect requests from local clients */ -//#define APP_OPTIONS_FLAGS_USE_FIFO (1<<0) -// -///** Server wants vpp to add segments when out of memory for fifos */ -//#define APP_OPTIONS_FLAGS_ADD_SEGMENT (1<<1) - -#define VNET_CONNECT_REDIRECTED 123 - -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); +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, |