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YvyeM67877RB\r\n" 78 "EDSKc/X8ESLfOB44iGvZUEMG6zJFscx9DgN25iQZAoGAbyd+JEWwdVH9/K3IH1t2\r\n" 79 "PBkZX17kNWv+iVM1WyFjbe++vfKZCrOJiyiqhDeEqgrP3AuNMlaaduC3VRC3G5oV\r\n" 80 "Mj1tlhDWQ/qhvKdCKNdIVQYDE75nw+FRWV8yYkHAnXYW3tNoweDIwixE0hkPR1bc\r\n" 81 "oEjPLVNtx8SOj/M4rhaPT3I=\r\n" "-----END PRIVATE KEY-----\r\n";
84 #define app_interface_check_thread_and_barrier(_fn, _arg) \ 85 if (PREDICT_FALSE (!vlib_thread_is_main_w_barrier ())) \ 87 vlib_rpc_call_main_thread (_fn, (u8 *) _arg, sizeof(*_arg)); \ 111 clib_warning (
"sw_if_index %u not configured with ip %U",
116 return (is_lep ||
ip_is_local (sep->fib_index, &sep->ip, sep->is_ip4));
125 *thread_index = handle & 0xFFFFFFFF;
126 *session_index = handle >> 32;
129 return VNET_API_ERROR_INVALID_VALUE;
134 return VNET_API_ERROR_INVALID_VALUE_2;
144 u32 ns_index, fib_index;
149 if (app->
flags & APP_OPTIONS_FLAGS_IS_TRANSPORT_APP)
169 fib_index = sep->fib_index;
171 fib_index = sep->is_ip4 ? app_ns->ip4_fib_index : app_ns->ip6_fib_index;
172 sep->peer.fib_index = fib_index;
173 sep->fib_index = fib_index;
177 sep->sw_if_index = app_ns->sw_if_index;
183 && sep->peer.sw_if_index != app_ns->sw_if_index)
184 clib_warning (
"Local sw_if_index different from app ns sw_if_index");
186 sep->peer.sw_if_index = app_ns->sw_if_index;
202 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
205 a->sep_ext.app_wrk_index = app_wrk->
wrk_index;
209 return VNET_API_ERROR_INVALID_VALUE_2;
221 ll_handle = a->handle;
265 SESSION_DBG (
"app (%d) not attached", wrk_map_index);
266 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
272 a->wrk_map_index, a->handle)))
289 u32 table_index, server_index, li;
297 return VNET_API_ERROR_INVALID_VALUE;
313 return VNET_API_ERROR_APP_CONNECT_FILTERED;
325 if (server_index != a->app_index)
345 return VNET_API_ERROR_SESSION_CONNECT;
348 return VNET_API_ERROR_APP_CONNECT_SCOPE;
366 return VNET_API_ERROR_SESSION_CONNECT;
391 u32 transport_proto = 0, port;
396 sep->transport_proto = transport_proto;
397 sep->port = clib_host_to_net_u16 (port);
403 &sep->ip.ip4, &port))
405 sep->transport_proto = transport_proto;
406 sep->port = clib_host_to_net_u16 (port);
414 sep->transport_proto = transport_proto;
415 sep->port = clib_host_to_net_u16 (port);
421 &sep->ip.ip6, &port))
423 sep->transport_proto = transport_proto;
424 sep->port = clib_host_to_net_u16 (port);
446 uri = (
char *)
format (0,
"%s%c", uri, 0);
453 return VNET_API_ERROR_INVALID_VALUE;
458 cache_uri = (
u8 *) uri;
471 if (
vec_len (namespace_id) == 0)
480 return VNET_API_ERROR_APP_INVALID_NS;
483 return VNET_API_ERROR_APP_INVALID_NS;
484 if (app_ns->ns_secret != secret)
485 return VNET_API_ERROR_APP_WRONG_NS_SECRET;
497 clib_warning (
"api client index %u does not have an api registration!",
499 return format (0,
"unknown%c", 0);
516 u32 app_ns_index = 0;
527 "api index or name must be provided");
531 "app already attached");
560 a->segment = &fs->
ssvm;
580 return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
597 sep.app_wrk_index = 0;
620 return VNET_API_ERROR_ADDRESS_NOT_IN_USE;
664 return VNET_API_ERROR_INVALID_VALUE;
667 return VNET_API_ERROR_INVALID_VALUE;
#define SESSION_DROP_HANDLE
u8 session_endpoint_in_ns(session_endpoint_t *sep)
int application_stop_listen(u32 app_index, u32 app_wrk_index, session_handle_t handle)
Stop listening on session associated to handle.
app_worker_t * app_worker_get(u32 wrk_index)
#define APP_NAMESPACE_INVALID_INDEX
void segment_manager_segment_reader_unlock(segment_manager_t *sm)
static int app_validate_namespace(u8 *namespace_id, u64 secret, u32 *app_ns_index)
int app_worker_alloc_and_init(application_t *app, app_worker_t **wrk)
static int application_connect(vnet_connect_args_t *a)
const u32 test_srv_crt_rsa_len
static int vnet_unbind_inline(vnet_unbind_args_t *a)
u32 ns_index
Namespace the application belongs to.
static u8 session_endpoint_is_local(session_endpoint_t *sep)
u8 application_has_global_scope(application_t *app)
struct _vnet_connect_args vnet_connect_args_t
int vnet_bind_uri(vnet_bind_args_t *a)
const u32 test_srv_key_rsa_len
u8 ip_is_local(u32 fib_index, ip46_address_t *ip46_address, u8 is_ip4)
Checks that an ip is local to the requested fib.
clib_error_t * vnet_unbind(vnet_unbind_args_t *a)
app_worker_t * application_listener_select_worker(stream_session_t *ls, u8 is_local)
application_t * application_lookup_name(const u8 *name)
u8 ip_interface_has_address(u32 sw_if_index, ip46_address_t *ip, u8 is_ip4)
u32 session_lookup_get_index_for_fib(u32 fib_proto, u32 fib_index)
local_session_t * application_get_local_session_from_handle(session_handle_t handle)
int application_local_session_connect(app_worker_t *client_wrk, app_worker_t *server_wrk, local_session_t *ll, u32 opaque)
application_t * application_lookup(u32 api_client_index)
static u8 * app_name_from_api_index(u32 api_client_index)
static void session_endpoint_update_for_app(session_endpoint_cfg_t *sep, application_t *app, u8 is_connect)
static u32 session_index_from_handle(session_handle_t handle)
stream_session_t * session_lookup_listener(u32 table_index, session_endpoint_t *sep)
Lookup listener, exact or proxy (inaddr_any:0) match.
static stream_session_t * listen_session_get_from_handle(session_handle_t handle)
app_worker_t * application_get_worker(application_t *app, u32 wrk_map_index)
application_t * application_get_if_valid(u32 app_index)
#define clib_memcpy(d, s, n)
int application_is_proxy(application_t *app)
int vnet_unbind_uri(vnet_unbind_args_t *a)
u32 first_segment_manager
First segment manager has in the the first segment the application's event fifo.
void application_detach_process(application_t *app, u32 api_client_index)
struct _vnet_disconnect_args_t vnet_disconnect_args_t
static session_endpoint_cfg_t * cache_sep
u32 transport_listener_index
Transport listener index.
struct _vnet_unbind_args_t vnet_unbind_args_t
svm_fifo_segment_private_t * segment_manager_get_segment_w_lock(segment_manager_t *sm, u32 segment_index)
Reads a segment from the segment manager's pool and acquires reader lock.
static local_session_t * application_get_local_listen_session(application_t *app, u32 session_index)
u32 app_namespace_index_from_id(const u8 *ns_id)
struct _stream_session_t stream_session_t
void session_close(stream_session_t *s)
Initialize session closing procedure.
stream_session_t * sessions
Worker session pool.
struct _vnet_app_attach_args_t vnet_app_attach_args_t
struct _session_endpoint_cfg session_endpoint_cfg_t
static session_manager_main_t * vnet_get_session_manager_main()
struct _session_endpoint session_endpoint_t
static u8 session_handle_is_local(session_handle_t handle)
static int vnet_bind_inline(vnet_bind_args_t *a)
#define APP_INVALID_INDEX
app_namespace_t * app_namespace_get(u32 index)
clib_error_t * vnet_connect(vnet_connect_args_t *a)
u32 wrk_index
Worker index in global worker pool.
u32 application_session_table(application_t *app, u8 fib_proto)
const char test_srv_crt_rsa[]
#define SESSION_DBG(_fmt, _args...)
An API client registration, only in vpp/vlib.
u64 session_lookup_local_endpoint(u32 table_index, session_endpoint_t *sep)
Look up endpoint in local session table.
u32 application_local_session_table(application_t *app)
#define app_interface_check_thread_and_barrier(_fn, _arg)
#define vec_free(V)
Free vector's memory (no header).
#define ENDPOINT_INVALID_INDEX
#define clib_warning(format, args...)
#define SESSION_INVALID_HANDLE
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
int vnet_disconnect_session(vnet_disconnect_args_t *a)
int api_parse_session_handle(u64 handle, u32 *session_index, u32 *thread_index)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
struct _app_namespace app_namespace_t
application_t * application_get(u32 app_index)
static stream_session_t * session_get_from_handle_if_valid(session_handle_t handle)
clib_error_t * vnet_bind(vnet_bind_args_t *a)
uword unformat_transport_proto(unformat_input_t *input, va_list *args)
static local_session_t * application_get_local_listener_w_handle(session_handle_t handle)
static u8 session_endpoint_fib_proto(session_endpoint_t *sep)
static void clib_mem_free(void *p)
static u8 session_endpoint_is_zero(session_endpoint_t *sep)
int application_local_session_disconnect(u32 app_index, local_session_t *ls)
struct _vnet_app_detach_args_t vnet_app_detach_args_t
static void * clib_mem_alloc(uword size)
int application_alloc_and_init(app_init_args_t *a)
u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
int parse_uri(char *uri, session_endpoint_cfg_t *sep)
int application_start_listen(application_t *app, session_endpoint_cfg_t *sep_ext, session_handle_t *res)
Start listening local transport endpoint for requested transport.
uword unformat_vnet_uri(unformat_input_t *input, va_list *args)
unformat a vnet URI
session_manager_worker_t * wrk
Worker contexts.
u64 segment_manager_segment_handle(segment_manager_t *sm, svm_fifo_segment_private_t *segment)
clib_error_t * vnet_connect_uri(vnet_connect_args_t *a)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * vnet_application_attach(vnet_app_attach_args_t *a)
Attach application to vpp.
#define SESSION_ENDPOINT_CFG_NULL
static fib_protocol_t fib_ip_proto(bool is_ip6)
Convert from boolean is_ip6 to FIB protocol.
u8 ip_is_local_host(ip46_address_t *ip46_address, u8 is_ip4)
int app_worker_open_session(app_worker_t *app, session_endpoint_t *sep, u32 api_context)
struct _segment_manager segment_manager_t
u32 app_index
Index of owning app.
int application_stop_local_listen(u32 app_index, u32 wrk_map_index, session_handle_t lh)
Clean up local session table.
#define clib_error_return_code(e, code, flags, args...)
void application_setup_proxy(application_t *app)
u32 api_client_index
API index for the worker.
svm_msg_q_t * event_queue
Application listens for events on this svm queue.
int vnet_application_detach(vnet_app_detach_args_t *a)
Detach application from vpp.
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_start_local_listen(application_t *app, session_endpoint_cfg_t *sep_ext, session_handle_t *handle)
static void local_session_parse_handle(session_handle_t handle, u32 *app_or_wrk_index, u32 *session_index)
const char test_srv_key_rsa[]
u8 application_has_local_scope(application_t *app)