Go to the documentation of this file.
46 static void DetectWindowRegisterTests(
void);
85 if (!(PacketIsTCP(p)) || wd == NULL) {
128 SCDetectU16Free(ptr);
137 static int DetectWindowTestParse01 (
void)
150 static int DetectWindowTestParse02 (
void)
164 static int DetectWindowTestParse03 (
void)
174 static int DetectWindowTestParse04 (
void)
184 static int DetectWindowTestPacket01 (
void)
186 uint8_t *buf = (uint8_t *)
"Hi all!";
187 uint16_t buflen = strlen((
char *)buf);
193 FAIL_IF(p[0] == NULL || p[1] == NULL || p[2] == NULL);
202 sigs[0]=
"alert tcp any any -> any any (msg:\"Testing window 1\"; window:40; sid:1;)";
203 sigs[1]=
"alert tcp any any -> any any (msg:\"Testing window 2\"; window:41; sid:2;)";
205 uint32_t sid[2] = {1, 2};
207 uint32_t results[3][2] = {
223 void DetectWindowRegisterTests(
void)
225 UtRegisterTest(
"DetectWindowTestParse01", DetectWindowTestParse01);
226 UtRegisterTest(
"DetectWindowTestParse02", DetectWindowTestParse02);
227 UtRegisterTest(
"DetectWindowTestParse03", DetectWindowTestParse03);
228 UtRegisterTest(
"DetectWindowTestParse04", DetectWindowTestParse04);
229 UtRegisterTest(
"DetectWindowTestPacket01", DetectWindowTestPacket01);
#define SIGMATCH_INFO_UINT16
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
SigTableElmt * sigmatch_table
void(* Free)(DetectEngineCtx *, void *)
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
main detection engine ctx
void DetectWindowFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectWindowData
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
#define TCP_GET_RAW_WINDOW(tcph)
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define PASS
Pass the test.
void DetectWindowRegister(void)
Registration function for window: keyword.
SigMatch * SCSigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
int DetectU16Match(const uint16_t parg, const DetectUintData_u16 *du16)
int UTHGenericTest(Packet **pkt, int numpkts, const char *sigs[], uint32_t sids[], uint32_t *results, int numsigs)
UTHGenericTest: function that perform a generic check taking care of as maximum common unittest eleme...
union PacketL4::L4Hdrs hdrs
DetectUintData_u16 DetectU16Data
#define DEBUG_VALIDATE_BUG_ON(exp)
void(* RegisterTests)(void)
#define SIG_FLAG_REQUIRE_PACKET
void UTHFreePackets(Packet **p, int numpkts)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself.