]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output-streaming: remove ThreadExitPrintStats callback
authorJason Ish <jason.ish@oisf.net>
Fri, 30 Aug 2024 13:50:59 +0000 (07:50 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 31 Aug 2024 08:53:59 +0000 (10:53 +0200)
Not used.

Ticket: #7227

src/log-tcp-data.c
src/output-streaming.c
src/output-streaming.h
src/output.c
src/output.h
src/runmodes.c

index 9c67497c16c607685fae7923d8a524900ff93b4d..a801c899787fd008edab812f661a4558e8a568c9 100644 (file)
@@ -44,12 +44,12 @@ static void LogTcpDataLogDeInitCtx(OutputCtx *);
 int LogTcpDataLogger(ThreadVars *tv, void *thread_data, const Flow *f, const uint8_t *data, uint32_t data_len, uint64_t tx_id, uint8_t flags);
 
 void LogTcpDataLogRegister (void) {
-    OutputRegisterStreamingModule(LOGGER_TCP_DATA, MODULE_NAME, "tcp-data",
-        LogTcpDataLogInitCtx, LogTcpDataLogger, STREAMING_TCP_DATA,
-        LogTcpDataLogThreadInit, LogTcpDataLogThreadDeinit, NULL);
+    OutputRegisterStreamingModule(LOGGER_TCP_DATA, MODULE_NAME, "tcp-data", LogTcpDataLogInitCtx,
+            LogTcpDataLogger, STREAMING_TCP_DATA, LogTcpDataLogThreadInit,
+            LogTcpDataLogThreadDeinit);
     OutputRegisterStreamingModule(LOGGER_TCP_DATA, MODULE_NAME, "http-body-data",
-        LogTcpDataLogInitCtx, LogTcpDataLogger, STREAMING_HTTP_BODIES,
-        LogTcpDataLogThreadInit, LogTcpDataLogThreadDeinit, NULL);
+            LogTcpDataLogInitCtx, LogTcpDataLogger, STREAMING_HTTP_BODIES, LogTcpDataLogThreadInit,
+            LogTcpDataLogThreadDeinit);
 }
 
 typedef struct LogTcpDataFileCtx_ {
index 3a7cefca23195e24c06dab8c9bf9e3f58594e125..8c1d54888f8dd75e24648b26190c85d673e56cac 100644 (file)
@@ -56,16 +56,13 @@ typedef struct OutputStreamingLogger_ {
     enum OutputStreamingType type;
     ThreadInitFunc ThreadInit;
     ThreadDeinitFunc ThreadDeinit;
-    ThreadExitPrintStatsFunc ThreadExitPrintStats;
 } OutputStreamingLogger;
 
 static OutputStreamingLogger *list = NULL;
 
-int OutputRegisterStreamingLogger(LoggerId id, const char *name,
-    StreamingLogger LogFunc, OutputCtx *output_ctx,
-    enum OutputStreamingType type, ThreadInitFunc ThreadInit,
-    ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats)
+int OutputRegisterStreamingLogger(LoggerId id, const char *name, StreamingLogger LogFunc,
+        OutputCtx *output_ctx, enum OutputStreamingType type, ThreadInitFunc ThreadInit,
+        ThreadDeinitFunc ThreadDeinit)
 {
     OutputStreamingLogger *op = SCCalloc(1, sizeof(*op));
     if (op == NULL)
@@ -78,7 +75,6 @@ int OutputRegisterStreamingLogger(LoggerId id, const char *name,
     op->type = type;
     op->ThreadInit = ThreadInit;
     op->ThreadDeinit = ThreadDeinit;
-    op->ThreadExitPrintStats = ThreadExitPrintStats;
 
     if (list == NULL)
         list = op;
@@ -425,22 +421,6 @@ static TmEcode OutputStreamingLogThreadDeinit(ThreadVars *tv, void *thread_data)
     return TM_ECODE_OK;
 }
 
-static void OutputStreamingLogExitPrintStats(ThreadVars *tv, void *thread_data) {
-    OutputStreamingLoggerThreadData *op_thread_data =
-            (OutputStreamingLoggerThreadData *)thread_data;
-    OutputLoggerThreadStore *store = op_thread_data->store;
-    OutputStreamingLogger *logger = list;
-
-    while (logger && store) {
-        if (logger->ThreadExitPrintStats) {
-            logger->ThreadExitPrintStats(tv, store->thread_data);
-        }
-
-        logger = logger->next;
-        store = store->next;
-    }
-}
-
 static uint32_t OutputStreamingLoggerGetActiveCount(void)
 {
     uint32_t cnt = 0;
@@ -451,9 +431,8 @@ static uint32_t OutputStreamingLoggerGetActiveCount(void)
 }
 
 void OutputStreamingLoggerRegister(void) {
-    OutputRegisterRootLogger(OutputStreamingLogThreadInit,
-        OutputStreamingLogThreadDeinit, OutputStreamingLogExitPrintStats,
-        OutputStreamingLog, OutputStreamingLoggerGetActiveCount);
+    OutputRegisterRootLogger(OutputStreamingLogThreadInit, OutputStreamingLogThreadDeinit, NULL,
+            OutputStreamingLog, OutputStreamingLoggerGetActiveCount);
 }
 
 void OutputStreamingShutdown(void)
index 91c89f1941430113812a1337a024680d1b7bada6..40633e02b4a1a79bb2edaf54ff188d526dcea7d5 100644 (file)
@@ -42,10 +42,9 @@ typedef int (*StreamingLogger)(ThreadVars *, void *thread_data,
         const Flow *f, const uint8_t *data, uint32_t data_len,
         uint64_t tx_id, uint8_t flags);
 
-int OutputRegisterStreamingLogger(LoggerId id, const char *name,
-    StreamingLogger LogFunc, OutputCtx *, enum OutputStreamingType,
-    ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats);
+int OutputRegisterStreamingLogger(LoggerId id, const char *name, StreamingLogger LogFunc,
+        OutputCtx *, enum OutputStreamingType, ThreadInitFunc ThreadInit,
+        ThreadDeinitFunc ThreadDeinit);
 
 void OutputStreamingLoggerRegister (void);
 
index da984aec515d77053f2312116ade5555371aa12b..33e82d60a76efb1c40f2adf3a8bf1a8d9ee03640 100644 (file)
@@ -501,12 +501,10 @@ error:
  *
  * \retval Returns 0 on success, -1 on failure.
  */
-void OutputRegisterStreamingModule(LoggerId id, const char *name,
-    const char *conf_name, OutputInitFunc InitFunc,
-    StreamingLogger StreamingLogFunc,
-    enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit,
-    ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats)
+void OutputRegisterStreamingModule(LoggerId id, const char *name, const char *conf_name,
+        OutputInitFunc InitFunc, StreamingLogger StreamingLogFunc,
+        enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit,
+        ThreadDeinitFunc ThreadDeinit)
 {
     if (unlikely(StreamingLogFunc == NULL)) {
         goto error;
@@ -525,7 +523,6 @@ void OutputRegisterStreamingModule(LoggerId id, const char *name,
     module->stream_type = stream_type;
     module->ThreadInit = ThreadInit;
     module->ThreadDeinit = ThreadDeinit;
-    module->ThreadExitPrintStats = ThreadExitPrintStats;
     TAILQ_INSERT_TAIL(&output_modules, module, entries);
 
     SCLogDebug("Streaming logger \"%s\" registered.", name);
index 81ed9394bf99c7205a620dd739c38cc80b039660..d393ff41823b62789332212b9b314f49a4e3d20e 100644 (file)
@@ -131,7 +131,7 @@ void OutputRegisterFlowSubModule(LoggerId id, const char *parent_name, const cha
 void OutputRegisterStreamingModule(LoggerId id, const char *name, const char *conf_name,
         OutputInitFunc InitFunc, StreamingLogger StreamingLogFunc,
         enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit,
-        ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats);
+        ThreadDeinitFunc ThreadDeinit);
 
 void OutputRegisterStatsModule(LoggerId id, const char *name,
     const char *conf_name, OutputInitFunc InitFunc,
index 3ad5f865abbfe289d7d5f7c47642d322df4391d9..ae844fc08615a7602f3fb5456dfbf0b6d2f6c71e 100644 (file)
@@ -641,10 +641,8 @@ static void SetupOutput(
         file_logger_count++;
     } else if (module->StreamingLogFunc) {
         SCLogDebug("%s is a streaming logger", module->name);
-        OutputRegisterStreamingLogger(module->logger_id, module->name,
-            module->StreamingLogFunc, output_ctx, module->stream_type,
-            module->ThreadInit, module->ThreadDeinit,
-            module->ThreadExitPrintStats);
+        OutputRegisterStreamingLogger(module->logger_id, module->name, module->StreamingLogFunc,
+                output_ctx, module->stream_type, module->ThreadInit, module->ThreadDeinit);
     } else {
         SCLogError("Unknown logger type: name=%s", module->name);
     }