|
suricata
|
#include "suricata-common.h"#include "conf.h"#include "util-debug.h"#include "ippair.h"#include "ippair-storage.h"#include "util-random.h"#include "util-misc.h"#include "util-byte.h"#include "util-validate.h"#include "ippair-queue.h"#include "detect-tag.h"#include "detect-engine-tag.h"#include "detect-engine-threshold.h"#include "util-hash-lookup3.h"
Go to the source code of this file.
Macros | |
| #define | IPPAIR_DEFAULT_HASHSIZE 4096 |
| #define | IPPAIR_DEFAULT_MEMCAP 16777216 |
| #define | IPPAIR_DEFAULT_PREALLOC 1000 |
Functions | |
| SC_ATOMIC_DECLARE (uint64_t, ippair_memuse) | |
| SC_ATOMIC_DECLARE (uint32_t, ippair_counter) | |
| SC_ATOMIC_DECLARE (uint32_t, ippair_prune_idx) | |
| int | IPPairSetMemcap (uint64_t size) |
| Update memcap value. | |
| uint64_t | IPPairGetMemcap (void) |
| Return memcap value. | |
| uint64_t | IPPairGetMemuse (void) |
| Return memuse value. | |
| void | IPPairMoveToSpare (IPPair *h) |
| IPPair * | IPPairAlloc (void) |
| void | IPPairFree (IPPair *h) |
| void | IPPairClearMemory (IPPair *h) |
| void | IPPairInitConfig (bool quiet) |
| initialize the configuration | |
| void | IPPairPrintStats (void) |
| print some ippair stats | |
| void | IPPairShutdown (void) |
| shutdown the flow engine | |
| void | IPPairCleanup (void) |
| Cleanup the ippair engine. | |
| void | IPPairRelease (IPPair *h) |
| void | IPPairUnlock (IPPair *h) |
| IPPair * | IPPairGetIPPairFromHash (Address *a, Address *b) |
| IPPair * | IPPairLookupIPPairFromHash (Address *a, Address *b) |
| look up a ippair in the hash | |
| void | IPPairRegisterUnittests (void) |
Variables | |
| IPPairHashRow * | ippair_hash |
| IPPairConfig | ippair_config |
Information about ippairs.
Definition in file ippair.c.
| IPPair * IPPairAlloc | ( | void | ) |
Definition at line 104 of file ippair.c.
References IPPAIR_CHECK_MEMCAP, IPPair_::m, SC_ATOMIC_ADD, SC_ATOMIC_INIT, SCCalloc, SCMutexInit, and unlikely.
Referenced by IPPairInitConfig().

| void IPPairCleanup | ( | void | ) |
Cleanup the ippair engine.
Cleanup the ippair engine from tag and threshold.
Definition at line 327 of file ippair.c.
References IPPairConfig_::hash_size, IPPair_::hnext, IPPair_::hprev, HRLOCK_LOCK, HRLOCK_UNLOCK, ippair_config, ippair_hash, IPPairClearMemory(), IPPairFreeStorage(), IPPairMoveToSpare(), and SC_ATOMIC_GET.

| void IPPairClearMemory | ( | IPPair * | h | ) |
Definition at line 150 of file ippair.c.
References IPPairFreeStorage(), and IPPairStorageSize().
Referenced by IPPairCleanup(), and IPPairFree().


| void IPPairFree | ( | IPPair * | h | ) |
Definition at line 124 of file ippair.c.
References IPPairClearMemory(), IPPair_::m, SC_ATOMIC_SUB, SCFree, and SCMutexDestroy.
Referenced by IPPairShutdown().


Definition at line 521 of file ippair.c.
References IPPair_::hnext, IPPair_::hprev, HRLOCK_LOCK, HRLOCK_UNLOCK, ippair_hash, IPPairIncrUsecnt, IPPair_::m, and SCMutexLock.
Referenced by AppLayerExpectationCreate().

| uint64_t IPPairGetMemcap | ( | void | ) |
Return memcap value.
| memcap | value |
Definition at line 81 of file ippair.c.
References ippair_config, and SC_ATOMIC_GET.
| uint64_t IPPairGetMemuse | ( | void | ) |
Return memuse value.
| memuse | value |
Definition at line 92 of file ippair.c.
References SC_ATOMIC_GET.
Referenced by AppLayerRegisterGlobalCounters().

