Go to the documentation of this file.
35 typedef struct PluginListNode_ {
53 if (plugin->
version != SC_API_VERSION) {
54 SCLogError(
"Suricata and plugin versions differ: plugin has %" PRIx64
55 " (%s) vs Suricata %" PRIx64
" (plugin was built with %s)",
64 PluginListNode *node =
SCCalloc(1,
sizeof(*node));
66 SCLogError(
"Failed to allocate memory for plugin");
69 node->plugin = plugin;
72 SCLogNotice(
"Initializing plugin %s; version= %s; author=%s; license=%s; built from %s",
79 static void InitPlugin(
char *path)
81 void *lib = dlopen(path, RTLD_NOW);
83 SCLogNotice(
"Failed to open %s as a plugin: %s", path, dlerror());
88 if (plugin_register == NULL) {
89 SCLogError(
"Plugin does not export SCPluginRegister function: %s", path);
95 SCLogError(
"Plugin registration failed: %s", path);
102 void SCPluginsLoad(
const char *capture_plugin_name,
const char *capture_plugin_args)
111 if (stat(plugin->
val, &statbuf) == -1) {
112 SCLogError(
"Bad plugin path: %s: %s", plugin->
val, strerror(errno));
115 if (S_ISDIR(statbuf.st_mode)) {
117 DIR *dir = opendir(plugin->
val);
119 SCLogError(
"Failed to open plugin directory %s: %s", plugin->
val, strerror(errno));
122 struct dirent *entry = NULL;
124 while ((entry = readdir(dir)) != NULL) {
125 if (strstr(entry->d_name,
".so") != NULL) {
126 snprintf(path,
sizeof(path),
"%s/%s", plugin->
val, entry->d_name);
132 InitPlugin(plugin->
val);
138 if (capture == NULL) {
139 FatalError(
"No capture plugin found with name %s", capture_plugin_name);
157 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.
bool(* Logger)(const void *tx, void *jb)
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 *)
const char * plugin_version
void SCPluginsLoad(const char *capture_plugin_name, const char *capture_plugin_args)
const char * suricata_version
int SCPluginRegisterAppLayer(SCAppLayerPlugin *)
int AppLayerParserPreRegister(void(*Register)(void))
int SigTablePreRegister(void(*KeywordsRegister)(void))
#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)