63 app_ns->ns_id =
vec_dup (ns_id);
80 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
94 return VNET_API_ERROR_INVALID_VALUE;
106 app_ns->ns_secret = a->secret;
107 app_ns->sw_if_index = a->sw_if_index;
108 app_ns->ip4_fib_index =
110 app_ns->ip6_fib_index =
120 return VNET_API_ERROR_UNIMPLEMENTED;
128 return app_ns->ns_id;
154 app_ns->ip4_fib_index : app_ns->ip6_fib_index;
202 u8 is_add = 0, *ns_id = 0, secret_set = 0, sw_if_index_set = 0;
217 else if (
unformat (line_input,
"id %_%v%_", &ns_id))
219 else if (
unformat (line_input,
"secret %lu", &secret))
221 else if (
unformat (line_input,
"sw_if_index %u", &sw_if_index))
223 else if (
unformat (line_input,
"fib_id", &fib_id))
235 if (!ns_id || !secret_set || !sw_if_index_set)
248 .ip4_fib_id = fib_id,
262 .short_help =
"app ns [add] id <namespace-id> secret <secret> " 263 "sw_if_index <sw_if_index>",
273 app_ns->ns_secret, app_ns->sw_if_index, app_ns->ns_id);
320 u8 *ns_id, do_table = 0, had_input = 1, do_api = 0;
334 if (
unformat (line_input,
"table %_%v%_", &ns_id))
336 else if (
unformat (line_input,
"api-clients"))
378 "sw_if_index",
"Name");
395 .path =
"show app ns",
396 .short_help =
"show app ns [table <id> [api-clients]]",
#define APP_NAMESPACE_INVALID_INDEX
session_table_t * session_table_alloc(void)
void session_lookup_show_table_entries(vlib_main_t *vm, session_table_t *table, u8 type, u8 is_local)
vnet_main_t * vnet_get_main(void)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define session_cli_return_if_not_enabled()
int vnet_app_namespace_add_del(vnet_app_namespace_add_del_args_t *a)
u32 app_namespace_index(app_namespace_t *app_ns)
static clib_error_t * app_ns_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void session_lookup_set_tables_appns(app_namespace_t *app_ns)
Mark (global) tables as pertaining to app ns.
struct _vnet_app_namespace_add_del_args vnet_app_namespace_add_del_args_t
u32 wrk_map_index
Worker index in app's map pool.
#define hash_set_mem(h, key, value)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
app_namespace_t * app_namespace_alloc(u8 *ns_id)
int appns_sapi_add_ns_socket(app_namespace_t *app_ns)
u8 * format_app_namespace(u8 *s, va_list *args)
static clib_file_t * clib_file_get(clib_file_main_t *fm, u32 file_index)
void app_namespaces_init(void)
description fragment has unexpected format
#define clib_error_return(e, args...)
clib_file_main_t file_main
u32 app_namespace_index_from_id(const u8 *ns_id)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
void session_table_init(session_table_t *slt, u8 fib_proto)
Initialize session table hash tables.
u32 app_namespace_get_fib_index(app_namespace_t *app_ns, u8 fib_proto)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void app_namespace_show_api(vlib_main_t *vm, app_namespace_t *app_ns)
#define APP_INVALID_INDEX
#define vec_dup(V)
Return copy of vector (no header, no alignment)
app_namespace_t * app_namespace_get(u32 index)
uword * app_namespace_lookup_table
Hash table of application namespaces by app ns ids.
session_table_t * app_namespace_get_local_table(app_namespace_t *app_ns)
#define vec_free(V)
Free vector's memory (no header).
const u8 * app_namespace_id_from_index(u32 index)
static u8 app_sapi_enabled
const u8 * app_namespace_id(app_namespace_t *app_ns)
struct _app_namespace app_namespace_t
#define VLIB_CLI_COMMAND(x,...)
session_table_t * session_table_get(u32 table_index)
u32 fib_table_get_table_id_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the Table-ID of the FIB bound to the interface.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
struct _socket_t clib_socket_t
#define hash_create_vec(elts, key_bytes, value_bytes)
app_worker_t * app_worker_get(u32 wrk_index)
void appns_sapi_enable(void)
struct _session_lookup_table session_table_t
#define FIB_PROTOCOL_MAX
Definition outside of enum so it does not need to be included in non-defaulted switch statements...
#define hash_get_mem(h, key)
u8 appns_sapi_enabled(void)
u32 app_index
Index of owning app.
u32 session_table_index(session_table_t *slt)
static app_namespace_t * app_namespace_pool
Pool of application namespaces.
static clib_error_t * show_app_ns_fn(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
app_namespace_t * app_namespace_get_from_id(const u8 *ns_id)
static vnet_sw_interface_t * vnet_get_sw_interface_or_null(vnet_main_t *vnm, u32 sw_if_index)
vl_api_interface_index_t sw_if_index
static uword pool_elts(void *v)
Number of active elements in a pool.