]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/file: reduce scope of keyword data structures
authorVictor Julien <vjulien@oisf.net>
Thu, 28 Jul 2022 09:16:37 +0000 (11:16 +0200)
committerVictor Julien <vjulien@oisf.net>
Thu, 28 Jul 2022 14:39:55 +0000 (16:39 +0200)
src/detect-fileext.c
src/detect-fileext.h
src/detect-filemagic.c
src/detect-filemagic.h
src/detect-filename.c
src/detect-filename.h

index 8512b913b5bba0c9fc609a5c2a593f8cca9b62de..8dd08c62b58fb05a022232e9c0326c0cdc352ff5 100644 (file)
 #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 *);
index 50cde0bfa7f6c2e23387502243fba1688fbea7ea..23088666bd84f3bd9b8a90ee778357b1093f1766 100644 (file)
 #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);
 
index ba2b33eaea39fabdd8fea7fed756f60cfde5bb3e..5409263ca1cb2be85b341e2ce310c0944456bab2 100644 (file)
@@ -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 *);
index 7936ad259ce667803762cf5572be1a6294275e69..d005597fca340fa16cc9b1a035b923735ddf23e3 100644 (file)
 #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
index aa4af7ac606adf15586b80895c6560c1ceed2427..53479b437e521958805a4aca5d3dd3691f55e891 100644 (file)
 #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 *);
index 41947835ca7f31245c7f950032785b354a6713b3..02684fcea416c4f389bfa62c8d16db04d2c7df8a 100644 (file)
 #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);