59 const char *name,
void (*FreeFunc)(
void *));
63 static inline void QuickSortSigIntId(
SigIntId *sids, uint32_t n)
83 QuickSortSigIntId(sids, r - sids + 1);
84 QuickSortSigIntId(l, sids + n - l);
93 const uint8_t ipproto,
94 const uint8_t flow_flags,
106 if (engine->
alproto != alproto)
191 void *pectx,
void (*FreeFunc)(
void *pectx),
194 if (sgh == NULL || PrefilterFunc == NULL || pectx == NULL)
200 memset(e, 0x00,
sizeof(*e));
210 while (t->
next != NULL) {
219 e->
gid = PrefilterStoreGetId(de_ctx, e->
name, e->
Free);
225 void *pectx,
void (*FreeFunc)(
void *pectx),
228 if (sgh == NULL || PrefilterFunc == NULL || pectx == NULL)
234 memset(e, 0x00,
sizeof(*e));
244 while (t->
next != NULL) {
253 e->
gid = PrefilterStoreGetId(de_ctx, e->
name, e->
Free);
260 const uint64_t idx,
const uint8_t
flags),
261 AppProto alproto,
int tx_min_progress,
262 void *pectx,
void (*FreeFunc)(
void *pectx),
265 if (sgh == NULL || PrefilterTxFunc == NULL || pectx == NULL)
271 memset(e, 0x00,
sizeof(*e));
283 while (t->
next != NULL) {
292 e->
gid = PrefilterStoreGetId(de_ctx, e->
name, e->
Free);
310 PrefilterFreeEngineList(t);
343 PrefilterFreeEngines(de_ctx, sgh->
tx_engines);
388 if (el->
next == NULL) {
413 if (el->
next == NULL) {
431 uint32_t local_id = 0;
441 if (el->
next == NULL) {
446 SCLogDebug(
"sgh %p max local_id %u", sgh, local_id);
452 static uint32_t PrefilterStoreHashFunc(
HashListTable *ht,
void *data, uint16_t datalen)
456 uint32_t hash = strlen(ctx->
name);
459 for (u = 0; u < strlen(ctx->
name); u++) {
460 hash += ctx->
name[u];
467 static char PrefilterStoreCompareFunc(
void *data1, uint16_t len1,
468 void *data2, uint16_t len2)
472 return (strcmp(ctx1->
name, ctx2->
name) == 0);
475 static void PrefilterStoreFreeFunc(
void *ptr)
492 PrefilterStoreHashFunc,
493 PrefilterStoreCompareFunc,
494 PrefilterStoreFreeFunc);
499 const char *name,
void (*FreeFunc)(
void *))
578 const uint64_t idx,
const uint8_t flags)
592 const uint8_t *data = buffer->
inspect;
597 if (data != NULL && data_len >= mpm_ctx->
minlen) {
599 &det_ctx->
mtcu, &det_ctx->
pmq, data, data_len);
603 static void PrefilterGenericMpmFree(
void *ptr)
623 pectx, PrefilterGenericMpmFree, mpm_reg->
pname);
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
HashListTableBucket * HashListTableGetListHead(HashListTable *ht)
DetectEnginePrefilterSetting
struct HtpBodyChunk_ * next
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
#define PREFILTER_PROFILING_END(ctx, profile_id)
#define HashListTableGetListData(hb)
void(* PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, void *tx, const uint64_t idx, const uint8_t flags)
InspectionBufferGetDataPtr GetData
one time registration of keywords at start up
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectMpmAppLayerRegistery *mpm_reg, int list_id)
const char * PrefilterStoreGetName(const uint32_t id)
Container for matching data for a signature group.
void * HashListTableLookup(HashListTable *ht, void *data, uint16_t datalen)
PrefilterEngineList * tx_engines
main detection engine ctx
PrefilterEngine * tx_engines
void PrefilterCleanupRuleGroup(const DetectEngineCtx *de_ctx, SigGroupHead *sgh)
PrefilterEngine * pkt_engines
int HashListTableAdd(HashListTable *ht, void *data, uint16_t datalen)
#define HashListTableGetListNext(hb)
void DetectRunPrefilterTx(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh, Packet *p, const uint8_t ipproto, const uint8_t flow_flags, const AppProto alproto, void *alstate, DetectTransaction *tx)
run prefilter engines on a transaction
int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, void(*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx), void *pectx, void(*FreeFunc)(void *pectx), const char *name)
#define PKT_DETECT_HAS_STREAMDATA
void(* PrefilterTx)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, void *tx, const uint64_t idx, const uint8_t flags)
void Prefilter(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh, Packet *p, const uint8_t flags)
struct PrefilterMpmCtx PrefilterMpmCtx
void PrefilterFreeEnginesList(PrefilterEngineList *list)
#define PACKET_PROFILING_DETECT_END(p, id)
PrefilterEngineList * payload_engines
HashListTable * HashListTableInit(uint32_t size, uint32_t(*Hash)(struct HashListTable_ *, void *, uint16_t), char(*Compare)(void *, uint16_t, void *, uint16_t), void(*Free)(void *))
PrefilterEngine * payload_engines
PrefilterEngineList * pkt_engines
void PrefilterDeinit(DetectEngineCtx *de_ctx)
enum DetectEnginePrefilterSetting prefilter_setting
void PrefilterSetupRuleGroup(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
#define SCMallocAligned(a, b)
wrapper for allocing aligned mem
void(* Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
DetectEngineTransforms transforms
struct DetectMpmAppLayerRegistery_::@101 v2
uint32_t rule_id_array_cnt
union PrefilterEngine_::@110 cb
HashListTable * prefilter_hash_table
#define PACKET_PROFILING_DETECT_START(p, id)
const DetectEngineTransforms * transforms
struct PrefilterEngineList_ * next
void HashListTableFree(HashListTable *ht)
int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, void(*PrefilterFunc)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx), void *pectx, void(*FreeFunc)(void *pectx), const char *name)
uint32_t(* Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t)
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, void(*PrefilterTxFunc)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, void *tx, const uint64_t idx, const uint8_t flags), AppProto alproto, int tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
void(* Free)(void *pectx)
InspectionBufferGetDataPtr GetData
#define PKT_NOPAYLOAD_INSPECTION
bool sm_types_prefilter[DETECT_TBLSIZE]
InspectionBuffer *(* InspectionBufferGetDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Flow *f, const uint8_t flow_flags, void *txv, const int list_id)
#define PREFILTER_PROFILING_START
int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
Prepare the pattern matcher ctx in a sig group head.
void(* Prefilter)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
void PrefilterInit(DetectEngineCtx *de_ctx)
#define SCFreeAligned(a)
Free aligned memory.
SigGroupHeadInitData * init