aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp
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/udp
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/udp')
-rw-r--r--src/vnet/udp/builtin_server.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/vnet/udp/builtin_server.c b/src/vnet/udp/builtin_server.c
index 57f774c5954..8565f04c725 100644
--- a/src/vnet/udp/builtin_server.c
+++ b/src/vnet/udp/builtin_server.c
@@ -91,12 +91,11 @@ static session_cb_vft_t builtin_server = {
/* *INDENT-ON* */
static int
-bind_builtin_uri_server (u8 * uri)
+attach_builtin_uri_server ()
{
- vnet_bind_args_t _a, *a = &_a;
- char segment_name[128];
+ vnet_app_attach_args_t _a, *a = &_a;
+ u8 segment_name[128];
u32 segment_name_length;
- int rv;
u64 options[16];
segment_name_length = ARRAY_LEN (segment_name);
@@ -104,8 +103,7 @@ bind_builtin_uri_server (u8 * uri)
memset (a, 0, sizeof (*a));
memset (options, 0, sizeof (options));
- a->uri = (char *) uri;
- a->api_client_index = ~0; /* built-in server */
+ a->api_client_index = ~0;
a->segment_name = segment_name;
a->segment_name_length = segment_name_length;
a->session_cb_vft = &builtin_server;
@@ -114,6 +112,23 @@ bind_builtin_uri_server (u8 * uri)
options[SESSION_OPTIONS_SEGMENT_SIZE] = (2 << 30); /*$$$$ config / arg */
a->options = options;
+ return vnet_application_attach (a);
+}
+
+static int
+bind_builtin_uri_server (u8 * uri)
+{
+ vnet_bind_args_t _a, *a = &_a;
+ int rv;
+
+ rv = attach_builtin_uri_server ();
+ if (rv)
+ return rv;
+
+ memset (a, 0, sizeof (*a));
+ a->uri = (char *) uri;
+ a->app_index = ~0; /* built-in server */
+
rv = vnet_bind_uri (a);
return rv;
@@ -122,11 +137,12 @@ bind_builtin_uri_server (u8 * uri)
static int
unbind_builtin_uri_server (u8 * uri)
{
- int rv;
+ vnet_unbind_args_t _a, *a = &_a;
- rv = vnet_unbind_uri ((char *) uri, ~0 /* client_index */ );
+ a->app_index = ~0;
+ a->uri = (char *) uri;
- return rv;
+ return vnet_unbind_uri (a);
}
static clib_error_t *