suricata
|
#include "suricata-common.h"
#include "util-hash.h"
#include "util-unittest.h"
#include "util-memcmp.h"
#include "util-hash-lookup3.h"
#include "util-rohash.h"
#include "util-debug.h"
Go to the source code of this file.
Data Structures | |
struct | ROHashTableItem_ |
struct | ROHashTableOffsets_ |
Typedefs | |
typedef struct ROHashTableItem_ | ROHashTableItem |
typedef struct ROHashTableOffsets_ | ROHashTableOffsets |
Functions | |
ROHashTable * | ROHashInit (uint8_t hash_bits, uint16_t item_size) |
initialize a new rohash More... | |
void | ROHashFree (ROHashTable *table) |
uint32_t | ROHashMemorySize (ROHashTable *table) |
void * | ROHashLookup (ROHashTable *table, void *data, uint16_t size) |
int | ROHashInitQueueValue (ROHashTable *table, void *value, uint16_t size) |
Add a new value to the hash. More... | |
int | ROHashInitFinalize (ROHashTable *table) |
create final hash data structure More... | |
Chained read only hash table implementation, meaning that after the initial fill no changes are allowed.
Loading takes 2 stages.
stage2 fills blob
Definition in file util-rohash.c.
typedef struct ROHashTableItem_ ROHashTableItem |
item_size data beyond this header
typedef struct ROHashTableOffsets_ ROHashTableOffsets |
offset table
void ROHashFree | ( | ROHashTable * | table | ) |
Definition at line 91 of file util-rohash.c.
References ROHashTable_::data, and SCFree.
Referenced by DetectFileHashFree().
ROHashTable* ROHashInit | ( | uint8_t | hash_bits, |
uint16_t | item_size | ||
) |
initialize a new rohash
hash_bits | hash size as 2^hash_bits, so power of 2, max 31 |
item_size | size of the data to store |
table | ptr or NULL on error |
Definition at line 64 of file util-rohash.c.
References ROHashTable_::hash_bits, hashsize, ROHashTable_::item_size, ROHashTable_::items, SCCalloc, SCLogError, TAILQ_INIT, and unlikely.
int ROHashInitFinalize | ( | ROHashTable * | table | ) |
create final hash data structure
table | the hash table |
0 | error |
1 | ok |
Definition at line 181 of file util-rohash.c.
References ROHashTableOffsets_::cnt, ROHashTable_::data, ROHashTable_::hash_bits, hashmask, hashsize, hashword(), ROHashTable_::item_size, ROHashTable_::items, ROHashTable_::locked, next, offset, ROHashTableOffsets_::offset, ROHashTableItem_::pos, SCCalloc, SCFree, SCLogError, TAILQ_FIRST, TAILQ_FOREACH, and TAILQ_REMOVE.
int ROHashInitQueueValue | ( | ROHashTable * | table, |
void * | value, | ||
uint16_t | size | ||
) |
Add a new value to the hash.
table | the hash table |
value | value to add |
size | value size. MUST match table item_size |
0 | error |
1 | ok |
Definition at line 151 of file util-rohash.c.
References ROHashTable_::item_size, ROHashTable_::locked, next, SCCalloc, SCLogError, and TAILQ_INSERT_TAIL.
Referenced by LoadHashTable().
void* ROHashLookup | ( | ROHashTable * | table, |
void * | data, | ||
uint16_t | size | ||
) |
NULL | not found |
ptr | found |
Definition at line 113 of file util-rohash.c.
References ROHashTableOffsets_::cnt, ROHashTable_::data, ROHashTable_::hash_bits, hashmask, hashword(), ROHashTable_::item_size, offset, ROHashTableOffsets_::offset, SCMemcmp, and SCReturnPtr.
uint32_t ROHashMemorySize | ( | ROHashTable * | table | ) |
Definition at line 102 of file util-rohash.c.
References ROHashTable_::hash_bits, hashsize, ROHashTable_::item_size, and ROHashTable_::items.