| void IPPairInitConfig | ( | bool | quiet | ) |
initialize the configuration
set config values for memcap, prealloc and hash_size
Definition at line 162 of file ippair.c.
References CLS, DEBUG_VALIDATE_BUG_ON, FatalError, IPPairConfig_::hash_rand, IPPairConfig_::hash_size, HRLOCK_INIT, IPPAIR_CHECK_MEMCAP, ippair_config, IPPAIR_DEFAULT_HASHSIZE, IPPAIR_DEFAULT_MEMCAP, IPPAIR_DEFAULT_PREALLOC, ippair_hash, IPPairAlloc(), IPPairEnqueue(), IPPairQueueInit(), IPPairStorageSize(), IPPairQueue_::len, ParseSizeStringU64(), IPPairConfig_::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 PreRunInit(), and StreamTcpUTInit().


look up a ippair in the hash
| a | address to look up |
| h | LOCKED ippair or NULL |
Definition at line 620 of file ippair.c.
References IPPair_::hnext, IPPair_::hprev, HRLOCK_LOCK, HRLOCK_UNLOCK, ippair_hash, IPPairIncrUsecnt, IPPair_::m, and SCMutexLock.
| void IPPairMoveToSpare | ( | IPPair * | h | ) |
Definition at line 98 of file ippair.c.
References IPPairEnqueue(), and SC_ATOMIC_SUB.
Referenced by IPPairCleanup().


| void IPPairPrintStats | ( | void | ) |
print some ippair stats
Definition at line 278 of file ippair.c.
References ippair_config, SC_ATOMIC_GET, and SCLogPerf.
Referenced by IPPairShutdown().

| void IPPairRegisterUnittests | ( | void | ) |
Definition at line 752 of file ippair.c.
References RegisterIPPairStorageTests().

| void IPPairRelease | ( | IPPair * | h | ) |
Definition at line 502 of file ippair.c.
References IPPairDecrUsecnt, IPPair_::m, and SCMutexUnlock.
Referenced by AppLayerExpectationClean(), AppLayerExpectationCreate(), and AppLayerExpectationHandle().

| int IPPairSetMemcap | ( | uint64_t | size | ) |
Update memcap value.
| size | new memcap value |
Definition at line 66 of file ippair.c.
References ippair_config, SC_ATOMIC_GET, and SC_ATOMIC_SET.
| void IPPairShutdown | ( | void | ) |
shutdown the flow engine
Definition at line 290 of file ippair.c.
References BUG_ON, IPPairConfig_::hash_size, IPPair_::hnext, HRLOCK_DESTROY, ippair_config, ippair_hash, IPPairDequeue(), IPPairFree(), IPPairPrintStats(), IPPairQueueDestroy(), SC_ATOMIC_GET, SC_ATOMIC_SUB, and SCFreeAligned.
Referenced by PostRunDeinit().


| void IPPairUnlock | ( | IPPair * | h | ) |
Definition at line 508 of file ippair.c.
References IPPair_::m, and SCMutexUnlock.
Referenced by AppLayerExpectationCreate().

| SC_ATOMIC_DECLARE | ( | uint32_t | , |
| ippair_counter | |||
| ) |
| SC_ATOMIC_DECLARE | ( | uint32_t | , |
| ippair_prune_idx | |||
| ) |
| SC_ATOMIC_DECLARE | ( | uint64_t | , |
| ippair_memuse | |||
| ) |
| IPPairConfig ippair_config |
Definition at line 52 of file ippair.c.
Referenced by IPPairCleanup(), IPPairGetMemcap(), IPPairInitConfig(), IPPairPrintStats(), IPPairSetMemcap(), IPPairShutdown(), and IPPairTimeoutHash().
| IPPairHashRow* ippair_hash |
ippair hash table
Definition at line 49 of file ippair.c.
Referenced by IPPairCleanup(), IPPairGetIPPairFromHash(), IPPairInitConfig(), IPPairLookupIPPairFromHash(), IPPairShutdown(), and IPPairTimeoutHash().