suricata
|
#include "decode.h"
#include "defrag.h"
#include "util-exception-policy.h"
#include "util-exception-policy-types.h"
Go to the source code of this file.
Data Structures | |
struct | DefragTrackerHashRow_ |
struct | DefragConfig_ |
Macros | |
#define | DRLOCK_MUTEX |
#define | DRLOCK_TYPE SCMutex |
#define | DRLOCK_INIT(fb) SCMutexInit(&(fb)->lock, NULL) |
#define | DRLOCK_DESTROY(fb) SCMutexDestroy(&(fb)->lock) |
#define | DRLOCK_LOCK(fb) SCMutexLock(&(fb)->lock) |
#define | DRLOCK_TRYLOCK(fb) SCMutexTrylock(&(fb)->lock) |
#define | DRLOCK_UNLOCK(fb) SCMutexUnlock(&(fb)->lock) |
#define | DEFRAG_CHECK_MEMCAP(size) ((((uint64_t)SC_ATOMIC_GET(defrag_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(defrag_config.memcap))) |
check if a memory alloc would fit in the memcap More... | |
Typedefs | |
typedef struct DefragTrackerHashRow_ | DefragTrackerHashRow |
typedef struct DefragConfig_ | DefragConfig |
Functions | |
SC_ATOMIC_EXTERN (uint64_t, defrag_memuse) | |
SC_ATOMIC_EXTERN (unsigned int, defragtracker_counter) | |
SC_ATOMIC_EXTERN (unsigned int, defragtracker_prune_idx) | |
void | DefragInitConfig (bool quiet) |
initialize the configuration More... | |
void | DefragHashShutdown (void) |
shutdown the flow engine More... | |
DefragTracker * | DefragLookupTrackerFromHash (Packet *) |
look up a tracker in the hash More... | |
DefragTracker * | DefragGetTrackerFromHash (ThreadVars *tv, DecodeThreadVars *dtv, Packet *) |
void | DefragTrackerRelease (DefragTracker *) |
void | DefragTrackerClearMemory (DefragTracker *) |
void | DefragTrackerMoveToSpare (DefragTracker *) |
int | DefragTrackerSetMemcap (uint64_t) |
Update memcap value. More... | |
uint64_t | DefragTrackerGetMemcap (void) |
Return memcap value. More... | |
uint64_t | DefragTrackerGetMemuse (void) |
Return memuse value. More... | |
enum ExceptionPolicy | DefragGetMemcapExceptionPolicy (void) |
Variables | |
DefragTrackerHashRow * | defragtracker_hash |
DefragConfig | defrag_config |
Definition in file defrag-hash.h.
#define DEFRAG_CHECK_MEMCAP | ( | size | ) | ((((uint64_t)SC_ATOMIC_GET(defrag_memuse) + (uint64_t)(size)) <= SC_ATOMIC_GET(defrag_config.memcap))) |
check if a memory alloc would fit in the memcap
size | memory allocation size to check |
1 | it fits |
0 | no fit |
Definition at line 84 of file defrag-hash.h.
#define DRLOCK_DESTROY | ( | fb | ) | SCMutexDestroy(&(fb)->lock) |
Definition at line 53 of file defrag-hash.h.
#define DRLOCK_INIT | ( | fb | ) | SCMutexInit(&(fb)->lock, NULL) |
Definition at line 52 of file defrag-hash.h.
#define DRLOCK_LOCK | ( | fb | ) | SCMutexLock(&(fb)->lock) |
Definition at line 54 of file defrag-hash.h.
#define DRLOCK_MUTEX |
Spinlocks or Mutex for the flow buckets.
Definition at line 35 of file defrag-hash.h.
#define DRLOCK_TRYLOCK | ( | fb | ) | SCMutexTrylock(&(fb)->lock) |
Definition at line 55 of file defrag-hash.h.
#define DRLOCK_TYPE SCMutex |
Definition at line 51 of file defrag-hash.h.
#define DRLOCK_UNLOCK | ( | fb | ) | SCMutexUnlock(&(fb)->lock) |
Definition at line 56 of file defrag-hash.h.
typedef struct DefragConfig_ DefragConfig |
typedef struct DefragTrackerHashRow_ DefragTrackerHashRow |
enum ExceptionPolicy DefragGetMemcapExceptionPolicy | ( | void | ) |
Definition at line 74 of file defrag-hash.c.
DefragTracker* DefragGetTrackerFromHash | ( | ThreadVars * | tv, |
DecodeThreadVars * | dtv, | ||
Packet * | |||
) |
Definition at line 529 of file defrag-hash.c.
void DefragHashShutdown | ( | void | ) |
shutdown the flow engine
Definition at line 296 of file defrag-hash.c.
References DefragTrackerDequeue().
Referenced by DefragDestroy().
void DefragInitConfig | ( | bool | quiet | ) |
initialize the configuration
set config values for memcap, prealloc and hash_size
Definition at line 169 of file defrag-hash.c.
References defrag_config, DefragTrackerStackInit(), SC_ATOMIC_INIT, and SCLogDebug.
DefragTracker* DefragLookupTrackerFromHash | ( | Packet * | p | ) |
look up a tracker in the hash
a | address to look up |
h | LOCKED tracker or NULL |
Definition at line 624 of file defrag-hash.c.
void DefragTrackerClearMemory | ( | DefragTracker * | ) |
Definition at line 158 of file defrag-hash.c.
References DefragTrackerFreeFrags().
uint64_t DefragTrackerGetMemcap | ( | void | ) |
Return memcap value.
memcap | value |
Definition at line 63 of file defrag-hash.c.
References defrag_config, and SC_ATOMIC_GET.
uint64_t DefragTrackerGetMemuse | ( | void | ) |
Return memuse value.
memuse | value |
Definition at line 74 of file defrag-hash.c.
References SC_ATOMIC_GET.
void DefragTrackerMoveToSpare | ( | DefragTracker * | ) |
Definition at line 85 of file defrag-hash.c.
References DefragTrackerEnqueue().
void DefragTrackerRelease | ( | DefragTracker * | ) |
Definition at line 152 of file defrag-hash.c.
References DefragTrackerDecrUsecnt, DefragTracker_::lock, and SCMutexUnlock.
int DefragTrackerSetMemcap | ( | uint64_t | size | ) |
Update memcap value.
size | new memcap value |
Definition at line 48 of file defrag-hash.c.
References defrag_config, SC_ATOMIC_GET, and SC_ATOMIC_SET.
SC_ATOMIC_EXTERN | ( | uint64_t | , |
defrag_memuse | |||
) |
SC_ATOMIC_EXTERN | ( | unsigned int | , |
defragtracker_counter | |||
) |
SC_ATOMIC_EXTERN | ( | unsigned int | , |
defragtracker_prune_idx | |||
) |
DefragConfig defrag_config |
Definition at line 32 of file defrag-hash.c.
Referenced by DefragInitConfig(), DefragTimeoutHash(), DefragTrackerGetMemcap(), and DefragTrackerSetMemcap().
DefragTrackerHashRow* defragtracker_hash |
defrag tracker hash table
Definition at line 31 of file defrag-hash.c.
Referenced by DefragTimeoutHash().