]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/prefilter: add de_ctx to registration
authorVictor Julien <victor@inliniac.net>
Tue, 31 Oct 2017 11:20:20 +0000 (12:20 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 14 Feb 2018 13:25:46 +0000 (14:25 +0100)
63 files changed:
src/detect-ack.c
src/detect-app-layer-protocol.c
src/detect-dce-stub-data.c
src/detect-dsize.c
src/detect-engine-dns.c
src/detect-engine-dns.h
src/detect-engine-filedata.h
src/detect-engine-hcbd.c
src/detect-engine-hcbd.h
src/detect-engine-hcd.c
src/detect-engine-hcd.h
src/detect-engine-hhhd.c
src/detect-engine-hhhd.h
src/detect-engine-hmd.c
src/detect-engine-hmd.h
src/detect-engine-hrhd.c
src/detect-engine-hrhd.h
src/detect-engine-hrhhd.c
src/detect-engine-hrhhd.h
src/detect-engine-hrud.c
src/detect-engine-hrud.h
src/detect-engine-hsbd.c
src/detect-engine-hsbd.h
src/detect-engine-hscd.c
src/detect-engine-hscd.h
src/detect-engine-hsmd.c
src/detect-engine-hsmd.h
src/detect-engine-hua.c
src/detect-engine-hua.h
src/detect-engine-mpm.c
src/detect-engine-mpm.h
src/detect-engine-payload.c
src/detect-engine-payload.h
src/detect-engine-prefilter-common.c
src/detect-engine-prefilter-common.h
src/detect-engine-prefilter.c
src/detect-engine-prefilter.h
src/detect-engine-tls.c
src/detect-engine-tls.h
src/detect-engine-uri.c
src/detect-engine-uri.h
src/detect-file-data.c
src/detect-flags.c
src/detect-flow.c
src/detect-fragbits.c
src/detect-fragoffset.c
src/detect-http-header-names.c
src/detect-http-header.c
src/detect-http-headers-stub.h
src/detect-http-protocol.c
src/detect-http-request-line.c
src/detect-http-response-line.c
src/detect-http-start.c
src/detect-icmp-id.c
src/detect-icmp-seq.c
src/detect-icode.c
src/detect-id.c
src/detect-itype.c
src/detect-seq.c
src/detect-ssh-proto.c
src/detect-ssh-software.c
src/detect-ttl.c
src/detect.h

index 6de42c698e843c12e18280c7d186ab17c175c9c4..095a44dc7e29c20e88f46b03562e9d092cd0cb42 100644 (file)
@@ -48,7 +48,7 @@ static int DetectAckMatch(ThreadVars *, DetectEngineThreadCtx *,
                           Packet *, const Signature *, const SigMatchCtx *);
 static void DetectAckRegisterTests(void);
 static void DetectAckFree(void *);
-static int PrefilterSetupTcpAck(SigGroupHead *sgh);
+static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterTcpAckIsPrefilterable(const Signature *s);
 
 void DetectAckRegister(void)
@@ -183,9 +183,9 @@ PrefilterPacketAckCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupTcpAck(SigGroupHead *sgh)
+static int PrefilterSetupTcpAck(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_ACK,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ACK,
         PrefilterPacketAckSet,
         PrefilterPacketAckCompare,
         PrefilterPacketAckMatch);
index e40af9eab458b29d99ef4340445ffe1a7797599a..214bac80b7347f26590076b949eda41767c54563 100644 (file)
@@ -238,9 +238,9 @@ PrefilterPacketAppProtoCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupAppProto(SigGroupHead *sgh)
+static int PrefilterSetupAppProto(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_AL_APP_LAYER_PROTOCOL,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_AL_APP_LAYER_PROTOCOL,
         PrefilterPacketAppProtoSet,
         PrefilterPacketAppProtoCompare,
         PrefilterPacketAppProtoMatch);
index 50c8c9925cb238c6d3d3f12cd93024e36546ea15..6470c92acbc2cd032e8ed645f4679e310cb5e7c2 100644 (file)
@@ -90,15 +90,16 @@ static void PrefilterTxDceStubDataRequest(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxDceStubDataRequestRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxDceStubDataRequestRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataRequest,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataRequest,
         ALPROTO_DCERPC, 0,
         mpm_ctx, NULL, KEYWORD_NAME " (request)");
     if (r == 0) {
-        r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataRequest,
+        r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataRequest,
                 ALPROTO_SMB, 0,
                 mpm_ctx, NULL, KEYWORD_NAME " (request)");
     }
@@ -135,15 +136,16 @@ static void PrefilterTxDceStubDataResponse(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxDceStubDataResponseRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxDceStubDataResponseRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataResponse,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataResponse,
         ALPROTO_DCERPC, 0,
         mpm_ctx, NULL, KEYWORD_NAME " (response)");
     if (r == 0) {
-        r = PrefilterAppendTxEngine(sgh, PrefilterTxDceStubDataResponse,
+        r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDceStubDataResponse,
                 ALPROTO_SMB, 0,
                 mpm_ctx, NULL, KEYWORD_NAME " (response)");
     }
index 193bcc21e614fd5f3c593e81d6e7686f379baf66..adbc0802b1a4b7289cb811aa65aa19b0d1f8f6b0 100644 (file)
@@ -56,7 +56,7 @@ static int DetectDsizeSetup (DetectEngineCtx *, Signature *s, const char *str);
 static void DsizeRegisterTests(void);
 static void DetectDsizeFree(void *);
 
