suricata
util-macset.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "flow-util.h"
#include "flow-private.h"
#include "flow-storage.h"
#include "util-macset.h"
#include "util-unittest.h"
#include "util-unittest-helper.h"
Include dependency graph for util-macset.c:

Go to the source code of this file.

Data Structures

struct  MacSet_
 

Typedefs

typedef uint8_t MacAddr[6]
 

Enumerations

enum  MacSetState { EMPTY_SET, SINGLE_MAC, MULTI_MAC }
 

Functions

void MacSetRegisterFlowStorage (void)
 
bool MacSetFlowStorageEnabled (void)
 
MacSetMacSetInit (int size)
 
int MacSetGetFlowStorageID (void)
 
void MacSetAddWithCtr (MacSet *ms, uint8_t *src_addr, uint8_t *dst_addr, ThreadVars *tv, uint16_t ctr_src, uint16_t ctr_dst)
 
void MacSetAdd (MacSet *ms, uint8_t *src_addr, uint8_t *dst_addr)
 
int MacSetForEach (const MacSet *ms, MacSetIteratorFunc IterFunc, void *data)
 
int MacSetSize (const MacSet *ms)
 
void MacSetReset (MacSet *ms)
 
void MacSetFree (MacSet *ms)
 
void MacSetRegisterTests (void)
 

Variables

int g_macset_storage_id = -1
 

Detailed Description

Author
Sascha Steinbiss sasch.nosp@m.a.st.nosp@m.einbi.nosp@m.ss@d.nosp@m.cso.d.nosp@m.e

Set-like data store for MAC addresses. Implemented as array for memory locality reasons as the expected number of items is typically low.

Definition in file util-macset.c.

Typedef Documentation

◆ MacAddr

typedef uint8_t MacAddr[6]

Definition at line 37 of file util-macset.c.

Enumeration Type Documentation

◆ MacSetState

Enumerator
EMPTY_SET 
SINGLE_MAC 
MULTI_MAC 

Definition at line 38 of file util-macset.c.

Function Documentation

◆ MacSetAdd()

void MacSetAdd ( MacSet ms,
uint8_t *  src_addr,
uint8_t *  dst_addr 
)

Definition at line 188 of file util-macset.c.

References MacSetAddWithCtr().

Here is the call graph for this function:

◆ MacSetAddWithCtr()

void MacSetAddWithCtr ( MacSet ms,
uint8_t *  src_addr,
uint8_t *  dst_addr,
ThreadVars tv,
uint16_t  ctr_src,
uint16_t  ctr_dst 
)

Definition at line 179 of file util-macset.c.

Referenced by MacSetAdd().

Here is the caller graph for this function:

◆ MacSetFlowStorageEnabled()

bool MacSetFlowStorageEnabled ( void  )

Definition at line 84 of file util-macset.c.

References g_macset_storage_id.

◆ MacSetForEach()

int MacSetForEach ( const MacSet ms,
MacSetIteratorFunc  IterFunc,
void *  data 
)

Definition at line 218 of file util-macset.c.

Referenced by CreateJSONEther().

Here is the caller graph for this function:

◆ MacSetFree()

void MacSetFree ( MacSet ms)

Definition at line 270 of file util-macset.c.

References MacSet_::buf, MAC_SET_DST, MAC_SET_SRC, SC_ATOMIC_SUB, SCFree, and MacSet_::size.

◆ MacSetGetFlowStorageID()

int MacSetGetFlowStorageID ( void  )

Definition at line 113 of file util-macset.c.

References g_macset_storage_id.

◆ MacSetInit()

◆ MacSetRegisterFlowStorage()

void MacSetRegisterFlowStorage ( void  )

Definition at line 61 of file util-macset.c.

Referenced by PostConfLoadedSetup().

Here is the caller graph for this function:

◆ MacSetRegisterTests()

void MacSetRegisterTests ( void  )

Definition at line 437 of file util-macset.c.

References UtRegisterTest().

Here is the call graph for this function:

◆ MacSetReset()

void MacSetReset ( MacSet ms)

Definition at line 262 of file util-macset.c.

References EMPTY_SET, MacSet_::last, MAC_SET_DST, MAC_SET_SRC, and MacSet_::state.

◆ MacSetSize()

int MacSetSize ( const MacSet ms)

Definition at line 231 of file util-macset.c.

References EMPTY_SET, MacSet_::last, MAC_SET_DST, MAC_SET_SRC, MULTI_MAC, SINGLE_MAC, and MacSet_::state.

Referenced by CreateJSONEther().

Here is the caller graph for this function:

Variable Documentation

◆ g_macset_storage_id

int g_macset_storage_id = -1

Definition at line 59 of file util-macset.c.

Referenced by MacSetFlowStorageEnabled(), and MacSetGetFlowStorageID().