aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-04-04 23:08:23 -0700
committerFlorin Coras <fcoras@cisco.com>2017-04-13 18:35:50 -0700
commit6cf30adc2cd3aa818e5d97cf71ea8b2fc2aaefa7 (patch)
tree3c4afef26295500b243f3655d96071565c2d2464 /src/vnet/session/application.h
parent0f7d2ff58a63fdc671c1c0954ffe7c6ff0501daa (diff)
Session layer refactoring
Major refactoring of the session layer api - Add attatch api for application binding to the the session layer - Simplify listen/connect calls - Update application CLI - Add transport endpoint to accept callback - Associate segment manager to application and allow for multiple binds/connects per app Additional: - svm fifo cleanup - add fifo free, format fns - add fifo offset enqueue unit test Change-Id: Id93a65047de61afc2bf3d58c9b544339c02065af Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/session/application.h')
-rw-r--r--src/vnet/session/application.h77
1 files changed, 48 insertions, 29 deletions
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index 480828f7b34..6bcee9d312e 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -18,11 +18,13 @@
#include <vnet/vnet.h>
#include <vnet/session/session.h>
+#include <vnet/session/segment_manager.h>
typedef enum
{
APP_SERVER,
- APP_CLIENT
+ APP_CLIENT,
+ APP_N_TYPES
} application_type_t;
typedef struct _stream_session_cb_vft
@@ -35,7 +37,7 @@ typedef struct _stream_session_cb_vft
int (*session_accept_callback) (stream_session_t * new_session);
/* Connection request callback */
- int (*session_connected_callback) (u32 api_client_index,
+ int (*session_connected_callback) (u32 app_index, u32 api_context,
stream_session_t * s, u8 code);
/** Notify app that session is closing */
@@ -59,45 +61,52 @@ typedef struct _application
/** Flags */
u32 flags;
+ /* Stream server mode: accept or connect
+ * TODO REMOVE*/
+ u8 mode;
+
+ /** Index of the listen session or connect session
+ * TODO REMOVE*/
+ u32 session_index;
+
+ /** Session thread index for client connect sessions
+ * TODO REMOVE */
+ u32 thread_index;
+
+ /*
+ * Binary API interface to external app
+ */
+
/** Binary API connection index, ~0 if internal */
u32 api_client_index;
- /* */
- u32 api_context;
-
/** Application listens for events on this svm queue */
unix_shared_memory_queue_t *event_queue;
- /** Stream session type */
- u8 session_type;
-
- /* Stream server mode: accept or connect */
- u8 mode;
+ /*
+ * Callbacks: shoulder-taps for the server/client
+ */
- u32 session_manager_index;
+ session_cb_vft_t cb_fns;
/*
- * Bind/Listen specific
+ * svm segment management
*/
+ u32 connects_seg_manager;
- /** Accept cookie, for multiple session flavors ($$$ maybe) */
- u32 accept_cookie;
+ /* Lookup tables for listeners. Value is segment manager index */
+ uword *listeners_table;
- /** Index of the listen session or connect session */
- u32 session_index;
+ u32 first_segment_manager;
- /** Session thread index for client connect sessions */
- u32 thread_index;
-
- /*
- * Callbacks: shoulder-taps for the server/client
- */
- session_cb_vft_t cb_fns;
+ /** Segment manager properties. Shared by all segment managers */
+ segment_manager_properties_t sm_properties;
} application_t;
-application_t *application_new (application_type_t type, session_type_t sst,
- u32 api_client_index, u32 flags,
- session_cb_vft_t * cb_fns);
+application_t *application_new ();
+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);
@@ -105,11 +114,21 @@ application_t *application_lookup (u32 api_client_index);
u32 application_get_index (application_t * app);
int
-application_server_init (application_t * server, u32 segment_size,
- u32 add_segment_size, u32 rx_fifo_size,
- u32 tx_fifo_size, u8 ** segment_name);
+application_start_listen (application_t * app, session_type_t session_type,
+ transport_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_api_queue_is_full (application_t * app);
+segment_manager_t *application_get_listen_segment_manager (application_t *
+ app,
+ stream_session_t *
+ s);
+segment_manager_t *application_get_connect_segment_manager (application_t *
+ app);
+
#endif /* SRC_VNET_SESSION_APPLICATION_H_ */
/*