suricata
util-var-name.c File Reference
#include "suricata-common.h"
#include "detect.h"
#include "util-hashlist.h"
#include "util-var-name.h"
Include dependency graph for util-var-name.c:

Go to the source code of this file.

Data Structures

struct  VarNameStore_
 
struct  VariableName_
 Name2idx mapping structure for flowbits, flowvars and pktvars. More...
 

Macros

#define VARNAME_HASHSIZE   0x1000
 
#define VARID_HASHSIZE   0x1000
 

Typedefs

typedef struct VarNameStore_ VarNameStore
 
typedef struct VariableName_ VariableName
 Name2idx mapping structure for flowbits, flowvars and pktvars. More...
 

Functions

 SC_ATOMIC_DECLARE (VarNameStore *, g_varnamestore_current)
 
int VarNameStoreSetupStaging (uint32_t de_ctx_version)
 setup staging store. Include current store if there is one. More...
 
const char * VarNameStoreLookupById (const uint32_t id, const enum VarTypes type)
 
uint32_t VarNameStoreLookupByName (const char *name, const enum VarTypes type)
 
uint32_t VarNameStoreSetupAdd (const char *name, const enum VarTypes type)
 add to staging or return existing id if already in there More...
 
char * VarNameStoreSetupLookup (uint32_t idx, const enum VarTypes type)
 
void VarNameStoreActivateStaging (void)
 
void VarNameStoreFreeOld (void)
 
void VarNameStoreFree (uint32_t de_ctx_version)
 

Detailed Description

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

Generic variable name utility functions

Definition in file util-var-name.c.

Macro Definition Documentation

#define VARID_HASHSIZE   0x1000

Definition at line 69 of file util-var-name.c.

#define VARNAME_HASHSIZE   0x1000

Definition at line 68 of file util-var-name.c.

Typedef Documentation

typedef struct VariableName_ VariableName

Name2idx mapping structure for flowbits, flowvars and pktvars.

typedef struct VarNameStore_ VarNameStore

Function Documentation

SC_ATOMIC_DECLARE ( VarNameStore ,
g_varnamestore_current   
)
void VarNameStoreActivateStaging ( void  )

Definition at line 340 of file util-var-name.c.

References SC_ATOMIC_GET, SC_ATOMIC_SET, SCMutexLock, and SCMutexUnlock.

Referenced by DetectEngineMultiTenantSetup(), and SigGroupBuild().

Here is the caller graph for this function:

void VarNameStoreFree ( uint32_t  de_ctx_version)

Definition at line 364 of file util-var-name.c.

References VarNameStore_::de_ctx_version, SC_ATOMIC_GET, SC_ATOMIC_SET, SCLogDebug, SCMutexLock, and SCMutexUnlock.

Referenced by DetectEngineCtxFree().

Here is the caller graph for this function:

void VarNameStoreFreeOld ( void  )

Definition at line 353 of file util-var-name.c.

References SCLogDebug, SCMutexLock, and SCMutexUnlock.

const char* VarNameStoreLookupById ( const uint32_t  id,
const enum VarTypes  type 
)

Definition at line 297 of file util-var-name.c.

References BUG_ON, HashListTableLookup(), VarNameStore_::ids, VariableName_::name, SC_ATOMIC_GET, and type.

Referenced by OutputJsonRegister(), and UnixSocketPcapFile().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t VarNameStoreLookupByName ( const char *  name,
const enum VarTypes  type 
)

Definition at line 309 of file util-var-name.c.

References BUG_ON, HashListTableLookup(), VariableName_::idx, VarNameStore_::names, SC_ATOMIC_GET, and SCLogDebug.

Referenced by DetectFlowintMatch(), DetectPcrePayloadMatch(), and UnixSocketPcapFile().

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t VarNameStoreSetupAdd ( const char *  name,
const enum VarTypes  type 
)

add to staging or return existing id if already in there

Definition at line 323 of file util-var-name.c.

References SCMutexLock, and SCMutexUnlock.

Referenced by DetectFlowbitMatch(), DetectFlowbitsAnalyze(), DetectFlowintMatch(), DetectFlowvarMatch(), DetectHostbitFree(), DetectLuaRegister(), DetectPcrePayloadMatch(), DetectPktvarRegister(), DetectXbitMatchHost(), and DetectXbitsRegister().

Here is the caller graph for this function:

char* VarNameStoreSetupLookup ( uint32_t  idx,
const enum VarTypes  type 
)

Definition at line 332 of file util-var-name.c.

References SCMutexLock, and SCMutexUnlock.

Referenced by DetectFlowbitsAnalyze().

Here is the caller graph for this function:

int VarNameStoreSetupStaging ( uint32_t  de_ctx_version)