return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
}
- listener = stream_session_lookup_listener (&tep->ip,
- clib_host_to_net_u16 (tep->port),
- sst);
+ listener = stream_session_lookup_listener (&tep->ip, tep->port, sst);
if (listener)
return VNET_API_ERROR_ADDRESS_IN_USE;
/*
* Figure out if connecting to a local server
*/
- listener = stream_session_lookup_listener (&tep->ip,
- clib_host_to_net_u16 (tep->port),
- sst);
+ listener = stream_session_lookup_listener (&tep->ip, tep->port, sst);
if (listener)
{
server = application_get (listener->app_index);
&tep->port))
{
*sst = SESSION_TYPE_IP4_TCP;
+ tep->port = clib_host_to_net_u16 (tep->port);
tep->is_ip4 = 1;
return 1;
}
&tep->port))
{
*sst = SESSION_TYPE_IP4_UDP;
+ tep->port = clib_host_to_net_u16 (tep->port);
tep->is_ip4 = 1;
return 1;
}
&tep->port))
{
*sst = SESSION_TYPE_IP6_UDP;
+ tep->port = clib_host_to_net_u16 (tep->port);
return 1;
}
if (unformat (input, "tcp://%U/%d", unformat_ip6_address, &tep->ip.ip6,
&tep->port))
{
*sst = SESSION_TYPE_IP6_TCP;
+ tep->port = clib_host_to_net_u16 (tep->port);
return 1;
}
return 0;
}
+static u8 *cache_uri;
+static session_type_t cache_sst;
+static transport_endpoint_t *cache_tep;
+
int
parse_uri (char *uri, session_type_t * sst, transport_endpoint_t * tep)
{
unformat_input_t _input, *input = &_input;
+ if (cache_uri && !strncmp (uri, (char *) cache_uri, vec_len (cache_uri)))
+ {
+ *sst = cache_sst;
+ *tep = *cache_tep;
+ return 0;
+ }
+
/* Make sure */
uri = (char *) format (0, "%s%c", uri, 0);
}
unformat_free (input);
+ vec_free (cache_uri);
+ cache_uri = (u8 *) uri;
+ cache_sst = *sst;
+ if (cache_tep)
+ clib_mem_free (cache_tep);
+ cache_tep = clib_mem_alloc (sizeof (*tep));
+ *cache_tep = *tep;
+
return 0;
}