suricata
|
Go to the source code of this file.
Data Structures | |
struct | IPPair_ |
struct | IPPairHashRow_ |
struct | IPPairConfig_ |
Macros | |
#define | HRLOCK_MUTEX |
#define | HRLOCK_TYPE SCMutex |
#define | HRLOCK_INIT(fb) SCMutexInit(&(fb)->lock, NULL) |
#define | HRLOCK_DESTROY(fb) SCMutexDestroy(&(fb)->lock) |
#define | HRLOCK_LOCK(fb) SCMutexLock(&(fb)->lock) |
#define | HRLOCK_TRYLOCK(fb) SCMutexTrylock(&(fb)->lock) |
#define | HRLOCK_UNLOCK(fb) SCMutexUnlock(&(fb)->lock) |
#define | IPPAIR_QUIET 1 |
#define | IPPAIR_CHECK_MEMCAP(size) ((((uint64_t)SC_ATOMIC_GET(ippair_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(ippair_config.memcap))) |
check if a memory alloc would fit in the memcap More... | |
#define | IPPairIncrUsecnt(h) (void)SC_ATOMIC_ADD((h)->use_cnt, 1) |
#define | IPPairDecrUsecnt(h) (void)SC_ATOMIC_SUB((h)->use_cnt, 1) |
Typedefs | |
typedef struct IPPair_ | IPPair |
typedef struct IPPairConfig_ | IPPairConfig |
Functions | |
struct IPPairHashRow_ | __attribute__ ((aligned(CLS))) IPPairHashRow |
SC_ATOMIC_EXTERN (uint64_t, ippair_memuse) | |
SC_ATOMIC_EXTERN (uint32_t, ippair_counter) | |
SC_ATOMIC_EXTERN (uint32_t, ippair_prune_idx) | |
void | IPPairInitConfig (bool quiet) |
initialize the configuration More... | |
void | IPPairShutdown (void) |
shutdown the flow engine More... | |
void | IPPairCleanup (void) |
Cleanup the ippair engine. More... | |
IPPair * | IPPairLookupIPPairFromHash (Address *, Address *) |
look up a ippair in the hash More... | |
IPPair * | IPPairGetIPPairFromHash (Address *, Address *) |
void | IPPairRelease (IPPair *) |
void | IPPairClearMemory (IPPair *) |
void | IPPairMoveToSpare (IPPair *) |
void | IPPairPrintStats (void) |
print some ippair stats More... | |
void | IPPairRegisterUnittests (void) |
IPPair * | IPPairAlloc (void) |
void | IPPairFree (IPPair *) |
void | IPPairUnlock (IPPair *) |
int | IPPairSetMemcap (uint64_t size) |
Update memcap value. More... | |
uint64_t | IPPairGetMemcap (void) |
Return memcap value. More... | |
uint64_t | IPPairGetMemuse (void) |
Return memuse value. More... | |
Variables | |
HRLOCK_TYPE | lock |
IPPair * | head |
IPPair * | tail |
IPPairHashRow * | ippair_hash |
IPPairConfig | ippair_config |
Definition in file ippair.h.
#define HRLOCK_DESTROY | ( | fb | ) | SCMutexDestroy(&(fb)->lock) |
#define HRLOCK_INIT | ( | fb | ) | SCMutexInit(&(fb)->lock, NULL) |
#define HRLOCK_LOCK | ( | fb | ) | SCMutexLock(&(fb)->lock) |
#define HRLOCK_MUTEX |
#define HRLOCK_TRYLOCK | ( | fb | ) | SCMutexTrylock(&(fb)->lock) |
#define HRLOCK_UNLOCK | ( | fb | ) | SCMutexUnlock(&(fb)->lock) |
#define IPPAIR_CHECK_MEMCAP | ( | size | ) | ((((uint64_t)SC_ATOMIC_GET(ippair_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(ippair_config.memcap))) |
#define IPPairDecrUsecnt | ( | h | ) | (void)SC_ATOMIC_SUB((h)->use_cnt, 1) |
#define IPPairIncrUsecnt | ( | h | ) | (void)SC_ATOMIC_ADD((h)->use_cnt, 1) |
typedef struct IPPairConfig_ IPPairConfig |
struct IPPairHashRow_ __attribute__ | ( | (aligned(CLS)) | ) |
IPPair* IPPairAlloc | ( | void | ) |
Definition at line 104 of file ippair.c.
References IPPAIR_CHECK_MEMCAP.
void IPPairCleanup | ( | void | ) |
Cleanup the ippair engine.
Cleanup the ippair engine from tag and threshold.
Definition at line 330 of file ippair.c.
References IPPairConfig_::hash_size, IPPair_::hnext, IPPair_::hprev, HRLOCK_LOCK, HRLOCK_UNLOCK, ippair_config, ippair_hash, IPPairClearMemory(), IPPairFreeStorage(), IPPairMoveToSpare(), and SC_ATOMIC_GET.
void IPPairClearMemory | ( | IPPair * | ) |
Definition at line 150 of file ippair.c.
References IPPairFreeStorage(), and IPPairStorageSize().
Referenced by IPPairCleanup(), and IPPairFree().
void IPPairFree | ( | IPPair * | ) |
Definition at line 124 of file ippair.c.
References IPPairClearMemory(), IPPair_::m, SC_ATOMIC_SUB, SCFree, and SCMutexDestroy.
uint64_t IPPairGetMemcap | ( | void | ) |
Return memcap value.
memcap | value |
Definition at line 81 of file ippair.c.
References ippair_config, and SC_ATOMIC_GET.
uint64_t IPPairGetMemuse | ( | void | ) |
Return memuse value.
memuse | value |
Definition at line 92 of file ippair.c.
References SC_ATOMIC_GET.
Referenced by AppLayerRegisterGlobalCounters().
void IPPairInitConfig | ( | bool | quiet | ) |
initialize the configuration
set config values for memcap, prealloc and hash_size
Definition at line 162 of file ippair.c.
References DEBUG_VALIDATE_BUG_ON, IPPairStorageSize(), and SCLogDebug.
Referenced by PreRunInit(), and StreamTcpUTInit().
void IPPairMoveToSpare | ( | IPPair * | ) |
Definition at line 98 of file ippair.c.
References IPPairEnqueue().
Referenced by IPPairCleanup().
void IPPairPrintStats | ( | void | ) |
print some ippair stats
Definition at line 281 of file ippair.c.
References ippair_config, SC_ATOMIC_GET, and SCLogPerf.
Referenced by IPPairShutdown().
void IPPairRegisterUnittests | ( | void | ) |
Definition at line 755 of file ippair.c.
References RegisterIPPairStorageTests().
void IPPairRelease | ( | IPPair * | ) |
Definition at line 505 of file ippair.c.
References IPPairDecrUsecnt, IPPair_::m, and SCMutexUnlock.
int IPPairSetMemcap | ( | uint64_t | size | ) |
Update memcap value.
size | new memcap value |
Definition at line 66 of file ippair.c.
References ippair_config, SC_ATOMIC_GET, and SC_ATOMIC_SET.
void IPPairShutdown | ( | void | ) |
shutdown the flow engine
Definition at line 293 of file ippair.c.
References IPPairDequeue(), and IPPairPrintStats().
void IPPairUnlock | ( | IPPair * | ) |
Definition at line 511 of file ippair.c.
References IPPair_::m, and SCMutexUnlock.
SC_ATOMIC_EXTERN | ( | uint32_t | , |
ippair_counter | |||
) |
SC_ATOMIC_EXTERN | ( | uint32_t | , |
ippair_prune_idx | |||
) |
SC_ATOMIC_EXTERN | ( | uint64_t | , |
ippair_memuse | |||
) |
IPPairConfig ippair_config |
Definition at line 52 of file ippair.c.
Referenced by IPPairCleanup(), IPPairGetMemcap(), IPPairPrintStats(), IPPairSetMemcap(), and IPPairTimeoutHash().
IPPairHashRow* ippair_hash |
ippair hash table
Definition at line 49 of file ippair.c.
Referenced by IPPairCleanup(), and IPPairTimeoutHash().
HRLOCK_TYPE lock |