}
}
+static DetectEngineState *HTPGetTxDetectState(void *vtx)
+{
+ htp_tx_t *tx = (htp_tx_t *)vtx;
+ HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
+ return tx_ud ? tx_ud->de_state : NULL;
+}
+
+static int HTPSetTxDetectState(void *vtx, DetectEngineState *s)
+{
+ 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 -ENOMEM;
+ memset(tx_ud, 0, sizeof(*tx_ud));
+ htp_tx_set_user_data(tx, tx_ud);
+ }
+ tx_ud->de_state = s;
+ return 0;
+}
+
static int HTPRegisterPatternsForProtocolDetection(void)
{
/* toserver */
AppLayerParserRegisterGetEventInfo(IPPROTO_TCP, ALPROTO_HTTP, HTPStateGetEventInfo);
AppLayerParserRegisterTruncateFunc(IPPROTO_TCP, ALPROTO_HTTP, HTPStateTruncate);
+ AppLayerParserRegisterDetectStateFuncs(IPPROTO_TCP, ALPROTO_HTTP,
+ HTPGetTxDetectState, HTPSetTxDetectState);
AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_HTTP, STREAM_TOSERVER,
HTPHandleRequestData);
#include "util-radix-tree.h"
#include "util-file.h"
#include "app-layer-htp-mem.h"
+#include "detect-engine-state.h"
#include <htp/htp.h>
uint8_t request_body_type;
uint8_t response_body_type;
+ DetectEngineState *de_state;
} HtpTxUserData;
typedef struct HtpState_ {