summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.api
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/session.api
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/session.api')
-rw-r--r--src/vnet/session/session.api237
1 files changed, 93 insertions, 144 deletions
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index 582765b5904..e207e46f686 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -13,6 +13,68 @@
* limitations under the License.
*/
+/** \brief client->vpp, attach application to session layer
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param initial_segment_size - size of the initial shm segment to be
+ allocated
+ @param options - segment size, fifo sizes, etc.
+*/
+ define application_attach {
+ u32 client_index;
+ u32 context;
+ u32 initial_segment_size;
+ u64 options[16];
+ };
+
+ /** \brief Application attach reply
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the request
+ @param app_event_queue_address - vpp event queue address or 0 if this
+ connection shouldn't send events
+ @param segment_size - size of first shm segment
+ @param segment_name_length - length of segment name
+ @param segment_name - name of segment client needs to attach to
+*/
+define application_attach_reply {
+ u32 context;
+ i32 retval;
+ u64 app_event_queue_address;
+ u32 segment_size;
+ u8 segment_name_length;
+ u8 segment_name[128];
+};
+
+ /** \brief client->vpp, attach application to session layer
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+ define application_detach {
+ u32 client_index;
+ u32 context;
+ };
+
+ /** \brief detach reply
+ @param context - sender context, to match reply w/ request
+ @param retval - return code for the request
+*/
+define application_detach_reply {
+ u32 context;
+ i32 retval;
+};
+
+/** \brief vpp->client, please map an additional shared memory segment
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param segment_name -
+*/
+define map_another_segment {
+ u32 client_index;
+ u32 context;
+ u32 segment_size;
+ u8 segment_name[128];
+};
+
/** \brief Bind to a given URI
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -25,9 +87,7 @@ define bind_uri {
u32 client_index;
u32 context;
u32 accept_cookie;
- u32 initial_segment_size;
u8 uri[128];
- u64 options[16];
};
/** \brief Unbind a given URI
@@ -49,7 +109,10 @@ define unbind_uri {
@param accept_cookie - sender accept cookie, to identify this bind flavor
@param uri - a URI, e.g. "tcp4://0.0.0.0/0/80"
"tcp6://::/0/80" [ipv6], etc.
- @param options - socket options, fifo sizes, etc.
+ @param options - socket options, fifo sizes, etc. passed by vpp to the
+ server when redirecting connects
+ @param client_queue_address - binary API client queue address. Used by
+ local server when connect was redirected.
*/
define connect_uri {
u32 client_index;
@@ -62,18 +125,10 @@ define connect_uri {
/** \brief Bind reply
@param context - sender context, to match reply w/ request
@param retval - return code for the request
- @param event_queue_address - vpp event queue address or 0 if this
- connection shouldn't send events
- @param segment_name_length - length of segment name
- @param segment_name - name of segment client needs to attach to
*/
define bind_uri_reply {
u32 context;
i32 retval;
- u64 server_event_queue_address;
- u8 segment_name_length;
- u32 segment_size;
- u8 segment_name[128];
};
/** \brief unbind reply
@@ -88,43 +143,28 @@ define unbind_uri_reply {
/** \brief vpp->client, connect reply
@param context - sender context, to match reply w/ request
@param retval - return code for the request
+ @param handle - session handle
@param server_rx_fifo - rx (vpp -> vpp-client) fifo address
@param server_tx_fifo - tx (vpp-client -> vpp) fifo address
- @param session_index - session index;
- @param session_thread_index - session thread index
- @param session_type - session thread type
@param vpp_event_queue_address - vpp's event queue address
- @param client_event_queue_address - client's event queue address
+ @param segment_size - size of segment to be attached. Only for redirects.
@param segment_name_length - non-zero if the client needs to attach to
- the fifo segment
+ the fifo segment. This should only happen
+ if session was redirected.
@param segment_name - set if the client needs to attach to the segment
*/
define connect_uri_reply {
u32 context;
i32 retval;
+ u64 handle;
u64 server_rx_fifo;
u64 server_tx_fifo;
- u32 session_index;
- u32 session_thread_index;
- u8 session_type;
- u64 client_event_queue_address;
u64 vpp_event_queue_address;
u32 segment_size;
u8 segment_name_length;
u8 segment_name[128];
};
-/** \brief vpp->client, please map an additional shared memory segment
- @param context - sender context, to match reply w/ request
- @param segment_name -
-*/
-define map_another_segment {
- u32 client_index;
- u32 context;
- u32 segment_size;
- u8 segment_name[128];
-};
-
/** \brief client->vpp
@param context - sender context, to match reply w/ request
@param retval - return code for the request
@@ -136,25 +176,27 @@ define map_another_segment_reply {
/** \brief vpp->client, accept this session
@param context - sender context, to match reply w/ request
- @param accept_cookie - tells client which bind flavor just occurred
+ @param listener_handle - tells client which listener this pertains to
+ @param handle - unique session identifier
+ @param session_thread_index - thread index of new session
@param rx_fifo_address - rx (vpp -> vpp-client) fifo address
@param tx_fifo_address - tx (vpp-client -> vpp) fifo address
- @param session_index - index of new session
- @param session_thread_index - thread index of new session
@param vpp_event_queue_address - vpp's event queue address
- @param session_type - type of session
-
+ @param port - remote port
+ @param is_ip4 - 1 if the ip is ip4
+ @param ip - remote ip
*/
define accept_session {
u32 client_index;
u32 context;
- u32 accept_cookie;
+ u64 listener_handle;
+ u64 handle;
u64 server_rx_fifo;
u64 server_tx_fifo;
- u32 session_index;
- u32 session_thread_index;
u64 vpp_event_queue_address;
- u8 session_type;
+ u16 port;
+ u8 is_ip4;
+ u8 ip[16];
};
/** \brief client->vpp, reply to an accept message
@@ -167,23 +209,19 @@ define accept_session {
define accept_session_reply {
u32 context;
i32 retval;
- u8 session_type;
- u8 session_thread_index;
- u32 session_index;
+ u64 handle;
};
/** \brief bidirectional disconnect API
@param client_index - opaque cookie to identify the sender
client to vpp direction only
@param context - sender context, to match reply w/ request
- @param session_index - cookie #1 from accept_session / connect_reply
- @param session_thread_index - cookie #2
+ @param handle - session handle obtained from accept/connect
*/
define disconnect_session {
u32 client_index;
u32 context;
- u32 session_index;
- u32 session_thread_index;
+ u64 handle;
};
/** \brief bidirectional disconnect reply API
@@ -191,31 +229,25 @@ define disconnect_session {
client to vpp direction only
@param context - sender context, to match reply w/ request
@param retval - return code for the request
- @param session_index - session index from accept_session / connect_reply
- @param session_thread_index - thread index from accept_session /
- connect_reply
+ @param handle - session handle
*/
define disconnect_session_reply {
u32 client_index;
u32 context;
i32 retval;
- u32 session_index;
- u32 session_thread_index;
+ u64 handle;
};
/** \brief vpp->client reset session API
@param client_index - opaque cookie to identify the sender
client to vpp direction only
@param context - sender context, to match reply w/ request
- @param session_index - session index from accept_session / connect_reply
- @param session_thread_index - thread index from accept_session /
- connect_reply
+ @param handle - session handle obtained via accept/connects
*/
define reset_session {
u32 client_index;
u32 context;
- u32 session_index;
- u32 session_thread_index;
+ u64 handle;
};
/** \brief client->vpp reset session reply
@@ -223,16 +255,13 @@ define reset_session {
client to vpp direction only
@param context - sender context, to match reply w/ request
@param retval - return code for the request
- @param session_index - session index from accept_session / connect_reply
- @param session_thread_index - thread index from accept_session /
- connect_reply
+ @param handle - session handle obtained via accept/connect
*/
define reset_session_reply {
u32 client_index;
u32 context;
i32 retval;
- u32 session_index;
- u32 session_thread_index;
+ u64 handle;
};
/** \brief Bind to an ip:port pair for a given transport protocol
@@ -277,7 +306,7 @@ define unbind_sock {
@param proto - protocol 0 - TCP 1 - UDP
@param client_queue_address - client's API queue address. Non-zero when
used to perform redirects
- @param options - socket options, fifo sizes, etc.
+ @param options - socket options, fifo sizes, etc. when doing redirects
*/
define connect_sock {
u32 client_index;
@@ -326,7 +355,7 @@ define unbind_sock_reply {
@param server_rx_fifo - rx (vpp -> vpp-client) fifo address
@param server_tx_fifo - tx (vpp-client -> vpp) fifo address
@param vpp_event_queue_address - vpp's event queue address
- @param client_event_queue_address - client's event queue address
+ @param segment_size - size of segment to be attached. Only for redirects.
@param segment_name_length - non-zero if the client needs to attach to
the fifo segment
@param segment_name - set if the client needs to attach to the segment
@@ -337,92 +366,12 @@ define connect_sock_reply {
u64 handle;
u64 server_rx_fifo;
u64 server_tx_fifo;
- u64 client_event_queue_address;
u64 vpp_event_queue_address;
u32 segment_size;
u8 segment_name_length;
u8 segment_name[128];
};
-/** \brief bidirectional disconnect API
- @param client_index - opaque cookie to identify the sender
- client to vpp direction only
- @param context - sender context, to match reply w/ request
- @param handle - session handle obtained through accept/connect
-*/
-define disconnect_sock {
- u32 client_index;
- u32 context;
- u64 handle;
-};
-
-/** \brief bidirectional disconnect reply API
- @param client_index - opaque cookie to identify the sender
- client to vpp direction only
- @param client_context - sender context, to match reply w/ request
- @param handle - session handle obtained through accept/connect
-*/
-define disconnect_sock_reply {
- u32 client_index;
- u32 context;
- i32 retval;
- u64 handle;
-};
-
-/** \brief vpp->client, accept this session
- @param context - sender context, to match reply w/ request
- @param accept_cookie - tells client which bind flavor just occurred
- @param handle - session handle obtained through accept/connect
- @param rx_fifo_address - rx (vpp -> vpp-client) fifo address
- @param tx_fifo_address - tx (vpp-client -> vpp) fifo address
- @param vpp_event_queue_address - vpp's event queue address
-*/
-define accept_sock {
- u32 client_index;
- u32 context;
- u32 accept_cookie;
- u64 handle;
- u64 server_rx_fifo;
- u64 server_tx_fifo;
- u64 vpp_event_queue_address;
-};
-
-/** \brief client->vpp, reply to an accept message
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
- @param handle - session handle obtained through accept/connect
-*/
-define accept_sock_reply {
- u32 context;
- i32 retval;
- u64 handle;
-};
-
-/** \brief vpp->client reset session API
- @param client_index - opaque cookie to identify the sender
- client to vpp direction only
- @param context - sender context, to match reply w/ request
- @param handle - session handle obtained through accept/connect
-*/
-define reset_sock {
- u32 client_index;
- u32 context;
- u64 handle;
-};
-
-/** \brief client->vpp reset session reply
- @param client_index - opaque cookie to identify the sender
- client to vpp direction only
- @param context - sender context, to match reply w/ request
- @param handle - session handle obtained through accept/connect
-*/
-define reset_sock_reply {
- u32 client_index;
- u32 context;
- i32 retval;
- u64 handle;
-};
-
/** \brief enable/disable session layer
@param client_index - opaque cookie to identify the sender
client to vpp direction only