]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
lib: reorganize to avoid static prototypes
authorJason Ish <jason.ish@oisf.net>
Fri, 23 Aug 2024 20:54:24 +0000 (14:54 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 1 Apr 2025 08:17:05 +0000 (10:17 +0200)
Ticket: #7240

src/source-lib.c

index 7e8f55415ecda1b7bb1cbcbd46e14c5d44333d25..822d7668f3f1ac62be47d4a372ef162d4944325f 100644 (file)
 #include "source-lib.h"
 #include "util-device.h"
 
-static TmEcode DecodeLibThreadInit(ThreadVars *tv, const void *initdata, void **data);
-static TmEcode DecodeLibThreadDeinit(ThreadVars *tv, void *data);
-static TmEcode DecodeLib(ThreadVars *tv, Packet *p, void *data);
-
 /* Set time to the first packet timestamp when replaying a PCAP. */
 static bool time_set = false;
 
-/** \brief register a "Decode" module for suricata as a library.
- *
- *  The "Decode" module is the first module invoked when processing a packet */
-void TmModuleDecodeLibRegister(void)
-{
-    tmm_modules[TMM_DECODELIB].name = "DecodeLib";
-    tmm_modules[TMM_DECODELIB].ThreadInit = DecodeLibThreadInit;
-    tmm_modules[TMM_DECODELIB].Func = DecodeLib;
-    tmm_modules[TMM_DECODELIB].ThreadExitPrintStats = NULL;
-    tmm_modules[TMM_DECODELIB].ThreadDeinit = DecodeLibThreadDeinit;
-    tmm_modules[TMM_DECODELIB].cap_flags = 0;
-    tmm_modules[TMM_DECODELIB].flags = TM_FLAG_DECODE_TM;
-}
-
 /** \brief initialize the "Decode" module.
  *
  * \param tv                    Pointer to the per-thread structure.
@@ -55,7 +37,7 @@ void TmModuleDecodeLibRegister(void)
  * \param data                  Pointer to the initialized context.
  * \return                      Error code.
  */
-TmEcode DecodeLibThreadInit(ThreadVars *tv, const void *initdata, void **data)
+static TmEcode DecodeLibThreadInit(ThreadVars *tv, const void *initdata, void **data)
 {
     SCEnter();
     DecodeThreadVars *dtv = NULL;
@@ -78,7 +60,7 @@ TmEcode DecodeLibThreadInit(ThreadVars *tv, const void *initdata, void **data)
  * \param data                  Pointer to the context.
  * \return                      Error code.
  */
-TmEcode DecodeLibThreadDeinit(ThreadVars *tv, void *data)
+static TmEcode DecodeLibThreadDeinit(ThreadVars *tv, void *data)
 {
     if (data != NULL)
         DecodeThreadVarsFree(tv, data);
@@ -96,7 +78,7 @@ TmEcode DecodeLibThreadDeinit(ThreadVars *tv, void *data)
  * \param data                  Pointer to the context.
  * \return                      Error code.
  */
-TmEcode DecodeLib(ThreadVars *tv, Packet *p, void *data)
+static TmEcode DecodeLib(ThreadVars *tv, Packet *p, void *data)
 {
     SCEnter();
     DecodeThreadVars *dtv = (DecodeThreadVars *)data;
@@ -174,3 +156,17 @@ int TmModuleLibHandlePacket(ThreadVars *tv, LiveDevice *device, const uint8_t *d
 
     SCReturnInt(TM_ECODE_OK);
 }
+
+/** \brief register a "Decode" module for suricata as a library.
+ *
+ *  The "Decode" module is the first module invoked when processing a packet */
+void TmModuleDecodeLibRegister(void)
+{
+    tmm_modules[TMM_DECODELIB].name = "DecodeLib";
+    tmm_modules[TMM_DECODELIB].ThreadInit = DecodeLibThreadInit;
+    tmm_modules[TMM_DECODELIB].Func = DecodeLib;
+    tmm_modules[TMM_DECODELIB].ThreadExitPrintStats = NULL;
+    tmm_modules[TMM_DECODELIB].ThreadDeinit = DecodeLibThreadDeinit;
+    tmm_modules[TMM_DECODELIB].cap_flags = 0;
+    tmm_modules[TMM_DECODELIB].flags = TM_FLAG_DECODE_TM;
+}