58 app_ns->ns_id =
vec_dup (ns_id);
75 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
89 return VNET_API_ERROR_INVALID_VALUE;
101 app_ns->ns_secret = a->secret;
102 app_ns->sw_if_index = a->sw_if_index;
103 app_ns->ip4_fib_index =
105 app_ns->ip6_fib_index =
111 return VNET_API_ERROR_UNIMPLEMENTED;
119 return app_ns->ns_id;
145 app_ns->ip4_fib_index : app_ns->ip6_fib_index;
181 u8 is_add = 0, *ns_id = 0, secret_set = 0, sw_if_index_set = 0;
196 else if (
unformat (line_input,
"id %_%v%_", &ns_id))
198 else if (
unformat (line_input,
"secret %lu", &secret))
200 else if (
unformat (line_input,
"sw_if_index %u", &sw_if_index))
202 else if (
unformat (line_input,
"fib_id", &fib_id))
214 if (!ns_id || !secret_set || !sw_if_index_set)
227 .ip4_fib_id = fib_id,
241 .short_help =
"app ns [add] id <namespace-id> secret <secret> " 242 "sw_if_index <sw_if_index>",
252 app_ns->ns_secret, app_ns->sw_if_index, app_ns->ns_id);
263 u8 *ns_id, do_table = 0, had_input = 1;
275 if (
unformat (line_input,
"table %_%v%_", &ns_id))
306 "sw_if_index",
"Name");
323 .path =
"show app ns",
324 .short_help =
"show app ns",
#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 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
#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)
u8 * format_app_namespace(u8 *s, va_list *args)
void app_namespaces_init(void)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define clib_error_return(e, args...)
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.
#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)
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,...)
#define hash_create_vec(elts, key_bytes, value_bytes)
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)
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