From 34e6ad02f231207de438c37c0ba5161c77967842 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 f82da37bda..5ee8439c80 100644 --- a/src/util-unittest-helper.c +++ b/src/util-unittest-helper.c @@ -432,6 +432,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, char *src, 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 3b57a9e47a..fbfd4c9c19 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, char *src, char *dst, Port sp, Port dp); void UTHFreeFlow(Flow *flow);