exit(EXIT_FAILURE);
}
+/**
+ * \brief Register a flow output 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
+OutputRegisterFlowModule(const char *name, const char *conf_name,
+ OutputCtx *(*InitFunc)(ConfNode *), FlowLogger FlowLogFunc)
+{
+ if (unlikely(FlowLogFunc == NULL)) {
+ goto error;
+ }
+
+ OutputModule *module = SCCalloc(1, sizeof(*module));
+ if (unlikely(module == NULL)) {
+ goto error;
+ }
+
+ module->name = name;
+ module->conf_name = conf_name;
+ module->InitFunc = InitFunc;
+ module->FlowLogFunc = FlowLogFunc;
+ TAILQ_INSERT_TAIL(&output_modules, module, entries);
+
+ SCLogDebug("Flow logger \"%s\" registered.", name);
+ return;
+error:
+ SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+ exit(EXIT_FAILURE);
+}
+
+/**
+ * \brief Register a flow 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
+OutputRegisterFlowSubModule(const char *parent_name, const char *name,
+ const char *conf_name, OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *),
+ FlowLogger FlowLogFunc)
+{
+ if (unlikely(FlowLogFunc == NULL)) {
+ goto error;
+ }
+
+ OutputModule *module = SCCalloc(1, sizeof(*module));
+ if (unlikely(module == NULL)) {
+ goto error;
+ }
+
+ module->name = name;
+ module->conf_name = conf_name;
+ module->parent_name = parent_name;
+ module->InitSubFunc = InitFunc;
+ module->FlowLogFunc = FlowLogFunc;
+ TAILQ_INSERT_TAIL(&output_modules, module, entries);
+
+ SCLogDebug("Flow logger \"%s\" registered.", name);
+ return;
+error:
+ SCLogError(SC_ERR_FATAL, "Fatal error encountered. Exiting...");
+ exit(EXIT_FAILURE);
+}
+
/**
* \brief Get an output module by name.
*
#include "output-tx.h"
#include "output-file.h"
#include "output-filedata.h"
+#include "output-flow.h"
typedef struct OutputModule_ {
const char *name;
TxLogger TxLogFunc;
FileLogger FileLogFunc;
FiledataLogger FiledataLogFunc;
+ FlowLogger FlowLogFunc;
AppProto alproto;
TAILQ_ENTRY(OutputModule_) entries;
const char *conf_name, OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *),
FiledataLogger FiledataLogFunc);
+void OutputRegisterFlowModule(const char *name, const char *conf_name,
+ OutputCtx *(*InitFunc)(ConfNode *), FlowLogger FlowLogFunc);
+void OutputRegisterFlowSubModule(const char *parent_name, const char *name,
+ const char *conf_name, OutputCtx *(*InitFunc)(ConfNode *, OutputCtx *),
+ FlowLogger FlowLogFunc);
+
OutputModule *OutputGetModuleByConfName(const char *name);
void OutputDeregisterAll(void);
/** \brief Turn output into thread module */
static void SetupOutput(const char *name, OutputModule *module, OutputCtx *output_ctx)
{
+ /* flow logger doesn't run in the packet path */
+ if (module->FlowLogFunc) {
+ OutputRegisterFlowLogger(module->name, module->FlowLogFunc, output_ctx);
+ return;
+ }
+
TmModule *tm_module = TmModuleGetByName(module->name);
if (tm_module == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT,