From: Victor Julien Date: Thu, 28 Jul 2022 09:16:37 +0000 (+0200) Subject: detect/file: reduce scope of keyword data structures X-Git-Tag: suricata-7.0.0-beta1~362 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af145ad125fb45d3eaec034054b08c7421e48a20;p=thirdparty%2Fsuricata.git detect/file: reduce scope of keyword data structures --- diff --git a/src/detect-fileext.c b/src/detect-fileext.c index 8512b913b5..8dd08c62b5 100644 --- a/src/detect-fileext.c +++ b/src/detect-fileext.c @@ -52,6 +52,12 @@ #include "stream-tcp.h" #include "detect-fileext.h" +typedef struct DetectFileextData_ { + uint8_t *ext; /** file extension to match */ + uint16_t len; /** length of the file */ + uint32_t flags; +} DetectFileextData; + static int DetectFileextMatch (DetectEngineThreadCtx *, Flow *, uint8_t, File *, const Signature *, const SigMatchCtx *); static int DetectFileextSetup (DetectEngineCtx *, Signature *, const char *); diff --git a/src/detect-fileext.h b/src/detect-fileext.h index 50cde0bfa7..23088666bd 100644 --- a/src/detect-fileext.h +++ b/src/detect-fileext.h @@ -24,13 +24,6 @@ #ifndef __DETECT_FILEEXT_H__ #define __DETECT_FILEEXT_H__ - -typedef struct DetectFileextData_ { - uint8_t *ext; /** file extension to match */ - uint16_t len; /** length of the file */ - uint32_t flags; -} DetectFileextData; - /* prototypes */ void DetectFileextRegister (void); diff --git a/src/detect-filemagic.c b/src/detect-filemagic.c index ba2b33eaea..5409263ca1 100644 --- a/src/detect-filemagic.c +++ b/src/detect-filemagic.c @@ -79,6 +79,17 @@ void DetectFilemagicRegister(void) #else /* HAVE_MAGIC */ +typedef struct DetectFilemagicThreadData { + magic_t ctx; +} DetectFilemagicThreadData; + +typedef struct DetectFilemagicData { + uint8_t *name; /** name of the file to match */ + BmCtx *bm_ctx; /** BM context */ + uint16_t len; /** name length */ + uint32_t flags; +} DetectFilemagicData; + static int DetectFilemagicMatch (DetectEngineThreadCtx *, Flow *, uint8_t, File *, const Signature *, const SigMatchCtx *); static int DetectFilemagicSetup (DetectEngineCtx *, Signature *, const char *); diff --git a/src/detect-filemagic.h b/src/detect-filemagic.h index 7936ad259c..d005597fca 100644 --- a/src/detect-filemagic.h +++ b/src/detect-filemagic.h @@ -25,19 +25,6 @@ #define __DETECT_FILEMAGIC_H__ #ifdef HAVE_MAGIC -#include "util-spm-bm.h" - -typedef struct DetectFilemagicThreadData { - magic_t ctx; -} DetectFilemagicThreadData; - -typedef struct DetectFilemagicData { - uint8_t *name; /** name of the file to match */ - BmCtx *bm_ctx; /** BM context */ - uint16_t len; /** name length */ - uint32_t flags; -} DetectFilemagicData; - /* prototypes */ int FilemagicThreadLookup(magic_t *ctx, File *file); #endif diff --git a/src/detect-filename.c b/src/detect-filename.c index aa4af7ac60..53479b437e 100644 --- a/src/detect-filename.c +++ b/src/detect-filename.c @@ -55,6 +55,13 @@ #include "detect-filename.h" #include "app-layer-parser.h" +typedef struct DetectFilenameData { + uint8_t *name; /** name of the file to match */ + BmCtx *bm_ctx; /** BM context */ + uint16_t len; /** name length */ + uint32_t flags; +} DetectFilenameData; + static int DetectFilenameMatch (DetectEngineThreadCtx *, Flow *, uint8_t, File *, const Signature *, const SigMatchCtx *); static int DetectFilenameSetup (DetectEngineCtx *, Signature *, const char *); diff --git a/src/detect-filename.h b/src/detect-filename.h index 41947835ca..02684fcea4 100644 --- a/src/detect-filename.h +++ b/src/detect-filename.h @@ -24,15 +24,6 @@ #ifndef __DETECT_FILENAME_H__ #define __DETECT_FILENAME_H__ -#include "util-spm-bm.h" - -typedef struct DetectFilenameData { - uint8_t *name; /** name of the file to match */ - BmCtx *bm_ctx; /** BM context */ - uint16_t len; /** name length */ - uint32_t flags; -} DetectFilenameData; - /* prototypes */ void DetectFilenameRegister (void);