|
|
|
@ -108,6 +108,49 @@ error:
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Register a packet output sub-module.
|
|
|
|
|
*
|
|
|
|
|
* This function will register an output module so it can be
|
|
|
|
|
* configured with the configuration file.
|
|
|
|
|
*
|
|
|
|
|
* \retval Returns 0 on success, -1 on failure.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
OutputRegisterPacketSubModule(const char *parent_name, char *name, char *conf_name,
|
|
|
|
|
OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *parent_ctx),
|
|
|
|
|
PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc)
|
|
|
|
|
{
|
|
|
|
|
if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutputModule *module = SCCalloc(1, sizeof(*module));
|
|
|
|
|
if (unlikely(module == NULL)) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module->name = SCStrdup(name);
|
|
|
|
|
if (unlikely(module->name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->conf_name = SCStrdup(conf_name);
|
|
|
|
|
if (unlikely(module->conf_name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->parent_name = SCStrdup(parent_name);
|
|
|
|
|
if (unlikely(module->conf_name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->InitSubFunc = InitFunc;
|
|
|
|
|
module->PacketLogFunc = PacketLogFunc;
|
|
|
|
|
module->PacketConditionFunc = PacketConditionFunc;
|
|
|
|
|
TAILQ_INSERT_TAIL(&output_modules, module, entries);
|
|
|
|
|
|
|
|
|
|
SCLogDebug("Packet logger \"%s\" registered.", name);
|
|
|
|
|
return;
|
|
|
|
|
error:
|
|
|
|
|
SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Register a tx output module.
|
|
|
|
|
*
|
|
|
|
@ -221,6 +264,47 @@ error:
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Register a file output sub-module.
|
|
|
|
|
*
|
|
|
|
|
* This function will register an output module so it can be
|
|
|
|
|
* configured with the configuration file.
|
|
|
|
|
*
|
|
|
|
|
* \retval Returns 0 on success, -1 on failure.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
OutputRegisterFileSubModule(const char *parent_name, char *name, char *conf_name,
|
|
|
|
|
OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *), FileLogger FileLogFunc)
|
|
|
|
|
{
|
|
|
|
|
if (unlikely(FileLogFunc == NULL)) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutputModule *module = SCCalloc(1, sizeof(*module));
|
|
|
|
|
if (unlikely(module == NULL)) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module->name = SCStrdup(name);
|
|
|
|
|
if (unlikely(module->name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->conf_name = SCStrdup(conf_name);
|
|
|
|
|
if (unlikely(module->conf_name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->parent_name = SCStrdup(parent_name);
|
|
|
|
|
if (unlikely(module->parent_name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->InitSubFunc = InitFunc;
|
|
|
|
|
module->FileLogFunc = FileLogFunc;
|
|
|
|
|
TAILQ_INSERT_TAIL(&output_modules, module, entries);
|
|
|
|
|
|
|
|
|
|
SCLogDebug("File logger \"%s\" registered.", name);
|
|
|
|
|
return;
|
|
|
|
|
error:
|
|
|
|
|
SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Register a file data output module.
|
|
|
|
|
*
|
|
|
|
@ -259,6 +343,47 @@ error:
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Register a file data output sub-module.
|
|
|
|
|
*
|
|
|
|
|
* This function will register an output module so it can be
|
|
|
|
|
* configured with the configuration file.
|
|
|
|
|
*
|
|
|
|
|
* \retval Returns 0 on success, -1 on failure.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
OutputRegisterFiledataSubModule(const char *parent_name, char *name, char *conf_name,
|
|
|
|
|
OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *), FiledataLogger FiledataLogFunc)
|
|
|
|
|
{
|
|
|
|
|
if (unlikely(FiledataLogFunc == NULL)) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutputModule *module = SCCalloc(1, sizeof(*module));
|
|
|
|
|
if (unlikely(module == NULL)) {
|
|
|
|
|
goto error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module->name = SCStrdup(name);
|
|
|
|
|
if (unlikely(module->name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->conf_name = SCStrdup(conf_name);
|
|
|
|
|
if (unlikely(module->conf_name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->parent_name = SCStrdup(parent_name);
|
|
|
|
|
if (unlikely(module->parent_name == NULL))
|
|
|
|
|
goto error;
|
|
|
|
|
module->InitSubFunc = InitFunc;
|
|
|
|
|
module->FiledataLogFunc = FiledataLogFunc;
|
|
|
|
|
TAILQ_INSERT_TAIL(&output_modules, module, entries);
|
|
|
|
|
|
|
|
|
|
SCLogDebug("Filedata logger \"%s\" registered.", name);
|
|
|
|
|
return;
|
|
|
|
|
error:
|
|
|
|
|
SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Get an output module by name.
|
|
|
|
|
*
|
|
|
|
|