suricata
util-var-name.c File Reference
#include "suricata-common.h"
#include "detect.h"
#include "util-hash-string.h"
#include "util-hashlist.h"
#include "util-var-name.h"
#include "util-validate.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 VarNameStoreVarNameStorePtr
 
typedef struct VariableName_ VariableName
 Name2idx mapping structure for flowbits, flowvars and pktvars. More...
 

Functions

void VarNameStoreDestroy (void)
 
uint32_t VarNameStoreRegister (const char *name, const enum VarTypes type)
 
const char * VarNameStoreSetupLookup (const uint32_t id, const enum VarTypes type)
 
void VarNameStoreUnregister (const uint32_t id, const enum VarTypes type)
 
int VarNameStoreActivate (void)
 
const char * VarNameStoreLookupById (const uint32_t id, const enum VarTypes type)
 find name for id+type at packet time. More...
 
uint32_t VarNameStoreLookupByName (const char *name, const enum VarTypes type)
 find name for id+type at packet time. More...
 

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

◆ VARID_HASHSIZE

#define VARID_HASHSIZE   0x1000

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

◆ VARNAME_HASHSIZE

#define VARNAME_HASHSIZE   0x1000

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

Typedef Documentation

◆ VariableName

typedef struct VariableName_ VariableName

Name2idx mapping structure for flowbits, flowvars and pktvars.

◆ VarNameStore

typedef struct VarNameStore_ VarNameStore

◆ VarNameStorePtr

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

Function Documentation

◆ VarNameStoreActivate()

int VarNameStoreActivate ( void  )

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

References SCMutexLock.

◆ VarNameStoreDestroy()

void VarNameStoreDestroy ( void  )

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

References SCMutexLock.

Referenced by GlobalsDestroy().

Here is the caller graph for this function:

◆ VarNameStoreLookupById()

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

find name for id+type at packet time.

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

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

Here is the call graph for this function:

◆ VarNameStoreLookupByName()

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

find name for id+type at packet time.

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

References HashListTableLookup(), VariableName_::id, VariableName_::name, VarNameStore_::names, SC_ATOMIC_GET, and type.

Referenced by DetectFlowintMatch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VarNameStoreRegister()

uint32_t VarNameStoreRegister ( const char *  name,
const enum VarTypes  type 
)
Return values
idor 0 on error

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

References SCMutexLock.

◆ VarNameStoreSetupLookup()

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

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

References SCMutexLock.

Referenced by DetectFlowbitsAnalyze().

Here is the caller graph for this function:

◆ VarNameStoreUnregister()

void VarNameStoreUnregister ( const uint32_t  id,
const enum VarTypes  type 
)

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

References SCMutexLock.

Referenced by DetectFlowbitFree(), DetectFlowintFree(), and DetectHostbitFree().

Here is the caller graph for this function: