suricata
ippair.c File Reference
#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"
Include dependency graph for ippair.c:

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. More...
 
uint64_t IPPairGetMemcap (void)
 Return memcap value. More...
 
uint64_t IPPairGetMemuse (void)
 Return memuse value. More...
 
uint32_t IPPairSpareQueueGetSize (void)
 
void IPPairMoveToSpare (IPPair *h)
 
IPPairIPPairAlloc (void)
 
void IPPairFree (IPPair *h)
 
void IPPairClearMemory (IPPair *h)
 
void IPPairInitConfig (bool quiet)
 initialize the configuration More...
 
void IPPairPrintStats (void)
 print some ippair stats More...
 
void IPPairShutdown (void)
 shutdown the flow engine More...
 
void IPPairCleanup (void)
 Cleanup the ippair engine. More...
 
void IPPairRelease (IPPair *h)
 
void IPPairLock (IPPair *h)
 
void IPPairUnlock (IPPair *h)
 
IPPairIPPairGetIPPairFromHash (Address *a, Address *b)
 
IPPairIPPairLookupIPPairFromHash (Address *a, Address *b)
 look up a ippair in the hash More...
 
void IPPairRegisterUnittests (void)
 

Variables

IPPairHashRow * ippair_hash
 
IPPairConfig ippair_config
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Information about ippairs.

Definition in file ippair.c.

Macro Definition Documentation

◆ IPPAIR_DEFAULT_HASHSIZE

#define IPPAIR_DEFAULT_HASHSIZE   4096

Definition at line 162 of file ippair.c.

◆ IPPAIR_DEFAULT_MEMCAP

#define IPPAIR_DEFAULT_MEMCAP   16777216

Definition at line 163 of file ippair.c.

◆ IPPAIR_DEFAULT_PREALLOC

#define IPPAIR_DEFAULT_PREALLOC   1000

Definition at line 164 of file ippair.c.

Function Documentation

◆ IPPairAlloc()

IPPair* IPPairAlloc ( void  )

Definition at line 109 of file ippair.c.

References IPPAIR_CHECK_MEMCAP.

◆ IPPairCleanup()

void IPPairCleanup ( void  )

Cleanup the ippair engine.

Cleanup the ippair engine from tag and threshold.

Definition at line 339 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.

Here is the call graph for this function:

◆ IPPairClearMemory()

void IPPairClearMemory ( IPPair h)

Definition at line 155 of file ippair.c.

References IPPairFreeStorage(), and IPPairStorageSize().

Referenced by IPPairCleanup(), and IPPairFree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IPPairFree()

void IPPairFree ( IPPair h)

Definition at line 129 of file ippair.c.

References IPPairClearMemory(), IPPair_::m, SC_ATOMIC_SUB, SCFree, and SCMutexDestroy.

Here is the call graph for this function:

◆ IPPairGetIPPairFromHash()

IPPair* IPPairGetIPPairFromHash ( Address a,
Address b 
)

Definition at line 540 of file ippair.c.

◆ IPPairGetMemcap()

uint64_t IPPairGetMemcap ( void  )

Return memcap value.

Return values
memcapvalue

Definition at line 81 of file ippair.c.

References ippair_config, and SC_ATOMIC_GET.

◆ IPPairGetMemuse()

uint64_t IPPairGetMemuse ( void  )

Return memuse value.

Return values
memusevalue

Definition at line 92 of file ippair.c.

References SC_ATOMIC_GET.

◆ IPPairInitConfig()

void IPPairInitConfig ( bool  quiet)

initialize the configuration

Warning
Not thread safe

set config values for memcap, prealloc and hash_size

Definition at line 167 of file ippair.c.

References DEBUG_VALIDATE_BUG_ON, IPPairStorageSize(), and SCLogDebug.

Referenced by PreRunInit(), and StreamTcpUTInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IPPairLock()

void IPPairLock ( IPPair h)

Definition at line 522 of file ippair.c.

References IPPair_::m, and SCMutexLock.

◆ IPPairLookupIPPairFromHash()

IPPair* IPPairLookupIPPairFromHash ( Address a,
Address b 
)

look up a ippair in the hash

Parameters
aaddress to look up
Return values
hLOCKED ippair or NULL

Definition at line 639 of file ippair.c.

◆ IPPairMoveToSpare()

void IPPairMoveToSpare ( IPPair h)

Definition at line 103 of file ippair.c.

References IPPairEnqueue().

Referenced by IPPairCleanup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IPPairPrintStats()

void IPPairPrintStats ( void  )

print some ippair stats

Warning
Not thread safe

Definition at line 288 of file ippair.c.

References ippair_config, SC_ATOMIC_GET, and SCLogPerf.

Referenced by IPPairShutdown().

Here is the caller graph for this function:

◆ IPPairRegisterUnittests()

void IPPairRegisterUnittests ( void  )

Definition at line 771 of file ippair.c.

References RegisterIPPairStorageTests().

Here is the call graph for this function:

◆ IPPairRelease()

void IPPairRelease ( IPPair h)

Definition at line 516 of file ippair.c.

References IPPairDecrUsecnt, IPPair_::m, and SCMutexUnlock.

◆ IPPairSetMemcap()

int IPPairSetMemcap ( uint64_t  size)

Update memcap value.

Parameters
sizenew memcap value

Definition at line 66 of file ippair.c.

References ippair_config, SC_ATOMIC_GET, and SC_ATOMIC_SET.

◆ IPPairShutdown()

void IPPairShutdown ( void  )

shutdown the flow engine

Warning
Not thread safe

Definition at line 301 of file ippair.c.

References IPPairDequeue(), and IPPairPrintStats().

Here is the call graph for this function:

◆ IPPairSpareQueueGetSize()

uint32_t IPPairSpareQueueGetSize ( void  )

Definition at line 98 of file ippair.c.

References IPPairQueueLen().

Referenced by IPPairGetSpareCount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IPPairUnlock()

void IPPairUnlock ( IPPair h)

Definition at line 527 of file ippair.c.

References IPPair_::m, and SCMutexUnlock.

◆ SC_ATOMIC_DECLARE() [1/3]

SC_ATOMIC_DECLARE ( uint32_t  ,
ippair_counter   
)

◆ SC_ATOMIC_DECLARE() [2/3]

SC_ATOMIC_DECLARE ( uint32_t  ,
ippair_prune_idx   
)

◆ SC_ATOMIC_DECLARE() [3/3]

SC_ATOMIC_DECLARE ( uint64_t  ,
ippair_memuse   
)

Variable Documentation

◆ ippair_config

IPPairConfig ippair_config

◆ ippair_hash

IPPairHashRow* ippair_hash

ippair hash table

Definition at line 49 of file ippair.c.

Referenced by IPPairCleanup(), and IPPairTimeoutHash().