From: Victor Julien Date: Thu, 30 Nov 2017 08:07:20 +0000 (+0100) Subject: unittest/helpers: add helper to assign flow to packet X-Git-Tag: suricata-4.0.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=346da89f4acdfcbb794ea88541add049e7625dec;p=thirdparty%2Fsuricata.git unittest/helpers: add helper to assign flow to packet --- diff --git a/src/util-unittest-helper.c b/src/util-unittest-helper.c index 2e7e2e0ac4..bbc662c100 100644 --- a/src/util-unittest-helper.c +++ b/src/util-unittest-helper.c @@ -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; diff --git a/src/util-unittest-helper.h b/src/util-unittest-helper.h index 73dae60c60..7d463359a7 100644 --- a/src/util-unittest-helper.h +++ b/src/util-unittest-helper.h @@ -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);