]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tests: update tests for app-layer changes
authorVictor Julien <victor@inliniac.net>
Sat, 11 Feb 2017 18:08:58 +0000 (19:08 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 15 May 2017 12:13:41 +0000 (14:13 +0200)
26 files changed:
src/app-layer-dcerpc.c
src/app-layer-dnp3.c
src/app-layer-enip.c
src/app-layer-ftp.c
src/app-layer-htp-file.c
src/app-layer-htp-xff.c
src/app-layer-htp.c
src/app-layer-modbus.c
src/app-layer-parser.c
src/app-layer-parser.h
src/app-layer-smb.c
src/app-layer-smtp.c
src/app-layer-ssl.c
src/detect-engine-prefilter.c
src/detect-engine-state.c
src/detect-http-client-body.c
src/detect-http-hh.c
src/detect-http-hrh.c
src/detect-http-server-body.c
src/detect-http-ua.c
src/detect-lua.c
src/detect-pcre.c
src/detect-uricontent.c
src/flow-timeout.c
src/output-streaming.c
src/output-tx.c

index 687f4127e91c45009b464a2942882f910d6f34c5..1723621b3a3fb57ab5b6d0e838f84b103ec247de 100644 (file)
@@ -2511,6 +2511,7 @@ static int DCERPCParserTest01(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2748,6 +2749,7 @@ static int DCERPCParserTest02(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2951,6 +2953,7 @@ static int DCERPCParserTest03(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4403,6 +4406,7 @@ static int DCERPCParserTest05(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4578,6 +4582,7 @@ static int DCERPCParserTest06(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4664,6 +4669,7 @@ static int DCERPCParserTest07(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4757,6 +4763,7 @@ static int DCERPCParserTest08(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4818,6 +4825,7 @@ static int DCERPCParserTest09(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4893,6 +4901,7 @@ static int DCERPCParserTest10(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4994,6 +5003,7 @@ static int DCERPCParserTest11(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5093,6 +5103,7 @@ static int DCERPCParserTest12(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5171,6 +5182,7 @@ static int DCERPCParserTest13(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5262,6 +5274,7 @@ static int DCERPCParserTest14(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5324,6 +5337,7 @@ static int DCERPCParserTest15(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5786,6 +5800,7 @@ static int DCERPCParserTest16(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6032,6 +6047,7 @@ static int DCERPCParserTest17(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6178,6 +6194,7 @@ static int DCERPCParserTest18(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6444,6 +6461,7 @@ static int DCERPCParserTest19(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_DCERPC;
 
     StreamTcpInitConfig(TRUE);
 
index 72e48e5f226746c77c38a4688e5cb7e7c4d5960d..a78a047ee1e2a11a825d4d582df7f74720a0d6b7 100644 (file)
@@ -2123,6 +2123,7 @@ static int DNP3ParserTestRequestResponse(void)
 
     flow.protoctx = (void *)&ssn;
     flow.proto = IPPROTO_TCP;
+    flow.alproto = ALPROTO_DNP3;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2154,7 +2155,6 @@ static int DNP3ParserTestRequestResponse(void)
     AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
     FLOW_DESTROY(&flow);
-    DNP3StateFree(state);
     PASS;
 }
 
@@ -2191,6 +2191,7 @@ static int DNP3ParserTestUnsolicitedResponseConfirm(void)
 
     flow.protoctx = (void *)&ssn;
     flow.proto = IPPROTO_TCP;
+    flow.alproto = ALPROTO_DNP3;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2224,7 +2225,6 @@ static int DNP3ParserTestUnsolicitedResponseConfirm(void)
     AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
     FLOW_DESTROY(&flow);
-    DNP3StateFree(state);
     PASS;
 }
 
@@ -2258,6 +2258,7 @@ static int DNP3ParserTestFlooded(void)
 
     flow.protoctx = (void *)&ssn;
     flow.proto = IPPROTO_TCP;
+    flow.alproto = ALPROTO_DNP3;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2304,7 +2305,6 @@ static int DNP3ParserTestFlooded(void)
     AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
     FLOW_DESTROY(&flow);
-    DNP3StateFree(state);
     PASS;
 }
 
@@ -2365,6 +2365,7 @@ static int DNP3ParserTestPartialFrame(void)
     memset(&ssn, 0, sizeof(ssn));
     flow.protoctx = (void *)&ssn;
     flow.proto = IPPROTO_TCP;
+    flow.alproto = ALPROTO_DNP3;
     StreamTcpInitConfig(TRUE);
 
     /* Pass in the first partial frame. */
@@ -2437,7 +2438,6 @@ static int DNP3ParserTestPartialFrame(void)
     AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
     FLOW_DESTROY(&flow);
-    DNP3StateFree(state);
     PASS;
 }
 
@@ -2478,6 +2478,7 @@ static int DNP3ParserTestMultiFrame(void)
     memset(&ssn, 0, sizeof(ssn));
     flow.protoctx = (void *)&ssn;
     flow.proto = IPPROTO_TCP;
+    flow.alproto = ALPROTO_DNP3;
     StreamTcpInitConfig(TRUE);
 
     SCMutexLock(&flow.m);
@@ -2493,7 +2494,6 @@ static int DNP3ParserTestMultiFrame(void)
     AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
     FLOW_DESTROY(&flow);
-    DNP3StateFree(state);
     PASS;
 }
 
index 27d1a5c7eca8d362681be5e9fa17cf493b1c6ae5..37062e16fd05103848cf83f03542982a1874405a 100644 (file)
@@ -571,6 +571,7 @@ static int ALDecodeENIPTest(void)
 
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_ENIP;
 
     StreamTcpInitConfig(TRUE);
 
index 71255ff5d462165e015c0db2ac4b5e040aa3ee34..f1ddc6eb27a07af7b3fe2cbe0aa312b2ba73a571 100644 (file)
@@ -484,6 +484,7 @@ static int FTPParserTest01(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_FTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -539,6 +540,7 @@ static int FTPParserTest03(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_FTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -612,6 +614,7 @@ static int FTPParserTest06(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_FTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -667,6 +670,7 @@ static int FTPParserTest07(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_FTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -732,6 +736,7 @@ static int FTPParserTest10(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_FTP;
 
     StreamTcpInitConfig(TRUE);
 
index 26ac3e529fd74b5d9bae675023fd155158d9872b..94dc163caddb3bcee932f824a0a40d5ce53aaeec 100644 (file)
@@ -310,6 +310,7 @@ static int HTPFileParserTest01(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -361,8 +362,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -405,6 +404,7 @@ static int HTPFileParserTest02(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -485,8 +485,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -534,6 +532,7 @@ static int HTPFileParserTest03(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -647,8 +646,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -696,6 +693,7 @@ static int HTPFileParserTest04(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -800,8 +798,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -840,6 +836,7 @@ static int HTPFileParserTest05(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -914,8 +911,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -955,6 +950,7 @@ static int HTPFileParserTest06(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1029,8 +1025,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -1059,6 +1053,7 @@ static int HTPFileParserTest07(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1122,8 +1117,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -1156,6 +1149,7 @@ static int HTPFileParserTest08(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1210,8 +1204,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -1255,6 +1247,7 @@ static int HTPFileParserTest09(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1333,8 +1326,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -1376,6 +1367,7 @@ static int HTPFileParserTest10(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1449,8 +1441,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -1520,6 +1510,7 @@ static int HTPFileParserTest11(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1611,8 +1602,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
index 8ba6637e9a1a9feae25cc8c3184542707444cf75..aaf7196a2cf46dec4e0c0269f20cde74cd9c5c12 100644 (file)
@@ -126,7 +126,7 @@ int HttpXFFGetIPFromTx(const Packet *p, uint64_t tx_id, HttpXFFCfg *xff_cfg,
         return 0;
     }
 
-    total_txs = AppLayerParserGetTxCnt(p->flow->proto, ALPROTO_HTTP, htp_state);
+    total_txs = AppLayerParserGetTxCnt(p->flow, htp_state);
     if (tx_id >= total_txs)
         return 0;
 
@@ -186,7 +186,7 @@ int HttpXFFGetIP(const Packet *p, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbufl
         goto end;
     }
 
-    total_txs = AppLayerParserGetTxCnt(p->flow->proto, ALPROTO_HTTP, htp_state);
+    total_txs = AppLayerParserGetTxCnt(p->flow, htp_state);
     for (; tx_id < total_txs; tx_id++) {
         if (HttpXFFGetIPFromTx(p, tx_id, xff_cfg, dstbuf, dstbuflen) == 1)
             return 1;
index 6f8e89a6d73f321dfcd6784081720e49ee14d271..1acccae56032d8c088671af8accff1d6f6eb46ef 100644 (file)
@@ -2906,6 +2906,7 @@ static int HTPParserTest01(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2957,8 +2958,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -2984,6 +2983,7 @@ static int HTPParserTest01a(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3034,8 +3034,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3058,6 +3056,7 @@ static int HTPParserTest02(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3091,8 +3090,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3117,6 +3114,7 @@ static int HTPParserTest03(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3161,8 +3159,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3187,6 +3183,7 @@ static int HTPParserTest04(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3222,8 +3219,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3258,6 +3253,7 @@ static int HTPParserTest05(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3342,8 +3338,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3407,6 +3401,7 @@ static int HTPParserTest06(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3461,8 +3456,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3487,6 +3480,7 @@ static int HTPParserTest07(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3551,8 +3545,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3595,6 +3587,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3635,9 +3628,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
-
     HTPFreeConfig();
     ConfDeInit();
     ConfRestoreContextBackup();
@@ -3683,6 +3673,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3721,9 +3712,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
-
     HTPFreeConfig();
     ConfDeInit();
     ConfRestoreContextBackup();
@@ -3752,6 +3740,7 @@ static int HTPParserTest10(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3819,8 +3808,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3845,6 +3832,7 @@ static int HTPParserTest11(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3905,8 +3893,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -3931,6 +3917,7 @@ static int HTPParserTest12(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3994,8 +3981,6 @@ static int HTPParserTest12(void)
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -4020,6 +4005,7 @@ static int HTPParserTest13(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4089,8 +4075,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -4421,6 +4405,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     htp_cfg_t *htp = cfglist.cfg;
 
@@ -4497,8 +4482,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -4619,6 +4602,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4739,8 +4723,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -4789,6 +4771,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4909,8 +4892,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -4957,6 +4938,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5051,8 +5033,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5095,6 +5075,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5162,8 +5143,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5206,6 +5185,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5273,8 +5253,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5317,6 +5295,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5384,8 +5363,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5429,6 +5406,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5496,8 +5474,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5538,6 +5514,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5605,8 +5582,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5648,6 +5623,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5715,8 +5691,6 @@ end:
     HtpConfigRestoreBackup();
 
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5811,6 +5785,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -5859,8 +5834,6 @@ end:
     ConfRestoreContextBackup();
     HtpConfigRestoreBackup();
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -5924,6 +5897,7 @@ libhtp:\n\
     if (f == NULL)
         goto end;
     f->protoctx = &ssn;
+    f->alproto = ALPROTO_HTTP;
     f->proto = IPPROTO_TCP;
 
     StreamTcpInitConfig(TRUE);
@@ -5994,8 +5968,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     if (httpbuf != NULL)
         SCFree(httpbuf);
@@ -6068,6 +6040,7 @@ libhtp:\n\
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6119,8 +6092,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     if (httpbuf != NULL)
         SCFree(httpbuf);
@@ -6158,6 +6129,7 @@ static int HTPParserTest16(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6212,8 +6184,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -6244,6 +6214,7 @@ static int HTPParserTest17(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6335,8 +6306,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -6369,6 +6338,7 @@ static int HTPParserTest18(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6468,8 +6438,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
@@ -6498,6 +6466,7 @@ static int HTPParserTest19(void)
         goto end;
     f->protoctx = &ssn;
     f->proto = IPPROTO_TCP;
+    f->alproto = ALPROTO_HTTP;
 
     StreamTcpInitConfig(TRUE);
 
@@ -6566,8 +6535,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (http_state != NULL)
-        HTPStateFree(http_state);
     UTHFreeFlow(f);
     return result;
 }
index a4754dfdc98f611100ee52734a10a93f26439d04..fb7b26b92e508286e1276f6d64f3a89137910981 100644 (file)
@@ -1762,6 +1762,7 @@ static int ModbusParserTest01(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1829,6 +1830,7 @@ static int ModbusParserTest02(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1909,6 +1911,7 @@ static int ModbusParserTest03(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -2022,6 +2025,7 @@ static int ModbusParserTest04(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2081,6 +2085,7 @@ static int ModbusParserTest05(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -2168,6 +2173,7 @@ static int ModbusParserTest06(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -2255,6 +2261,7 @@ static int ModbusParserTest07(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -2343,6 +2350,7 @@ static int ModbusParserTest08(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -2450,6 +2458,7 @@ static int ModbusParserTest09(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2546,6 +2555,7 @@ static int ModbusParserTest10(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2636,6 +2646,7 @@ static int ModbusParserTest11(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -2724,6 +2735,7 @@ static int ModbusParserTest12(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -2804,6 +2816,7 @@ static int ModbusParserTest13(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2872,6 +2885,7 @@ static int ModbusParserTest14(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2948,6 +2962,7 @@ static int ModbusParserTest15(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -3058,6 +3073,7 @@ static int ModbusParserTest16(void) {
     f.alproto   = ALPROTO_MODBUS;
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
     f.flags     |= FLOW_IPV4;
 
     p->flow         = &f;
@@ -3162,6 +3178,7 @@ static int ModbusParserTest17(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3206,6 +3223,7 @@ static int ModbusParserTest18(void) {
     FLOW_INITIALIZE(&f);
     f.protoctx  = (void *)&ssn;
     f.proto     = IPPROTO_TCP;
+    f.alproto   = ALPROTO_MODBUS;
 
     StreamTcpInitConfig(TRUE);
 
index 021e8039cf9e6f761a3d267359b70a633db33d47..0d6408dc7b83c6046670b1a4758a8b45aa871e60 100644 (file)
@@ -640,24 +640,23 @@ uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint
     SCReturnCT(pstate->inspect_id[direction & STREAM_TOSERVER ? 0 : 1], "uint64_t");
 }
 
-void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
-                                           const uint8_t ipproto, const AppProto alproto,
+void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate,
                                            void *alstate, const uint8_t flags)
 {
     SCEnter();
 
     int direction = (flags & STREAM_TOSERVER) ? 0 : 1;
-    uint64_t total_txs = AppLayerParserGetTxCnt(ipproto, alproto, alstate);
+    const uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate);
     uint64_t idx = AppLayerParserGetTransactionInspectId(pstate, flags);
-    int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(alproto, flags);
+    const int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(f->alproto, flags);
     void *tx;
     int state_progress;
 
     for (; idx < total_txs; idx++) {
-        tx = AppLayerParserGetTx(ipproto, alproto, alstate, idx);
+        tx = AppLayerParserGetTx(f->proto, f->alproto, alstate, idx);
         if (tx == NULL)
             continue;
-        state_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx, flags);
+        state_progress = AppLayerParserGetStateProgress(f->proto, f->alproto, tx, flags);
         if (state_progress >= state_done_progress)
             continue;
         else
@@ -749,7 +748,7 @@ uint64_t AppLayerTransactionGetActiveLogOnly(Flow *f, uint8_t flags)
     }
 
     /* logger is disabled, return highest 'complete' tx id */
-    uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, f->alstate);
+    uint64_t total_txs = AppLayerParserGetTxCnt(f, f->alstate);
     uint64_t idx = AppLayerParserGetTransactionInspectId(f->alparser, flags);
     int state_done_progress = AppLayerParserGetStateProgressCompletionStatus(f->alproto, flags);
     void *tx;
@@ -836,11 +835,11 @@ int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto,
     SCReturnInt(r);
 }
 
-uint64_t AppLayerParserGetTxCnt(uint8_t ipproto, AppProto alproto, void *alstate)
+uint64_t AppLayerParserGetTxCnt(const Flow *f, void *alstate)
 {
     SCEnter();
     uint64_t r = 0;
-    r = alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].
+    r = alp_ctx.ctxs[f->protomap][f->alproto].
                StateGetTxCnt(alstate);
     SCReturnCT(r, "uint64_t");
 }
@@ -1014,7 +1013,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow
     }
 
     if (AppLayerParserProtocolIsTxAware(f->proto, alproto)) {
-        p_tx_cnt = AppLayerParserGetTxCnt(f->proto, alproto, f->alstate);
+        p_tx_cnt = AppLayerParserGetTxCnt(f, f->alstate);
     }
 
     /* invoke the recursive parser, but only on data. We may get empty msgs on EOF */
@@ -1066,7 +1065,7 @@ int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow
 
     if (AppLayerParserProtocolIsTxAware(f->proto, alproto)) {
         if (likely(tv)) {
-            uint64_t cur_tx_cnt = AppLayerParserGetTxCnt(f->proto, alproto, f->alstate);
+            uint64_t cur_tx_cnt = AppLayerParserGetTxCnt(f, f->alstate);
             if (cur_tx_cnt > p_tx_cnt) {
                 AppLayerIncTxCounter(tv, f, cur_tx_cnt - p_tx_cnt);
             }
@@ -1128,7 +1127,7 @@ int AppLayerParserHasDecoderEvents(const Flow *f,
         } else {
             /* check each tx */
             tx_id = AppLayerParserGetTransactionInspectId(pstate, flags);
-            max_id = AppLayerParserGetTxCnt(f->proto, f->alproto, alstate);
+            max_id = AppLayerParserGetTxCnt(f, alstate);
             for ( ; tx_id < max_id; tx_id++) {
                 decoder_events = AppLayerParserGetEventsByTx(f->proto, f->alproto, alstate, tx_id);
                 if (decoder_events && decoder_events->cnt)
index 83e6672d0083ac0c2702908c5f05c43e528abda1..8318ef34e6c5fecd9be00f1d7d3ab7c89b6e82b9 100644 (file)
@@ -166,14 +166,16 @@ void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto a
 
 uint64_t AppLayerParserGetTransactionLogId(AppLayerParserState *pstate);
 void AppLayerParserSetTransactionLogId(AppLayerParserState *pstate, uint64_t tx_id);
+
 void AppLayerParserSetTxLogged(uint8_t ipproto, AppProto alproto, void *alstate,
                                void *tx, uint32_t logger);
 int AppLayerParserGetTxLogged(uint8_t ipproto, AppProto alproto, void *alstate,
                               void *tx, uint32_t logger);
+
 uint64_t AppLayerParserGetTransactionInspectId(AppLayerParserState *pstate, uint8_t direction);
-void AppLayerParserSetTransactionInspectId(AppLayerParserState *pstate,
-                                const uint8_t ipproto, const AppProto alproto, void *alstate,
-                                const uint8_t flags);
+void AppLayerParserSetTransactionInspectId(const Flow *f, AppLayerParserState *pstate,
+                                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,
@@ -182,7 +184,7 @@ FileContainer *AppLayerParserGetFiles(uint8_t ipproto, AppProto alproto,
                            void *alstate, uint8_t direction);
 int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto,
                         void *alstate, uint8_t direction);
-uint64_t AppLayerParserGetTxCnt(uint8_t ipproto, AppProto alproto, void *alstate);
+uint64_t AppLayerParserGetTxCnt(const Flow *, void *alstate);
 void *AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id);
 int AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t direction);
 int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name,
index fee5ec2f17067556ecaa6353e9415c933f69ce21..3fcd5764c7160d4da0f22e74752f9041a939b9eb 100644 (file)
@@ -1657,6 +1657,7 @@ static int SMBParserTest01(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1737,6 +1738,7 @@ static int SMBParserTest02(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2036,6 +2038,7 @@ static int SMBParserTest03(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2158,6 +2161,7 @@ static int SMBParserTest04(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2421,6 +2425,7 @@ static int SMBParserTest07(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2498,6 +2503,7 @@ static int SMBParserTest08(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2616,6 +2622,7 @@ static int SMBParserTest09(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2742,6 +2749,7 @@ static int SMBParserTest10(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMB;
 
     StreamTcpInitConfig(TRUE);
 
index d55d8620847509d0bf97a56df9e41b1a61a4f5cc..13a23277256b01cd066e4f23d86dc298c38e742f 100644 (file)
@@ -1792,6 +1792,7 @@ static int SMTPParserTest01(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -2148,6 +2149,7 @@ static int SMTPParserTest02(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -2783,6 +2785,7 @@ static int SMTPParserTest03(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -2931,6 +2934,7 @@ static int SMTPParserTest04(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -3079,6 +3083,7 @@ static int SMTPParserTest05(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -3376,6 +3381,7 @@ static int SMTPParserTest06(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -3615,6 +3621,7 @@ static int SMTPParserTest07(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -3729,6 +3736,7 @@ static int SMTPParserTest08(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -3843,6 +3851,7 @@ static int SMTPParserTest09(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -3957,6 +3966,7 @@ static int SMTPParserTest10(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -4065,6 +4075,7 @@ static int SMTPParserTest11(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
@@ -4159,6 +4170,7 @@ static int SMTPParserTest12(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
     p->flow = &f;
     p->flowflags |= FLOW_PKT_TOSERVER;
     p->flowflags |= FLOW_PKT_ESTABLISHED;
@@ -4301,6 +4313,7 @@ static int SMTPParserTest13(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
     p->flow = &f;
     p->flowflags |= FLOW_PKT_TOSERVER;
     p->flowflags |= FLOW_PKT_ESTABLISHED;
@@ -4586,6 +4599,7 @@ static int SMTPParserTest14(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_SMTP;
 
     StreamTcpInitConfig(TRUE);
     SMTPTestInitConfig();
index a2c05cbc238203dad919890462571c5a0e871e81..dc0b8e1fc8da8ce28309daf163d56c86b8c637cc 100644 (file)
@@ -1891,6 +1891,7 @@ static int SSLParserTest01(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1930,6 +1931,7 @@ static int SSLParserTest02(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -1977,6 +1979,7 @@ static int SSLParserTest03(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2032,6 +2035,7 @@ static int SSLParserTest04(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2090,6 +2094,7 @@ static int SSLParserTest05(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2201,6 +2206,7 @@ static int SSLParserTest06(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2351,6 +2357,7 @@ static int SSLParserMultimsgTest01(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2415,6 +2422,7 @@ static int SSLParserMultimsgTest02(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2464,6 +2472,7 @@ static int SSLParserTest07(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2504,6 +2513,7 @@ static int SSLParserTest08(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2630,6 +2640,7 @@ static int SSLParserTest09(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2692,6 +2703,7 @@ static int SSLParserTest10(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2753,6 +2765,7 @@ static int SSLParserTest11(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2819,6 +2832,7 @@ static int SSLParserTest12(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2896,6 +2910,7 @@ static int SSLParserTest13(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -2962,6 +2977,7 @@ static int SSLParserTest14(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3007,6 +3023,7 @@ static int SSLParserTest15(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3043,6 +3060,7 @@ static int SSLParserTest16(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3079,6 +3097,7 @@ static int SSLParserTest17(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3121,6 +3140,7 @@ static int SSLParserTest18(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3167,6 +3187,7 @@ static int SSLParserTest19(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3207,6 +3228,7 @@ static int SSLParserTest20(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3244,6 +3266,7 @@ static int SSLParserTest21(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3293,6 +3316,7 @@ static int SSLParserTest22(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3578,6 +3602,7 @@ static int SSLParserTest23(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -3723,6 +3748,7 @@ static int SSLParserTest24(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4080,6 +4106,7 @@ static int SSLParserTest25(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
@@ -4234,6 +4261,7 @@ static int SSLParserTest26(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_TLS;
 
     StreamTcpInitConfig(TRUE);
 
index d8c9fa3129afc7498e07de1d841d168928439bc5..5478902cf43ef56afef17cd7f180fb5e65adf56e 100644 (file)
@@ -101,7 +101,7 @@ static inline void PrefilterTx(DetectEngineThreadCtx *det_ctx,
 
     void *alstate = p->flow->alstate;
     uint64_t idx = AppLayerParserGetTransactionInspectId(p->flow->alparser, flags);
-    const uint64_t total_txs = AppLayerParserGetTxCnt(ipproto, alproto, alstate);
+    const uint64_t total_txs = AppLayerParserGetTxCnt(p->flow, alstate);
 
     /* HACK test HTTP state here instead of in each engine */
     if (alproto == ALPROTO_HTTP) {
index b8a98fccad18daa5e141a49ba9692561ef46afe7..84e0afa8a72a02c9a0560c806ff8668ea225b90d 100644 (file)
@@ -256,7 +256,7 @@ static int HasStoredSigs(const Flow *f, const uint8_t flags)
         /* if state == 1 we also fall through */
 
         uint64_t inspect_tx_id = AppLayerParserGetTransactionInspectId(f->alparser, flags);
-        uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, alproto, alstate);
+        uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate);
 
         for ( ; inspect_tx_id < total_txs; inspect_tx_id++) {
             void *inspect_tx = AppLayerParserGetTx(f->proto, alproto, alstate, inspect_tx_id);
@@ -394,7 +394,7 @@ int DeStateDetectStartDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
         check_before_add = 1;
     }
 
-    uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, alproto, alstate);
+    uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate);
     SCLogDebug("total_txs %"PRIu64, total_txs);
 
     SCLogDebug("starting: start tx %u, packet %u", (uint)tx_id, (uint)p->pcap_cnt);
@@ -753,7 +753,7 @@ void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx,
         }
 
         inspect_tx_id = AppLayerParserGetTransactionInspectId(f->alparser, flags);
-        total_txs = AppLayerParserGetTxCnt(f->proto, alproto, alstate);
+        total_txs = AppLayerParserGetTxCnt(f, alstate);
 
         for ( ; inspect_tx_id < total_txs; inspect_tx_id++) {
             int inspect_tx_inprogress = 0;
@@ -838,8 +838,8 @@ end:
 void DeStateUpdateInspectTransactionId(Flow *f, const uint8_t flags)
 {
     if (f->alparser && f->alstate) {
-        AppLayerParserSetTransactionInspectId(f->alparser, f->proto,
-                                              f->alproto, f->alstate, flags);
+        AppLayerParserSetTransactionInspectId(f, f->alparser,
+                                              f->alstate, flags);
     }
     return;
 }
@@ -861,7 +861,7 @@ void DetectEngineStateResetTxs(Flow *f)
 
         uint64_t inspect_tx_id = MIN(inspect_ts, inspect_tc);
 
-        uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, alstate);
+        uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate);
 
         for ( ; inspect_tx_id < total_txs; inspect_tx_id++) {
             void *inspect_tx = AppLayerParserGetTx(f->proto, f->alproto, alstate, inspect_tx_id);
index 13ffe54707fd4c89a96ca515561b912472f8e961..cdbc204d30c250608a4374920ae64d4097fd7b37 100644 (file)
@@ -1441,7 +1441,7 @@ static int DetectHttpClientBodyTest14(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
@@ -1667,7 +1667,7 @@ static int DetectHttpClientBodyTest15(void)
     }
 
     /* hardcoded check of the transactions and it's client body chunks */
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
index 382263aaa3a8e1c9c6eb78c3721f6953b1ad24f2..6ce5e2efc13d8e3e31c5b287f8d0d205293141d7 100644 (file)
@@ -1447,7 +1447,7 @@ static int DetectHttpHHTest14(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
index ebefcb23691ba63ed90a77aa2625f01c95a8bec0..0afd1d6ed9b1ea990167fed83821cbec4949d6c0 100644 (file)
@@ -1393,7 +1393,7 @@ static int DetectHttpHRHTest14(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
index a1901ef0fc9d46075c4ed27ce6e0f028430b45e0..18ebe2eb3f24fd82d1456c98a3b9ce19de3d07ae 100644 (file)
@@ -1598,7 +1598,7 @@ static int DetectHttpServerBodyTest14(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
@@ -1763,7 +1763,7 @@ static int DetectHttpServerBodyTest15(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
@@ -3714,7 +3714,7 @@ static int DetectHttpServerBodyFileDataTest09(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
@@ -3875,7 +3875,7 @@ static int DetectHttpServerBodyFileDataTest10(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
index c9019387b538b4390e70a0c17cac2b760f7a1663..f2ca11ceb7380e64763dfbe6160500697b04ab33 100644 (file)
@@ -1394,7 +1394,7 @@ static int DetectHttpUATest14(void)
         goto end;
     }
 
-    if (AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2) {
+    if (AppLayerParserGetTxCnt(&f, htp_state) != 2) {
         printf("The http app layer doesn't have 2 transactions, but it should: ");
         goto end;
     }
index b5603c5d5b2223c534e07ae583eb383f7d38447f..1e3c4c6c7cc014162c079e9a062d0ccd161bb7b9 100644 (file)
@@ -373,7 +373,7 @@ static int DetectLuaMatch (ThreadVars *tv, DetectEngineThreadCtx *det_ctx,
             htp_tx_t *tx = NULL;
             uint64_t idx = AppLayerParserGetTransactionInspectId(p->flow->alparser,
                                                                  STREAM_TOSERVER);
-            uint64_t total_txs= AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state);
+            uint64_t total_txs= AppLayerParserGetTxCnt(p->flow, htp_state);
             for ( ; idx < total_txs; idx++) {
                 tx = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, idx);
                 if (tx == NULL)
index 68b4eedbe506ae3246e31fe532e5f27828fc608a..aebc06a9d0252f3b0276f22663da847f84c36d8e 100644 (file)
@@ -2701,7 +2701,7 @@ static int DetectPcreTxBodyChunksTest01(void)
     FAIL_IF(htp_state == NULL);
 
     /* hardcoded check of the transactions and it's client body chunks */
-    FAIL_IF(AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2);
+    FAIL_IF(AppLayerParserGetTxCnt(&f, htp_state) != 2);
 
     htp_tx_t *t1 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 0);
     htp_tx_t *t2 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 1);
@@ -2870,7 +2870,7 @@ static int DetectPcreTxBodyChunksTest02(void)
     FAIL_IF(htp_state == NULL);
 
     /* hardcoded check of the transactions and it's client body chunks */
-    FAIL_IF(AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2);
+    FAIL_IF(AppLayerParserGetTxCnt(&f, htp_state) != 2);
 
     htp_tx_t *t1 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 0);
     htp_tx_t *t2 = AppLayerParserGetTx(IPPROTO_TCP, ALPROTO_HTTP, htp_state, 1);
@@ -3044,7 +3044,7 @@ static int DetectPcreTxBodyChunksTest03(void)
     HtpState *htp_state = f.alstate;
     FAIL_IF(htp_state == NULL);
 
-    FAIL_IF(AppLayerParserGetTxCnt(IPPROTO_TCP, ALPROTO_HTTP, htp_state) != 2);
+    FAIL_IF(AppLayerParserGetTxCnt(&f, htp_state) != 2);
 
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
index 0aa10c79414a383b916eafe8fdf8287176dc1d12..4886bacccb65e697ff1e3962ad539dc95ddd78a2 100644 (file)
@@ -213,6 +213,7 @@ static int HTTPUriTest01(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_HTTP;
     f.flags |= FLOW_IPV4;
 
     StreamTcpInitConfig(TRUE);
@@ -283,6 +284,7 @@ static int HTTPUriTest02(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_HTTP;
     f.flags |= FLOW_IPV4;
 
     StreamTcpInitConfig(TRUE);
@@ -328,8 +330,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     FLOWLOCK_UNLOCK(&f);
     FLOW_DESTROY(&f);
     return result;
@@ -355,6 +355,7 @@ static int HTTPUriTest03(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_HTTP;
     f.flags |= FLOW_IPV4;
 
     StreamTcpInitConfig(TRUE);
@@ -400,8 +401,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     FLOWLOCK_UNLOCK(&f);
     FLOW_DESTROY(&f);
     return result;
@@ -428,6 +427,7 @@ static int HTTPUriTest04(void)
     FLOW_INITIALIZE(&f);
     f.protoctx = (void *)&ssn;
     f.proto = IPPROTO_TCP;
+    f.alproto = ALPROTO_HTTP;
     f.flags |= FLOW_IPV4;
 
     StreamTcpInitConfig(TRUE);
@@ -473,8 +473,6 @@ end:
     if (alp_tctx != NULL)
         AppLayerParserThreadCtxFree(alp_tctx);
     StreamTcpFreeConfig(TRUE);
-    if (htp_state != NULL)
-        HTPStateFree(htp_state);
     FLOWLOCK_UNLOCK(&f);
     FLOW_DESTROY(&f);
     return result;
index f2c5718c03fd574c2dd6f928e27c3e43bb79132f..adab394cafb586ce76790fbc58281c9b82f4aa53 100644 (file)
@@ -320,7 +320,7 @@ int FlowForceReassemblyNeedReassembly(Flow *f, int *server, int *client)
     if (f->alproto != ALPROTO_UNKNOWN && f->alstate != NULL &&
         AppLayerParserProtocolSupportsTxs(f->proto, f->alproto))
     {
-        uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, f->alstate);
+        uint64_t total_txs = AppLayerParserGetTxCnt(f, f->alstate);
 
         if (AppLayerParserGetTransactionActive(f, f->alparser, STREAM_TOCLIENT) < total_txs)
         {
index bab641098a98736dd09ba060e55e13f4b1f950c4..7061301830ec67080a7cafe1847d0b51e9e907bd 100644 (file)
@@ -161,7 +161,7 @@ static int HttpBodyIterator(Flow *f, int close, void *cbdata, uint8_t iflags)
 
         // for each tx
         uint64_t tx_id = 0;
-        uint64_t total_txs = AppLayerParserGetTxCnt(f->proto, f->alproto, f->alstate);
+        const uint64_t total_txs = AppLayerParserGetTxCnt(f, f->alstate);
         SCLogDebug("s->conn %p", s->conn);
         for (tx_id = 0; tx_id < total_txs; tx_id++) { // TODO optimization store log tx
             htp_tx_t *tx = AppLayerParserGetTx(f->proto, f->alproto, f->alstate, tx_id);
index 575bf5aa06a4c7aa2944e97ef419a92547a508fc..326d881b047ffa89c0aeeaa72772cccc19055559 100644 (file)
@@ -161,7 +161,7 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data)
         goto end;
     }
 
-    uint64_t total_txs = AppLayerParserGetTxCnt(p->proto, alproto, alstate);
+    const uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate);
     uint64_t tx_id = AppLayerParserGetTransactionLogId(f->alparser);
     uint64_t max_id = tx_id;
     int logged = 0;