29 typedef struct PluginListNode_ {
54 PluginListNode *node =
SCCalloc(1,
sizeof(*node));
59 node->plugin = plugin;
68 static void InitPlugin(
char *path)
70 void *lib = dlopen(path, RTLD_NOW);
72 SCLogNotice(
"Failed to open %s as a plugin: %s", path, dlerror());
77 if (plugin_register == NULL) {
91 void SCPluginsLoad(
const char *capture_plugin_name,
const char *capture_plugin_args)
100 if (stat(plugin->
val, &statbuf) == -1) {
102 plugin->
val, strerror(errno));
105 if (S_ISDIR(statbuf.st_mode)) {
107 DIR *dir = opendir(plugin->
val);
110 plugin->
val, strerror(errno));
113 struct dirent *entry = NULL;
115 while ((entry = readdir(dir)) != NULL) {
116 if (strstr(entry->d_name,
".so") != NULL) {
117 snprintf(path,
sizeof(path),
"%s/%s", plugin->
val, entry->d_name);
123 InitPlugin(plugin->
val);
129 if (capture == NULL) {
131 capture_plugin_name);
138 static bool IsBuiltinTypeName(
const char *name)
140 const char *builtin[] = {
147 for (
int i = 0;; i++) {
148 if (builtin[i] == NULL) {
151 if (strcmp(builtin[i], name) == 0) {
168 if (IsBuiltinTypeName(plugin->
name)) {
177 if (strcmp(existing->
name, plugin->
name) == 0) {
179 "Eve file type name conflicts with previously registered type: %s",
194 if (strcmp(name, plugin->
name) == 0) {
212 if (strcmp(name, plugin->
name) == 0) {