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
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)
struct PrefilterEngineFlowbits __attribute__
DNP3 application header.
struct IPPairConfig_ IPPairConfig
void IPPairClearMemory(IPPair *)
void IPPairUnlock(IPPair *)
IPPairHashRow * ippair_hash
int IPPairSetMemcap(uint64_t size)
Update memcap value.
IPPair * IPPairLookupIPPairFromHash(Address *, Address *)
look up a ippair in the hash
void IPPairCleanup(void)
Cleanup the ippair engine.
void IPPairMoveToSpare(IPPair *)
void IPPairRegisterUnittests(void)
void IPPairInitConfig(bool quiet)
initialize the configuration
IPPair * IPPairGetIPPairFromHash(Address *, Address *)
void IPPairRelease(IPPair *)
void IPPairFree(IPPair *)
IPPairConfig ippair_config
void IPPairShutdown(void)
shutdown the flow engine
uint64_t IPPairGetMemuse(void)
Return memuse value.
void IPPairPrintStats(void)
print some ippair stats
IPPair * IPPairAlloc(void)
uint64_t IPPairGetMemcap(void)
Return memcap value.
SC_ATOMIC_DECLARE(uint64_t, memcap)
SC_ATOMIC_DECLARE(unsigned int, use_cnt)
#define SC_ATOMIC_EXTERN(type, name)
wrapper for referencing an atomic variable declared on another file.