suricata
|
Go to the source code of this file.
Data Structures | |
struct | Host_ |
struct | HostHashRow_ |
struct | HostConfig_ |
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 | HOST_VERBOSE 0 |
#define | HOST_QUIET 1 |
#define | HOST_CHECK_MEMCAP(size) ((((uint64_t)SC_ATOMIC_GET(host_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(host_config.memcap))) |
check if a memory alloc would fit in the memcap | |
#define | HostIncrUsecnt(h) (void)SC_ATOMIC_ADD((h)->use_cnt, 1) |
#define | HostDecrUsecnt(h) (void)SC_ATOMIC_SUB((h)->use_cnt, 1) |
#define | HostReference(dst_h_ptr, h) |
#define | HostDeReference(src_h_ptr) |
Typedefs | |
typedef struct Host_ | Host |
typedef struct HostConfig_ | HostConfig |
Functions | |
struct HostHashRow_ | __attribute__ ((aligned(CLS))) HostHashRow |
SC_ATOMIC_EXTERN (uint64_t, host_memuse) | |
SC_ATOMIC_EXTERN (uint32_t, host_counter) | |
SC_ATOMIC_EXTERN (uint32_t, host_prune_idx) | |
void | HostInitConfig (bool quiet) |
initialize the configuration | |
void | HostShutdown (void) |
shutdown the flow engine | |
void | HostCleanup (void) |
Cleanup the host engine. | |
Host * | HostLookupHostFromHash (Address *) |
look up a host in the hash | |
Host * | HostGetHostFromHash (Address *) |
void | HostRelease (Host *) |
void | HostLock (Host *) |
void | HostClearMemory (Host *) |
void | HostMoveToSpare (Host *) |
void | HostPrintStats (void) |
print some host stats | |
void | HostRegisterUnittests (void) |
Host * | HostAlloc (void) |
void | HostFree (Host *) |
void | HostUnlock (Host *h) |
int | HostSetMemcap (uint64_t) |
Update memcap value. | |
uint64_t | HostGetMemcap (void) |
Return memcap value. | |
uint64_t | HostGetMemuse (void) |
Return memuse value. | |
Variables | |
HRLOCK_TYPE | lock |
Host * | head |
Host * | tail |
HostHashRow * | host_hash |
HostConfig | host_config |
Definition in file host.h.
#define HOST_CHECK_MEMCAP | ( | size | ) | ((((uint64_t)SC_ATOMIC_GET(host_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(host_config.memcap))) |
#define HostDecrUsecnt | ( | h | ) | (void)SC_ATOMIC_SUB((h)->use_cnt, 1) |
#define HostDeReference | ( | src_h_ptr | ) |
#define HostIncrUsecnt | ( | h | ) | (void)SC_ATOMIC_ADD((h)->use_cnt, 1) |
#define HostReference | ( | dst_h_ptr, | |
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_TRYLOCK | ( | fb | ) | SCMutexTrylock(&(fb)->lock) |
#define HRLOCK_UNLOCK | ( | fb | ) | SCMutexUnlock(&(fb)->lock) |
typedef struct HostConfig_ HostConfig |
struct HostHashRow_ __attribute__ | ( | (aligned(CLS)) | ) |
Definition at line 2092 of file tm-threads.c.
Host * HostAlloc | ( | void | ) |
Definition at line 106 of file host.c.
References HOST_CHECK_MEMCAP, Host_::m, SC_ATOMIC_ADD, SC_ATOMIC_INIT, SCCalloc, SCMutexInit, and unlikely.
Referenced by HostInitConfig().
void HostCleanup | ( | void | ) |
Cleanup the host engine.
Cleanup the host engine from tag and threshold.
Definition at line 332 of file host.c.
References HostConfig_::hash_size, Host_::hnext, host_config, host_hash, HostClearMemory(), HostFreeStorage(), HostMoveToSpare(), Host_::hprev, HRLOCK_LOCK, HRLOCK_UNLOCK, Host_::iprep, and SC_ATOMIC_GET.
Referenced by PostRunDeinit().
void HostClearMemory | ( | Host * | h | ) |
Definition at line 150 of file host.c.
References BUG_ON, HostFreeStorage(), HostStorageSize(), Host_::iprep, SC_ATOMIC_GET, and SRepFreeHostData().
Referenced by HostCleanup(), and HostFree().
void HostFree | ( | Host * | h | ) |
Definition at line 125 of file host.c.
References HostClearMemory(), Host_::m, SC_ATOMIC_SUB, SCFree, and SCMutexDestroy.
Referenced by HostShutdown().
Definition at line 486 of file host.c.
References Host_::hnext, host_hash, HostIncrUsecnt, Host_::hprev, HRLOCK_LOCK, HRLOCK_UNLOCK, Host_::m, and SCMutexLock.
Referenced by SRepLoadFileFromFD(), and TagHashAddTag().
uint64_t HostGetMemcap | ( | void | ) |
Return memcap value.
memcap | value |
Definition at line 83 of file host.c.
References host_config, and SC_ATOMIC_GET.
Referenced by AppLayerRegisterGlobalCounters().
uint64_t HostGetMemuse | ( | void | ) |
Return memuse value.
memuse | value |
Definition at line 94 of file host.c.
References SC_ATOMIC_GET.
Referenced by AppLayerRegisterGlobalCounters().
void HostInitConfig | ( | bool | quiet | ) |
initialize the configuration
set config values for memcap, prealloc and hash_size
Definition at line 168 of file host.c.
References CLS, DEBUG_VALIDATE_BUG_ON, FatalError, HostConfig_::hash_rand, HostConfig_::hash_size, HOST_CHECK_MEMCAP, host_config, HOST_DEFAULT_HASHSIZE, HOST_DEFAULT_MEMCAP, HOST_DEFAULT_PREALLOC, host_hash, HostAlloc(), HostEnqueue(), HostQueueInit(), HostStorageSize(), HRLOCK_INIT, HostQueue_::len, ParseSizeStringU64(), HostConfig_::prealloc, RandomGet(), SC_ATOMIC_ADD, SC_ATOMIC_GET, SC_ATOMIC_INIT, SC_ATOMIC_SET, SCConfGet(), SCLogConfig, SCLogDebug, SCLogError, SCMallocAligned, StringParseUint32(), unlikely, and WarnInvalidConfEntry.
Referenced by PostConfLoadedSetup().
void HostLock | ( | Host * | h | ) |
Definition at line 467 of file host.c.
References Host_::m, and SCMutexLock.
look up a host in the hash
a | address to look up |
h | LOCKED host or NULL |
Definition at line 585 of file host.c.
References Host_::hnext, host_hash, HostIncrUsecnt, Host_::hprev, HRLOCK_LOCK, HRLOCK_UNLOCK, Host_::m, and SCMutexLock.
void HostMoveToSpare | ( | Host * | h | ) |
Definition at line 100 of file host.c.
References HostEnqueue(), and SC_ATOMIC_SUB.
Referenced by HostCleanup().
void HostPrintStats | ( | void | ) |
print some host stats
Definition at line 284 of file host.c.
References host_config, SC_ATOMIC_GET, and SCLogPerf.
Referenced by HostShutdown(), and SRepInit().
void HostRegisterUnittests | ( | void | ) |
Definition at line 717 of file host.c.
References RegisterHostStorageTests().
void HostRelease | ( | Host * | h | ) |
Definition at line 461 of file host.c.
References HostDecrUsecnt, Host_::m, and SCMutexUnlock.
Referenced by SRepLoadFileFromFD(), and TagHashAddTag().
int HostSetMemcap | ( | uint64_t | size | ) |
Update memcap value.
size | new memcap value |
Definition at line 68 of file host.c.
References host_config, SC_ATOMIC_GET, and SC_ATOMIC_SET.
void HostShutdown | ( | void | ) |
shutdown the flow engine
Definition at line 296 of file host.c.
References HostConfig_::hash_size, Host_::hnext, host_config, host_hash, HostDequeue(), HostFree(), HostPrintStats(), HostQueueDestroy(), HRLOCK_DESTROY, SC_ATOMIC_SUB, and SCFreeAligned.
Referenced by GlobalsDestroy().
void HostUnlock | ( | Host * | h | ) |
Definition at line 472 of file host.c.
References Host_::m, and SCMutexUnlock.
Referenced by TagHandlePacket().
SC_ATOMIC_EXTERN | ( | uint32_t | , |
host_counter | |||
) |
SC_ATOMIC_EXTERN | ( | uint32_t | , |
host_prune_idx | |||
) |
SC_ATOMIC_EXTERN | ( | uint64_t | , |
host_memuse | |||
) |
|
extern |
Definition at line 53 of file host.c.
Referenced by HostCleanup(), HostGetMemcap(), HostInitConfig(), HostPrintStats(), HostSetMemcap(), HostShutdown(), and HostTimeoutHash().
|
extern |
host hash table
Definition at line 50 of file host.c.
Referenced by HostCleanup(), HostGetHostFromHash(), HostInitConfig(), HostLookupHostFromHash(), HostShutdown(), and HostTimeoutHash().
HRLOCK_TYPE lock |
Definition at line 0 of file host.h.
Referenced by TmqhOutputPacketpool().
Host* tail |
Definition at line 2 of file host.h.
Referenced by FlowSparePoolUpdate().