From 15c84bf3c62b0a96778b061d995adc712a32fac8 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 20 Oct 2020 11:03:56 +0200 Subject: [PATCH] detect/lua: convert to v2 inspect API --- src/detect-lua.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/detect-lua.c b/src/detect-lua.c index 337dcefd90..1ff14226dc 100644 --- a/src/detect-lua.c +++ b/src/detect-lua.c @@ -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 */