Go to the documentation of this file.
19 #include "../util-unittest.h"
20 #include "../util-unittest-helper.h"
29 static int DetectTtlParseTest01 (
void)
44 static int DetectTtlParseTest02 (
void)
59 static int DetectTtlParseTest03 (
void)
75 static int DetectTtlParseTest04 (
void)
90 static int DetectTtlParseTest05 (
void)
106 static int DetectTtlParseTest06 (
void)
118 static int DetectTtlParseTest07 (
void)
132 static int DetectTtlSetupTest01(
void)
139 de_ctx,
"alert ip any any -> any any (msg:\"with in ttl limit\"; ttl:1 - 3; sid:1;)");
159 static int DetectTtlTestSig1(
void)
168 memset(&th_v, 0,
sizeof(th_v));
169 memset(&ip4h, 0,
sizeof(ip4h));
173 p->
proto = IPPROTO_TCP;
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
int PacketAlertCheck(Packet *p, uint32_t sid)
Check if a certain sid alerted, this is used in the test functions.
void UTHSetIPV4Hdr(Packet *p, IPV4Hdr *ip4h)
main detection engine ctx
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
SigMatchData * sm_arrays[DETECT_SM_LIST_MAX]
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
DetectUintData_u8 * DetectU8Parse(const char *u8str)
This function is used to parse u8 options passed via some u8 keyword.
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
#define PASS
Pass the test.
Per thread variable structure.
TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data)
initialize thread specific detection engine context
DetectUintData_u8 DetectU8Data
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
void DetectTtlRegisterTests(void)
this function registers unit tests for DetectTtl
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
void DetectTtlFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectU8Data
DetectEngineCtx * DetectEngineCtxInit(void)