suricata
|
#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"
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 VarNameStore * | VarNameStorePtr |
typedef struct VariableName_ | VariableName |
Name2idx mapping structure for flowbits, flowvars and pktvars. | |
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. As the active store won't be modified, we don't need locks. | |
uint32_t | VarNameStoreLookupByName (const char *name, const enum VarTypes type) |
find name for id+type at packet time. As the active store won't be modified, we don't need locks. | |
Generic variable name utility functions
Definition in file util-var-name.c.
#define VARID_HASHSIZE 0x1000 |
Definition at line 85 of file util-var-name.c.
#define VARNAME_HASHSIZE 0x1000 |
Definition at line 84 of file util-var-name.c.
typedef struct VariableName_ VariableName |
Name2idx mapping structure for flowbits, flowvars and pktvars.
typedef struct VarNameStore_ VarNameStore |
typedef VarNameStore* VarNameStorePtr |
Definition at line 74 of file util-var-name.c.
int VarNameStoreActivate | ( | void | ) |
Definition at line 214 of file util-var-name.c.
References BUG_ON, CreateIsoTimeString(), VarNameStore_::free_after, HashListTableAdd(), HashListTableFree(), HashListTableGetListData, HashListTableGetListHead(), HashListTableGetListNext, HashListTableInit(), VariableName_::id, VarNameStore_::ids, VariableName_::name, VarNameStore_::names, next, VariableName_::ref_cnt, SC_ATOMIC_GET, SC_ATOMIC_SET, SCCalloc, SCFree, SCLogDebug, SCMutexLock, SCMutexUnlock, SCTIME_ADD_SECS, SCTIME_CMP_LTE, TAILQ_FIRST, TAILQ_INSERT_TAIL, TAILQ_REMOVE, VARID_HASHSIZE, and VARNAME_HASHSIZE.
Referenced by DetectEngineMultiTenantSetup(), and SigGroupBuild().
void VarNameStoreDestroy | ( | void | ) |
Definition at line 116 of file util-var-name.c.
References DEBUG_VALIDATE_BUG_ON, HashListTableFree(), HashListTableGetListData, HashListTableGetListHead(), HashListTableGetListNext, VariableName_::id, VarNameStore_::ids, VarNameStore_::max_id, VariableName_::name, VarNameStore_::names, next, VariableName_::ref_cnt, SC_ATOMIC_GET, SC_ATOMIC_SET, SCFree, SCLogWarning, SCMutexLock, SCMutexUnlock, TAILQ_FIRST, TAILQ_REMOVE, and VariableName_::type.
Referenced by GlobalsDestroy().
const char * VarNameStoreLookupById | ( | const uint32_t | id, |
const enum VarTypes | type | ||
) |
find name for id+type at packet time. As the active
store won't be modified, we don't need locks.
Definition at line 299 of file util-var-name.c.
References HashListTableLookup(), VarNameStore_::ids, name, VariableName_::name, SC_ATOMIC_GET, type, and VariableName_::type.
uint32_t VarNameStoreLookupByName | ( | const char * | name, |
const enum VarTypes | type | ||
) |
find name for id+type at packet time. As the active
store won't be modified, we don't need locks.
Definition at line 319 of file util-var-name.c.
References HashListTableLookup(), VariableName_::id, name, VariableName_::name, VarNameStore_::names, SC_ATOMIC_GET, and type.
Referenced by DetectFlowintMatch().
uint32_t VarNameStoreRegister | ( | const char * | name, |
const enum VarTypes | type | ||
) |
id | or 0 on error |
Definition at line 155 of file util-var-name.c.
References HashListTableAdd(), HashListTableLookup(), id, VariableName_::id, VarNameStore_::ids, likely, VarNameStore_::max_id, name, VariableName_::name, VarNameStore_::names, VariableName_::ref_cnt, SCCalloc, SCFree, SCLogDebug, SCMutexLock, SCMutexUnlock, SCStrdup, type, and VariableName_::type.
const char * VarNameStoreSetupLookup | ( | const uint32_t | id, |
const enum VarTypes | type | ||
) |
Definition at line 188 of file util-var-name.c.
References HashListTableLookup(), VarNameStore_::ids, name, VariableName_::name, SCMutexLock, SCMutexUnlock, type, and VariableName_::type.
Referenced by DetectFlowbitsAnalyze(), and EngineAnalysisRules2().
void VarNameStoreUnregister | ( | const uint32_t | id, |
const enum VarTypes | type | ||
) |
Definition at line 201 of file util-var-name.c.
References DEBUG_VALIDATE_BUG_ON, HashListTableLookup(), VarNameStore_::ids, VariableName_::name, VariableName_::ref_cnt, SCLogDebug, SCMutexLock, SCMutexUnlock, type, and VariableName_::type.
Referenced by DetectFlowbitFree(), DetectFlowintFree(), and DetectHostbitFree().