20 #include <vat/plugin.h> 28 #define PLUGIN_LOG_DBG(...) \ 29 do {vlib_log_debug (vat_builtin_logger, __VA_ARGS__);} while(0) 30 #define PLUGIN_LOG_ERR(...) \ 31 do {vlib_log_err (vat_builtin_logger, __VA_ARGS__);} while(0) 32 #define PLUGIN_LOG_NOTICE(...) \ 33 do {vlib_log_notice (vat_builtin_logger, __VA_ARGS__);} while(0) 38 void *handle, *register_handle;
42 handle = dlopen ((
char *) pi->
filename, RTLD_LAZY);
57 register_handle = dlsym (pi->
handle,
"vat_plugin_register");
58 if (register_handle == 0)
67 error = (*fp) (pm->vat_main);
115 struct dirent *entry;
124 for (i = 0; i <
vec_len (plugin_path); i++)
126 dp = opendir ((
char *) plugin_path[i]);
131 while ((entry = readdir (dp)))
144 file_name =
format (0,
"%s/%s%c", plugin_path[i], entry->d_name, 0);
145 plugin_name =
format (0,
"%s%c", entry->d_name, 0);
148 if (stat ((
char *) file_name, &statb) < 0)
157 if (!S_ISREG (statb.st_mode))
164 pi->
name = plugin_name;
190 #define QUOTE(x) QUOTE_(x) 203 u8 *plugin_name_filter;
215 if (plugin_name_filter)
u8 * vlib_get_vat_plugin_name_filter(void)
u8 * format_clib_error(u8 *s, va_list *va)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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)
#define PLUGIN_LOG_NOTICE(...)
#define PLUGIN_LOG_ERR(...)
char * vat_plugin_name_filter
vlib_log_class_t vlib_log_register_class_rate_limit(char *class, char *subclass, u32 limit)
#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
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static u8 ** split_plugin_path(plugin_main_t *pm)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
int vat_plugin_init(vat_main_t *vam)
#define clib_error_free(e)
#define hash_get_mem(h, key)
plugin_main_t vat_plugin_main
int vat_load_new_plugins(plugin_main_t *pm)
static vlib_log_class_t vat_builtin_logger
uword * plugin_by_name_hash