suricata
util-rohash.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ROHashTable_
 

Typedefs

typedef struct ROHashTable_ ROHashTable
 

Functions

ROHashTableROHashInit (uint8_t hash_bits, uint16_t item_size)
 initialize a new rohash More...
 
int ROHashInitFinalize (ROHashTable *table)
 create final hash data structure More...
 
void ROHashFree (ROHashTable *table)
 
int ROHashInitQueueValue (ROHashTable *table, void *value, uint16_t size)
 Add a new value to the hash. More...
 
uint32_t ROHashMemorySize (ROHashTable *table)
 
void * ROHashLookup (ROHashTable *table, void *data, uint16_t size)
 

Detailed Description

Typedef Documentation

◆ ROHashTable

typedef struct ROHashTable_ ROHashTable

Function Documentation

◆ ROHashFree()

void ROHashFree ( ROHashTable table)

Definition at line 91 of file util-rohash.c.

References ROHashTable_::data, and SCFree.

Referenced by DetectFileHashFree().

Here is the caller graph for this function:

◆ ROHashInit()

ROHashTable* ROHashInit ( uint8_t  hash_bits,
uint16_t  item_size 
)

initialize a new rohash

Parameters
hash_bitshash size as 2^hash_bits, so power of 2, max 31
item_sizesize of the data to store
Return values
tableptr 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.

◆ ROHashInitFinalize()

int ROHashInitFinalize ( ROHashTable table)

create final hash data structure

Parameters
tablethe hash table
Return values
0error
1ok
Note
after this call the nothing can be added to the hash anymore.

Definition at line 182 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.

Here is the call graph for this function:

◆ ROHashInitQueueValue()

int ROHashInitQueueValue ( ROHashTable table,
void *  value,
uint16_t  size 
)

Add a new value to the hash.

Note
can only be done when table isn't in a locked state yet
Parameters
tablethe hash table
valuevalue to add
sizevalue size. MUST match table item_size
Return values
0error
1ok

Definition at line 152 of file util-rohash.c.

References ROHashTable_::item_size, ROHashTable_::locked, next, SCCalloc, SCLogError, and TAILQ_INSERT_TAIL.

Referenced by LoadHashTable().

Here is the caller graph for this function:

◆ ROHashLookup()

void* ROHashLookup ( ROHashTable table,
void *  data,
uint16_t  size 
)
Return values
NULLnot found
ptrfound

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.

Here is the call graph for this function:

◆ ROHashMemorySize()

uint32_t ROHashMemorySize ( ROHashTable table)