]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output-flow: rename register function and document
authorJason Ish <jason.ish@oisf.net>
Tue, 27 Aug 2024 22:41:34 +0000 (16:41 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 31 Aug 2024 08:53:59 +0000 (10:53 +0200)
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

examples/plugins/c-custom-loggers/custom-logger.c
src/output-flow.c
src/output-flow.h
src/runmodes.c

index ba4274639d95261bd8e723963768aa9388372073..fbebbd5e987074754c516da9847f289d4baeddf3 100644 (file)
@@ -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);
 }
 
index ae309777aba4d7f0986e1073e3c7da47aa5afd67..b6d7bc3cdc56b46e02e0a191eb0fd7b3721e3c2a 100644 (file)
@@ -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));
index 906921b0028efc23f3d17205b9814d9fa899c9a4..d91e044ae9676d7919c01dca9d025edaaa461bb3 100644 (file)
@@ -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
 #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 */
index e2d88bfbb4e7cc3ac2f482b9979b016cd2a5bb42..f092e4066ea0718dee191a34dfe9dfbcd2a7ccda 100644 (file)
@@ -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 */