Go to the documentation of this file.
24 #ifndef SURICATA_IPPAIR_H
25 #define SURICATA_IPPAIR_H
36 #error Cannot enable both HRLOCK_SPIN and HRLOCK_MUTEX
41 #define HRLOCK_TYPE SCSpinlock
42 #define HRLOCK_INIT(fb) SCSpinInit(&(fb)->lock, 0)
43 #define HRLOCK_DESTROY(fb) SCSpinDestroy(&(fb)->lock)
44 #define HRLOCK_LOCK(fb) SCSpinLock(&(fb)->lock)
45 #define HRLOCK_TRYLOCK(fb) SCSpinTrylock(&(fb)->lock)
46 #define HRLOCK_UNLOCK(fb) SCSpinUnlock(&(fb)->lock)
47 #elif defined HRLOCK_MUTEX
48 #define HRLOCK_TYPE SCMutex
49 #define HRLOCK_INIT(fb) SCMutexInit(&(fb)->lock, NULL)
50 #define HRLOCK_DESTROY(fb) SCMutexDestroy(&(fb)->lock)
51 #define HRLOCK_LOCK(fb) SCMutexLock(&(fb)->lock)
52 #define HRLOCK_TRYLOCK(fb) SCMutexTrylock(&(fb)->lock)
53 #define HRLOCK_UNLOCK(fb) SCMutexUnlock(&(fb)->lock)
55 #error Enable HRLOCK_SPIN or HRLOCK_MUTEX
89 #define IPPAIR_QUIET 1
105 #define IPPAIR_CHECK_MEMCAP(size) \
106 ((((uint64_t)SC_ATOMIC_GET(ippair_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(ippair_config.memcap)))
108 #define IPPairIncrUsecnt(h) \
109 (void)SC_ATOMIC_ADD((h)->use_cnt, 1)
110 #define IPPairDecrUsecnt(h) \
111 (void)SC_ATOMIC_SUB((h)->use_cnt, 1)
int IPPairSetMemcap(uint64_t size)
Update memcap value.
void IPPairMoveToSpare(IPPair *)
struct IPPairHashRow_ __attribute__((aligned(CLS))) IPPairHashRow
uint64_t IPPairGetMemuse(void)
Return memuse value.
IPPairHashRow * ippair_hash
IPPairConfig ippair_config
void IPPairClearMemory(IPPair *)
struct IPPairConfig_ IPPairConfig
void IPPairPrintStats(void)
print some ippair stats
void IPPairFree(IPPair *)
void IPPairRegisterUnittests(void)
void IPPairUnlock(IPPair *)
SC_ATOMIC_DECLARE(uint64_t, memcap)
IPPair * IPPairAlloc(void)
void IPPairRelease(IPPair *)
uint64_t IPPairGetMemcap(void)
Return memcap value.
SC_ATOMIC_EXTERN(uint64_t, ippair_memuse)
void IPPairCleanup(void)
Cleanup the ippair engine.
void IPPairInitConfig(bool quiet)
initialize the configuration
SC_ATOMIC_DECLARE(unsigned int, use_cnt)
IPPair * IPPairLookupIPPairFromHash(Address *, Address *)
look up a ippair in the hash
IPPair * IPPairGetIPPairFromHash(Address *, Address *)
void IPPairShutdown(void)
shutdown the flow engine