Go to the documentation of this file.
44 static void DetectSameipRegisterTests(
void);
126 static int DetectSameipSigTest01(
void)
128 uint8_t *buf = (uint8_t *)
131 uint16_t buflen = strlen((
char *)buf);
137 memset(&th_v, 0,
sizeof(th_v));
151 "alert tcp any any -> any any "
152 "(msg:\"Testing sameip\"; sameip; sid:1;)");
174 static void DetectSameipRegisterTests(
void)
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void SigMatchAppendSMToList(Signature *s, SigMatch *new, const int list)
Append a SigMatch to the list type.
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.
Packet * UTHBuildPacketSrcDst(uint8_t *payload, uint16_t payload_len, uint8_t ipproto, const char *src, const char *dst)
UTHBuildPacketSrcDst is a wrapper that build packets specifying IPs and defaulting ports.
main detection engine ctx
void DetectSameipRegister(void)
Registration function for sameip: keyword.
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
#define PASS
Pass the test.
Per thread variable structure.
Signature * SigInit(DetectEngineCtx *de_ctx, const char *sigstr)
Parses a signature and adds it to the Detection Engine Context.
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
SigMatch * SigMatchAlloc(void)
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
a single match condition for a signature
DetectEngineCtx * DetectEngineCtxInit(void)
void(* RegisterTests)(void)
#define SIG_FLAG_REQUIRE_PACKET