suricata
util-mpm.c File Reference
#include "suricata-common.h"
#include "util-mpm.h"
#include "util-debug.h"
#include "util-mpm-ac.h"
#include "util-mpm-ac-bs.h"
#include "util-mpm-ac-tile.h"
#include "util-mpm-hs.h"
#include "util-hashlist.h"
#include "detect-engine.h"
#include "util-misc.h"
#include "conf.h"
#include "conf-yaml-loader.h"
#include "queue.h"
#include "util-unittest.h"
#include "util-memcpy.h"
Include dependency graph for util-mpm.c:

Go to the source code of this file.

Macros

#define DEFAULT_MPM   MPM_AC
 

Functions

int32_t MpmFactoryRegisterMpmCtxProfile (DetectEngineCtx *de_ctx, const char *name)
 Register a new Mpm Context. More...
 
int32_t MpmFactoryIsMpmCtxAvailable (const DetectEngineCtx *de_ctx, const MpmCtx *mpm_ctx)
 
MpmCtxMpmFactoryGetMpmCtxForProfile (const DetectEngineCtx *de_ctx, int32_t id, int direction)
 
void MpmFactoryReClaimMpmCtx (const DetectEngineCtx *de_ctx, MpmCtx *mpm_ctx)
 
void MpmFactoryDeRegisterAllMpmCtxProfiles (DetectEngineCtx *de_ctx)
 
void MpmInitThreadCtx (MpmThreadCtx *mpm_thread_ctx, uint16_t matcher)
 
void MpmInitCtx (MpmCtx *mpm_ctx, uint16_t matcher)
 
void MpmTableSetup (void)
 
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)
 
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 MpmFreePattern (MpmCtx *mpm_ctx, MpmPattern *p)
 
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)
 
void MpmRegisterTests (void)
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Pattern matcher utility Functions

Definition in file util-mpm.c.

Macro Definition Documentation

#define DEFAULT_MPM   MPM_AC

Definition at line 280 of file util-mpm.c.

Referenced by MpmTableSetup().

Function Documentation

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 
)
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 
)

Definition at line 310 of file util-mpm.c.

References MpmTableElmt_::AddPattern, mpm_table, and MpmCtx_::mpm_type.

Referenced by MpmACRegister(), MpmACTileRegister(), PatternStrength(), and SCACBSPrintInfo().

Here is the caller graph for this function:

int32_t MpmFactoryIsMpmCtxAvailable ( const DetectEngineCtx de_ctx,
const MpmCtx mpm_ctx 
)
void MpmFactoryReClaimMpmCtx ( const DetectEngineCtx de_ctx,
MpmCtx mpm_ctx 
)

Definition at line 215 of file util-mpm.c.

References MpmTableElmt_::DestroyCtx, MPM_NOTSET, mpm_table, MpmCtx_::mpm_type, MpmFactoryIsMpmCtxAvailable(), and SCFree.

Referenced by MpmStoreFree().

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t MpmFactoryRegisterMpmCtxProfile ( DetectEngineCtx de_ctx,
const char *  name 
)

Register a new Mpm Context.

Parameters
nameA new profile to be registered to store this MpmCtx.
Return values
idReturn the id created for the new MpmCtx profile.

Definition at line 55 of file util-mpm.c.

References MpmCtx_::global, MpmCtxFactoryItem_::id, MpmCtxFactoryContainer_::items, DetectEngineCtx_::mpm_ctx_factory_container, MpmCtxFactoryItem_::mpm_ctx_tc, MpmCtxFactoryItem_::mpm_ctx_ts, MpmCtxFactoryItem_::name, MpmCtxFactoryContainer_::no_of_items, SC_ERR_MEM_ALLOC, SCFree, SCLogError, SCMalloc, SCRealloc, and unlikely.

Referenced by DetectMpmPrepareAppMpms(), and DetectMpmSetupAppMpms().

Here is the caller graph for this function:

void MpmInitCtx ( MpmCtx mpm_ctx,
uint16_t  matcher 
)

Definition at line 261 of file util-mpm.c.

References MpmTableElmt_::InitCtx, mpm_table, and MpmCtx_::mpm_type.

Referenced by AppLayerProtoDetectSetup(), MpmACRegister(), MpmACTileRegister(), MpmStoreFree(), SCACBSPrintInfo(), and SMTPStateAlloc().

Here is the caller graph for this function:

void MpmInitThreadCtx ( MpmThreadCtx mpm_thread_ctx,
uint16_t  matcher 
)

Definition at line 256 of file util-mpm.c.

References MpmTableElmt_::InitThreadCtx, and mpm_table.

Referenced by PatternMatchThreadPrepare(), and SMTPStateAlloc().

Here is the caller graph for this function:

void MpmTableSetup ( void  )

Definition at line 284 of file util-mpm.c.

References DEFAULT_MPM, mpm_default_matcher, mpm_table, MpmACBSRegister(), MpmACRegister(), MpmACTileRegister(), MpmHSRegister(), and SCLogInfo.

Referenced by ListAppLayerProtocols(), ListKeywords(), PostRunDeinit(), RegisterAllModules(), and RunUnittests().

Here is the call graph for this function:

Here is the caller graph for this function: