aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-25 06:34:42 -0800
committerDave Barach <openvpp@barachs.net>2018-01-26 16:15:13 +0000
commit4399c2eb848b79762ff52a95fa5d9fab222c73bd (patch)
tree88ad4c903eb516bccb97b8c2fe101cb9e15398f7 /src/vnet/session
parent87233b51bc4d088ff566cef09a7c96f1f0dac078 (diff)
session: move builtin apps to their own folder
This consolidates builtin apps under session-apps folder. It also removes duplicate builtin echo server/client implementations. Change-Id: I75ed879399c5aa9b75b1eb38b33aedf69dd8df3f Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application.c4
-rw-r--r--src/vnet/session/application_interface.c49
-rw-r--r--src/vnet/session/transport.c5
3 files changed, 16 insertions, 42 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 13ccdd7cbc8..bd708fc864e 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -272,7 +272,9 @@ application_init (application_t * app, u32 api_client_index, u64 * options,
if (!reg)
return VNET_API_ERROR_APP_UNSUPPORTED_CFG;
- if (vl_api_registration_file_index (reg) == ~0)
+ if (options[APP_OPTIONS_FLAGS] & APP_OPTIONS_FLAGS_IS_BUILTIN)
+ st = SSVM_N_SEGMENT_TYPES;
+ else if (vl_api_registration_file_index (reg) == VL_API_INVALID_FI)
st = SSVM_SEGMENT_SHM;
if (!application_verify_cfg (st))
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index f2a13be6144..63666a60e7f 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -275,9 +275,8 @@ vnet_connect_i (u32 app_index, u32 api_context, session_endpoint_t * sep,
/**
* unformat a vnet URI
*
- * fifo://name
- * tcp://ip46-addr:port
- * udp://ip46-addr:port
+ * transport-proto://ip46-addr:port
+ * eg. tcp://ip46-addr:port
*
* u8 ip46_address[16];
* u16 port_in_host_byte_order;
@@ -293,51 +292,21 @@ uword
unformat_vnet_uri (unformat_input_t * input, va_list * args)
{
session_endpoint_t *sep = va_arg (*args, session_endpoint_t *);
-
- if (unformat (input, "tcp://%U/%d", unformat_ip4_address, &sep->ip.ip4,
- &sep->port))
- {
- sep->transport_proto = TRANSPORT_PROTO_TCP;
- sep->port = clib_host_to_net_u16 (sep->port);
- sep->is_ip4 = 1;
- return 1;
- }
- if (unformat (input, "udp://%U/%d", unformat_ip4_address, &sep->ip.ip4,
- &sep->port))
- {
- sep->transport_proto = TRANSPORT_PROTO_UDP;
- sep->port = clib_host_to_net_u16 (sep->port);
- sep->is_ip4 = 1;
- return 1;
- }
- if (unformat (input, "udp://%U/%d", unformat_ip6_address, &sep->ip.ip6,
- &sep->port))
- {
- sep->transport_proto = TRANSPORT_PROTO_UDP;
- sep->port = clib_host_to_net_u16 (sep->port);
- sep->is_ip4 = 0;
- return 1;
- }
- if (unformat (input, "tcp://%U/%d", unformat_ip6_address, &sep->ip.ip6,
- &sep->port))
- {
- sep->transport_proto = TRANSPORT_PROTO_TCP;
- sep->port = clib_host_to_net_u16 (sep->port);
- sep->is_ip4 = 0;
- return 1;
- }
- if (unformat (input, "sctp://%U/%d", unformat_ip4_address, &sep->ip.ip4,
+ u32 transport_proto = 0;
+ if (unformat (input, "%U://%U/%d", unformat_transport_proto,
+ &transport_proto, unformat_ip4_address, &sep->ip.ip4,
&sep->port))
{
- sep->transport_proto = TRANSPORT_PROTO_SCTP;
+ sep->transport_proto = transport_proto;
sep->port = clib_host_to_net_u16 (sep->port);
sep->is_ip4 = 1;
return 1;
}
- if (unformat (input, "sctp://%U/%d", unformat_ip6_address, &sep->ip.ip6,
+ if (unformat (input, "%U://%U/%d", unformat_transport_proto,
+ &transport_proto, unformat_ip6_address, &sep->ip.ip6,
&sep->port))
{
- sep->transport_proto = TRANSPORT_PROTO_SCTP;
+ sep->transport_proto = transport_proto;
sep->port = clib_host_to_net_u16 (sep->port);
sep->is_ip4 = 0;
return 1;
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 964e739550e..c31964c88b6 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -73,6 +73,9 @@ format_transport_proto_short (u8 * s, va_list * args)
case TRANSPORT_PROTO_UDP:
s = format (s, "U");
break;
+ case TRANSPORT_PROTO_SCTP:
+ s = format (s, "S");
+ break;
}
return s;
}
@@ -89,7 +92,7 @@ unformat_transport_proto (unformat_input_t * input, va_list * args)
*proto = TRANSPORT_PROTO_UDP;
else if (unformat (input, "UDP"))
*proto = TRANSPORT_PROTO_UDP;
- if (unformat (input, "sctp"))
+ else if (unformat (input, "sctp"))
*proto = TRANSPORT_PROTO_SCTP;
else if (unformat (input, "SCTP"))
*proto = TRANSPORT_PROTO_SCTP;