]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: make tests tx aware
authorVictor Julien <victor@inliniac.net>
Mon, 27 May 2019 07:46:41 +0000 (09:46 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 29 May 2019 13:34:36 +0000 (15:34 +0200)
Make tests minimally TX-aware so we can asume all parsers use
the tx API.

src/app-layer-parser.c

index 858b56d46a90297b36f3fe16db2abc91bc998ab1..7ee3f37c692a3d27c29d5975f382738d3c489c4e 100644 (file)
@@ -1979,6 +1979,12 @@ static void TestProtocolStateFree(void *s)
     SCFree(s);
 }
 
+static uint64_t TestProtocolGetTxCnt(void *state)
+{
+    /* single tx */
+    return 1;
+}
+
 void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto,
                                   void (*RegisterUnittests)(void))
 {
@@ -2026,6 +2032,7 @@ static int AppLayerParserTest01(void)
                       TestProtocolParser);
     AppLayerParserRegisterStateFuncs(IPPROTO_TCP, ALPROTO_TEST,
                           TestProtocolStateAlloc, TestProtocolStateFree);
+    AppLayerParserRegisterGetTxCnt(IPPROTO_TCP, ALPROTO_TEST, TestProtocolGetTxCnt);
 
     f = UTHBuildFlow(AF_INET, "1.2.3.4", "4.3.2.1", 20, 40);
     if (f == NULL)
@@ -2080,6 +2087,7 @@ static int AppLayerParserTest02(void)
                       TestProtocolParser);
     AppLayerParserRegisterStateFuncs(IPPROTO_UDP, ALPROTO_TEST,
                           TestProtocolStateAlloc, TestProtocolStateFree);
+    AppLayerParserRegisterGetTxCnt(IPPROTO_UDP, ALPROTO_TEST, TestProtocolGetTxCnt);
 
     f = UTHBuildFlow(AF_INET, "1.2.3.4", "4.3.2.1", 20, 40);
     if (f == NULL)