output-flow: rename register function and document

Rename OutputRegisterFlowLogger to SCOutputRegisterFlowLogger and
document in the header file.

Mark other functions in the header file as part of the internal API.

Ticket: #7227
pull/11689/head
Jason Ish 1 year ago committed by Victor Julien
parent 7b4271c309
commit a2779ac916

@ -94,7 +94,7 @@ static void Init(void)
{
SCOutputRegisterPacketLogger(LOGGER_USER, "custom-packet-logger", CustomPacketLogger,
CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit);
OutputRegisterFlowLogger(
SCOutputRegisterFlowLogger(
"custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit);
}

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2022 Open Information Security Foundation
/* Copyright (C) 2007-2024 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
@ -55,15 +55,7 @@ typedef struct OutputFlowLogger_ {
static OutputFlowLogger *list = NULL;
/**
* \brief Register a new low-level flow logger.
*
* \param name The name of this logger. Its only used for debugging,
* so choose something unique.
*
* \retval 0 on success, -1 on failure.
*/
int OutputRegisterFlowLogger(const char *name, FlowLogger LogFunc, void *initdata,
int SCOutputRegisterFlowLogger(const char *name, FlowLogger LogFunc, void *initdata,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
{
OutputFlowLogger *op = SCCalloc(1, sizeof(*op));

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2022 Open Information Security Foundation
/* Copyright (C) 2007-2024 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
@ -30,16 +30,37 @@
#include "tm-modules.h"
#include "flow.h"
/** flow logger function pointer type */
/**
* \brief Flow logger function pointer type.
*/
typedef int (*FlowLogger)(ThreadVars *, void *thread_data, Flow *f);
int OutputRegisterFlowLogger(const char *name, FlowLogger LogFunc, void *initdata,
/**
* \brief Register a flow logger.
*
* \param name An informational name for this logger. Used only for
* debugging.
* \param LogFunc A function that will be called to log each flow.
* \param initdata A pointer to initialization data that will be
* passed the ThreadInit.
* \param ThreadInit Thread initialization callback.
* \param ThreadDeinit Thread de-initialization callback.
*
* \retval 0 on success, -1 on failure.
*/
int SCOutputRegisterFlowLogger(const char *name, FlowLogger LogFunc, void *initdata,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
/** Internal function: private API. */
void OutputFlowShutdown(void);
/** Internal function: private API. */
TmEcode OutputFlowLog(ThreadVars *tv, void *thread_data, Flow *f);
/** Internal function: private API. */
TmEcode OutputFlowLogThreadInit(ThreadVars *tv, void **data);
/** Internal function: private API. */
TmEcode OutputFlowLogThreadDeinit(ThreadVars *tv, void *thread_data);
#endif /* SURICATA_OUTPUT_FLOW_H */

@ -600,8 +600,8 @@ static void SetupOutput(
{
/* flow logger doesn't run in the packet path */
if (module->FlowLogFunc) {
OutputRegisterFlowLogger(module->name, module->FlowLogFunc, output_ctx, module->ThreadInit,
module->ThreadDeinit);
SCOutputRegisterFlowLogger(module->name, module->FlowLogFunc, output_ctx,
module->ThreadInit, module->ThreadDeinit);
return;
}
/* stats logger doesn't run in the packet path */

Loading…
Cancel
Save