20 #include <vat/plugin.h> 29 void *handle, *register_handle;
33 handle = dlopen ((
char *) pi->
name, RTLD_LAZY);
48 register_handle = dlsym (pi->
handle,
"vat_plugin_register");
49 if (register_handle == 0)
54 error = (*fp) (pm->vat_main);
108 for (i = 0; i <
vec_len (plugin_path); i++)
110 dp = opendir ((
char *) plugin_path[i]);
115 while ((entry = readdir (dp)))
127 plugin_name =
format (0,
"%s/%s%c", plugin_path[i],
131 if (stat ((
char *) plugin_name, &statb) < 0)
139 if (!S_ISREG (statb.st_mode))
146 pi->
name = plugin_name;
155 memset (pi, 0,
sizeof (*pi));
170 #define QUOTE(x) QUOTE_(x) 186 u8 *plugin_name_filter;
194 if (plugin_name_filter)
u8 * vlib_get_vat_plugin_name_filter(void)
sll srl srl sll sra u16x4 i
u8 * vlib_get_vat_plugin_path(void)
#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)
char * vat_plugin_name_filter
#define hash_create_string(elts, value_bytes)
static int load_one_plugin(plugin_main_t *pm, plugin_info_t *pi)
plugin_info_t * plugin_info
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
static u8 ** split_plugin_path(plugin_main_t *pm)
#define clib_error_report(e)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
int vat_plugin_init(vat_main_t *vam)
#define hash_get_mem(h, key)
plugin_main_t vat_plugin_main
int vat_load_new_plugins(plugin_main_t *pm)
uword * plugin_by_name_hash