-static int PrefilterSetupDsize(SigGroupHead *sgh);
+static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterDsizeIsPrefilterable(const Signature *s);
 
 /**
@@ -354,9 +354,9 @@ PrefilterPacketDsizeCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupDsize(SigGroupHead *sgh)
+static int PrefilterSetupDsize(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_DSIZE,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_DSIZE,
             PrefilterPacketDsizeSet,
             PrefilterPacketDsizeCompare,
             PrefilterPacketDsizeMatch);
index 8226920191d2dbad5ef5745120e5d9e9deada00a..3053f0121319cd8d49e751bab54d3ef60d0f40cb 100644 (file)
@@ -169,11 +169,12 @@ static void PrefilterTxDnsQuery(DetectEngineThreadCtx *det_ctx,
 #endif
 }
 
-int PrefilterTxDnsQueryRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxDnsQueryRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxDnsQuery,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxDnsQuery,
         ALPROTO_DNS, 1,
         mpm_ctx, NULL, "dns_query");
 }
index ed7ef51df730ed669920ba7c388dd46ca73f7888..9ce2e4451dc4b9407f5409638ddbb16047378b24 100644 (file)
@@ -23,7 +23,8 @@
 #ifndef __DETECT_ENGINE_DNS_H__
 #define __DETECT_ENGINE_DNS_H__
 
-int PrefilterTxDnsQueryRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxDnsQueryRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectDnsQueryName(ThreadVars *,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,
index 6a272daa674a817c8267f7fe20af3ff510db5fd1..515915d3f3630bee1124c6deabe4808b33e80310 100644 (file)
@@ -23,6 +23,9 @@
 #ifndef __DETECT_ENGINE_FILEDATA_H__
 #define __DETECT_ENGINE_FILEDATA_H__
 
+int PrefilterMpmFiledataRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx,
+        const DetectMpmAppLayerRegistery *mpm_reg, int list_id);
 void PrefilterTxFiledata(DetectEngineThreadCtx *det_ctx,
         const void *pectx,
         Packet *p, Flow *f, void *txv,
index df27e9e7e8eb799c3e0078da19ca5c52480b5509..448842ff211771812f2f6f610df2aa4819419ae6 100644 (file)
@@ -251,11 +251,12 @@ static void PrefilterTxHttpRequestBody(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxHttpRequestBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpRequestBodyRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestBody,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestBody,
         ALPROTO_HTTP, HTP_REQUEST_BODY,
         mpm_ctx, NULL, "http_client_body");
 }
index c3c91a76a35bea1b069e71edb057793251bea9d7..2675629ffbac173f411eb2537d0a07d54470efc4 100644 (file)
@@ -27,7 +27,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxHttpRequestBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpRequestBodyRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpClientBody(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index 8f06cda19247a50219e6f717876cd43dc2b8199b..e919c106dd52fa6ed15e45362c67bd2fd2067895 100644 (file)
@@ -97,11 +97,12 @@ static void PrefilterTxRequestCookie(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxRequestCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxRequestCookieRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxRequestCookie,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestCookie,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, "http_cookie (request)");
 }
@@ -143,11 +144,12 @@ static void PrefilterTxResponseCookie(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxResponseCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxResponseCookieRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxResponseCookie,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseCookie,
         ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
         mpm_ctx, NULL, "http_cookie (response)");
 }
index bdf9c498d4e92bae7999d840a665f8ba3c0e2e36..22a925365ad220a23c62da2bdffbbf8289816891 100644 (file)
 
 #include "app-layer-htp.h"
 
-int PrefilterTxRequestCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxResponseCookieRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxRequestCookieRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxResponseCookieRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpCookie(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index f884d7a85a1e54534f27a4d1d873f26362ec4014..d55bbc70aa15e961e6ee46da60182fa3b764b683 100644 (file)
@@ -92,11 +92,12 @@ static void PrefilterTxHostname(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxHostnameRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHostnameRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHostname,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHostname,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, "http_host");
 }
index 39e16493a33c46735fd4bd860790748e434e49d4..5518ac8cf95a39cb8db545a7b2fbe010ffcb194a 100644 (file)
@@ -25,7 +25,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxHostnameRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHostnameRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpHH(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index 27dcb16567c7776794a96d5f97b20273fddb433c..976a9cdab75dcadba7d3de60dce6c1965b823044 100644 (file)
@@ -91,9 +91,10 @@ static void PrefilterTxMethod(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxMethodRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxMethodRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
-    return PrefilterAppendTxEngine(sgh, PrefilterTxMethod,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxMethod,
         ALPROTO_HTTP, HTP_REQUEST_LINE,
         mpm_ctx, NULL, "http_method");
 }
index d3fe192f58ea4e2712e2d63be179fba5b1f99dbd..f5f09f211f09452d540af2b130a8f3c871350851 100644 (file)
@@ -30,7 +30,8 @@ int DetectEngineInspectHttpMethod(ThreadVars *tv,
         const Signature *s, const SigMatchData *smd,
         Flow *f, uint8_t flags, void *alstate, void *tx, uint64_t tx_id);
 
-int PrefilterTxMethodRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxMethodRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 void DetectEngineHttpMethodRegisterTests(void);
 
index 9cdfbf2385a21d8401188b9f707e4226823d8167..2974c04083c996841d189df5ae532893fb07999a 100644 (file)
@@ -91,16 +91,17 @@ static void PrefilterTxRequestHeadersRaw(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxRequestHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxRequestHeadersRawRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxRequestHeadersRaw,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestHeadersRaw,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS+1, /* inspect when headers complete */
         mpm_ctx, NULL, "http_raw_header (request)");
     if (r != 0)
         return r;
-    return PrefilterAppendTxEngine(sgh, PrefilterTxRequestHeadersRaw,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRequestHeadersRaw,
         ALPROTO_HTTP, HTP_REQUEST_TRAILER+1, /* inspect when trailer complete */
         mpm_ctx, NULL, "http_raw_header (request)");
 }
@@ -135,16 +136,17 @@ static void PrefilterTxResponseHeadersRaw(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxResponseHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxResponseHeadersRawRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxResponseHeadersRaw,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseHeadersRaw,
         ALPROTO_HTTP, HTP_RESPONSE_HEADERS+1, /* inspect when headers complete */
         mpm_ctx, NULL, "http_raw_header (response)");
     if (r != 0)
         return r;
-    return PrefilterAppendTxEngine(sgh, PrefilterTxResponseHeadersRaw,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxResponseHeadersRaw,
         ALPROTO_HTTP, HTP_RESPONSE_TRAILER+1, /* inspect when trailer complete */
         mpm_ctx, NULL, "http_raw_header (response)");
 }
index 132ca642ba44eee3f08817df7925eaf82f3c9820..177aad829a4276596bc8c28d244550017b647d14 100644 (file)
 
 #include "app-layer-htp.h"
 
-int PrefilterTxRequestHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxResponseHeadersRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxRequestHeadersRawRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxResponseHeadersRawRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpRawHeader(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index 455b98c76737073800f95fa78ed81bf3cf8ba8ce..6e0c02b655f398381b9d65e6f91bd484fc693752 100644 (file)
@@ -104,11 +104,12 @@ static void PrefilterTxHostnameRaw(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxHostnameRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHostnameRawRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHostnameRaw,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHostnameRaw,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, "http_raw_host");
 }
index 4523cbc4253a589dfd99831b29a273c7c0a63138..a7aec372f6a0e28be8af377adbfdf2914f5b29bb 100644 (file)
@@ -25,7 +25,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxHostnameRawRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHostnameRawRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpHRH(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index e41c4fdff3ea27db8ee1d9fa482e391d96bff4df..a37043378f099df77eb2ce9086b806cfae1d1c72 100644 (file)
@@ -89,11 +89,12 @@ static void PrefilterTxRawUri(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxRawUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxRawUriRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxRawUri,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxRawUri,
         ALPROTO_HTTP, HTP_REQUEST_LINE,
         mpm_ctx, NULL, "http_raw_uri");
 }
index 2d41f69650ccaaed8068aa2dd44bfafe24e4bf53..3feb4f00b1fc108974fee16ecafd42c815de37e8 100644 (file)
@@ -26,7 +26,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxRawUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxRawUriRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpRawUri(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index 8476689824e1d3ba0838020b1f4bfe2e5129fd22..0ec43e05da423ab8acedfbcfb6cdfd6d97853e17 100644 (file)
@@ -284,11 +284,12 @@ static void PrefilterTxHttpResponseBody(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxHttpResponseBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpResponseBodyRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseBody,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseBody,
         ALPROTO_HTTP, HTP_RESPONSE_BODY,
         mpm_ctx, NULL, "file_data (http response)");
 }
