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 "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)
 

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

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 51 of file flow-util.c.

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

Referenced by FlowInitConfig(), FlowSetupPacket(), FlowStorageRegister(), FlowUpdateSpareFlows(), and TagTimeoutCheck().

Here is the call graph for this function:

Here is the caller graph for this function:

void FlowFree ( Flow f)

cleanup & free the memory of a flow

Parameters
fflow to clear & destroy

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

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

Referenced by AppLayerParserStreamTruncated(), FlowShutdown(), FlowStorageRegister(), FlowUpdateSpareFlows(), and UTHFreeFlow().

Here is the call graph for this function:

Here is the caller graph for this function:

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 95 of file flow-util.c.

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

Referenced by AppLayerGetTxIterator(), AppLayerParserDestroyProtocolParserLocalStorage(), AppLayerParserGetEventInfo(), AppLayerParserGetEventsByTx(), AppLayerParserGetFiles(), AppLayerParserGetFirstDataDir(), AppLayerParserGetProtocolParserLocalStorage(), AppLayerParserGetStateProgress(), AppLayerParserGetTx(), AppLayerParserGetTxDetectFlags(), AppLayerParserGetTxDetectState(), AppLayerParserParse(), AppLayerParserProtocolGetLoggerBits(), AppLayerParserProtocolHasLogger(), AppLayerParserProtocolIsTxAware(), AppLayerParserProtocolIsTxEventAware(), AppLayerParserProtocolSupportsTxs(), AppLayerParserProtoIsRegistered(), AppLayerParserRegisterDetectFlagsFuncs(), AppLayerParserRegisterDetectStateFuncs(), AppLayerParserRegisterGetEventInfo(), AppLayerParserRegisterGetEventsFunc(), AppLayerParserRegisterGetFilesFunc(), AppLayerParserRegisterGetStateProgressFunc(), AppLayerParserRegisterGetTx(), AppLayerParserRegisterGetTxCnt(), AppLayerParserRegisterGetTxIterator(), AppLayerParserRegisterLocalStorageFunc(), AppLayerParserRegisterLogger(), AppLayerParserRegisterLoggerBits(), AppLayerParserRegisterLoggerFuncs(), AppLayerParserRegisterOptionFlags(), AppLayerParserRegisterParser(), AppLayerParserRegisterParserAcceptableDataDirection(), AppLayerParserRegisterProtocolUnittests(), AppLayerParserRegisterStateFuncs(), AppLayerParserRegisterTruncateFunc(), AppLayerParserRegisterTxFreeFunc(), AppLayerParserRestoreParserTable(), AppLayerParserSetStreamDepth(), AppLayerParserSetTxDetectFlags(), AppLayerParserSetTxLogged(), AppLayerParserStateCleanup(), AppLayerParserStreamTruncated(), AppLayerParserSupportsFiles(), AppLayerParserSupportsTxDetectState(), AppLayerProtoDetectUnittestCtxRestore(), AppLayerRegisterThreadCounters(), AppLayerSetupCounters(), DetectDnsQueryRegister(), DetectTlsFingerprintRegister(), DetectTlsIssuerRegister(), DetectTlsJa3HashRegister(), DetectTlsJa3StringRegister(), DetectTlsSerialRegister(), DetectTlsSniRegister(), DetectTlsSubjectRegister(), DetectTlsValidityRegister(), FlowInit(), FlowSetProtoFreeFunc(), FlowShutdown(), FlowUpdateState(), RegisterDCERPCUDPParsers(), RegisterDNSUDPParsers(), and TagTimeoutCheck().

uint8_t FlowGetReverseProtoMapping ( uint8_t  rproto)

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

References FLOW_PROTO_ICMP, FLOW_PROTO_SCTP, FLOW_PROTO_TCP, FLOW_PROTO_UDP, Flow_::icmp_d, Flow_::icmp_s, ICMPv4GetCounterpart(), and ICMPv6GetCounterpart().

Referenced by AppLayerParserThreadCtxAlloc(), and AppLayerParserThreadCtxFree().

Here is the call graph for this function:

Here is the caller graph for this function: