]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unittest/helpers: add helper to assign flow to packet
authorVictor Julien <victor@inliniac.net>
Thu, 30 Nov 2017 08:07:20 +0000 (09:07 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 30 Nov 2017 17:17:46 +0000 (18:17 +0100)
src/util-unittest-helper.c
src/util-unittest-helper.h

index 2e7e2e0ac41688c8e9b54e917fcf30f28ed984ec..bbc662c1007a4c96574ed76abf0600be0565355b 100644 (file)
@@ -435,6 +435,14 @@ void UTHFreePacket(Packet *p)
     SCFree(p);
 }
 
+void UTHAssignFlow(Packet *p, Flow *f)
+{
+    if (p && f) {
+        p->flow = f;
+        p->flags |= PKT_HAS_FLOW;
+    }
+}
+
 Flow *UTHBuildFlow(int family, const char *src, const char *dst, Port sp, Port dp)
 {
     struct in_addr in;
index 73dae60c605846b557951ee424cc911ccced869a..7d463359a7ac1e476ccfd94583e4bdfaf3796544 100644 (file)
@@ -41,6 +41,7 @@ Packet *UTHBuildPacketFromEth(uint8_t *, uint16_t);
 void UTHFreePacket(Packet *);
 void UTHFreePackets(Packet **, int);
 
+void UTHAssignFlow(Packet *p, Flow *f);
 Flow *UTHBuildFlow(int family, const char *src, const char *dst, Port sp, Port dp);
 void UTHFreeFlow(Flow *flow);
 int UTHAddStreamToFlow(Flow *f, int direction, uint8_t *data, uint32_t data_len);