From: Jason Ish Date: Fri, 23 Aug 2024 20:54:24 +0000 (-0600) Subject: lib: reorganize to avoid static prototypes X-Git-Tag: suricata-8.0.0-beta1~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3513d707320dd7868c718a275b3c91055a1ea82;p=thirdparty%2Fsuricata.git lib: reorganize to avoid static prototypes Ticket: #7240 --- diff --git a/src/source-lib.c b/src/source-lib.c index 7e8f55415e..822d7668f3 100644 --- a/src/source-lib.c +++ b/src/source-lib.c @@ -27,27 +27,9 @@ #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; +}