suricata
|
#include "suricata-common.h"
#include "conf.h"
#include "util-debug.h"
#include "util-thash.h"
#include "util-random.h"
#include "util-misc.h"
#include "util-byte.h"
#include "util-hash-lookup3.h"
#include "util-validate.h"
Go to the source code of this file.
Macros | |
#define | THASH_DEFAULT_HASHSIZE 4096 |
#define | THASH_DEFAULT_MEMCAP 16777216 |
#define | THASH_DEFAULT_PREALLOC 1000 |
#define | GET_VAR(prefix, name) snprintf(varname, sizeof(varname), "%s.%s", (prefix), (name)) |
Functions | |
void | THashDataMoveToSpare (THashTableContext *ctx, THashData *h) |
THashDataQueue * | THashDataQueueNew (void) |
THashTableContext * | THashInit (const char *cnf_prefix, size_t data_size, int(*DataSet)(void *, void *), void(*DataFree)(void *), uint32_t(*DataHash)(void *), bool(*DataCompare)(void *, void *), bool reset_memcap, uint64_t memcap, uint32_t hashsize) |
void | THashConsolidateMemcap (THashTableContext *ctx) |
void | THashShutdown (THashTableContext *ctx) |
shutdown the flow engine More... | |
int | THashWalk (THashTableContext *ctx, THashFormatFunc FormatterFunc, THashOutputFunc OutputterFunc, void *output_ctx) |
Walk the hash. More... | |
void | THashCleanup (THashTableContext *ctx) |
Cleanup the thash engine. More... | |
struct THashDataGetResult | THashGetFromHash (THashTableContext *ctx, void *data) |
THashData * | THashLookupFromHash (THashTableContext *ctx, void *data) |
look up data in the hash More... | |
int | THashRemoveFromHash (THashTableContext *ctx, void *data) |
Definition in file util-thash.c.
#define GET_VAR | ( | prefix, | |
name | |||
) | snprintf(varname, sizeof(varname), "%s.%s", (prefix), (name)) |
Definition at line 206 of file util-thash.c.
#define THASH_DEFAULT_HASHSIZE 4096 |
Definition at line 202 of file util-thash.c.
#define THASH_DEFAULT_MEMCAP 16777216 |
Definition at line 203 of file util-thash.c.
#define THASH_DEFAULT_PREALLOC 1000 |
Definition at line 204 of file util-thash.c.
void THashCleanup | ( | THashTableContext * | ctx | ) |
Cleanup the thash engine.
Cleanup the thash engine from tag and threshold.
Definition at line 416 of file util-thash.c.
References THashTableContext_::array, THashTableContext_::config, THashDataConfig_::hash_size, HRLOCK_LOCK, HRLOCK_UNLOCK, THashData_::next, THashData_::prev, SC_ATOMIC_GET, and THashDataMoveToSpare().
void THashConsolidateMemcap | ( | THashTableContext * | ctx | ) |
Definition at line 339 of file util-thash.c.
References THashTableContext_::config, MAX, THashDataConfig_::memcap, SC_ATOMIC_GET, and SCLogDebug.
void THashDataMoveToSpare | ( | THashTableContext * | ctx, |
THashData * | h | ||
) |
Definition at line 41 of file util-thash.c.
Referenced by THashCleanup().
THashDataQueue* THashDataQueueNew | ( | void | ) |
Definition at line 56 of file util-thash.c.
References SCLogError, and SCMalloc.
struct THashDataGetResult THashGetFromHash | ( | THashTableContext * | ctx, |
void * | data | ||
) |
Definition at line 483 of file util-thash.c.
THashTableContext* THashInit | ( | const char * | cnf_prefix, |
size_t | data_size, | ||
int(*)(void *, void *) | DataSet, | ||
void(*)(void *) | DataFree, | ||
uint32_t(*)(void *) | DataHash, | ||
bool(*)(void *, void *) | DataCompare, | ||
bool | reset_memcap, | ||
uint64_t | memcap, | ||
uint32_t | hashsize | ||
) |
Definition at line 295 of file util-thash.c.
References BUG_ON, THashTableContext_::config, THashDataConfig_::data_size, THashDataConfig_::DataCompare, THashDataConfig_::DataFree, THashDataConfig_::DataHash, THashDataConfig_::DataSet, THashDataConfig_::hash_rand, THashDataConfig_::hash_size, hashsize, THashDataConfig_::memcap, THashDataConfig_::prealloc, RandomGet(), SC_ATOMIC_INIT, SCCalloc, THASH_DEFAULT_HASHSIZE, THASH_DEFAULT_MEMCAP, and THASH_DEFAULT_PREALLOC.
Referenced by HttpRangeContainersInit().
THashData* THashLookupFromHash | ( | THashTableContext * | ctx, |
void * | data | ||
) |
look up data in the hash
data | data to look up |
h | LOCKED data or NULL |
Definition at line 640 of file util-thash.c.
int THashRemoveFromHash | ( | THashTableContext * | ctx, |
void * | data | ||
) |
int | -1 not found |
int | 0 found, but it was busy (ref cnt) |
int | 1 found and removed |
Definition at line 775 of file util-thash.c.
void THashShutdown | ( | THashTableContext * | ctx | ) |
shutdown the flow engine
Definition at line 347 of file util-thash.c.
Referenced by HttpRangeContainersDestroy().
int THashWalk | ( | THashTableContext * | ctx, |
THashFormatFunc | FormatterFunc, | ||
THashOutputFunc | OutputterFunc, | ||
void * | output_ctx | ||
) |
Walk the hash.
Definition at line 381 of file util-thash.c.
References THashTableContext_::array, THashTableContext_::config, THashData_::data, THashDataConfig_::hash_size, HRLOCK_LOCK, HRLOCK_UNLOCK, and THashData_::next.