index 1187f936ef4841b4d7398d1ed5cf56d96d63be3e..b11ec651a36a1c933ed83d3f9ec7ecf0b148b3ce 100644 (file)
@@ -27,7 +27,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxHttpResponseBodyRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpResponseBodyRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpServerBody(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index 8a563235b167344e64faa40b6c9cd2f2e76d80a4..33e75608530d27e27ac462b0bc51bb831718b36e 100644 (file)
@@ -87,11 +87,12 @@ static void PrefilterTxHttpStatCode(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxHttpStatCodeRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpStatCodeRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpStatCode,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpStatCode,
         ALPROTO_HTTP,
         HTP_RESPONSE_LINE+1, /* inspect when response line completely parsed */
         mpm_ctx, NULL, "http_stat_code");
index d2e4d2fff870773be811417416feb876e23c3347..1a3e066157e5e82792b1a9da9e3e074b52ce49b8 100644 (file)
@@ -25,7 +25,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxHttpStatCodeRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpStatCodeRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpStatCode(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index cb52c03535a337be26d2b7257264def5a8fb29e0..4266ec770c26c3f6caf9f1fca8046820e7c9fb09 100644 (file)
@@ -87,11 +87,12 @@ static void PrefilterTxHttpStatMsg(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxHttpStatMsgRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxHttpStatMsgRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpStatMsg,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpStatMsg,
         ALPROTO_HTTP,
         HTP_RESPONSE_LINE+1, /* inspect when response line completely parsed */
         mpm_ctx, NULL, "http_stat_msg");
index 36eee9024f49b9c25d0ea8d5c8a1b886816ae042..df6b1208f20b6e273f857cd8b8caa106dafbca30 100644 (file)
@@ -25,7 +25,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxHttpStatMsgRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxHttpStatMsgRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpStatMsg(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index 2511767c944e7771146a57d3a4f15a3e74a36d80..ee8f6d84d216f4679f08fdbff55bb6b9af1248ea 100644 (file)
@@ -97,11 +97,12 @@ static void PrefilterTxUA(DetectEngineThreadCtx *det_ctx, const void *pectx,
     }
 }
 
-int PrefilterTxUARegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxUARegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxUA,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxUA,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, "http_user_agent");
 }
index 40c85887c7febd3e8239368fa58ce0a24080cb82..3fe50c59e79e9b4dedb9b3b2b82b14e4f37e3866 100644 (file)
@@ -25,7 +25,8 @@
 
 #include "app-layer-htp.h"
 
-int PrefilterTxUARegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxUARegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpUA(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index ffad501ba2ac7fd7d91e11b80e33a3109b47cd4a..28b9f3f6cd4d200de9fc42b405ae48b6bf385bd1 100644 (file)
@@ -97,7 +97,8 @@ static int g_app_mpms_list_cnt = 0;
  */
 void DetectAppLayerMpmRegister2(const char *name,
         int direction, int priority,
-        int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+        int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+            SigGroupHead *sgh, MpmCtx *mpm_ctx,
             const DetectMpmAppLayerRegistery *mpm_reg, int list_id),
         InspectionBufferGetDataPtr GetData,
         AppProto alproto, int tx_min_progress)
@@ -149,7 +150,8 @@ void DetectAppLayerMpmRegister2(const char *name,
 
 void DetectAppLayerMpmRegister(const char *name,
         int direction, int priority,
-        int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx))
+        int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+            SigGroupHead *sgh, MpmCtx *mpm_ctx))
 {
     SCLogDebug("registering %s/%d/%d/%p",
             name, direction, priority, PrefilterRegister);
@@ -1357,12 +1359,12 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
         if (SGH_DIRECTION_TS(sh)) {
             mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_PKT_TS);
             if (mpm_store != NULL) {
-                PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+                PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
             }
 
             mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_STREAM_TS);
             if (mpm_store != NULL) {
-                PrefilterPktStreamRegister(sh, mpm_store->mpm_ctx);
+                PrefilterPktStreamRegister(de_ctx, sh, mpm_store->mpm_ctx);
             }
 
             SetRawReassemblyFlag(de_ctx, sh);
@@ -1370,12 +1372,12 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
         if (SGH_DIRECTION_TC(sh)) {
             mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_PKT_TC);
             if (mpm_store != NULL) {
-                PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+                PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
             }
 
             mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_TCP_STREAM_TC);
             if (mpm_store != NULL) {
-                PrefilterPktStreamRegister(sh, mpm_store->mpm_ctx);
+                PrefilterPktStreamRegister(de_ctx, sh, mpm_store->mpm_ctx);
             }
 
             SetRawReassemblyFlag(de_ctx, sh);
@@ -1384,19 +1386,19 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
         if (SGH_DIRECTION_TS(sh)) {
             mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_UDP_TS);
             if (mpm_store != NULL) {
-                PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+                PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
             }
         }
         if (SGH_DIRECTION_TC(sh)) {
             mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_UDP_TC);
             if (mpm_store != NULL) {
-                PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+                PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
             }
         }
     } else {
         mpm_store = MpmStorePrepareBuffer(de_ctx, sh, MPMB_OTHERIP);
         if (mpm_store != NULL) {
-            PrefilterPktPayloadRegister(sh, mpm_store->mpm_ctx);
+            PrefilterPktPayloadRegister(de_ctx, sh, mpm_store->mpm_ctx);
         }
     }
 
@@ -1430,12 +1432,13 @@ int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
                 /* if we have just certain types of negated patterns,
                  * mpm_ctx can be NULL */
                 if (a->reg->v2.PrefilterRegisterWithListId && mpm_store->mpm_ctx) {
-                    BUG_ON(a->reg->v2.PrefilterRegisterWithListId(sh, mpm_store->mpm_ctx,
+                    BUG_ON(a->reg->v2.PrefilterRegisterWithListId(de_ctx,
+                                sh, mpm_store->mpm_ctx,
                                 a->reg, a->reg->sm_list) != 0);
                     SCLogDebug("mpm %s %d set up", a->reg->name, a->reg->sm_list);
                 }
                 else if (a->reg->PrefilterRegister && mpm_store->mpm_ctx) {
-                    BUG_ON(a->reg->PrefilterRegister(sh, mpm_store->mpm_ctx) != 0);
+                    BUG_ON(a->reg->PrefilterRegister(de_ctx, sh, mpm_store->mpm_ctx) != 0);
                     SCLogDebug("mpm %s %d set up", a->reg->name, a->reg->sm_list);
                 }
             }
index 316b8938e4ccd10c70bdf94b86e585e692e1ea71..cf03136a5bf638f6dc575aaf7dfdcfd64313d317 100644 (file)
@@ -89,10 +89,12 @@ int DetectSetFastPatternAndItsId(DetectEngineCtx *de_ctx);
  */
 void DetectAppLayerMpmRegister(const char *name,
         int direction, int priority,
-        int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx));
+        int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+            SigGroupHead *sgh, MpmCtx *mpm_ctx));
 void DetectAppLayerMpmRegister2(const char *name,
         int direction, int priority,
-        int (*PrefilterRegister)(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+        int (*PrefilterRegister)(DetectEngineCtx *de_ctx,
+            SigGroupHead *sgh, MpmCtx *mpm_ctx,
             const DetectMpmAppLayerRegistery *mpm_reg, int list_id),
         InspectionBufferGetDataPtr GetData,
         AppProto alproto, int tx_min_progress);
index b648db9fff20472fdc1256b7aa989ced34083dec..c0a9b97fb9ad31e1e6ad862e85a1df1e7e136213 100644 (file)
@@ -103,9 +103,11 @@ static void PrefilterPktStream(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterPktStreamRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterPktStreamRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
-    return PrefilterAppendPayloadEngine(sgh, PrefilterPktStream, mpm_ctx, NULL, "stream");
+    return PrefilterAppendPayloadEngine(de_ctx, sgh,
+            PrefilterPktStream, mpm_ctx, NULL, "stream");
 }
 
 static void PrefilterPktPayload(DetectEngineThreadCtx *det_ctx,
@@ -122,9 +124,11 @@ static void PrefilterPktPayload(DetectEngineThreadCtx *det_ctx,
             p->payload, p->payload_len);
 }
 
-int PrefilterPktPayloadRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterPktPayloadRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
-    return PrefilterAppendPayloadEngine(sgh, PrefilterPktPayload, mpm_ctx, NULL, "payload");
+    return PrefilterAppendPayloadEngine(de_ctx, sgh,
+            PrefilterPktPayload, mpm_ctx, NULL, "payload");
 }
 
 
