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