In preparation of per tx files storage.
NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOCLIENT, (uint8_t *)str, strlen(str));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
uint64_t ret[4];
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOSERVER | STREAM_EOF,
(uint8_t *)str, strlen(str));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 8); // inspect_id[0] not updated by ..Cleanup() until full tx is done
r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_HTTP1, STREAM_TOCLIENT | STREAM_EOF,
(uint8_t *)str, strlen(str));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 9); // inspect_id[0]
sizeof(encrypted));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(&f);
+ AppLayerParserTransactionsCleanup(&f, STREAM_TOCLIENT);
UTHAppLayerParserStateGetIds(f.alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 5); // inspect_id[0]
FAIL_IF_NOT(ret[1] == 5); // inspect_id[1]
/**
* \brief remove obsolete (inspected and logged) transactions
*/
-void AppLayerParserTransactionsCleanup(Flow *f)
+void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
{
SCEnter();
DEBUG_ASSERT_FLOW_LOCKED(f);
AppLayerParserState *AppLayerParserStateAlloc(void);
void AppLayerParserStateFree(AppLayerParserState *pstate);
-void AppLayerParserTransactionsCleanup(Flow *f);
+void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir);
#ifdef DEBUG
void AppLayerParserStatePrintDetails(AppLayerParserState *pstate);
NULL, alp_tctx, f, ALPROTO_RFB, STREAM_TOCLIENT, (uint8_t *)server_init, sizeof(server_init));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 1); // inspect_id[0]
FAIL_IF_NOT(ret[1] == 1); // inspect_id[1]
FAIL_IF_NOT(ret[2] == 1); // log_id
FAIL_IF_NOT(ret[3] == 1); // min_id
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
AppLayerParserThreadCtxFree(alp_tctx);
StreamTcpFreeConfig(true);
UTHFreeFlow(f);
FAIL_IF_NOT(r == 0);
req_str[28]++;
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOSERVER);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 0); // inspect_id[0]
FAIL_IF_NOT(ret[1] == 0); // inspect_id[1]
r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_SMB,
STREAM_TOCLIENT, (uint8_t *)resp_str, sizeof(resp_str));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 2); // inspect_id[0]
r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_SMB,
STREAM_TOCLIENT, (uint8_t *)resp_str, sizeof(resp_str));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 8); // inspect_id[0]
r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_SMB,
STREAM_TOSERVER | STREAM_EOF, (uint8_t *)req_str, sizeof(req_str));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOSERVER);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 8); // inspect_id[0] not updated by ..Cleanup() until full tx is done
r = AppLayerParserParse(NULL, alp_tctx, f, ALPROTO_SMB,
STREAM_TOCLIENT | STREAM_EOF, (uint8_t *)resp_str, sizeof(resp_str));
FAIL_IF_NOT(r == 0);
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, STREAM_TOCLIENT);
UTHAppLayerParserStateGetIds(f->alparser, &ret[0], &ret[1], &ret[2], &ret[3]);
FAIL_IF_NOT(ret[0] == 9); // inspect_id[0]
FLOWWORKER_PROFILING_END(p, PROFILE_FLOWWORKER_TCPPRUNE);
/* run tx cleanup last */
- AppLayerParserTransactionsCleanup(p->flow);
+ AppLayerParserTransactionsCleanup(p->flow, STREAM_FLAGS_FOR_PACKET(p));
FlowDeReference(&p->flow);
/* flow is unlocked later in FlowFinish() */
}
/* run tx cleanup last */
- AppLayerParserTransactionsCleanup(p->flow);
+ AppLayerParserTransactionsCleanup(p->flow, STREAM_FLAGS_FOR_PACKET(p));
Flow *f = p->flow;
FlowDeReference(&p->flow);
break;
}
- AppLayerParserTransactionsCleanup(f);
+ AppLayerParserTransactionsCleanup(f, flags & (STREAM_TOSERVER | STREAM_TOCLIENT));
}
alsize -= alnext - albuffer + 4;
albuffer = alnext + 4;