50static void DetectICodeRegisterTests(
void);
55static bool PrefilterICodeIsPrefilterable(
const Signature *s);
93 if (PacketIsICMPv4(p)) {
95 }
else if (PacketIsICMPv6(p)) {
96 const ICMPV6Hdr *icmpv6h = PacketGetICMPv6(p);
149 Packet *p,
const void *pectx)
154 if (PacketIsICMPv4(p)) {
156 }
else if (PacketIsICMPv6(p)) {
157 const ICMPV6Hdr *icmpv6h = PacketGetICMPv6(p);
167 PrefilterAddSids(&det_ctx->
pmq, sa->
sigs, sa->
cnt);
177static bool PrefilterICodeIsPrefilterable(
const Signature *s)
197static int DetectICodeParseTest01(
void)
212static int DetectICodeParseTest02(
void)
227static int DetectICodeParseTest03(
void)
242static int DetectICodeParseTest04(
void)
258static int DetectICodeParseTest05(
void)
273static int DetectICodeParseTest06(
void)
288static int DetectICodeParseTest07(
void)
303static int DetectICodeParseTest08(
void)
315static int DetectICodeParseTest09(
void)
328static int DetectICodeMatchTest01(
void)
334 memset(&th_v, 0,
sizeof(th_v));
382void DetectICodeRegisterTests(
void)
#define ICMPV6_GET_CODE(icmp6h)
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
int PacketAlertCheck(Packet *p, uint32_t sid)
Check if a certain sid alerted, this is used in the test functions.
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
int PrefilterSetupPacketHeaderU8Hash(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, SignatureMask mask, void(*Set)(PrefilterPacketHeaderValue *v, void *), bool(*Compare)(PrefilterPacketHeaderValue v, void *), void(*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
DetectEngineCtx * DetectEngineCtxInit(void)
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
DetectUintData_u8 * DetectU8Parse(const char *u8str)
This function is used to parse u8 options passed via some u8 keyword.
void PrefilterPacketU8Set(PrefilterPacketHeaderValue *v, void *smctx)
int DetectU8Match(const uint8_t parg, const DetectUintData_u8 *du8)
bool PrefilterPacketU8Compare(PrefilterPacketHeaderValue v, void *smctx)
DetectUintData_u8 DetectU8Data
TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data)
initialize thread specific detection engine context
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
void DetectICodeRegister(void)
Registration function for icode: keyword.
void DetectICodeFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectU8Data
SigMatch * SCSigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
SigTableElmt * sigmatch_table
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
#define SIG_FLAG_REQUIRE_PACKET
#define SIG_MASK_REQUIRE_REAL_PKT
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
#define PASS
Pass the test.
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
main detection engine ctx
union PacketL4::L4Hdrs hdrs
struct Packet_::@33::@40 icmp_s
Container for matching data for a signature group.
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
a single match condition for a signature
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
void(* Free)(DetectEngineCtx *, void *)
void(* RegisterTests)(void)
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
bool(* SupportsPrefilter)(const Signature *s)
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
SignatureInitData * init_data
Per thread variable structure.
void UTHFreePackets(Packet **p, int numpkts)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself.
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 DEBUG_VALIDATE_BUG_ON(exp)