index 759a725449e179d799dc273b2184d401f9d2e2c2..c85fe8011623b3cf624c77181dcc95cd51b8f94e 100644 (file)
 #ifndef __DETECT_ENGINE_PAYLOAD_H__
 #define __DETECT_ENGINE_PAYLOAD_H__
 
-int PrefilterPktPayloadRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterPktStreamRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterPktPayloadRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterPktStreamRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectPacketPayload(DetectEngineCtx *,
         DetectEngineThreadCtx *, const Signature *, Flow *, Packet *);
index 35f45e71b0a2b9d537a74aaf31f7dc192ce3d0bd..b9495fa06338139c4d83091c8d4ccef3671cda1d 100644 (file)
@@ -93,8 +93,8 @@ static void GetExtraMatch(const Signature *s, uint16_t *type, uint16_t *value)
 /** \internal
  */
 static int
-SetupEngineForPacketHeader(SigGroupHead *sgh, int sm_type,
-        PrefilterPacketHeaderHashCtx *hctx,
+SetupEngineForPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
+        int sm_type, PrefilterPacketHeaderHashCtx *hctx,
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
 {
@@ -142,8 +142,8 @@ SetupEngineForPacketHeader(SigGroupHead *sgh, int sm_type,
     SCLogDebug("%s: ctx %p extra type %u extra value %u, sig cnt %u",
             sigmatch_table[sm_type].name, ctx, ctx->type, ctx->value,
             ctx->sigs_cnt);
-    PrefilterAppendEngine(sgh, Match, ctx, PrefilterPacketHeaderFree,
-            sigmatch_table[sm_type].name);
+    PrefilterAppendEngine(de_ctx, sgh, Match, ctx,
+            PrefilterPacketHeaderFree, sigmatch_table[sm_type].name);
     return 0;
 }
 
@@ -197,8 +197,8 @@ static void ApplyToU8Hash(PrefilterPacketU8HashCtx *ctx, PrefilterPacketHeaderVa
  *  \todo deduplicate sigs arrays
  */
 static int
-SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(SigGroupHead *sgh, int sm_type,
-        uint32_t *counts,
+SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, int sm_type, uint32_t *counts,
         void (*Set)(PrefilterPacketHeaderValue *v, void *),
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
@@ -240,7 +240,7 @@ SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(SigGroupHead *sgh, int sm_typ
     }
 
     if (cnt) {
-        PrefilterAppendEngine(sgh, Match, ctx,
+        PrefilterAppendEngine(de_ctx, sgh, Match, ctx,
                 PrefilterPacketU8HashCtxFree,
                 sigmatch_table[sm_type].name);
     } else {
@@ -252,7 +252,7 @@ SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(SigGroupHead *sgh, int sm_typ
 /** \internal
  *  \brief setup a engine for each unique value
  */
-static void SetupSingle(HashListTable *hash_table,
+static void SetupSingle(DetectEngineCtx *de_ctx, HashListTable *hash_table,
         SigGroupHead *sgh, int sm_type,
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx,
@@ -262,7 +262,7 @@ static void SetupSingle(HashListTable *hash_table,
     for ( ; hb != NULL; hb = HashListTableGetListNext(hb)) {
         PrefilterPacketHeaderHashCtx *ctx = HashListTableGetListData(hb);
 
-        SetupEngineForPacketHeader(sgh, sm_type,
+        SetupEngineForPacketHeader(de_ctx, sgh, sm_type,
                 ctx, Compare, Match);
     }
 }
@@ -270,7 +270,7 @@ static void SetupSingle(HashListTable *hash_table,
 /** \internal
  *  \brief setup a single engine with a hash map for u8 values
  */
-static void SetupU8Hash(HashListTable *hash_table,
+static void SetupU8Hash(DetectEngineCtx *de_ctx, HashListTable *hash_table,
         SigGroupHead *sgh, int sm_type,
         void (*Set)(PrefilterPacketHeaderValue *v, void *),
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
@@ -318,11 +318,12 @@ static void SetupU8Hash(HashListTable *hash_table,
         }
     }
 
-    SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(sgh, sm_type,
+    SetupEngineForPacketHeaderPrefilterPacketU8HashCtx(de_ctx, sgh, sm_type,
             counts, Set, Compare, Match);
 }
 
-static int PrefilterSetupPacketHeaderCommon(SigGroupHead *sgh, int sm_type,
+static int PrefilterSetupPacketHeaderCommon(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, int sm_type,
         void (*Set)(PrefilterPacketHeaderValue *v, void *),
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx,
@@ -379,9 +380,9 @@ static int PrefilterSetupPacketHeaderCommon(SigGroupHead *sgh, int sm_type,
     }
 
     if (u8hash == FALSE) {
-        SetupSingle(hash_table, sgh, sm_type, Compare, Match);
+        SetupSingle(de_ctx, hash_table, sgh, sm_type, Compare, Match);
     } else {
-        SetupU8Hash(hash_table, sgh, sm_type, Set, Compare, Match);
+        SetupU8Hash(de_ctx, hash_table, sgh, sm_type, Set, Compare, Match);
     }
 
     HashListTableFree(hash_table);
@@ -391,22 +392,24 @@ error:
     return -1;
 }
 
-int PrefilterSetupPacketHeaderU8Hash(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, int sm_type,
         void (*Set)(PrefilterPacketHeaderValue *v, void *),
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx,
                       Packet *p, const void *pectx))
 {
-    return PrefilterSetupPacketHeaderCommon(sgh, sm_type,
+    return PrefilterSetupPacketHeaderCommon(de_ctx, sgh, sm_type,
             Set, Compare, Match, TRUE);
 }
 
-int PrefilterSetupPacketHeader(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, int sm_type,
         void (*Set)(PrefilterPacketHeaderValue *v, void *),
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx,
         Packet *p, const void *pectx))
 {
-    return PrefilterSetupPacketHeaderCommon(sgh, sm_type,
+    return PrefilterSetupPacketHeaderCommon(de_ctx, sgh, sm_type,
             Set, Compare, Match, FALSE);
 }
index 6072b56c51fa462271e14b036ffd45b5c029a29f..6137f8b19b099c18931873015a30f4832357e596 100644 (file)
@@ -56,13 +56,15 @@ typedef struct PrefilterPacketU8HashCtx_ {
 #define PREFILTER_U8HASH_MODE_GT    2
 #define PREFILTER_U8HASH_MODE_RA    3
 
-int PrefilterSetupPacketHeader(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, int sm_type,
         void (*Set)(PrefilterPacketHeaderValue *v, void *),
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx,
             Packet *p, const void *pectx));
 
-int PrefilterSetupPacketHeaderU8Hash(SigGroupHead *sgh, int sm_type,
+int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, int sm_type,
         void (*Set)(PrefilterPacketHeaderValue *v, void *),
         _Bool (*Compare)(PrefilterPacketHeaderValue v, void *),
         void (*Match)(DetectEngineThreadCtx *det_ctx,
index 50382efeb5d3b051fd79d3442483a247a2715bd4..20acdb8ad11d8b16927b1bd03768151f567b2f7a 100644 (file)
@@ -55,7 +55,8 @@
 
 #include "util-profiling.h"
 
-static int PrefilterStoreGetId(const char *name, void (*FreeFunc)(void *));
+static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
+        const char *name, void (*FreeFunc)(void *));
 static const PrefilterStore *PrefilterStoreGetStore(const uint32_t id);
 
 static inline void QuickSortSigIntId(SigIntId *sids, uint32_t n)
@@ -183,7 +184,7 @@ void Prefilter(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh,
     }
 }
 
-int PrefilterAppendEngine(SigGroupHead *sgh,
+int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
         void (*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
         void *pectx, void (*FreeFunc)(void *pectx),
         const char *name)
@@ -213,11 +214,11 @@ int PrefilterAppendEngine(SigGroupHead *sgh,
     }
 
     e->name = name;
-    e->gid = PrefilterStoreGetId(e->name, e->Free);
+    e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
     return 0;
 }
 
-int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
+int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
         void (*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
         void *pectx, void (*FreeFunc)(void *pectx),
         const char *name)
@@ -247,11 +248,11 @@ int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
     }
 
     e->name = name;
-    e->gid = PrefilterStoreGetId(e->name, e->Free);
+    e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
     return 0;
 }
 
-int PrefilterAppendTxEngine(SigGroupHead *sgh,
+int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
         void (*PrefilterTxFunc)(DetectEngineThreadCtx *det_ctx, const void *pectx,
             Packet *p, Flow *f, void *tx,
             const uint64_t idx, const uint8_t flags),
@@ -286,7 +287,7 @@ int PrefilterAppendTxEngine(SigGroupHead *sgh,
     }
 
     e->name = name;
-    e->gid = PrefilterStoreGetId(e->name, e->Free);
+    e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
     return 0;
 }
 
@@ -351,7 +352,7 @@ void PrefilterSetupRuleGroup(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
         for (i = 0; i < DETECT_TBLSIZE; i++)
         {
             if (sigmatch_table[i].SetupPrefilter != NULL) {
-                sigmatch_table[i].SetupPrefilter(sgh);
+                sigmatch_table[i].SetupPrefilter(de_ctx, sgh);
             }
         }
     }
@@ -496,7 +497,8 @@ static void PrefilterInit(void)
     SCMutexUnlock(&g_prefilter_mutex);
 }
 
-static int PrefilterStoreGetId(const char *name, void (*FreeFunc)(void *))
+static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
+        const char *name, void (*FreeFunc)(void *))
 {
     PrefilterStore ctx = { name, FreeFunc, 0 };
 
@@ -626,7 +628,8 @@ static void PrefilterGenericMpmFree(void *ptr)
     SCFree(ptr);
 }
 
-int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx,
         const DetectMpmAppLayerRegistery *mpm_reg, int list_id)
 {
     SCEnter();
@@ -638,7 +641,7 @@ int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
     pectx->mpm_ctx = mpm_ctx;
     pectx->transforms = &mpm_reg->v2.transforms;
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterMpm,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterMpm,
         mpm_reg->v2.alproto, mpm_reg->v2.tx_min_progress,
         pectx, PrefilterGenericMpmFree, mpm_reg->pname);
     if (r != 0) {
index 584341b57f24ddcaa7ef15b331dd9dd2daab62aa..6469883eaf753fd8ecb775f1a2f24b5f3cfa3333 100644 (file)
@@ -35,15 +35,15 @@ typedef struct PrefilterStore_ {
 void Prefilter(DetectEngineThreadCtx *, const SigGroupHead *, Packet *p,
         const uint8_t flags);
 
-int PrefilterAppendEngine(SigGroupHead *sgh,
+int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
         void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
         void *pectx, void (*FreeFunc)(void *pectx),
         const char *name);
-int PrefilterAppendPayloadEngine(SigGroupHead *sgh,
+int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
         void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx),
         void *pectx, void (*FreeFunc)(void *pectx),
         const char *name);
-int PrefilterAppendTxEngine(SigGroupHead *sgh,
+int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh,
         void (*PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx,
             Packet *p, Flow *f, void *tx,
             const uint64_t idx, const uint8_t flags),
@@ -69,7 +69,8 @@ void PrefilterCleanupRuleGroup(SigGroupHead *sgh);
 const char *PrefilterStoreGetName(const uint32_t id);
 #endif
 
-int PrefilterGenericMpmRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx,
+int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx,
         const DetectMpmAppLayerRegistery *mpm_reg, int list_id);
 
 #endif
index fe08450ce318ac2e1b06ab3d9f199fb2fe649596..84ec8946856d1eca48403736519caed4cbb3d588 100644 (file)
@@ -76,11 +76,12 @@ static void PrefilterTxTlsSni(DetectEngineThreadCtx *det_ctx, const void *pectx,
     }
 }
 
-int PrefilterTxTlsSniRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsSniRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSni,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSni,
         ALPROTO_TLS, 0, // TODO a special 'cert ready' state might be good to add
         mpm_ctx, NULL, "tls_sni");
 }
@@ -151,11 +152,12 @@ static void PrefilterTxTlsIssuer(DetectEngineThreadCtx *det_ctx, const void *pec
     }
 }
 
-int PrefilterTxTlsIssuerRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsIssuerRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxTlsIssuer,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsIssuer,
         ALPROTO_TLS, TLS_STATE_CERT_READY,
         mpm_ctx, NULL, "tls_cert_issuer");
 }
@@ -226,11 +228,12 @@ static void PrefilterTxTlsSubject(DetectEngineThreadCtx *det_ctx, const void *pe
     }
 }
 
-int PrefilterTxTlsSubjectRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsSubjectRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSubject,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSubject,
         ALPROTO_TLS, TLS_STATE_CERT_READY,
         mpm_ctx, NULL, "tls_cert_subject");
 }
