Go to the documentation of this file.
24 #ifndef SURICATA_HOST_H
25 #define SURICATA_HOST_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
92 #define HOST_VERBOSE 0
109 #define HOST_CHECK_MEMCAP(size) \
110 ((((uint64_t)SC_ATOMIC_GET(host_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(host_config.memcap)))
112 #define HostIncrUsecnt(h) \
113 (void)SC_ATOMIC_ADD((h)->use_cnt, 1)
114 #define HostDecrUsecnt(h) \
115 (void)SC_ATOMIC_SUB((h)->use_cnt, 1)
117 #define HostReference(dst_h_ptr, h) do { \
119 HostIncrUsecnt((h)); \
124 #define HostDeReference(src_h_ptr) do { \
125 if (*(src_h_ptr) != NULL) { \
126 HostDecrUsecnt(*(src_h_ptr)); \
127 *(src_h_ptr) = NULL; \
Host * HostLookupHostFromHash(Address *)
look up a host in the hash
SC_ATOMIC_DECLARE(unsigned int, use_cnt)
struct HostConfig_ HostConfig
void HostCleanup(void)
Cleanup the host engine.
SC_ATOMIC_DECLARE(uint64_t, memcap)
void HostInitConfig(bool quiet)
initialize the configuration
struct HostHashRow_ __attribute__((aligned(CLS))) HostHashRow
void HostPrintStats(void)
print some host stats
void HostRegisterUnittests(void)
uint64_t HostGetMemcap(void)
Return memcap value.
SC_ATOMIC_EXTERN(uint64_t, host_memuse)
int HostSetMemcap(uint64_t)
Update memcap value.
void HostShutdown(void)
shutdown the flow engine
void HostClearMemory(Host *)
Host * HostGetHostFromHash(Address *)
uint64_t HostGetMemuse(void)
Return memuse value.
void HostMoveToSpare(Host *)