return 0;
}
-static uint64_t HTPGetTxMpmIDs(void *vtx)
+static uint64_t HTPGetTxDetectFlags(void *vtx, uint8_t dir)
{
htp_tx_t *tx = (htp_tx_t *)vtx;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
- return tx_ud ? tx_ud->mpm_ids : 0;
+ if (tx_ud) {
+ if (dir & STREAM_TOSERVER) {
+ return tx_ud->detect_flags_ts;
+ } else {
+ return tx_ud->detect_flags_tc;
+ }
+ }
+ return 0;
}
-static int HTPSetTxMpmIDs(void *vtx, uint64_t mpm_ids)
+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 -ENOMEM;
+ return;
memset(tx_ud, 0, sizeof(*tx_ud));
htp_tx_set_user_data(tx, tx_ud);
}
- tx_ud->mpm_ids = mpm_ids;
- return 0;
+ if (dir & STREAM_TOSERVER) {
+ tx_ud->detect_flags_ts = detect_flags;
+ } else {
+ tx_ud->detect_flags_tc = detect_flags;
+ }
+ return;
}
static int HTPRegisterPatternsForProtocolDetection(void)
AppLayerParserRegisterDetectStateFuncs(IPPROTO_TCP, ALPROTO_HTTP,
HTPStateHasTxDetectState,
HTPGetTxDetectState, HTPSetTxDetectState);
- AppLayerParserRegisterMpmIDsFuncs(IPPROTO_TCP, ALPROTO_HTTP,
- HTPGetTxMpmIDs, HTPSetTxMpmIDs);
+ AppLayerParserRegisterDetectFlagsFuncs(IPPROTO_TCP, ALPROTO_HTTP,
+ HTPGetTxDetectFlags, HTPSetTxDetectFlags);
AppLayerParserRegisterParser(IPPROTO_TCP, ALPROTO_HTTP, STREAM_TOSERVER,
HTPHandleRequestData);
/** Now the Body Chunks will be stored per transaction, at
* the tx user data */
typedef struct HtpTxUserData_ {
- /** flags to track which mpm has run */
- uint64_t mpm_ids;
+ /** detection engine flags */
+ uint64_t detect_flags_ts;
+ uint64_t detect_flags_tc;
/* Body of the request (if any) */
uint8_t request_body_init;