@@ -301,11 +304,12 @@ static void PrefilterTxTlsSerial(DetectEngineThreadCtx *det_ctx, const void *pec
     }
 }
 
-int PrefilterTxTlsSerialRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsSerialRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxTlsSerial, ALPROTO_TLS,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsSerial, ALPROTO_TLS,
                                    TLS_STATE_CERT_READY, mpm_ctx, NULL,
                                    "tls_cert_serial");
 }
@@ -378,11 +382,12 @@ static void PrefilterTxTlsFingerprint(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-int PrefilterTxTlsFingerprintRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxTlsFingerprintRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxTlsFingerprint, ALPROTO_TLS,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxTlsFingerprint, ALPROTO_TLS,
                                    TLS_STATE_CERT_READY, mpm_ctx, NULL,
                                    "tls_cert_fingerprint");
 }
index 401f3ac69897e84c60221683afe13a8665119d1c..b63a8ea3f61dd584af9023801c7082de402255ae 100644 (file)
 #ifndef __DETECT_ENGINE_TLS_H__
 #define __DETECT_ENGINE_TLS_H__
 
-int PrefilterTxTlsSniRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsIssuerRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsSubjectRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsSerialRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
-int PrefilterTxTlsFingerprintRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsSniRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsIssuerRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsSubjectRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsSerialRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxTlsFingerprintRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectTlsSni(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index ed02ca76728b1a9cd35d61492e5835800e76090a..71f46cf783e9f4d685ff87e4bbdd245d7f152610 100644 (file)
@@ -81,11 +81,12 @@ static void PrefilterTxUri(DetectEngineThreadCtx *det_ctx, const void *pectx,
     }
 }
 
