From 346da89f4acdfcbb794ea88541add049e7625dec Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 30 Nov 2017 09:07:20 +0100 Subject: [PATCH] unittest/helpers: add helper to assign flow to packet --- src/util-unittest-helper.c | 8 ++++++++ src/util-unittest-helper.h | 1 + 2 files changed, 9 insertions(+) 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); -- 2.47.2