Go to the documentation of this file.
35 typedef struct PluginListNode_ {
58 PluginListNode *node =
SCCalloc(1,
sizeof(*node));
60 SCLogError(
"Failed to allocate memory for plugin");
63 node->plugin = plugin;
72 static void InitPlugin(
char *path)
74 void *lib = dlopen(path, RTLD_NOW);
76 SCLogNotice(
"Failed to open %s as a plugin: %s", path, dlerror());
81 if (plugin_register == NULL) {
82 SCLogError(
"Plugin does not export SCPluginRegister function: %s", path);
88 SCLogError(
"Plugin registration failed: %s", path);
95 void SCPluginsLoad(
const char *capture_plugin_name,
const char *capture_plugin_args)
104 if (stat(plugin->
val, &statbuf) == -1) {
105 SCLogError(
"Bad plugin path: %s: %s", plugin->
val, strerror(errno));
108 if (S_ISDIR(statbuf.st_mode)) {
110 DIR *dir = opendir(plugin->
val);
112 SCLogError(
"Failed to open plugin directory %s: %s", plugin->
val, strerror(errno));
115 struct dirent *entry = NULL;
117 while ((entry = readdir(dir)) != NULL) {
118 if (strstr(entry->d_name,
".so") != NULL) {
119 snprintf(path,
sizeof(path),
"%s/%s", plugin->
val, entry->d_name);
125 InitPlugin(plugin->
val);
131 if (capture == NULL) {
132 FatalError(
"No capture plugin found with name %s", capture_plugin_name);
150 if (strcmp(
name, plugin->
name) == 0) {
int SCPluginRegisterCapture(SCCapturePlugin *)
int SCRunmodeGet(void)
Get the current run mode.
struct HtpBodyChunk_ * next
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
void(* Init)(const char *args, int plugin_slot, int receive_slot, int decode_slot)
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_INSERT_TAIL(head, elm, field)
void(* KeywordsRegister)(void)
bool(* EveJsonSimpleTxLogFunc)(void *, struct JsonBuilder *)
#define TAILQ_ENTRY(type)
#define TAILQ_HEAD_INITIALIZER(head)
void AppProtoRegisterProtoString(AppProto alproto, const char *proto_name)
bool RegisterPlugin(SCPlugin *, void *)
#define SC_PLUGIN_API_VERSION
void SCPluginsLoad(const char *capture_plugin_name, const char *capture_plugin_args)
int SCPluginRegisterAppLayer(SCAppLayerPlugin *)
int AppLayerParserPreRegister(void(*Register)(void))
int SigTablePreRegister(void(*KeywordsRegister)(void))
bool(* Logger)(void *tx, void *jb)
#define SCLogError(...)
Macro used to log ERROR messages.
#define TAILQ_HEAD(name, type)
int OutputPreRegisterLogger(EveJsonTxLoggerRegistrationData reg_data)
#define SCLogNotice(...)
Macro used to log NOTICE messages.
SCCapturePlugin * SCPluginFindCaptureByName(const char *name)
SCPlugin *(* SCPluginRegisterFunc)(void)