detect: pass flags to inspect_id update logic

pull/1606/head
Victor Julien 11 years ago
parent c087708fa9
commit 6946e0be55

@ -546,15 +546,15 @@ uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint
}
void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
uint8_t ipproto, AppProto alproto, void *alstate,
uint8_t direction)
const uint8_t ipproto, const AppProto alproto,
void *alstate, const uint8_t flags)
{
SCEnter();
uint8_t dir = (direction & STREAM_TOSERVER) ? 0 : 1;
int direction = (flags & STREAM_TOSERVER) ? 0 : 1;
uint64_t total_txs = AppLayerParserGetTxCnt(ipproto, alproto, alstate);
uint64_t idx = AppLayerParserGetTransactionInspectId(pstate, direction);
int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(ipproto, alproto, direction);
uint64_t idx = AppLayerParserGetTransactionInspectId(pstate, flags);
int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(ipproto, alproto, flags);
void *tx;
int state_progress;
@ -562,13 +562,13 @@ void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
tx = AppLayerParserGetTx(ipproto, alproto, alstate, idx);
if (tx == NULL)
continue;
state_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx, direction);
state_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx, flags);
if (state_progress >= state_done_progress)
continue;
else
break;
}
pstate->inspect_id[dir] = idx;
pstate->inspect_id[direction] = idx;
SCReturn;
}

@ -158,8 +158,8 @@ uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate);
void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate);
uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction);
void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
uint8_t ipproto, AppProto alproto, void *alstate,
uint8_t direction);
const uint8_t ipproto, const AppProto alproto, void *alstate,
const uint8_t flags);
AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(AppLayerParserState *pstate);
void AppLayerParserSetDecoderEvents(AppLayerParserState *pstate, AppLayerDecoderEvents *devents);
AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *alstate,

@ -1095,13 +1095,17 @@ end:
return;
}
/** \brief update flow's inspection id's
*
* \param f unlocked flow
* \param flags direction and disruption flags
*
* \note it is possible that f->alstate, f->alparser are NULL */
void DeStateUpdateInspectTransactionId(Flow *f, uint8_t direction)
void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags)
{
FLOWLOCK_WRLOCK(f);
if (f->alparser && f->alstate) {
AppLayerParserSetTransactionInspectId(f->alparser, f->proto, f->alproto, f->alstate, direction);
AppLayerParserSetTransactionInspectId(f->alparser, f->proto,
f->alproto, f->alstate, flags);
}
FLOWLOCK_UNLOCK(f);

@ -219,10 +219,10 @@ void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
/**
* \brief Update the inspect id.
*
* \param f Flow(unlocked).
* \param direction 0 for to server, 1 for toclient.
* \param f unlocked flow
* \param flags direction and disruption flags
*/
void DeStateUpdateInspectTransactionId(Flow *f, uint8_t direction);
void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags);
/**
* \brief Reset a DetectEngineState state.

Loading…
Cancel
Save