return FALSE;
}
-DetectEngineState *AppLayerParserGetTxDetectState(uint8_t ipproto, AppProto alproto, void *tx)
-{
- SCEnter();
- AppLayerTxData *d = AppLayerParserGetTxData(ipproto, alproto, tx);
- DetectEngineState *s = d->de_state;
- SCReturnPtr(s, "DetectEngineState");
-}
-
-int AppLayerParserSetTxDetectState(const Flow *f,
- void *tx, DetectEngineState *s)
-{
- SCEnter();
- AppLayerTxData *d = alp_ctx.ctxs[f->protomap][f->alproto].GetTxData(tx);
- d->de_state = s;
- SCReturnInt(0);
-}
-
AppLayerTxData *AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx)
{
SCEnter();
uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, AppProto alproto);
int AppLayerParserSupportsFiles(uint8_t ipproto, AppProto alproto);
-int AppLayerParserHasTxDetectState(uint8_t ipproto, AppProto alproto, void *alstate);
-DetectEngineState *AppLayerParserGetTxDetectState(uint8_t ipproto, AppProto alproto, void *tx);
-int AppLayerParserSetTxDetectState(const Flow *f, void *tx, DetectEngineState *s);
AppLayerTxData *AppLayerParserGetTxData(uint8_t ipproto, AppProto alproto, void *tx);
void AppLayerParserApplyTxConfig(uint8_t ipproto, AppProto alproto,
uint32_t inspect_flags, uint8_t flow_flags,
const uint16_t file_no_match)
{
- DetectEngineState *destate = AppLayerParserGetTxDetectState(f->proto, f->alproto, tx);
- if (destate == NULL) {
- destate = DetectEngineStateAlloc();
- if (destate == NULL)
- return;
- if (AppLayerParserSetTxDetectState(f, tx, destate) < 0) {
- DetectEngineStateFree(destate);
+ AppLayerTxData *tx_data = AppLayerParserGetTxData(f->proto, f->alproto, tx);
+ BUG_ON(tx_data == NULL);
+ if (tx_data == NULL) {
+ SCLogDebug("No TX data for %" PRIu64, tx_id);
+ return;
+ }
+ if (tx_data->de_state == NULL) {
+ tx_data->de_state = DetectEngineStateAlloc();
+ if (tx_data->de_state == NULL)
return;
- }
SCLogDebug("destate created for %"PRIu64, tx_id);
}
- DeStateSignatureAppend(destate, s, inspect_flags, flow_flags);
- StoreStateTxHandleFiles(sgh, f, destate, flow_flags, tx_id, file_no_match);
+ DeStateSignatureAppend(tx_data->de_state, s, inspect_flags, flow_flags);
+ StoreStateTxHandleFiles(sgh, f, tx_data->de_state, flow_flags, tx_id, file_no_match);
SCLogDebug("Stored for TX %"PRIu64, tx_id);
}
for ( ; inspect_tx_id < total_txs; inspect_tx_id++) {
void *inspect_tx = AppLayerParserGetTx(f->proto, f->alproto, alstate, inspect_tx_id);
if (inspect_tx != NULL) {
- DetectEngineState *tx_de_state = AppLayerParserGetTxDetectState(f->proto, f->alproto, inspect_tx);
- ResetTxState(tx_de_state);
+ AppLayerTxData *txd = AppLayerParserGetTxData(f->proto, f->alproto, inspect_tx);
+ BUG_ON(txd == NULL);
+ if (txd) {
+ ResetTxState(txd->de_state);
+ }
}
}
}
void *tx = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP1, f.alstate, 0);
FAIL_IF_NULL(tx);
- DetectEngineState *tx_de_state = AppLayerParserGetTxDetectState(IPPROTO_TCP, ALPROTO_HTTP1, tx);
+ AppLayerTxData *tx_data = AppLayerParserGetTxData(IPPROTO_TCP, ALPROTO_HTTP1, tx);
+ FAIL_IF_NULL(tx_data);
+ DetectEngineState *tx_de_state = tx_data->de_state;
FAIL_IF_NULL(tx_de_state);
FAIL_IF(tx_de_state->dir_state[0].cnt != 1);
/* http_header(mpm): 5, uri: 3, method: 6, cookie: 7 */
const int tx_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx_ptr, flow_flags);
const int dir_int = (flow_flags & STREAM_TOSERVER) ? 0 : 1;
- DetectEngineState *tx_de_state = AppLayerParserGetTxDetectState(ipproto, alproto, tx_ptr);
+ DetectEngineState *tx_de_state = txd->de_state;
DetectEngineStateDirection *tx_dir_state = tx_de_state ? &tx_de_state->dir_state[dir_int] : NULL;
uint64_t prefilter_flags = detect_flags & APP_LAYER_TX_PREFILTER_MASK;
DEBUG_VALIDATE_BUG_ON(prefilter_flags & APP_LAYER_TX_RESERVED_FLAGS);