Go to the documentation of this file.
84 #define VARNAME_HASHSIZE 0x1000
85 #define VARID_HASHSIZE 0x1000
92 static uint32_t VariableNameHash(
HashListTable *ht,
void *buf, uint16_t buflen);
93 static char VariableNameCompare(
void *buf1, uint16_t len1,
void *buf2, uint16_t len2);
94 static uint32_t VariableIdHash(
HashListTable *ht,
void *ptr, uint16_t _unused);
95 static char VariableIdCompare(
void *ptr1, uint16_t _unused1,
void *ptr2, uint16_t _unused2);
96 static void VariableNameFree(
void *data);
103 if (base.
names == NULL) {
104 FatalError(
"failed to initialize variable name hash (names)");
109 if (base.
ids == NULL) {
110 FatalError(
"failed to initialize variable name hash (names)");
168 if (vn->
name != NULL) {
174 "new registration %s id %u type %u -> %u", vn->name, vn->id, vn->type,
id);
182 SCLogDebug(
"existing registration %s ref_cnt %u -> %u", name, found->
ref_cnt,
id);
190 const char *name = NULL;
231 if (new_active == NULL) {
232 new_active =
SCCalloc(1,
sizeof(*new_active));
233 if (new_active == NULL) {
240 if (new_active->
names == NULL) {
247 if (new_active->
ids == NULL) {
269 SCLogDebug(
"old active is stored in free list");
281 SCLogDebug(
"not yet freeing store %p before %s", s, timebuf);
284 SCLogDebug(
"freeing store %p with time %s", s, timebuf);
292 SCLogDebug(
"activating new lookup store: complete %d", result);
300 const char *name = NULL;
329 static uint32_t VariableNameHash(
HashListTable *ht,
void *buf, uint16_t buflen)
336 static char VariableNameCompare(
void *buf1, uint16_t len1,
void *buf2, uint16_t len2)
343 static uint32_t VariableIdHash(
HashListTable *ht,
void *ptr, uint16_t _unused)
346 uint32_t hash = vn->
id << vn->
type;
350 static char VariableIdCompare(
void *ptr1, uint16_t _unused1,
void *ptr2, uint16_t _unused2)
358 static void VariableNameFree(
void *data)
363 if (vn->
name != NULL) {
#define HashListTableGetListData(hb)
void CreateIsoTimeString(const SCTime_t ts, char *str, size_t size)
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
struct HtpBodyChunk_ * next
void VarNameStoreInit(void)
HashListTableBucket * HashListTableGetListHead(HashListTable *ht)
const char * VarNameStoreSetupLookup(const uint32_t id, const enum VarTypes type)
#define SCMUTEX_INITIALIZER
#define TAILQ_INSERT_TAIL(head, elm, field)
uint32_t VarNameStoreRegister(const char *name, const enum VarTypes type)
void * HashListTableLookup(HashListTable *ht, void *data, uint16_t datalen)
int HashListTableAdd(HashListTable *ht, void *data, uint16_t datalen)
#define TAILQ_ENTRY(type)
#define HashListTableGetListNext(hb)
#define TAILQ_HEAD_INITIALIZER(head)
uint32_t VarNameStoreLookupByName(const char *name, const enum VarTypes type)
find name for id+type at packet time.
HashListTable * HashListTableInit(uint32_t size, uint32_t(*Hash)(struct HashListTable_ *, void *, uint16_t), char(*Compare)(void *, uint16_t, void *, uint16_t), void(*Free)(void *))
#define TAILQ_REMOVE(head, elm, field)
#define TAILQ_FIRST(head)
#define SCMutexUnlock(mut)
void VarNameStoreUnregister(const uint32_t id, const enum VarTypes type)
struct VariableName_ VariableName
Name2idx mapping structure for flowbits, flowvars and pktvars.
struct VarNameStore_ VarNameStore
#define SCLogWarning(...)
Macro used to log WARNING messages.
#define SC_ATOMIC_DECLARE(type, name)
wrapper for declaring atomic variables.
void VarNameStoreDestroy(void)
const char * VarNameStoreLookupById(const uint32_t id, const enum VarTypes type)
find name for id+type at packet time.
Name2idx mapping structure for flowbits, flowvars and pktvars.
void HashListTableFree(HashListTable *ht)
#define SC_ATOMIC_INITPTR(name)
VarNameStore * VarNameStorePtr
#define TAILQ_HEAD(name, type)
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.
#define SCTIME_ADD_SECS(ts, s)
#define DEBUG_VALIDATE_BUG_ON(exp)
#define SCTIME_CMP_LTE(a, b)
int VarNameStoreActivate(void)
uint32_t StringHashDjb2(const uint8_t *data, uint32_t datalen)