From f1ddd310f71615ccca8eb9c683845570f0e14970 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Mon, 10 Jul 2023 10:12:09 -0400 Subject: [PATCH] mpm: Use typedef for mpm registration Issue: 4145 --- src/detect-engine-mpm.c | 5 ++--- src/detect-engine-mpm.h | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/detect-engine-mpm.c b/src/detect-engine-mpm.c index 816a34e347c4..d1a79f8e4aa5 100644 --- a/src/detect-engine-mpm.c +++ b/src/detect-engine-mpm.c @@ -87,9 +87,8 @@ static int g_mpm_list_cnt[DETECT_BUFFER_MPM_TYPE_SIZE] = { 0, 0, 0 }; * \note to be used at start up / registration only. Errors are fatal. */ void DetectAppLayerMpmRegister2(const char *name, int direction, int priority, - int (*PrefilterRegister)(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, - const DetectBufferMpmRegistry *mpm_reg, int list_id), - InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress) + PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, + AppProto alproto, int tx_min_progress) { SCLogDebug("registering %s/%d/%d/%p/%p/%u/%d", name, direction, priority, PrefilterRegister, GetData, alproto, tx_min_progress); diff --git a/src/detect-engine-mpm.h b/src/detect-engine-mpm.h index 16eb6d987f18..adb40297190f 100644 --- a/src/detect-engine-mpm.h +++ b/src/detect-engine-mpm.h @@ -75,6 +75,9 @@ MpmStore *MpmStorePrepareBuffer(DetectEngineCtx *de_ctx, SigGroupHead *sgh, enum */ int DetectSetFastPatternAndItsId(DetectEngineCtx *de_ctx); +typedef int (*PrefilterRegisterFunc)(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, + const DetectBufferMpmRegistry *mpm_reg, int list_id); + /** \brief register an app layer keyword for mpm * \param name buffer name * \param direction SIG_FLAG_TOSERVER or SIG_FLAG_TOCLIENT @@ -88,17 +91,14 @@ int DetectSetFastPatternAndItsId(DetectEngineCtx *de_ctx); * If both are needed, register the keyword twice. */ void DetectAppLayerMpmRegister2(const char *name, int direction, int priority, - int (*PrefilterRegister)(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, - const DetectBufferMpmRegistry *mpm_reg, int list_id), - InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress); + PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, + AppProto alproto, int tx_min_progress); void DetectAppLayerMpmRegisterByParentId( DetectEngineCtx *de_ctx, const int id, const int parent_id, DetectEngineTransforms *transforms); -void DetectPktMpmRegister(const char *name, int priority, - int (*PrefilterRegister)(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, - const DetectBufferMpmRegistry *mpm_reg, int list_id), +void DetectPktMpmRegister(const char *name, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetPktDataPtr GetData); void DetectPktMpmRegisterByParentId(DetectEngineCtx *de_ctx, const int id, const int parent_id,