26 static int DetectFlowPktsMatch(
29 if (p->
flow == NULL) {
33 const DetectFlowPkts *df = (
const DetectFlowPkts *)
ctx;
34 if (df->dir == DETECT_FLOW_TOSERVER) {
36 }
else if (df->dir == DETECT_FLOW_TOCLIENT) {
38 }
else if (df->dir == DETECT_FLOW_TOEITHER) {
43 }
else if (df->dir == DETECT_FLOW_TOBOTH) {
55 SCDetectFlowPktsFree(ptr);
61 DetectFlowPkts *df = SCDetectFlowPktsParseDir(rawstr, DETECT_FLOW_TOSERVER);
68 DetectFlowPktsFree(
de_ctx, df);
78 DetectFlowPkts *df = SCDetectFlowPktsParseDir(rawstr, DETECT_FLOW_TOCLIENT);
84 DetectFlowPktsFree(
de_ctx, df);
94 DetectFlowPkts *df = SCDetectFlowPktsParse(rawstr);
100 DetectFlowPktsFree(
de_ctx, df);
111 const DetectFlowPkts *df = smctx;
112 const DetectUintData_u32 *data = &df->pkt_data;
113 v->
u8[0] = data->mode;
114 v->
u8[1] = (uint8_t)df->dir;
115 v->
u32[1] = data->arg1;
116 v->
u32[2] = data->arg2;
121 const DetectFlowPkts *df = smctx;
122 if (v.
u8[0] == df->pkt_data.mode && v.
u8[1] == df->dir && v.
u32[1] == df->pkt_data.arg1 &&
123 v.
u32[2] == df->pkt_data.arg2) {
129 static void PrefilterPacketFlowPktsMatch(
133 if (!PrefilterPacketHeaderExtraMatch(
ctx, p))
137 DetectUintData_u32 data = {
138 .mode =
ctx->v1.u8[0], .arg1 =
ctx->v1.u32[1], .arg2 =
ctx->v1.u32[2]
141 df.dir =
ctx->v1.u8[1];
143 if (DetectFlowPktsMatch(det_ctx, p, NULL, (
const SigMatchCtx *)&df)) {
144 PrefilterAddSids(&det_ctx->
pmq,
ctx->sigs_array,
ctx->sigs_cnt);
151 PrefilterPacketFlowPktsSet, PrefilterPacketFlowPktsCompare,
152 PrefilterPacketFlowPktsMatch);
155 static bool PrefilterFlowPktsIsPrefilterable(
const Signature *s)
176 "match number of packets in a flow in to server direction";
190 "match number of packets in a flow in to client direction";
200 static int DetectFlowBytesMatch(
203 if (p->
flow == NULL) {
207 const DetectFlowBytes *df = (
const DetectFlowBytes *)
ctx;
208 if (df->dir == DETECT_FLOW_TOSERVER) {
210 }
else if (df->dir == DETECT_FLOW_TOCLIENT) {
212 }
else if (df->dir == DETECT_FLOW_TOEITHER) {
217 }
else if (df->dir == DETECT_FLOW_TOBOTH) {
229 SCDetectFlowBytesFree(ptr);
235 DetectFlowBytes *df = SCDetectFlowBytesParseDir(rawstr, DETECT_FLOW_TOSERVER);
242 DetectFlowBytesFree(
de_ctx, df);
252 DetectFlowBytes *df = SCDetectFlowBytesParseDir(rawstr, DETECT_FLOW_TOCLIENT);
259 DetectFlowBytesFree(
de_ctx, df);
269 DetectFlowBytes *df = SCDetectFlowBytesParse(rawstr);
275 DetectFlowBytesFree(
de_ctx, df);
297 "match number of bytes in a flow in to server dir";
309 "match number of bytes in a flow in to client dir";