30 return (ip46_address->ip4.as_u32 == 0);
32 return (ip46_address->as_u64[0] == 0 && ip46_address->as_u64[1] == 0);
67 *thread_index = handle & 0xFFFFFFFF;
68 *session_index = handle >> 32;
70 if (*thread_index >=
vec_len (smm->sessions))
71 return VNET_API_ERROR_INVALID_VALUE;
73 pool = smm->sessions[*thread_index];
76 return VNET_API_ERROR_INVALID_VALUE_2;
92 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
97 return VNET_API_ERROR_ADDRESS_IN_USE;
101 return VNET_API_ERROR_INVALID_VALUE_2;
115 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
141 if (server->flags & APP_OPTIONS_FLAGS_USE_FIFO)
142 return server->cb_fns.
179 *sst = SESSION_TYPE_IP4_TCP;
180 tep->port = clib_host_to_net_u16 (tep->port);
187 *sst = SESSION_TYPE_IP4_UDP;
188 tep->port = clib_host_to_net_u16 (tep->port);
195 *sst = SESSION_TYPE_IP6_UDP;
196 tep->port = clib_host_to_net_u16 (tep->port);
202 *sst = SESSION_TYPE_IP6_TCP;
203 tep->port = clib_host_to_net_u16 (tep->port);
227 uri = (
char *)
format (0,
"%s%c", uri, 0);
234 return VNET_API_ERROR_INVALID_VALUE;
272 &seg_name, &a->segment_size);
274 a->segment_name_length =
vec_len (seg_name);
275 a->segment_name = seg_name;
277 a->app_index = app->index;
290 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
304 memset (&tep, 0,
sizeof (tep));
309 if ((rv =
vnet_bind_i (a->app_index, sst, &tep, &a->handle)))
328 clib_host_to_net_u16 (tep.port),
331 return VNET_API_ERROR_ADDRESS_NOT_IN_USE;
344 memset (&tep, 0,
sizeof (tep));
349 return vnet_connect_i (a->app_index, a->api_context, sst, &tep, a->mp);
355 u32 index, thread_index;
361 if (!s || s->app_index != a->app_index)
362 return VNET_API_ERROR_INVALID_VALUE;
365 ASSERT (s->session_index == index);
379 if ((rv =
vnet_bind_i (a->app_index, sst, &a->tep, &a->handle)))
397 return vnet_connect_i (a->app_index, a->api_context, sst, &a->tep, a->mp);
fib_protocol_t fp_proto
protocol type
int application_stop_listen(application_t *srv, u64 handle)
Stop listening on session associated to handle.
struct _vnet_connect_args vnet_connect_args_t
int vnet_bind_uri(vnet_bind_args_t *a)
application_t * application_new()
int vnet_bind_i(u32 app_index, session_type_t sst, transport_endpoint_t *tep, u64 *handle)
static transport_endpoint_t * cache_tep
void segment_manager_get_segment_info(u32 index, u8 **name, u32 *size)
int vnet_unbind_uri(vnet_unbind_args_t *a)
static u8 ip_is_local(ip46_address_t *ip46_address, u8 is_ip4)
static session_type_t cache_sst
struct _vnet_disconnect_args_t vnet_disconnect_args_t
int vnet_bind(vnet_bind_args_t *a)
struct _vnet_unbind_args_t vnet_unbind_args_t
Aggregrate type for a prefix.
int vnet_connect_i(u32 app_index, u32 api_context, session_type_t sst, transport_endpoint_t *tep, void *mp)
struct _stream_session_t stream_session_t
u16 fp_len
The mask length.
void session_send_session_evt_to_thread(u64 session_handle, fifo_event_type_t evt_type, u32 thread_index)
fib_node_index_t fib_table_lookup(u32 fib_index, const fib_prefix_t *prefix)
Perfom a longest prefix match in the non-forwarding table.
static uword pointer_to_uword(const void *p)
struct _vnet_app_attach_args_t vnet_app_attach_args_t
static session_manager_main_t * vnet_get_session_manager_main()
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
struct _session_manager_main session_manager_main_t
static u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
static int redirect_connect_callback(u32 server_api_client_index, void *mp_arg)
Redirect a connect_uri message to the indicated server.
#define clib_memcpy(a, b, c)
stream_session_t * stream_session_lookup_listener(ip46_address_t *lcl, u16 lcl_port, u8 proto)
u32 fib_node_index_t
A typedef of a node index.
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
struct _application application_t
int vnet_disconnect_session(vnet_disconnect_args_t *a)
int api_parse_session_handle(u64 handle, u32 *session_index, u32 *thread_index)
static stream_session_t * stream_session_get_if_valid(u64 si, u32 thread_index)
enum fib_entry_flag_t_ fib_entry_flag_t
int vnet_application_attach(vnet_app_attach_args_t *a)
Attaches application.
static void stream_session_parse_handle(u64 handle, u32 *index, u32 *thread_index)
int application_init(application_t *app, u32 api_client_index, u64 *options, session_cb_vft_t *cb_fns)
static void clib_mem_free(void *p)
void application_del(application_t *app)
int application_start_listen(application_t *srv, session_type_t session_type, transport_endpoint_t *tep, u64 *res)
Start listening local transport endpoint for requested transport.
struct _vnet_app_detach_args_t vnet_app_detach_args_t
static void * clib_mem_alloc(uword size)
session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
uword unformat_vnet_uri(unformat_input_t *input, va_list *args)
unformat a vnet URI
int vnet_unbind_i(u32 app_index, u64 handle)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
application_t * application_get(u32 index)
struct _transport_endpoint transport_endpoint_t
int vnet_connect(vnet_connect_args_t *a)
int vnet_unbind(vnet_unbind_args_t *a)
struct _segment_manager segment_manager_t
int parse_uri(char *uri, session_type_t *sst, transport_endpoint_t *tep)
int vnet_connect_uri(vnet_connect_args_t *a)
int vnet_application_detach(vnet_app_detach_args_t *a)
struct _vnet_bind_args_t vnet_bind_args_t
static segment_manager_t * segment_manager_get(u32 index)
static u64 listen_session_get_handle(stream_session_t *s)
int application_open_session(application_t *app, session_type_t sst, transport_endpoint_t *tep, u32 api_context)
application_t * application_get_if_valid(u32 index)
fib_entry_flag_t fib_entry_get_flags(fib_node_index_t fib_entry_index)