diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index f214b2ee13..280cb72b84 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -2992,24 +2992,6 @@ static void *HTPStateGetTx(void *alstate, uint64_t tx_id) return NULL; } -static void HTPStateSetTxLogged(void *alstate, void *vtx, LoggerId bits) -{ - htp_tx_t *tx = (htp_tx_t *)vtx; - HtpTxUserData *tx_ud = (HtpTxUserData *) htp_tx_get_user_data(tx); - if (tx_ud) - tx_ud->logged = bits; -} - -static LoggerId HTPStateGetTxLogged(void *alstate, void *vtx) -{ - htp_tx_t *tx = (htp_tx_t *)vtx; - HtpTxUserData *tx_ud = (HtpTxUserData *) htp_tx_get_user_data(tx); - if (tx_ud != NULL) - return tx_ud->logged; - - return 0; -} - static int HTPStateGetAlstateProgressCompletionStatus(uint8_t direction) { return (direction & STREAM_TOSERVER) ? HTP_REQUEST_COMPLETE : HTP_RESPONSE_COMPLETE; @@ -3073,37 +3055,14 @@ static int HTPSetTxDetectState(void *vtx, DetectEngineState *s) return 0; } -static uint64_t HTPGetTxDetectFlags(void *vtx, uint8_t dir) +static AppLayerTxData *HTPGetTxData(void *vtx) { htp_tx_t *tx = (htp_tx_t *)vtx; HtpTxUserData *tx_ud = htp_tx_get_user_data(tx); if (tx_ud) { - if (dir & STREAM_TOSERVER) { - return tx_ud->detect_flags_ts; - } else { - return tx_ud->detect_flags_tc; - } - } - return 0; -} - -static void HTPSetTxDetectFlags(void *vtx, uint8_t dir, uint64_t detect_flags) -{ - htp_tx_t *tx = (htp_tx_t *)vtx; - HtpTxUserData *tx_ud = htp_tx_get_user_data(tx); - if (tx_ud == NULL) { - tx_ud = HTPMalloc(sizeof(*tx_ud)); - if (unlikely(tx_ud == NULL)) - return; - memset(tx_ud, 0, sizeof(*tx_ud)); - htp_tx_set_user_data(tx, tx_ud); + return &tx_ud->tx_data; } - if (dir & STREAM_TOSERVER) { - tx_ud->detect_flags_ts = detect_flags; - } else { - tx_ud->detect_flags_tc = detect_flags; - } - return; + return NULL; } static int HTPRegisterPatternsForProtocolDetection(void) @@ -3182,8 +3141,6 @@ void RegisterHTPParsers(void) AppLayerParserRegisterGetStateProgressFunc(IPPROTO_TCP, ALPROTO_HTTP, HTPStateGetAlstateProgress); AppLayerParserRegisterGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, HTPStateGetTxCnt); AppLayerParserRegisterGetTx(IPPROTO_TCP, ALPROTO_HTTP, HTPStateGetTx); - AppLayerParserRegisterLoggerFuncs(IPPROTO_TCP, ALPROTO_HTTP, HTPStateGetTxLogged, - HTPStateSetTxLogged); AppLayerParserRegisterGetStateProgressCompletionStatus(ALPROTO_HTTP, HTPStateGetAlstateProgressCompletionStatus); AppLayerParserRegisterGetEventsFunc(IPPROTO_TCP, ALPROTO_HTTP, HTPGetEvents); @@ -3193,8 +3150,7 @@ void RegisterHTPParsers(void) AppLayerParserRegisterTruncateFunc(IPPROTO_TCP, ALPROTO_HTTP, HTPStateTruncate); AppLayerParserRegisterDetectStateFuncs(IPPROTO_TCP, ALPROTO_HTTP, HTPGetTxDetectState, HTPSetTxDetectState); - AppLayerParserRegisterDetectFlagsFuncs(IPPROTO_TCP, ALPROTO_HTTP, - HTPGetTxDetectFlags, HTPSetTxDetectFlags); + AppLayerParserRegisterTxDataFunc(IPPROTO_TCP, ALPROTO_HTTP, HTPGetTxData); AppLayerParserRegisterSetStreamDepthFlag(IPPROTO_TCP, ALPROTO_HTTP, AppLayerHtpSetStreamDepthFlag); diff --git a/src/app-layer-htp.h b/src/app-layer-htp.h index 1b322c1c80..6be50fda38 100644 --- a/src/app-layer-htp.h +++ b/src/app-layer-htp.h @@ -38,6 +38,7 @@ #include "app-layer-htp-mem.h" #include "detect-engine-state.h" #include "util-streaming-buffer.h" +#include "rust.h" #include @@ -204,10 +205,6 @@ typedef struct HtpBody_ { /** Now the Body Chunks will be stored per transaction, at * the tx user data */ typedef struct HtpTxUserData_ { - /** detection engine flags */ - uint64_t detect_flags_ts; - uint64_t detect_flags_tc; - /* Body of the request (if any) */ uint8_t request_body_init; uint8_t response_body_init; @@ -215,9 +212,6 @@ typedef struct HtpTxUserData_ { uint8_t request_has_trailers; uint8_t response_has_trailers; - /* indicates which loggers that have logged */ - uint32_t logged; - HtpBody request_body; HtpBody response_body; @@ -242,6 +236,7 @@ typedef struct HtpTxUserData_ { uint8_t request_body_type; DetectEngineState *de_state; + AppLayerTxData tx_data; } HtpTxUserData; typedef struct HtpState_ {