From: Victor Julien Date: Tue, 20 Oct 2020 09:07:03 +0000 (+0200) Subject: detect/template: convert to v2 inspect API X-Git-Tag: suricata-7.0.0-beta1~1960 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92a8d8b4f4cd7e1f4776bb0f9acb32bcda1471b9;p=thirdparty%2Fsuricata.git detect/template: convert to v2 inspect API --- diff --git a/src/detect-template-rust-buffer.c b/src/detect-template-rust-buffer.c index d2615dea33..d8806c4fb9 100644 --- a/src/detect-template-rust-buffer.c +++ b/src/detect-template-rust-buffer.c @@ -43,10 +43,9 @@ static int DetectTemplateRustBufferSetup(DetectEngineCtx *, Signature *, const char *); -static int DetectEngineInspectTemplateRustBuffer(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 DetectEngineInspectTemplateRustBuffer(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); #ifdef UNITTESTS static void DetectTemplateRustBufferRegisterTests(void); #endif @@ -72,12 +71,10 @@ void DetectTemplateRustBufferRegister(void) sigmatch_table[DETECT_AL_TEMPLATE_RUST_BUFFER].flags |= SIGMATCH_NOOPT; /* register inspect engines */ - DetectAppLayerInspectEngineRegister("template_rust_buffer", - ALPROTO_TEMPLATE, SIG_FLAG_TOSERVER, 0, - DetectEngineInspectTemplateRustBuffer); - DetectAppLayerInspectEngineRegister("template_rust_buffer", - ALPROTO_TEMPLATE, SIG_FLAG_TOCLIENT, 0, - DetectEngineInspectTemplateRustBuffer); + DetectAppLayerInspectEngineRegister2("template_rust_buffer", ALPROTO_TEMPLATE, + SIG_FLAG_TOSERVER, 0, DetectEngineInspectTemplateRustBuffer, NULL); + DetectAppLayerInspectEngineRegister2("template_rust_buffer", ALPROTO_TEMPLATE, + SIG_FLAG_TOCLIENT, 0, DetectEngineInspectTemplateRustBuffer, NULL); g_template_rust_id = DetectBufferTypeGetByName("template_rust_buffer"); @@ -95,10 +92,9 @@ static int DetectTemplateRustBufferSetup(DetectEngineCtx *de_ctx, Signature *s, return 0; } -static int DetectEngineInspectTemplateRustBuffer(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 DetectEngineInspectTemplateRustBuffer(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) { int ret = 0; const uint8_t *data = NULL; @@ -111,9 +107,9 @@ static int DetectEngineInspectTemplateRustBuffer(ThreadVars *tv, } if (data != NULL) { - ret = DetectEngineContentInspection(de_ctx, det_ctx, s, smd, - NULL, f, (uint8_t *)data, data_len, 0, DETECT_CI_FLAGS_SINGLE, - DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE); + ret = DetectEngineContentInspection(de_ctx, det_ctx, s, engine->smd, NULL, f, + (uint8_t *)data, data_len, 0, DETECT_CI_FLAGS_SINGLE, + DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE); } SCLogNotice("Returning %d.", ret);