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;
96 clib_host_to_net_u16 (tep->port),
99 return VNET_API_ERROR_ADDRESS_IN_USE;
103 return VNET_API_ERROR_INVALID_VALUE_2;
117 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
135 clib_host_to_net_u16 (tep->port),
145 if (server->flags & APP_OPTIONS_FLAGS_USE_FIFO)
146 return server->cb_fns.
183 *sst = SESSION_TYPE_IP4_TCP;
190 *sst = SESSION_TYPE_IP4_UDP;
197 *sst = SESSION_TYPE_IP6_UDP;
203 *sst = SESSION_TYPE_IP6_TCP;
216 uri = (
char *)
format (0,
"%s%c", uri, 0);
223 return VNET_API_ERROR_INVALID_VALUE;
253 &seg_name, &a->segment_size);
255 a->segment_name_length =
vec_len (seg_name);
256 a->segment_name = seg_name;
258 a->app_index = app->index;
271 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
284 return SESSION_TYPE_IP4_TCP;
286 return SESSION_TYPE_IP6_TCP;
291 return SESSION_TYPE_IP4_UDP;
293 return SESSION_TYPE_IP6_UDP;
306 memset (&tep, 0,
sizeof (tep));
311 if ((rv =
vnet_bind_i (a->app_index, sst, &tep, &a->handle)))
330 clib_host_to_net_u16 (tep.port),
333 return VNET_API_ERROR_ADDRESS_NOT_IN_USE;
346 memset (&tep, 0,
sizeof (tep));
351 return vnet_connect_i (a->app_index, a->api_context, sst, &tep, a->mp);
357 u32 index, thread_index;
363 if (!s || s->app_index != a->app_index)
364 return VNET_API_ERROR_INVALID_VALUE;
367 ASSERT (s->session_index == index);
381 if ((rv =
vnet_bind_i (a->app_index, sst, &a->tep, &a->handle)))
399 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)
struct _stream_session_t stream_session_t
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)
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)
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()
enum _session_api_proto session_api_proto_t
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 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)
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)
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
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
session_type_t session_type_from_proto_and_ip(session_api_proto_t proto, u8 is_ip4)
stream_session_t * stream_session_lookup_listener(ip46_address_t *lcl, u16 lcl_port, u8 proto)
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)