aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-10-02 00:18:51 -0700
committerDave Barach <openvpp@barachs.net>2017-10-10 20:42:50 +0000
commitcea194d8f973a2f2b5ef72d212533057174cc70a (patch)
tree6fdd2e8a929c62625d1ad35bfbec342129989aef /src/vnet/session/application.h
parent1f36a93d3d68f5ba6dcda08809394ce757cefd72 (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.h')
-rw-r--r--src/vnet/session/application.h34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index e030c376d83..00a5554dd23 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -19,7 +19,7 @@
#include <vnet/vnet.h>
#include <vnet/session/session.h>
#include <vnet/session/segment_manager.h>
-
+#include <vnet/session/application_namespace.h>
typedef enum
{
APP_SERVER,
@@ -36,7 +36,7 @@ typedef struct _stream_session_cb_vft
/** Notify server of newly accepted session */
int (*session_accept_callback) (stream_session_t * new_session);
- /* Connection request callback */
+ /** Connection request callback */
int (*session_connected_callback) (u32 app_index, u32 opaque,
stream_session_t * s, u8 code);
@@ -46,10 +46,10 @@ typedef struct _stream_session_cb_vft
/** Notify app that session was reset */
void (*session_reset_callback) (stream_session_t * s);
- /* Direct RX callback, for built-in servers */
+ /** Direct RX callback, for built-in servers */
int (*builtin_server_rx_callback) (stream_session_t * session);
- /* Redirect connection to local server */
+ /** Redirect connection to local server */
int (*redirect_connect_callback) (u32 api_client_index, void *mp);
} session_cb_vft_t;
@@ -68,6 +68,9 @@ typedef struct _application
/** Binary API connection index, ~0 if internal */
u32 api_client_index;
+ /** Namespace the application belongs to */
+ u32 ns_index;
+
/** Application listens for events on this svm queue */
unix_shared_memory_queue_t *event_queue;
@@ -95,25 +98,24 @@ typedef struct _application
segment_manager_properties_t sm_properties;
} application_t;
+#define APP_INVALID_INDEX ((u32)~0)
+#define APP_NS_INVALID_INDEX ((u32)~0)
#define APP_INVALID_SEGMENT_MANAGER_INDEX ((u32) ~0)
application_t *application_new ();
-int
-application_init (application_t * app, u32 api_client_index, u64 * options,
- session_cb_vft_t * cb_fns);
+int application_init (application_t * app, u32 api_client_index,
+ u64 * options, session_cb_vft_t * cb_fns);
void application_del (application_t * app);
application_t *application_get (u32 index);
application_t *application_get_if_valid (u32 index);
application_t *application_lookup (u32 api_client_index);
u32 application_get_index (application_t * app);
-int
-application_start_listen (application_t * app, session_type_t session_type,
- transport_endpoint_t * tep, u64 * handle);
+int application_start_listen (application_t * app,
+ session_endpoint_t * tep, u64 * handle);
int application_stop_listen (application_t * srv, u64 handle);
-int
-application_open_session (application_t * app, session_type_t sst,
- transport_endpoint_t * tep, u32 api_context);
+int application_open_session (application_t * app, session_endpoint_t * tep,
+ u32 api_context);
int application_api_queue_is_full (application_t * app);
segment_manager_t *application_get_listen_segment_manager (application_t *
@@ -124,6 +126,12 @@ segment_manager_t *application_get_connect_segment_manager (application_t *
app);
int application_is_proxy (application_t * app);
int application_add_segment_notify (u32 app_index, u32 fifo_segment_index);
+u32 application_session_table (application_t * app, u8 fib_proto);
+u32 application_local_session_table (application_t * app);
+u8 *application_name_from_index (u32 app_index);
+
+u8 application_has_local_scope (application_t * app);
+u8 application_has_global_scope (application_t * app);
#endif /* SRC_VNET_SESSION_APPLICATION_H_ */