44 void *handle, *register_handle;
47 void *handoff_structure;
49 handle = dlopen ((
char *)pi->
name, RTLD_LAZY);
64 register_handle = dlsym (pi->
handle,
"vlib_plugin_register");
65 if (register_handle == 0)
75 if (handoff_structure == 0)
78 error = (*fp)(pm->
vlib_main, handoff_structure, from_early_init);
121 struct dirent *entry;
130 for (i = 0; i <
vec_len (plugin_path); i++)
132 dp = opendir ((
char *)plugin_path[i]);
137 while ((entry = readdir (dp)))
149 plugin_name =
format (0,
"%s/%s%c", plugin_path[i],
153 if (stat ((
char *)plugin_name, &statb) < 0)
161 if (!S_ISREG(statb.st_mode))
168 pi->
name = plugin_name;
177 memset (pi, 0,
sizeof (*pi));
190 char *vlib_plugin_path __attribute__((weak));
191 char *vlib_plugin_path =
"";
192 char *vlib_plugin_name_filter __attribute__((weak));
193 char *vlib_plugin_name_filter = 0;
203 if (vlib_plugin_name_filter)
sll srl srl sll sra u16x4 i
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
int vlib_load_new_plugins(plugin_main_t *pm, int from_early_init)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#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)
#define clib_error_report(e)
static void * vnet_get_handoff_structure(void)
#define clib_warning(format, args...)
void vlib_set_get_handoff_structure_cb(void *cb)
#define hash_create_string(elts, value_bytes)
static u8 ** split_plugin_path(plugin_main_t *pm)
plugin_main_t vlib_plugin_main
int vlib_plugin_early_init(vlib_main_t *vm)
uword * plugin_by_name_hash
#define vec_free(V)
Free vector's memory (no header).
static int load_one_plugin(plugin_main_t *pm, plugin_info_t *pi, int from_early_init)
void * handoff_structure_get_cb
plugin_info_t * plugin_info
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_get_mem(h, key)
#define clib_error_return(e, args...)