20 #include <vat/plugin.h> 29 void *handle, *register_handle;
33 handle = dlopen ((
char *) pi->
filename, 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)))
132 file_name =
format (0,
"%s/%s%c", plugin_path[i], entry->d_name, 0);
133 plugin_name =
format (0,
"%s%c", entry->d_name, 0);
136 if (stat ((
char *) file_name, &statb) < 0)
145 if (!S_ISREG (statb.st_mode))
152 pi->
name = plugin_name;
163 memset (pi, 0,
sizeof (*pi));
178 #define QUOTE(x) QUOTE_(x) 194 u8 *plugin_name_filter;
202 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_vat_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