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
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; \
struct PrefilterEngineFlowbits __attribute__
DNP3 application header.
void HostMoveToSpare(Host *)
Host * HostGetHostFromHash(Address *)
uint64_t HostGetMemcap(void)
Return memcap value.
Host * HostLookupHostFromHash(Address *)
look up a host in the hash
void HostCleanup(void)
Cleanup the host engine.
int HostSetMemcap(uint64_t)
Update memcap value.
void HostShutdown(void)
shutdown the flow engine
uint64_t HostGetMemuse(void)
Return memuse value.
struct HostConfig_ HostConfig
void HostPrintStats(void)
print some host stats
void HostInitConfig(bool quiet)
initialize the configuration
void HostClearMemory(Host *)
void HostRegisterUnittests(void)
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.