]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/lua: convert to v2 inspect API
authorVictor Julien <victor@inliniac.net>
Tue, 20 Oct 2020 09:03:56 +0000 (11:03 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 7 Dec 2020 15:01:52 +0000 (16:01 +0100)
src/detect-lua.c

index 337dcefd9092a4551252d7ff68041f0141003736..1ff14226dc18b984e4ed7f3129a1fb60fb33ffe4 100644 (file)
@@ -103,11 +103,9 @@ static void DetectLuaRegisterTests(void);
 static void DetectLuaFree(DetectEngineCtx *, void *);
 static int g_smtp_generic_list_id = 0;
 
-static int InspectSmtpGeneric(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);
+static int InspectSmtpGeneric(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);
 
 /**
  * \brief Registration function for keyword: lua
@@ -127,25 +125,21 @@ void DetectLuaRegister(void)
 #endif
     g_smtp_generic_list_id = DetectBufferTypeRegister("smtp_generic");
 
-    DetectAppLayerInspectEngineRegister("smtp_generic",
-            ALPROTO_SMTP, SIG_FLAG_TOSERVER, 0,
-            InspectSmtpGeneric);
-    DetectAppLayerInspectEngineRegister("smtp_generic",
-            ALPROTO_SMTP, SIG_FLAG_TOCLIENT, 0,
-            InspectSmtpGeneric);
+    DetectAppLayerInspectEngineRegister2(
+            "smtp_generic", ALPROTO_SMTP, SIG_FLAG_TOSERVER, 0, InspectSmtpGeneric, NULL);
+    DetectAppLayerInspectEngineRegister2(
+            "smtp_generic", ALPROTO_SMTP, SIG_FLAG_TOCLIENT, 0, InspectSmtpGeneric, NULL);
 
-       SCLogDebug("registering lua rule option");
+    SCLogDebug("registering lua rule option");
     return;
 }
 
-static int InspectSmtpGeneric(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)
+static int InspectSmtpGeneric(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)
 {
-    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd,
-                                          f, flags, alstate, txv, tx_id);
+    return DetectEngineInspectGenericList(
+            NULL, de_ctx, det_ctx, s, engine->smd, f, flags, alstate, txv, tx_id);
 }
 
 #define DATATYPE_PACKET                     (1<<0)
@@ -2063,4 +2057,4 @@ void DetectLuaRegisterTests(void)
     UtRegisterTest("LuaMatchTest06", LuaMatchTest06);
 }
 #endif
-#endif /* HAVE_LUAJIT */
\ No newline at end of file
+#endif /* HAVE_LUAJIT */