suricata
flow-util.c File Reference
#include "suricata-common.h"
#include "threads.h"
#include "flow.h"
#include "flow-private.h"
#include "flow-util.h"
#include "flow-var.h"
#include "app-layer.h"
#include "util-var.h"
#include "util-debug.h"
#include "util-macset.h"
#include "flow-storage.h"
#include "detect.h"
#include "detect-engine-state.h"
#include "decode-icmpv4.h"
Include dependency graph for flow-util.c:

Go to the source code of this file.

Functions

FlowFlowAlloc (void)
 allocate a flow More...
 
void FlowFree (Flow *f)
 cleanup & free the memory of a flow More...
 
uint8_t FlowGetProtoMapping (uint8_t proto)
 Function to map the protocol to the defined FLOW_PROTO_* enumeration. More...
 
uint8_t FlowGetReverseProtoMapping (uint8_t rproto)
 
void FlowInit (Flow *f, const Packet *p)
 
FlowStorageId GetFlowBypassInfoID (void)
 
void RegisterFlowBypassInfo (void)
 
void FlowEndCountersRegister (ThreadVars *t, FlowEndCounters *fec)
 

Variables

FlowStorageId g_bypass_info_id = { .id = -1 }
 

Detailed Description

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

Flow utility functions

Definition in file flow-util.c.

Function Documentation

◆ FlowAlloc()

Flow* FlowAlloc ( void  )

allocate a flow

We check against the memuse counter. If it passes that check we increment the counter first, then we try to alloc.

Return values
fthe flow or NULL on out of memory

Definition at line 52 of file flow-util.c.

References FLOW_CHECK_MEMCAP, FLOW_INITIALIZE, FlowStorageSize(), SC_ATOMIC_ADD, SC_ATOMIC_SUB, SCMalloc, and unlikely.

Referenced by FlowGetFromFlowKey(), and LLVMFuzzerTestOneInput().

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

◆ FlowEndCountersRegister()

◆ FlowFree()

void FlowFree ( Flow f)

cleanup & free the memory of a flow

Parameters
fflow to clear & destroy

Definition at line 81 of file flow-util.c.

References FLOW_DESTROY, FlowStorageSize(), SC_ATOMIC_SUB, and SCFree.

Referenced by FlowReset(), FlowShutdown(), LLVMFuzzerTestOneInput(), and UTHBuildPacketOfFlows().

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

◆ FlowGetProtoMapping()

uint8_t FlowGetProtoMapping ( uint8_t  proto)

◆ FlowGetReverseProtoMapping()

uint8_t FlowGetReverseProtoMapping ( uint8_t  rproto)

Definition at line 110 of file flow-util.c.

References FLOW_PROTO_ICMP, FLOW_PROTO_TCP, and FLOW_PROTO_UDP.

Referenced by AppLayerParserThreadCtxAlloc(), and AppLayerParserThreadCtxFree().

Here is the caller graph for this function:

◆ FlowInit()

◆ GetFlowBypassInfoID()

FlowStorageId GetFlowBypassInfoID ( void  )

Definition at line 221 of file flow-util.c.

References g_bypass_info_id.

Referenced by EveAddFlow(), and PacketBypassCallback().

Here is the caller graph for this function:

◆ RegisterFlowBypassInfo()

void RegisterFlowBypassInfo ( void  )

Definition at line 239 of file flow-util.c.

References FlowStorageRegister(), and g_bypass_info_id.

Referenced by PostConfLoadedSetup().

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

Variable Documentation

◆ g_bypass_info_id

FlowStorageId g_bypass_info_id = { .id = -1 }

Definition at line 219 of file flow-util.c.

Referenced by GetFlowBypassInfoID(), and RegisterFlowBypassInfo().