From: Philippe Antoine Date: Mon, 15 Jul 2024 12:12:38 +0000 (+0200) Subject: detect: helper function for multibuffer registration X-Git-Tag: suricata-8.0.0-beta1~1009 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4e7d1e21792504de2f0f3c15ef0f83729b907b4;p=thirdparty%2Fsuricata.git detect: helper function for multibuffer registration So that rust does not need to know about SIG_FLAG_TOCLIENT value --- diff --git a/src/detect-engine-helper.c b/src/detect-engine-helper.c index 9b58864881..740fec7618 100644 --- a/src/detect-engine-helper.c +++ b/src/detect-engine-helper.c @@ -81,6 +81,20 @@ int DetectHelperBufferMpmRegister(const char *name, const char *desc, AppProto a return DetectBufferTypeGetByName(name); } +int DetectHelperMultiBufferMpmRegister(const char *name, const char *desc, AppProto alproto, + bool toclient, bool toserver, InspectionMultiBufferGetDataPtr GetData) +{ + if (toserver) { + DetectAppLayerMultiRegister(name, alproto, SIG_FLAG_TOSERVER, 0, GetData, 2, 0); + } + if (toclient) { + DetectAppLayerMultiRegister(name, alproto, SIG_FLAG_TOCLIENT, 0, GetData, 2, 0); + } + DetectBufferTypeSupportsMultiInstance(name); + DetectBufferTypeSetDescriptionByName(name, desc); + return DetectBufferTypeGetByName(name); +} + int DetectHelperKeywordRegister(const SCSigTableElmt *kw) { if (DETECT_TBLSIZE_IDX >= DETECT_TBLSIZE) { diff --git a/src/detect-engine-helper.h b/src/detect-engine-helper.h index 5a2c49e1b0..76e27dee7c 100644 --- a/src/detect-engine-helper.h +++ b/src/detect-engine-helper.h @@ -39,6 +39,8 @@ InspectionBuffer *DetectHelperGetData(struct DetectEngineThreadCtx_ *det_ctx, const int list_id, SimpleGetTxBuffer GetBuf); int DetectHelperBufferMpmRegister(const char *name, const char *desc, AppProto alproto, bool toclient, bool toserver, InspectionBufferGetDataPtr GetData); +int DetectHelperMultiBufferMpmRegister(const char *name, const char *desc, AppProto alproto, + bool toclient, bool toserver, InspectionMultiBufferGetDataPtr GetData); InspectionBuffer *DetectHelperGetMultiData(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Flow *f, const uint8_t flow_flags, void *txv,