suricata
|
#include "suricata-common.h"
#include "util-hashlist.h"
#include "util-unittest.h"
#include "util-debug.h"
#include "util-memcmp.h"
Go to the source code of this file.
Functions | |
HashListTable * | HashListTableInit (uint32_t size, uint32_t(*Hash)(struct HashListTable_ *, void *, uint16_t), char(*Compare)(void *, uint16_t, void *, uint16_t), void(*Free)(void *)) |
void | HashListTableFree (HashListTable *ht) |
int | HashListTableAdd (HashListTable *ht, void *data, uint16_t datalen) |
int | HashListTableRemove (HashListTable *ht, void *data, uint16_t datalen) |
char | HashListTableDefaultCompare (void *data1, uint16_t len1, void *data2, uint16_t len2) |
void * | HashListTableLookup (HashListTable *ht, void *data, uint16_t datalen) |
uint32_t | HashListTableGenericHash (HashListTable *ht, void *data, uint16_t datalen) |
HashListTableBucket * | HashListTableGetListHead (HashListTable *ht) |
void | HashListTableRegisterTests (void) |
Chained hash table implementation
The 'Free' pointer can be used to have the API free your hashed data. If it's NULL it's the callers responsibility
Definition in file util-hashlist.c.
int HashListTableAdd | ( | HashListTable * | ht, |
void * | data, | ||
uint16_t | datalen | ||
) |
Definition at line 114 of file util-hashlist.c.
References HashListTable_::array, HashListTableBucket_::bucknext, HashListTableBucket_::data, HashListTable_::Hash, HashListTable_::listhead, HashListTableBucket_::listnext, HashListTableBucket_::listprev, HashListTable_::listtail, SCCalloc, SCLogDebug, HashListTableBucket_::size, and unlikely.
Referenced by DetectEngineBufferTypeGetByIdTransforms(), DetectPortHashAdd(), and SigGroupHeadHashAdd().
char HashListTableDefaultCompare | ( | void * | data1, |
uint16_t | len1, | ||
void * | data2, | ||
uint16_t | len2 | ||
) |
Definition at line 234 of file util-hashlist.c.
References SCMemcmp.
Referenced by HashListTableInit().
void HashListTableFree | ( | HashListTable * | ht | ) |
Definition at line 88 of file util-hashlist.c.
References HashListTable_::array, HashListTable_::array_size, HashListTableBucket_::bucknext, HashListTableBucket_::data, HashListTable_::Free, and SCFree.
Referenced by DetectAddressMapFree(), DetectParseDupSigHashFree(), DetectPortHashFree(), DumpPatterns(), MpmStoreFree(), PrefilterDeinit(), and SigGroupHeadHashFree().
uint32_t HashListTableGenericHash | ( | HashListTable * | ht, |
void * | data, | ||
uint16_t | datalen | ||
) |
Definition at line 270 of file util-hashlist.c.
References HashListTable_::array_size.
HashListTableBucket* HashListTableGetListHead | ( | HashListTable * | ht | ) |
Definition at line 287 of file util-hashlist.c.
References HashListTable_::listhead.
Referenced by DumpPatterns(), FeatureDump(), and MpmStoreReportStats().
HashListTable* HashListTableInit | ( | uint32_t | size, |
uint32_t(*)(struct HashListTable_ *, void *, uint16_t) | Hash, | ||
char(*)(void *, uint16_t, void *, uint16_t) | Compare, | ||
void(*)(void *) | Free | ||
) |
Definition at line 35 of file util-hashlist.c.
References HashListTable_::array, HashListTable_::array_size, HashTable_::Compare, HashListTable_::Compare, HashTable_::Free, HashListTable_::Free, HashTable_::Hash, HashListTable_::Hash, HashListTableDefaultCompare(), HashListTable_::listhead, HashListTable_::listtail, SC_EINVAL, SC_ENOMEM, sc_errno, SC_OK, SCCalloc, SCFree, and unlikely.
Referenced by DetectAddressMapInit(), DetectParseDupSigHashInit(), DetectPortHashInit(), DetectRegisterThreadCtxFuncs(), DetectSetFastPatternAndItsId(), EngineAnalysisAddAllRulePatterns(), MpmStoreInit(), PrefilterInit(), and SigGroupHeadHashInit().
void* HashListTableLookup | ( | HashListTable * | ht, |
void * | data, | ||
uint16_t | datalen | ||
) |
Definition at line 245 of file util-hashlist.c.
References HashListTable_::array, HashListTableBucket_::bucknext, HashListTable_::Compare, HashListTableBucket_::data, HashListTable_::Hash, SCLogDebug, and HashListTableBucket_::size.
Referenced by DetectEngineBufferTypeGetById(), DetectEngineBufferTypeGetByIdTransforms(), DetectPortHashLookup(), SigGroupHeadHashLookup(), VarNameStoreLookupById(), and VarNameStoreLookupByName().
void HashListTableRegisterTests | ( | void | ) |
Definition at line 498 of file util-hashlist.c.
References UtRegisterTest().
int HashListTableRemove | ( | HashListTable * | ht, |
void * | data, | ||
uint16_t | datalen | ||
) |
Definition at line 154 of file util-hashlist.c.
References HashListTable_::array, HashListTableBucket_::bucknext, HashListTable_::Compare, HashListTableBucket_::data, HashListTable_::Free, HashListTable_::Hash, HashListTable_::listhead, HashListTableBucket_::listnext, HashListTableBucket_::listprev, HashListTable_::listtail, SCFree, SCLogDebug, and HashListTableBucket_::size.
Referenced by DetectUnregisterThreadCtxFuncs().