diff --git a/src/detect-dns-query.c b/src/detect-dns-query.c index 97b8ddc668..77f1c00f95 100644 --- a/src/detect-dns-query.c +++ b/src/detect-dns-query.c @@ -145,10 +145,8 @@ typedef struct PrefilterMpmDnsQuery { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterTxDnsQuery(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxDnsQuery(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-engine-prefilter.c b/src/detect-engine-prefilter.c index 034c16e1b7..066098601a 100644 --- a/src/detect-engine-prefilter.c +++ b/src/detect-engine-prefilter.c @@ -118,8 +118,8 @@ void DetectRunPrefilterTx(DetectEngineThreadCtx *det_ctx, } PREFILTER_PROFILING_START(det_ctx); - engine->cb.PrefilterTx(det_ctx, engine->pectx, - p, p->flow, tx->tx_ptr, tx->tx_id, flow_flags); + engine->cb.PrefilterTx(det_ctx, engine->pectx, p, p->flow, tx->tx_ptr, tx->tx_id, + tx->tx_data_ptr, flow_flags); PREFILTER_PROFILING_END(det_ctx, engine->gid); if (tx->tx_progress > engine->ctx.tx_min_progress && engine->is_last_for_progress) { @@ -268,12 +268,8 @@ int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, } int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, - void (*PrefilterTxFunc)(DetectEngineThreadCtx *det_ctx, const void *pectx, - Packet *p, Flow *f, void *tx, - const uint64_t idx, const uint8_t flags), - AppProto alproto, int tx_min_progress, - void *pectx, void (*FreeFunc)(void *pectx), - const char *name) + PrefilterTxFn PrefilterTxFunc, AppProto alproto, int tx_min_progress, void *pectx, + void (*FreeFunc)(void *pectx), const char *name) { if (sgh == NULL || PrefilterTxFunc == NULL || pectx == NULL) return -1; @@ -718,10 +714,8 @@ typedef struct PrefilterMpmCtx { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterMpm(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterMpm(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, + void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-engine-prefilter.h b/src/detect-engine-prefilter.h index 5ad6d1b623..39ac66fb83 100644 --- a/src/detect-engine-prefilter.h +++ b/src/detect-engine-prefilter.h @@ -44,10 +44,8 @@ int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, void *pectx, void (*FreeFunc)(void *pectx), const char *name); int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, - void (*PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, - void *tx, const uint64_t idx, const uint8_t flags), - const AppProto alproto, const int tx_min_progress, void *pectx, - void (*FreeFunc)(void *pectx), const char *name); + PrefilterTxFn PrefilterTxFunc, const AppProto alproto, const int tx_min_progress, + void *pectx, void (*FreeFunc)(void *pectx), const char *name); int PrefilterAppendFrameEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterFrameFn PrefilterFrameFunc, AppProto alproto, uint8_t frame_type, void *pectx, void (*FreeFunc)(void *pectx), const char *name); diff --git a/src/detect-file-data.c b/src/detect-file-data.c index 08c58f751a..891bc4111e 100644 --- a/src/detect-file-data.c +++ b/src/detect-file-data.c @@ -450,7 +450,7 @@ static uint8_t DetectEngineInspectBufferHttpBody(DetectEngineCtx *de_ctx, * \param flags STREAM_* flags including direction */ static void PrefilterTxHTTPFiledata(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, - Flow *f, void *txv, const uint64_t idx, const uint8_t flags) + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); @@ -653,10 +653,8 @@ static uint8_t DetectEngineInspectFiledata(DetectEngineCtx *de_ctx, DetectEngine * \param idx transaction id * \param flags STREAM_* flags including direction */ -static void PrefilterTxFiledata(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxFiledata(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-filemagic.c b/src/detect-filemagic.c index 8bc9c8ecc4..82d5784a35 100644 --- a/src/detect-filemagic.c +++ b/src/detect-filemagic.c @@ -530,10 +530,8 @@ typedef struct PrefilterMpmFilemagic { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterTxFilemagic(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxFilemagic(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-filename.c b/src/detect-filename.c index 8159d8e51d..35b568234a 100644 --- a/src/detect-filename.c +++ b/src/detect-filename.c @@ -426,10 +426,8 @@ typedef struct PrefilterMpmFilename { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterTxFilename(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxFilename(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-http-client-body.c b/src/detect-http-client-body.c index bfaa6e9255..ec4caacfd5 100644 --- a/src/detect-http-client-body.c +++ b/src/detect-http-client-body.c @@ -351,7 +351,7 @@ static uint8_t DetectEngineInspectBufferHttpBody(DetectEngineCtx *de_ctx, * \param flags STREAM_* flags including direction */ static void PrefilterTxHttpRequestBody(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, - Flow *f, void *txv, const uint64_t idx, const uint8_t flags) + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-http-header.c b/src/detect-http-header.c index 2e55b42482..f9a24d63d3 100644 --- a/src/detect-http-header.c +++ b/src/detect-http-header.c @@ -239,10 +239,8 @@ typedef struct PrefilterMpmHttpHeaderCtx { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterMpmHttpHeader(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterMpmHttpHeader(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); @@ -276,10 +274,8 @@ static void PrefilterMpmHttpHeader(DetectEngineThreadCtx *det_ctx, } } -static void PrefilterMpmHttpTrailer(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterMpmHttpTrailer(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); @@ -291,7 +287,7 @@ static void PrefilterMpmHttpTrailer(DetectEngineThreadCtx *det_ctx, ((flags & STREAM_TOCLIENT) && !htud->response_has_trailers))) { SCReturn; } - PrefilterMpmHttpHeader(det_ctx, pectx, p, f, txv, idx, flags); + PrefilterMpmHttpHeader(det_ctx, pectx, p, f, txv, idx, _txd, flags); SCReturn; } diff --git a/src/detect-http-raw-header.c b/src/detect-http-raw-header.c index 36555b4c89..df1e87304f 100644 --- a/src/detect-http-raw-header.c +++ b/src/detect-http-raw-header.c @@ -241,10 +241,8 @@ typedef struct PrefilterMpmHttpHeaderRawCtx { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterMpmHttpHeaderRaw(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterMpmHttpHeaderRaw(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); @@ -272,10 +270,8 @@ static void PrefilterMpmHttpHeaderRaw(DetectEngineThreadCtx *det_ctx, } } -static void PrefilterMpmHttpTrailerRaw(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterMpmHttpTrailerRaw(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); @@ -287,7 +283,7 @@ static void PrefilterMpmHttpTrailerRaw(DetectEngineThreadCtx *det_ctx, ((flags & STREAM_TOCLIENT) && !htud->response_has_trailers))) { SCReturn; } - PrefilterMpmHttpHeaderRaw(det_ctx, pectx, p, f, txv, idx, flags); + PrefilterMpmHttpHeaderRaw(det_ctx, pectx, p, f, txv, idx, _txd, flags); SCReturn; } diff --git a/src/detect-http2.c b/src/detect-http2.c index e21cc7b14b..3d4fd52f7e 100644 --- a/src/detect-http2.c +++ b/src/detect-http2.c @@ -702,10 +702,8 @@ static InspectionBuffer *GetHttp2HNameData(DetectEngineThreadCtx *det_ctx, SCReturnPtr(buffer, "InspectionBuffer"); } -static void PrefilterTxHttp2HName(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxHttp2HName(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); @@ -834,10 +832,8 @@ static InspectionBuffer *GetHttp2HeaderData(DetectEngineThreadCtx *det_ctx, SCReturnPtr(buffer, "InspectionBuffer"); } -static void PrefilterTxHttp2Header(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxHttp2Header(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-ike-vendor.c b/src/detect-ike-vendor.c index 5a5c8a66fe..4c4be8f1a9 100644 --- a/src/detect-ike-vendor.c +++ b/src/detect-ike-vendor.c @@ -87,7 +87,7 @@ static InspectionBuffer *IkeVendorGetData(DetectEngineThreadCtx *det_ctx, * \param pectx inspection context */ static void PrefilterTxIkeVendor(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, - Flow *f, void *txv, const uint64_t idx, const uint8_t flags) + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-krb5-cname.c b/src/detect-krb5-cname.c index bb43056e9d..eef48d0c6c 100644 --- a/src/detect-krb5-cname.c +++ b/src/detect-krb5-cname.c @@ -134,10 +134,8 @@ typedef struct PrefilterMpmKrb5Name { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterTxKrb5CName(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxKrb5CName(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-krb5-sname.c b/src/detect-krb5-sname.c index 100c635e52..544dd9e711 100644 --- a/src/detect-krb5-sname.c +++ b/src/detect-krb5-sname.c @@ -134,10 +134,8 @@ typedef struct PrefilterMpmKrb5Name { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterTxKrb5SName(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxKrb5SName(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-mqtt-subscribe-topic.c b/src/detect-mqtt-subscribe-topic.c index c63c01919b..e0793b0144 100644 --- a/src/detect-mqtt-subscribe-topic.c +++ b/src/detect-mqtt-subscribe-topic.c @@ -139,10 +139,9 @@ typedef struct PrefilterMpmMQTTSubscribeTopic { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterTxMQTTSubscribeTopic(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxMQTTSubscribeTopic(DetectEngineThreadCtx *det_ctx, const void *pectx, + Packet *p, Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, + const uint8_t flags) { SCEnter(); diff --git a/src/detect-mqtt-unsubscribe-topic.c b/src/detect-mqtt-unsubscribe-topic.c index 4249153a02..433e18f0e5 100644 --- a/src/detect-mqtt-unsubscribe-topic.c +++ b/src/detect-mqtt-unsubscribe-topic.c @@ -139,10 +139,9 @@ typedef struct PrefilterMpmMQTTUnsubscribeTopic { * \param txv tx to inspect * \param pectx inspection context */ -static void PrefilterTxMQTTUnsubscribeTopic(DetectEngineThreadCtx *det_ctx, - const void *pectx, - Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxMQTTUnsubscribeTopic(DetectEngineThreadCtx *det_ctx, const void *pectx, + Packet *p, Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, + const uint8_t flags) { SCEnter(); diff --git a/src/detect-quic-cyu-hash.c b/src/detect-quic-cyu-hash.c index e76265de5b..40cff70ecd 100644 --- a/src/detect-quic-cyu-hash.c +++ b/src/detect-quic-cyu-hash.c @@ -135,7 +135,7 @@ typedef struct PrefilterMpmQuicHash { * \param pectx inspection context */ static void PrefilterTxQuicHash(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, - Flow *f, void *txv, const uint64_t idx, const uint8_t flags) + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-quic-cyu-string.c b/src/detect-quic-cyu-string.c index 6ef0796874..914a6432a5 100644 --- a/src/detect-quic-cyu-string.c +++ b/src/detect-quic-cyu-string.c @@ -127,7 +127,7 @@ static uint8_t DetectEngineInspectQuicString(DetectEngineCtx *de_ctx, * \param pectx inspection context */ static void PrefilterTxQuicString(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, - Flow *f, void *txv, const uint64_t idx, const uint8_t flags) + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect-tls-certs.c b/src/detect-tls-certs.c index 79fae74d4b..be2dd7aed0 100644 --- a/src/detect-tls-certs.c +++ b/src/detect-tls-certs.c @@ -198,9 +198,8 @@ static uint8_t DetectEngineInspectTlsCerts(DetectEngineCtx *de_ctx, DetectEngine return DETECT_ENGINE_INSPECT_SIG_NO_MATCH; } -static void PrefilterTxTlsCerts(DetectEngineThreadCtx *det_ctx, - const void *pectx, Packet *p, Flow *f, void *txv, - const uint64_t idx, const uint8_t flags) +static void PrefilterTxTlsCerts(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, + Flow *f, void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags) { SCEnter(); diff --git a/src/detect.h b/src/detect.h index f5db9f33c8..ce249e1ca9 100644 --- a/src/detect.h +++ b/src/detect.h @@ -1306,6 +1306,10 @@ typedef struct MpmStore_ { typedef void (*PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, const struct Frames *frames, const struct Frame *frame, const uint32_t idx); +typedef struct AppLayerTxData AppLayerTxData; +typedef void (*PrefilterTxFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, + void *tx, const uint64_t tx_id, const AppLayerTxData *tx_data, const uint8_t flags); + typedef struct PrefilterEngineList_ { uint16_t id; @@ -1322,9 +1326,7 @@ typedef struct PrefilterEngineList_ { void *pectx; void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx); - void (*PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx, - Packet *p, Flow *f, void *tx, - const uint64_t idx, const uint8_t flags); + PrefilterTxFn PrefilterTx; PrefilterFrameFn PrefilterFrame; struct PrefilterEngineList_ *next; @@ -1356,9 +1358,7 @@ typedef struct PrefilterEngine_ { union { void (*Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx); - void (*PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx, - Packet *p, Flow *f, void *tx, - const uint64_t idx, const uint8_t flags); + PrefilterTxFn PrefilterTx; PrefilterFrameFn PrefilterFrame; } cb;