]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: reduce datatype scope for various keywords
authorVictor Julien <vjulien@oisf.net>
Wed, 27 Jul 2022 14:05:08 +0000 (16:05 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 27 Jul 2022 20:07:14 +0000 (22:07 +0200)
src/detect-app-layer-event.c
src/detect-app-layer-event.h
src/detect-app-layer-protocol.c
src/detect-app-layer-protocol.h
src/detect-base64-decode.c
src/detect-base64-decode.h
src/detect-csum.c
src/detect-csum.h

index 040566dda3c6eb3cc511d5d1e9c4e58cc4248f0e..f189cbfd3cf9486c2f5fa9d3ede34c723b6f936b 100644 (file)
 
 #define MAX_ALPROTO_NAME 50
 
+typedef struct DetectAppLayerEventData_ {
+    AppProto alproto;
+    uint8_t event_id;
+
+    /* it's used to check if there are event set into the detect engine */
+    bool needs_detctx;
+
+    char *arg;
+} DetectAppLayerEventData;
+
 static int DetectAppLayerEventPktMatch(DetectEngineThreadCtx *det_ctx,
                                        Packet *p, const Signature *s, const SigMatchCtx *ctx);
 static int DetectAppLayerEventSetupP1(DetectEngineCtx *, Signature *, const char *);
index 13be31733dbd5f96924fedb62c2fc32ad1e4149e..28580c60d072427644ba5c21cdd916d0da9a9bfd 100644 (file)
 #ifndef __DETECT_APP_LAYER_EVENT_H__
 #define __DETECT_APP_LAYER_EVENT_H__
 
-typedef struct DetectAppLayerEventData_ {
-    AppProto alproto;
-    uint8_t event_id;
-
-    /* it's used to check if there are event set into the detect engine */
-    bool needs_detctx;
-
-    char *arg;
-} DetectAppLayerEventData;
-
 int DetectAppLayerEventPrepare(DetectEngineCtx *de_ctx, Signature *s);
 void DetectAppLayerEventRegister(void);
 
index 72475a111ac394ca68e15990f7fa3d53d4ef20f7..0673eaac09def00cffa13a6230a83db79909232c 100644 (file)
 static void DetectAppLayerProtocolRegisterTests(void);
 #endif
 
+typedef struct DetectAppLayerProtocolData_ {
+    AppProto alproto;
+    uint8_t negated;
+} DetectAppLayerProtocolData;
+
 static int DetectAppLayerProtocolPacketMatch(
         DetectEngineThreadCtx *det_ctx,
         Packet *p, const Signature *s, const SigMatchCtx *ctx)
index 65bc3d8c76fbc1d6777835bd6edd7e324ec21fa0..864bd671b266f9e8da3c89bb188b65d3ea40dda0 100644 (file)
 #ifndef __DETECT_APP_LAYER_PROTOCOL__H__
 #define __DETECT_APP_LAYER_PROTOCOL__H__
 
-typedef struct DetectAppLayerProtocolData_ {
-    AppProto alproto;
-    uint8_t negated;
-} DetectAppLayerProtocolData;
-
 void DetectAppLayerProtocolRegister(void);
 
 #endif /* __DETECT_APP_LAYER_PROTOCOL__H__ */
index 25198b7112a12e981e12b9ff2a2c4efb877c365b..1fe49047933e2d4c5e62d84112f33a319961dcf4 100644 (file)
 /* Arbitrary maximum buffer size for decoded base64 data. */
 #define BASE64_DECODE_MAX 65535
 
+typedef struct DetectBase64Decode_ {
+    uint32_t bytes;
+    uint32_t offset;
+    uint8_t relative;
+} DetectBase64Decode;
+
 static const char decode_pattern[] = "\\s*(bytes\\s+(\\d+),?)?"
     "\\s*(offset\\s+(\\d+),?)?"
     "\\s*(\\w+)?";
index b2f7bdaaf5b8dc57078c0dbbd72d40d455668cc1..58f4e526884c7f4cb4d85c1b8aee10532aa02f45 100644 (file)
 #ifndef __DETECT_BASE64_DECODE_H__
 #define __DETECT_BASE64_DECODE_H__
 
-
-typedef struct DetectBase64Decode_ {
-    uint32_t bytes;
-    uint32_t offset;
-    uint8_t relative;
-} DetectBase64Decode;
-
 void DetectBase64DecodeRegister(void);
 int DetectBase64DecodeDoMatch(DetectEngineThreadCtx *, const Signature *,
     const SigMatchData *, const uint8_t *, uint32_t);
index 0a1c5d8295a60ffb5fe00bb1383d161cd2e992ea..09ae62275c07ec6c0644ed1d9f0d2cb6b069f5dd 100644 (file)
 #include "util-profiling.h"
 #include "detect-engine-build.h"
 
+#define DETECT_CSUM_VALID   "valid"
+#define DETECT_CSUM_INVALID "invalid"
+
+typedef struct DetectCsumData_ {
+    /* Indicates if the csum-<protocol> keyword in a rule holds the
+       keyvalue "valid" or "invalid" */
+    int16_t valid;
+} DetectCsumData;
+
 /* prototypes for the "ipv4-csum" rule keyword */
 static int DetectIPV4CsumMatch(DetectEngineThreadCtx *,
         Packet *, const Signature *, const SigMatchCtx *);
index 8dd1f4a656a65b0c256b5ca469408292031deb14..64914912fe8f22cf3fa438d27319eb5be535b17e 100644 (file)
 #ifndef __DETECT_CSUM_H__
 #define __DETECT_CSUM_H__
 
-#define DETECT_CSUM_VALID "valid"
-#define DETECT_CSUM_INVALID "invalid"
-
-typedef struct DetectCsumData_ {
-    /* Indicates if the csum-<protocol> keyword in a rule holds the
-       keyvalue "valid" or "invalid" */
-    int16_t valid;
-} DetectCsumData;
-
 void DetectCsumRegister(void);
 
 #endif /* __DETECT_CSUM_H__ */