suricata
host-bit.c File Reference
#include "suricata-common.h"
#include "threads.h"
#include "host-bit.h"
#include "host.h"
#include "detect.h"
#include "util-var.h"
#include "util-debug.h"
#include "util-unittest.h"
#include "host-storage.h"
Include dependency graph for host-bit.c:

Go to the source code of this file.

Functions

void HostBitInitCtx (void)
 
int HostHasHostBits (Host *host)
 
int HostBitsTimedoutCheck (Host *h, struct timeval *ts)
 
void HostBitSet (Host *h, uint32_t idx, uint32_t expire)
 
void HostBitUnset (Host *h, uint32_t idx)
 
void HostBitToggle (Host *h, uint32_t idx, uint32_t expire)
 
int HostBitIsset (Host *h, uint32_t idx, uint32_t ts)
 
int HostBitIsnotset (Host *h, uint32_t idx, uint32_t ts)
 
int HostBitList (Host *h, XBit **iter)
 
void HostBitRegisterTests (void)
 

Detailed Description

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

Implements per host bits. Actually, not a bit, but called that way because of Snort's flowbits. It's a binary storage.

Todo:

move away from a linked list implementation

use different datatypes, such as string, int, etc.

Definition in file host-bit.c.

Function Documentation

void HostBitInitCtx ( void  )

Definition at line 49 of file host-bit.c.

References HostStorageRegister(), SC_ERR_HOST_INIT, and SCLogError.

Referenced by DetectHostbitFree(), DetectXbitFree(), PostRunDeinit(), and RunUnittests().

Here is the call graph for this function:

Here is the caller graph for this function:

int HostBitIsnotset ( Host h,
uint32_t  idx,
uint32_t  ts 
)

Definition at line 171 of file host-bit.c.

References XBit_::expire.

Referenced by DetectHostbitsRegister().

Here is the caller graph for this function:

int HostBitIsset ( Host h,
uint32_t  idx,
uint32_t  ts 
)

Definition at line 158 of file host-bit.c.

References XBit_::expire.

Referenced by DetectHostbitsRegister().

Here is the caller graph for this function:

int HostBitList ( Host h,
XBit **  iter 
)

Definition at line 185 of file host-bit.c.

References DETECT_XBITS, HostAlloc(), HostCleanup(), HostFree(), HostGetStorageById(), HostInitConfig(), GenericVar_::next, TRUE, and GenericVar_::type.

Referenced by UnixSocketPcapFile().

Here is the call graph for this function:

Here is the caller graph for this function:

void HostBitRegisterTests ( void  )

Definition at line 509 of file host-bit.c.

References UtRegisterTest().

Here is the call graph for this function:

void HostBitSet ( Host h,
uint32_t  idx,
uint32_t  expire 
)

Definition at line 132 of file host-bit.c.

Referenced by DetectHostbitsRegister(), and UnixSocketPcapFile().

Here is the caller graph for this function:

int HostBitsTimedoutCheck ( Host h,
struct timeval *  ts 
)
Return values
1host timed out wrt xbits
0host still has active (non-expired) xbits

Definition at line 68 of file host-bit.c.

References DETECT_XBITS, XBit_::expire, GenericVarAppend(), GenericVarRemove(), HostGetStorageById(), HostSetStorageById(), GenericVar_::idx, XBit_::idx, GenericVar_::next, XBit_::next, SCMalloc, GenericVar_::type, XBit_::type, unlikely, and XBitFree().

Referenced by HostGetActiveCount().

Here is the call graph for this function:

Here is the caller graph for this function:

void HostBitToggle ( Host h,
uint32_t  idx,
uint32_t  expire 
)

Definition at line 148 of file host-bit.c.

Referenced by DetectHostbitsRegister().

Here is the caller graph for this function:

void HostBitUnset ( Host h,
uint32_t  idx 
)

Definition at line 140 of file host-bit.c.

Referenced by DetectHostbitsRegister(), and UnixSocketPcapFile().

Here is the caller graph for this function:

int HostHasHostBits ( Host host)

Definition at line 59 of file host-bit.c.

References HostGetStorageById().

Referenced by DetectHostbitFree(), and HostGetActiveCount().

Here is the call graph for this function:

Here is the caller graph for this function: