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-callbacks.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 "util-validate.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 (ThreadVars *tv, 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 55 of file flow-util.c.

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

Referenced by 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 83 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)

Function to map the protocol to the defined FLOW_PROTO_* enumeration.

Parameters
protoprotocol which is needed to be mapped

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

References FLOW_PROTO_DEFAULT, FLOW_PROTO_ICMP, FLOW_PROTO_TCP, FLOW_PROTO_UDP, and proto.

Referenced by AppLayerParserApplyTxConfig(), AppLayerParserGetEventInfo(), AppLayerParserGetEventInfoById(), AppLayerParserParse(), AppLayerParserProtocolGetLoggerBits(), AppLayerParserProtocolHasLogger(), AppLayerParserProtoIsRegistered(), FlowReset(), FlowSetProtoFreeFunc(), FlowShutdown(), and LLVMFuzzerTestOneInput().

Here is the caller graph for this function:

◆ FlowGetReverseProtoMapping()

uint8_t FlowGetReverseProtoMapping ( uint8_t  rproto)

Definition at line 112 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 214 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 232 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 212 of file flow-util.c.

Referenced by GetFlowBypassInfoID(), and RegisterFlowBypassInfo().