Go to the documentation of this file.
44 #ifdef BUILD_HYPERSCAN
76 strcmp(item->
name, name) == 0) {
126 if (mpm_ctx == i->mpm_ctx_ts || mpm_ctx == i->mpm_ctx_tc) {
140 memset(mpm_ctx, 0,
sizeof(
MpmCtx));
142 }
else if (
id < -1) {
152 return (direction == 0) ? i->mpm_ctx_ts : i->mpm_ctx_tc;
211 #ifdef BUILD_HYPERSCAN
212 # define DEFAULT_MPM MPM_HS
213 # define DEFAULT_MPM_AC MPM_AC
215 # define DEFAULT_MPM MPM_AC
226 #ifdef BUILD_HYPERSCAN
227 #ifdef HAVE_HS_VALID_PLATFORM
230 if (hs_valid_platform() != HS_SUCCESS) {
231 SCLogInfo(
"SSSE3 support not detected, disabling Hyperscan for "
245 uint16_t
offset, uint16_t depth,
254 uint16_t
offset, uint16_t depth,
273 static inline uint32_t MpmInitHashRaw(uint8_t *pat, uint16_t patlen)
275 uint32_t hash = patlen * pat[0];
295 uint8_t *pat, uint16_t patlen,
296 uint16_t
offset, uint16_t depth,
297 uint8_t
flags, uint32_t pid)
299 uint32_t hash = MpmInitHashRaw(pat, patlen);
306 for ( ; t != NULL; t = t->
next) {
354 if (p != NULL && p->
cs != NULL && p->
cs != p->
ci) {
360 if (p != NULL && p->
ci != NULL) {
380 static inline uint32_t MpmInitHash(
MpmPattern *p)
391 uint32_t hash = MpmInitHash(p);
431 uint16_t
offset, uint16_t depth, uint32_t pid,
434 SCLogDebug(
"Adding pattern for ctx %p, patlen %"PRIu16
" and pid %" PRIu32,
435 mpm_ctx, patlen, pid);
446 MpmPattern *p = MpmInitHashLookup(mpm_ctx, pat, patlen,
452 p = MpmAllocPattern(mpm_ctx);
475 memcpy_tolower(p->
ci, pat, patlen);
482 if (memcmp(p->
ci, pat, p->
len) == 0) {
491 memcpy(p->
cs, pat, patlen);
496 if (MpmInitHashAdd(mpm_ctx, p) != 0)
508 SCLogDebug(
"%p: alas, no depth for us", mpm_ctx);
512 if (mpm_ctx->
maxlen < patlen)
515 if (mpm_ctx->
minlen == 0) {
518 if (mpm_ctx->
minlen > patlen)
538 if (p->
sids[x] == sid) {
577 if (
mpm_table[i].RegisterUnittests != NULL) {
583 "unittest registration function.",
void MpmInitThreadCtx(MpmThreadCtx *mpm_thread_ctx, uint16_t matcher)
void(* InitThreadCtx)(struct MpmCtx_ *, struct MpmThreadCtx_ *)
void MpmFactoryDeRegisterAllMpmCtxProfiles(DetectEngineCtx *de_ctx)
void MpmFreePattern(MpmCtx *mpm_ctx, MpmPattern *p)
void MpmFactoryReClaimMpmCtx(const DetectEngineCtx *de_ctx, MpmCtx *mpm_ctx)
struct HtpBodyChunk_ * next
void MpmRegisterTests(void)
main detection engine ctx
int(* AddPatternNocase)(struct MpmCtx_ *, uint8_t *, uint16_t, uint16_t, uint16_t, uint32_t, SigIntId, uint8_t)
int(* AddPattern)(struct MpmCtx_ *, uint8_t *, uint16_t, uint16_t, uint16_t, uint32_t, SigIntId, uint8_t)
uint8_t mpm_default_matcher
MpmCtxFactoryContainer * mpm_ctx_factory_container
void(* InitCtx)(struct MpmCtx_ *)
void MpmInitCtx(MpmCtx *mpm_ctx, uint8_t matcher)
struct MpmPattern_ MpmPattern
int32_t MpmFactoryIsMpmCtxAvailable(const DetectEngineCtx *de_ctx, const MpmCtx *mpm_ctx)
struct MpmPattern_ * next
MpmCtx * MpmFactoryGetMpmCtxForProfile(const DetectEngineCtx *de_ctx, int32_t id, int direction)
#define MPM_PATTERN_CTX_OWNS_ID
#define SCLogWarning(...)
Macro used to log WARNING messages.
MpmCtxFactoryItem * items
#define MPMCTX_FLAGS_GLOBAL
int32_t MpmFactoryRegisterMpmCtxProfile(DetectEngineCtx *de_ctx, const char *name, const int sm_list, const AppProto alproto)
Register a new Mpm Context.
#define MPM_INIT_HASH_SIZE
int MpmAddPatternCS(struct MpmCtx_ *mpm_ctx, uint8_t *pat, uint16_t patlen, uint16_t offset, uint16_t depth, uint32_t pid, SigIntId sid, uint8_t flags)
#define MPMCTX_FLAGS_NODEPTH
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
void MpmACTileRegister(void)
Register the aho-corasick mpm 'ks' originally developed by Ken Steele for Tilera Tile-Gx processor.
#define ENGINE_SGH_MPM_FACTORY_CONTEXT_START_ID_RANGE
struct MpmCtxFactoryItem * next
#define SCRealloc(ptr, sz)
#define MPM_PATTERN_FLAG_NOCASE
void MpmACBSRegister(void)
Register the aho-corasick mpm.
#define SCLogError(...)
Macro used to log ERROR messages.
void(* DestroyCtx)(struct MpmCtx_ *)
#define MPM_CTX_FACTORY_UNIQUE_CONTEXT
void MpmACRegister(void)
Register the aho-corasick mpm.
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
int MpmAddPattern(MpmCtx *mpm_ctx, uint8_t *pat, uint16_t patlen, uint16_t offset, uint16_t depth, uint32_t pid, SigIntId sid, uint8_t flags)
int MpmAddPatternCI(struct MpmCtx_ *mpm_ctx, uint8_t *pat, uint16_t patlen, uint16_t offset, uint16_t depth, uint32_t pid, SigIntId sid, uint8_t flags)
void(* RegisterUnittests)(void)