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)
58 error = (*fp) (pm->vat_main);
103 struct dirent *entry;
112 for (i = 0; i <
vec_len (plugin_path); i++)
114 dp = opendir ((
char *) plugin_path[i]);
119 while ((entry = readdir (dp)))
131 plugin_name =
format (0,
"%s/%s%c", plugin_path[i],
135 if (stat ((
char *) plugin_name, &statb) < 0)
143 if (!S_ISREG (statb.st_mode))
150 pi->
name = plugin_name;
159 memset (pi, 0,
sizeof (*pi));
174 #define QUOTE(x) QUOTE_(x) 190 u8 *plugin_name_filter;
198 if (plugin_name_filter)
u8 * vlib_get_vat_plugin_name_filter(void)
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