]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/enip/cip: convert to v2 inspect API
authorVictor Julien <victor@inliniac.net>
Tue, 20 Oct 2020 08:40:54 +0000 (10:40 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 7 Dec 2020 15:01:52 +0000 (16:01 +0100)
src/detect-cipservice.c
src/detect-engine-enip.c
src/detect-engine-enip.h

index f6516d344230351fc5b04ce866c791dad7b3cab4..482fc56fa29b11359e48c3afb3ec0c6303c6cd52 100644 (file)
@@ -62,12 +62,10 @@ void DetectCipServiceRegister(void)
     sigmatch_table[DETECT_CIPSERVICE].RegisterTests
             = DetectCipServiceRegisterTests;
 #endif
-    DetectAppLayerInspectEngineRegister("cip",
-            ALPROTO_ENIP, SIG_FLAG_TOSERVER, 0,
-            DetectEngineInspectCIP);
-    DetectAppLayerInspectEngineRegister("cip",
-            ALPROTO_ENIP, SIG_FLAG_TOCLIENT, 0,
-            DetectEngineInspectCIP);
+    DetectAppLayerInspectEngineRegister2(
+            "cip", ALPROTO_ENIP, SIG_FLAG_TOSERVER, 0, DetectEngineInspectCIP, NULL);
+    DetectAppLayerInspectEngineRegister2(
+            "cip", ALPROTO_ENIP, SIG_FLAG_TOCLIENT, 0, DetectEngineInspectCIP, NULL);
 
     g_cip_buffer_id = DetectBufferTypeGetByName("cip");
 
@@ -317,12 +315,10 @@ void DetectEnipCommandRegister(void)
     sigmatch_table[DETECT_ENIPCOMMAND].RegisterTests
             = DetectEnipCommandRegisterTests;
 #endif
-    DetectAppLayerInspectEngineRegister("enip",
-            ALPROTO_ENIP, SIG_FLAG_TOSERVER, 0,
-            DetectEngineInspectENIP);
-    DetectAppLayerInspectEngineRegister("enip",
-            ALPROTO_ENIP, SIG_FLAG_TOCLIENT, 0,
-            DetectEngineInspectENIP);
+    DetectAppLayerInspectEngineRegister2(
+            "enip", ALPROTO_ENIP, SIG_FLAG_TOSERVER, 0, DetectEngineInspectENIP, NULL);
+    DetectAppLayerInspectEngineRegister2(
+            "enip", ALPROTO_ENIP, SIG_FLAG_TOCLIENT, 0, DetectEngineInspectENIP, NULL);
 
     g_enip_buffer_id = DetectBufferTypeGetByName("enip");
 }
@@ -461,4 +457,4 @@ static void DetectEnipCommandRegisterTests(void)
     UtRegisterTest("DetectEnipCommandSignatureTest01",
             DetectEnipCommandSignatureTest01);
 }
-#endif /* UNITTESTS */
\ No newline at end of file
+#endif /* UNITTESTS */
index 3dcb681a82a553ccc3f8128636a78167320640f1..421cb693dbdf3e9e91b0eab9aff009b536e5da18 100644 (file)
@@ -217,16 +217,15 @@ static int CIPServiceMatch(ENIPTransaction *enip_data,
  *
  *  \retval 0 no match or 1 match
  */
-int DetectEngineInspectCIP(ThreadVars *tv,
-        DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const Signature *s, const SigMatchData *smd, Flow *f, uint8_t flags,
-        void *alstate, void *txv, uint64_t tx_id)
+int DetectEngineInspectCIP(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
+        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
+        uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
 {
     SCEnter();
 
 
     ENIPTransaction *tx = (ENIPTransaction *) txv;
-    DetectCipServiceData *cipserviced = (DetectCipServiceData *) smd->ctx;
+    DetectCipServiceData *cipserviced = (DetectCipServiceData *)engine->smd->ctx;
 
     if (cipserviced == NULL)
     {
@@ -257,15 +256,14 @@ int DetectEngineInspectCIP(ThreadVars *tv,
  *  \retval 0 no match or 1 match
  */
 
-int DetectEngineInspectENIP(ThreadVars *tv,
-        DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const Signature *s, const SigMatchData *smd,
-        Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
+int DetectEngineInspectENIP(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
+        const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f,
+        uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
 {
     SCEnter();
 
     ENIPTransaction *tx = (ENIPTransaction *) txv;
-    DetectEnipCommandData *enipcmdd = (DetectEnipCommandData *) smd->ctx;
+    DetectEnipCommandData *enipcmdd = (DetectEnipCommandData *)engine->smd->ctx;
 
     if (enipcmdd == NULL)
     {
index 23864201d2f1ce20ec0dd6243a8e9705eacf5d6a..37dbb8e1c7b11ff66223d939e2a3957451d6167a 100644 (file)
 #ifndef __DETECT_ENGINE_ENIP_H__
 #define __DETECT_ENGINE_ENIP_H__
 
-int DetectEngineInspectCIP(ThreadVars *,
-        DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,
-        const Signature *, const SigMatchData *smd,
-        Flow *, uint8_t, void *, void *, uint64_t);
+int DetectEngineInspectCIP(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,
+        const struct DetectEngineAppInspectionEngine_ *, const Signature *, Flow *, uint8_t, void *,
+        void *, uint64_t);
 
-int DetectEngineInspectENIP(ThreadVars *,
-        DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,
-        const Signature *, const SigMatchData *smd,
-        Flow *, uint8_t, void *, void *, uint64_t);
+int DetectEngineInspectENIP(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,
+        const struct DetectEngineAppInspectionEngine_ *, const Signature *, Flow *, uint8_t, void *,
+        void *, uint64_t);
 
 void DetectEngineInspectENIPRegisterTests(void);
 #endif /* __DETECT_ENGINE_ENIP_H__ */