24#ifndef SURICATA_UTIL_UNITTEST_HELPER
25#define SURICATA_UTIL_UNITTEST_HELPER
34#if defined(UNITTESTS) || defined(FUZZ)
76 uint16_t , uint16_t );
78void *
UTHmemsearch(
const void *big,
size_t big_len,
const void *little,
size_t little_len);
main detection engine ctx
Packet * UTHBuildPacketIPV6SrcDst(uint8_t *, uint16_t, uint8_t ipproto, const char *, const char *)
UTHBuildPacketSrcDst is a wrapper that build packets specifying IPs and defaulting ports (IPV6)
int TestHelperBufferToFile(const char *name, const uint8_t *data, size_t size)
writes the contents of a buffer into a file
int UTHAppendSigs(DetectEngineCtx *, const char **, int)
int UTHGenericTest(Packet **, int, const char **, uint32_t *, uint32_t *, int)
int UTHRemoveSessionFromFlow(Flow *f)
void * UTHmemsearch(const void *big, size_t big_len, const void *little, size_t little_len)
Packet * UTHBuildPacketReal(uint8_t *, uint16_t, uint8_t ipproto, const char *, const char *, uint16_t, uint16_t)
UTHBuildPacketReal is a function that create tcp/udp packets for unittests specifying ip and port sou...
Packet * UTHBuildPacket(uint8_t *, uint16_t, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
int UTHAddSessionToFlow(Flow *f, uint32_t ts_isn, uint32_t tc_isn)
int UTHMatchPacketsWithResults(DetectEngineCtx *, Packet **, int, uint32_t *, uint32_t *, int)
void UTHSetIPV4Hdr(Packet *p, IPV4Hdr *ip4h)
void UTHFreePackets(Packet **, int)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself.
Packet * UTHBuildPacketSrcDstPorts(uint8_t *, uint16_t, uint8_t ipproto, uint16_t, uint16_t)
UTHBuildPacketSrcDstPorts is a wrapper that build packets specifying src and dst ports and defaulting...
void UTHAssignFlow(Packet *p, Flow *f)
uint32_t UTHSetIPv4Address(const char *)
return the uint32_t for a ipv4 address string
void UTHFreePacket(Packet *)
UTHFreePacket: function to release the allocated data from UTHBuildPacket and the packet itself.
void UTHFreeFlow(Flow *flow)
Flow * TestHelperBuildFlow(int family, const char *src, const char *dst, Port sp, Port dp)
uint32_t UTHBuildPacketOfFlows(uint32_t, uint32_t, uint8_t)
int UTHCheckPacketMatchResults(Packet *, uint32_t *, uint32_t *, int)
int UTHPacketMatchSigMpm(Packet *, char *, uint16_t)
void UTHRegisterTests(void)
int UTHAddStreamToFlow(Flow *f, int direction, uint8_t *data, uint32_t data_len)
int UTHParseSignature(const char *str, bool expect)
parser a sig and see if the expected result is correct
int UTHMatchPackets(DetectEngineCtx *, Packet **, int)
void UTHSetTCPHdr(Packet *p, TCPHdr *tcph)
void UTHSetIPV6Hdr(Packet *p, IPV6Hdr *ip6h)
Packet * UTHBuildPacketFromEth(uint8_t *, uint16_t)
UTHBuildPacketFromEth is a wrapper that build a packet for the rawbytes.
Packet * UTHBuildPacketSrcDst(uint8_t *, uint16_t, uint8_t ipproto, const char *, const char *)
UTHBuildPacketSrcDst is a wrapper that build packets specifying IPs and defaulting ports.
Packet * UTHBuildPacketIPV6Real(uint8_t *, uint16_t, uint8_t ipproto, const char *, const char *, uint16_t, uint16_t)
UTHBuildPacketReal is a function that create tcp/udp packets for unittests specifying ip and port sou...
int UTHCheckPacketMatch(Packet *, uint32_t *, uint32_t *, int)
int UTHPacketMatchSig(Packet *p, const char *)
Flow * UTHBuildFlow(int family, const char *src, const char *dst, Port sp, Port dp)