47 result =
vec_dup (feature_vector);
68 if (last_node_index != ~0)
91 u32 last_node_index = ~0;
100 _vec_len (config_string) = 0;
116 if (last_node_index == ~0 || last_node_index != end_node_index)
118 u32 next_index =
add_next (vm, cm, last_node_index, end_node_index);
119 vec_add1 (config_string, next_index);
170 char *start_node_names[],
171 int n_start_node_names,
172 char *feature_node_names[],
int n_feature_node_names)
184 ASSERT (n_feature_node_names >= 1);
187 for (i = 0; i < n_start_node_names; i++)
196 for (i = 0; i < n_feature_node_names; i++)
198 if (!feature_node_names[i])
206 if (i + 1 == n_feature_node_names)
255 u32 config_string_heap_index,
u32 end_node_index)
260 if (end_node_index == ~0)
263 if (config_string_heap_index == ~0)
284 _vec_len (new_features) =
last;
292 new->reference_count += 1;
300 new->config_string_heap_index + 1);
309 u32 config_string_heap_index,
311 void *feature_config,
u32 n_feature_config_bytes)
315 u32 n_feature_config_u32s, end_node_index;
318 if (node_index == ~0)
321 if (config_string_heap_index == ~0)
342 if (n_feature_config_bytes)
344 n_feature_config_u32s =
350 n_feature_config_bytes);
354 if (
vec_len (new_features) > 1)
361 new->reference_count += 1;
369 new->config_string_heap_index + 1);
378 u32 config_string_heap_index,
380 void *feature_config,
u32 n_feature_config_bytes)
384 u32 n_feature_config_u32s;
392 n_feature_config_u32s =
402 && (n_feature_config_u32s == 0
404 n_feature_config_bytes)))
413 f = new_features + (f - old->
features);
415 vec_delete (new_features, 1, f - new_features);
424 [config_string_heap_index]);
425 new->reference_count += 1;
428 new->config_string_heap_index + 1);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
vnet_config_feature_t * features
void vnet_config_init(vlib_main_t *vm, vnet_config_main_t *cm, char *start_node_names[], int n_start_node_names, char *feature_node_names[], int n_feature_node_names)
#define hash_unset(h, key)
static vnet_config_t * find_config_with_features(vlib_main_t *vm, vnet_config_main_t *cm, vnet_config_feature_t *feature_vector, u32 end_node_index)
#define clib_memcpy_fast(a, b, c)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
static void remove_reference(vnet_config_main_t *cm, vnet_config_t *c)
u32 default_end_node_index
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define heap_elt_at_index(v, index)
static heap_elt_t * last(heap_header_t *h)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define hash_set_mem(h, key, value)
u32 config_string_heap_handle
u32 * config_string_vector
#define vec_bytes(v)
Number of data bytes in vector.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
u32 * node_index_by_feature_index
#define clib_memcpy(d, s, n)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
u32 vnet_config_modify_end_node(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 end_node_index)
vl_api_cnat_endpoint_t new
static int feature_cmp(void *a1, void *a2)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void vnet_config_feature_free(vnet_config_feature_t *f)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
#define vec_end(v)
End (last data address) of vector.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define pool_put(P, E)
Free an object E in pool P.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
static void free_feature_vector(vnet_config_feature_t *feature_vector)
u32 * config_pool_index_by_user_index
static void vnet_config_free(vnet_config_main_t *cm, vnet_config_t *c)
static u32 * vnet_get_config_heap(vnet_config_main_t *cm, u32 ci)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static uword round_pow2(uword x, uword pow2)
static vnet_config_feature_t * duplicate_feature_vector(vnet_config_feature_t *feature_vector)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
#define heap_alloc(v, size, handle)
static u32 add_next(vlib_main_t *vm, vnet_config_main_t *cm, u32 last_node_index, u32 this_node_index)
#define vec_elt(v, i)
Get vector value at index i.
#define hash_create_vec(elts, key_bytes, value_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
#define hash_get_mem(h, key)
#define STRUCT_SIZE_OF(t, f)
vnet_config_t * config_pool
#define vec_foreach(var, vec)
Vector iterator.
void vnet_config_del(vnet_config_main_t *cm, u32 config_id)
u32 * end_node_indices_by_user_index
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
uword * config_string_hash
u32 config_string_heap_index