-int PrefilterTxUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+int PrefilterTxUriRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxUri,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxUri,
         ALPROTO_HTTP, HTP_REQUEST_LINE,
         mpm_ctx, NULL, "http_uri");
 }
index fa18960bdbdcf0b8633fa885e496189c09d7ac09..28c21d6ec2235bec1f4b4985fb741b67d0fd49ef 100644 (file)
@@ -24,7 +24,8 @@
 #ifndef __DETECT_ENGINE_URICONTENT_H__
 #define __DETECT_ENGINE_URICONTENT_H__
 
-int PrefilterTxUriRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+int PrefilterTxUriRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 int DetectEngineInspectHttpUri(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
index c9754b9bfdd6e07e721f268cc9f1d8229a056d1d..7136527e94169ba528d36b45fbf11cdc89bc21ca 100644 (file)
@@ -54,7 +54,8 @@ static void DetectFiledataRegisterTests(void);
 static void DetectFiledataSetupCallback(Signature *s);
 static int g_file_data_buffer_id = 0;
 
-static int PrefilterTxSmtpFiledataRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+static int PrefilterTxSmtpFiledataRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 
 /**
  * \brief Registration function for keyword: file_data
@@ -91,11 +92,12 @@ void DetectFiledataRegister(void)
     g_file_data_buffer_id = DetectBufferTypeGetByName("file_data");
 }
 
-static int PrefilterTxSmtpFiledataRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSmtpFiledataRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxFiledata,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxFiledata,
         ALPROTO_SMTP, 0,
         mpm_ctx, NULL, "file_data (smtp)");
 }
index 6959277399b18043d6799633623f4662f65ecfe0..d5e9145df2903a0164e7cd2f00e6967a7b6725a5 100644 (file)
@@ -64,7 +64,7 @@ static int DetectFlagsSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectFlagsFree(void *);
 
 static _Bool PrefilterTcpFlagsIsPrefilterable(const Signature *s);
-static int PrefilterSetupTcpFlags(SigGroupHead *sgh);
+static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 
 /**
  * \brief Registration function for flags: keyword
@@ -594,9 +594,9 @@ PrefilterPacketFlagsCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupTcpFlags(SigGroupHead *sgh)
+static int PrefilterSetupTcpFlags(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_FLAGS,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FLAGS,
             PrefilterPacketFlagsSet,
             PrefilterPacketFlagsCompare,
             PrefilterPacketFlagsMatch);
index 2d5c7a0c1f3058ca73a2d5a1fcd446997a493bc1..06992d48a472aa5d4970adc3aaf44d3d0f692920 100644 (file)
@@ -55,7 +55,7 @@ static int DetectFlowSetup (DetectEngineCtx *, Signature *, const char *);
 void DetectFlowRegisterTests(void);
 void DetectFlowFree(void *);
 
-static int PrefilterSetupFlow(SigGroupHead *sgh);
+static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterFlowIsPrefilterable(const Signature *s);
 
 /**
@@ -426,9 +426,9 @@ PrefilterPacketFlowCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupFlow(SigGroupHead *sgh)
+static int PrefilterSetupFlow(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_FLOW,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FLOW,
         PrefilterPacketFlowSet,
         PrefilterPacketFlowCompare,
         PrefilterPacketFlowMatch);
index 3349ab3480494d30aa475fe3ef38787b246957ff..529adc097272322ef2def8a8fcb90da948ccf2ce 100644 (file)
@@ -73,7 +73,7 @@ static int DetectFragBitsMatch (ThreadVars *, DetectEngineThreadCtx *, Packet *,
 static int DetectFragBitsSetup (DetectEngineCtx *, Signature *, const char *);
 static void DetectFragBitsFree(void *);
 
-static int PrefilterSetupFragBits(SigGroupHead *sgh);
+static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterFragBitsIsPrefilterable(const Signature *s);
 
 /**
@@ -358,9 +358,9 @@ PrefilterPacketFragBitsCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupFragBits(SigGroupHead *sgh)
+static int PrefilterSetupFragBits(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_FRAGBITS,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FRAGBITS,
         PrefilterPacketFragBitsSet,
         PrefilterPacketFragBitsCompare,
         PrefilterPacketFragBitsMatch);
index 5f5eacc8a3fe6c0b82238e0b16e81d679a07423b..052aa82ac38a3302a383b2809b478eb6f93a7184 100644 (file)
@@ -50,7 +50,7 @@ static int DetectFragOffsetSetup(DetectEngineCtx *, Signature *, const char *);
 void DetectFragOffsetRegisterTests(void);
 void DetectFragOffsetFree(void *);
 
-static int PrefilterSetupFragOffset(SigGroupHead *sgh);
+static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterFragOffsetIsPrefilterable(const Signature *s);
 
 /**
@@ -302,9 +302,9 @@ PrefilterPacketFragOffsetCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupFragOffset(SigGroupHead *sgh)
+static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_FRAGOFFSET,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_FRAGOFFSET,
         PrefilterPacketFragOffsetSet,
         PrefilterPacketFragOffsetCompare,
         PrefilterPacketFragOffsetMatch);
index 0ac8f7aacc0001cd6a742e44a0409ecc00a71af9..fa2780045765a75e261a0636d33a423516059f6a 100644 (file)
@@ -214,11 +214,12 @@ static void PrefilterTxHttpRequestTrailers(DetectEngineThreadCtx *det_ctx,
     }
 }
 #endif
-static int PrefilterTxHttpRequestHeaderNamesRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestHeaderNamesRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeaderNames,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeaderNames,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, KEYWORD_NAME " (request)");
     return r;
@@ -294,11 +295,12 @@ static void PrefilterTxHttpResponseTrailers(DetectEngineThreadCtx *det_ctx,
     }
 }
 #endif
-static int PrefilterTxHttpResponseHeaderNamesRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseHeaderNamesRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeaderNames,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeaderNames,
         ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
         mpm_ctx, NULL, KEYWORD_NAME " (response)");
     return r;
index 9d56af61dd946d9152e8eff22c595196e33a35ff..9d2c980c0c0e386904124b3f1be71b722d556db9 100644 (file)
@@ -215,16 +215,17 @@ static void PrefilterTxHttpRequestTrailers(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpRequestHeadersRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestHeadersRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeaders,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeaders,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, "http_header (request)");
     if (r != 0)
         return r;
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestTrailers,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestTrailers,
         ALPROTO_HTTP, HTP_REQUEST_TRAILER,
         mpm_ctx, NULL, "http_header (request trailer)");
 }
@@ -295,16 +296,17 @@ static void PrefilterTxHttpResponseTrailers(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpResponseHeadersRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseHeadersRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeaders,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeaders,
         ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
         mpm_ctx, NULL, "http_header (response)");
     if (r != 0)
         return r;
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseTrailers,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseTrailers,
         ALPROTO_HTTP, HTP_RESPONSE_TRAILER,
         mpm_ctx, NULL, "http_header (response trailer)");
 }
index 98f26a5cbd53672de209e976080500ec40a3a2a8..fc70640146b023727d97b525f460886dea7c8057 100644 (file)
@@ -116,11 +116,12 @@ static void PrefilterTxHttpRequestTrailers(DetectEngineThreadCtx *det_ctx,
     }
 }
 #endif
-static int PrefilterTxHttpRequestHeaderRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestHeaderRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestHeader,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestHeader,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, KEYWORD_NAME " (request)");
     return r;
@@ -202,11 +203,12 @@ static void PrefilterTxHttpResponseTrailers(DetectEngineThreadCtx *det_ctx,
     }
 }
 #endif
-static int PrefilterTxHttpResponseHeaderRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseHeaderRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseHeader,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseHeader,
         ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
         mpm_ctx, NULL, KEYWORD_NAME " (response)");
     return r;
index 79f4fb078874f95a29001e90e2b95858af6e5250..527a9e2e75ba7c87ec3f60d7baa243dea31bd7c5 100644 (file)
@@ -101,11 +101,12 @@ static void PrefilterTxHttpRequestProtocol(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpRequestProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestProtocolRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestProtocol,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestProtocol,
         ALPROTO_HTTP, HTP_REQUEST_LINE,
         mpm_ctx, NULL, KEYWORD_NAME " (request)");
     return r;
@@ -141,11 +142,12 @@ static void PrefilterTxHttpResponseProtocol(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpResponseProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseProtocolRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseProtocol,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseProtocol,
         ALPROTO_HTTP, HTP_RESPONSE_LINE,
         mpm_ctx, NULL, KEYWORD_NAME " (response)");
     return r;
index 047beee252b0fb25308b44db819af63928d525f0..11b4210da27735133fbe1f7f0a170acc403509e2 100644 (file)
@@ -62,7 +62,8 @@
 
 static int DetectHttpRequestLineSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectHttpRequestLineRegisterTests(void);
-static int PrefilterTxHttpRequestLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+static int PrefilterTxHttpRequestLineRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 static int DetectEngineInspectHttpRequestLine(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
         const Signature *s, const SigMatchData *smd,
@@ -146,11 +147,12 @@ static void PrefilterTxHttpRequestLine(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpRequestLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestLineRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestLine,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestLine,
         ALPROTO_HTTP, HTP_REQUEST_LINE,
         mpm_ctx, NULL, "http_request_line");
 }
index e375984fe3692948067ddca513ce1a312d29da17..f1d79d5dcaa609af39628ba42d4a41c7cb86681a 100644 (file)
@@ -62,7 +62,8 @@
 
 static int DetectHttpResponseLineSetup(DetectEngineCtx *, Signature *, const char *);
 static void DetectHttpResponseLineRegisterTests(void);
-static int PrefilterTxHttpResponseLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx);
+static int PrefilterTxHttpResponseLineRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx);
 static int DetectEngineInspectHttpResponseLine(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
         const Signature *s, const SigMatchData *smd,
@@ -146,11 +147,12 @@ static void PrefilterTxHttpResponseLine(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpResponseLineRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseLineRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    return PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseLine,
+    return PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseLine,
         ALPROTO_HTTP, HTP_RESPONSE_LINE,
         mpm_ctx, NULL, "http_response_line");
 }
index bc0d32f90259cad5d561119dbcac7c155e855dfb..19f79160e810dbbe3b0cad0777e698f0f61a849d 100644 (file)
@@ -199,11 +199,12 @@ static void PrefilterTxHttpRequestStart(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpRequestStartRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpRequestStartRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpRequestStart,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpRequestStart,
         ALPROTO_HTTP, HTP_REQUEST_HEADERS,
         mpm_ctx, NULL, KEYWORD_NAME " (request)");
     return r;
@@ -238,11 +239,12 @@ static void PrefilterTxHttpResponseStart(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxHttpResponseStartRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxHttpResponseStartRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxHttpResponseStart,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxHttpResponseStart,
         ALPROTO_HTTP, HTP_RESPONSE_HEADERS,
         mpm_ctx, NULL, KEYWORD_NAME " (response)");
     return r;
index 310bc3ce76d8a8228b475f33a806886c809b8b9b..82da577c972714c49a4616a2651a4f0051af2080 100644 (file)
@@ -48,7 +48,7 @@ static int DetectIcmpIdMatch(ThreadVars *, DetectEngineThreadCtx *, Packet *,
 static int DetectIcmpIdSetup(DetectEngineCtx *, Signature *, const char *);
 void DetectIcmpIdRegisterTests(void);
 void DetectIcmpIdFree(void *);
-static int PrefilterSetupIcmpId(SigGroupHead *sgh);
+static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterIcmpIdIsPrefilterable(const Signature *s);
 
 /**
@@ -299,9 +299,9 @@ PrefilterPacketIcmpIdCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupIcmpId(SigGroupHead *sgh)
+static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_ICMP_ID,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ICMP_ID,
         PrefilterPacketIcmpIdSet,
         PrefilterPacketIcmpIdCompare,
         PrefilterPacketIcmpIdMatch);
index 04290084e0f930dc6c125d4162c7c1fc6abbdf37..27313df684f32fa52d07bc2356a3c9d9491fc8ce 100644 (file)
@@ -48,7 +48,7 @@ static int DetectIcmpSeqMatch(ThreadVars *, DetectEngineThreadCtx *, Packet *,
 static int DetectIcmpSeqSetup(DetectEngineCtx *, Signature *, const char *);
 void DetectIcmpSeqRegisterTests(void);
 void DetectIcmpSeqFree(void *);
-static int PrefilterSetupIcmpSeq(SigGroupHead *sgh);
+static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterIcmpSeqIsPrefilterable(const Signature *s);
 
 /**
@@ -302,9 +302,9 @@ PrefilterPacketIcmpSeqCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupIcmpSeq(SigGroupHead *sgh)
+static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_ICMP_SEQ,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ICMP_SEQ,
         PrefilterPacketIcmpSeqSet,
         PrefilterPacketIcmpSeqCompare,
         PrefilterPacketIcmpSeqMatch);
index 1de36486aa637d9e0ebedcafcc4be1b584ad2829..0faf45493416501ed2587e142d1cd5e3fa8ff8ec 100644 (file)
@@ -52,7 +52,7 @@ static int DetectICodeSetup(DetectEngineCtx *, Signature *, const char *);
 void DetectICodeRegisterTests(void);
 void DetectICodeFree(void *);
 
-static int PrefilterSetupICode(SigGroupHead *sgh);
+static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterICodeIsPrefilterable(const Signature *s);
 
 /**
@@ -331,9 +331,9 @@ PrefilterPacketICodeCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupICode(SigGroupHead *sgh)
+static int PrefilterSetupICode(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeaderU8Hash(sgh, DETECT_ICODE,
+    return PrefilterSetupPacketHeaderU8Hash(de_ctx, sgh, DETECT_ICODE,
             PrefilterPacketICodeSet,
             PrefilterPacketICodeCompare,
             PrefilterPacketICodeMatch);
index 324c60eb36803415b99e25712e9a4863eaca542a..c1010b2160473a43fcf90ece8209e11321e55cfe 100644 (file)
@@ -55,7 +55,7 @@ static int DetectIdSetup (DetectEngineCtx *, Signature *, const char *);
 void DetectIdRegisterTests(void);
 void DetectIdFree(void *);
 
-static int PrefilterSetupId(SigGroupHead *sgh);
+static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterIdIsPrefilterable(const Signature *s);
 
 /**
@@ -257,9 +257,9 @@ PrefilterPacketIdCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupId(SigGroupHead *sgh)
+static int PrefilterSetupId(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_ID,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_ID,
         PrefilterPacketIdSet,
         PrefilterPacketIdCompare,
         PrefilterPacketIdMatch);
index 638c07877a4ff14a0555788a93b0fbdab80f8a77..8546c92bcb56fe0d133ef190b5cd14e8e8df3d9e 100644 (file)
@@ -52,7 +52,7 @@ static int DetectITypeSetup(DetectEngineCtx *, Signature *, const char *);
 void DetectITypeRegisterTests(void);
 void DetectITypeFree(void *);
 
-static int PrefilterSetupIType(SigGroupHead *sgh);
+static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterITypeIsPrefilterable(const Signature *s);
 
 /**
@@ -335,9 +335,9 @@ PrefilterPacketITypeCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupIType(SigGroupHead *sgh)
+static int PrefilterSetupIType(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeaderU8Hash(sgh, DETECT_ITYPE,
+    return PrefilterSetupPacketHeaderU8Hash(de_ctx, sgh, DETECT_ITYPE,
             PrefilterPacketITypeSet,
             PrefilterPacketITypeCompare,
             PrefilterPacketITypeMatch);
index e2f185ad1a3a9dbee29bd8e70f202d487c087c72..972482724f818c3236fdeafe8ef33c4c114d0e4c 100644 (file)
@@ -45,7 +45,7 @@ static int DetectSeqMatch(ThreadVars *, DetectEngineThreadCtx *,
                           Packet *, const Signature *, const SigMatchCtx *);
 static void DetectSeqRegisterTests(void);
 static void DetectSeqFree(void *);
-static int PrefilterSetupTcpSeq(SigGroupHead *sgh);
+static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterTcpSeqIsPrefilterable(const Signature *s);
 
 void DetectSeqRegister(void)
@@ -178,9 +178,9 @@ PrefilterPacketSeqCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupTcpSeq(SigGroupHead *sgh)
+static int PrefilterSetupTcpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_SEQ,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_SEQ,
         PrefilterPacketSeqSet,
         PrefilterPacketSeqCompare,
         PrefilterPacketSeqMatch);
index 4039830452cfaa710fa12f56e6abe4c51d3f891e..58d6bd07497170dbb2acaa9bb720885d77962cfd 100644 (file)
@@ -83,11 +83,12 @@ static void PrefilterTxSshRequestProtocol(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxSshRequestProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshRequestProtocolRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshRequestProtocol,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshRequestProtocol,
         ALPROTO_SSH, SSH_STATE_BANNER_DONE,
         mpm_ctx, NULL, KEYWORD_NAME " (request)");
     return r;
@@ -123,11 +124,12 @@ static void PrefilterTxSshResponseProtocol(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxSshResponseProtocolRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshResponseProtocolRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshResponseProtocol,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshResponseProtocol,
         ALPROTO_SSH, SSH_STATE_BANNER_DONE,
         mpm_ctx, NULL, KEYWORD_NAME " (response)");
     return r;
index 2b8dc1114d6bb82d5081470716d62b9b53bd16e7..4f5b4e214d292d00aefbcf80ac3a66182d6d55e4 100644 (file)
@@ -83,11 +83,12 @@ static void PrefilterTxSshRequestSoftware(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxSshRequestSoftwareRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshRequestSoftwareRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshRequestSoftware,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshRequestSoftware,
         ALPROTO_SSH, SSH_STATE_BANNER_DONE,
         mpm_ctx, NULL, KEYWORD_NAME " (request)");
     return r;
@@ -123,11 +124,12 @@ static void PrefilterTxSshResponseSoftware(DetectEngineThreadCtx *det_ctx,
     }
 }
 
-static int PrefilterTxSshResponseSoftwareRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
+static int PrefilterTxSshResponseSoftwareRegister(DetectEngineCtx *de_ctx,
+        SigGroupHead *sgh, MpmCtx *mpm_ctx)
 {
     SCEnter();
 
-    int r = PrefilterAppendTxEngine(sgh, PrefilterTxSshResponseSoftware,
+    int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterTxSshResponseSoftware,
         ALPROTO_SSH, SSH_STATE_BANNER_DONE,
         mpm_ctx, NULL, KEYWORD_NAME " (response)");
     return r;
index 488e14c41521796ab4ebde6f2c89d98b547f9948..6a30679183613bb0dc0d644ab8f5000f9ea000e8 100644 (file)
@@ -49,7 +49,7 @@ static int DetectTtlSetup (DetectEngineCtx *, Signature *, const char *);
 void DetectTtlFree (void *);
 void DetectTtlRegisterTests (void);
 
-static int PrefilterSetupTtl(SigGroupHead *sgh);
+static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
 static _Bool PrefilterTtlIsPrefilterable(const Signature *s);
 
 /**
@@ -360,9 +360,9 @@ PrefilterPacketTtlCompare(PrefilterPacketHeaderValue v, void *smctx)
     return FALSE;
 }
 
-static int PrefilterSetupTtl(SigGroupHead *sgh)
+static int PrefilterSetupTtl(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
 {
-    return PrefilterSetupPacketHeader(sgh, DETECT_TTL,
+    return PrefilterSetupPacketHeader(de_ctx, sgh, DETECT_TTL,
             PrefilterPacketTtlSet,
             PrefilterPacketTtlCompare,
             PrefilterPacketTtlMatch);
index 4bd680123b0c54dbb832c09d75dc622f314b9134..878f08afbd3e29eebafc43f5862a2589e8618272 100644 (file)
@@ -557,12 +557,14 @@ typedef struct DetectMpmAppLayerRegistery_ {
     int direction;              /**< SIG_FLAG_TOSERVER or SIG_FLAG_TOCLIENT */
     int sm_list;
 
-    int (*PrefilterRegister)(struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx);
+    int (*PrefilterRegister)(struct DetectEngineCtx_ *de_ctx,
+            struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx);
 
     int priority;
 
     struct {
-        int (*PrefilterRegisterWithListId)(struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
+        int (*PrefilterRegisterWithListId)(struct DetectEngineCtx_ *de_ctx,
+                struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
                 const struct DetectMpmAppLayerRegistery_ *mpm_reg, int list_id);
         InspectionBufferGetDataPtr GetData;
         AppProto alproto;
@@ -1130,7 +1132,7 @@ typedef struct SigTableElmt_ {
     int (*Setup)(DetectEngineCtx *, Signature *, const char *);
 
     _Bool (*SupportsPrefilter)(const Signature *s);
-    int (*SetupPrefilter)(struct SigGroupHead_ *sgh);
+    int (*SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh);
 
     void (*Free)(void *);
     void (*RegisterTests)(void);