suricata
|
#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"
Go to the source code of this file.
Functions | |
Flow * | FlowAlloc (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 } |
Flow utility functions
Definition in file flow-util.c.
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.
f | the 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().
void FlowEndCountersRegister | ( | ThreadVars * | t, |
FlowEndCounters * | fec | ||
) |
Definition at line 238 of file flow-util.c.
References FlowEndCounters_::flow_state, FLOW_STATE_CLOSED, FLOW_STATE_ESTABLISHED, FLOW_STATE_LOCAL_BYPASSED, FLOW_STATE_NEW, FLOW_STATE_SIZE, FlowEndCounters_::flow_tcp_liberal, FlowEndCounters_::flow_tcp_state, StatsRegisterCounter(), TCP_CLOSE_WAIT, TCP_CLOSED, TCP_CLOSING, TCP_ESTABLISHED, TCP_FIN_WAIT1, TCP_FIN_WAIT2, TCP_LAST_ACK, TCP_NONE, TCP_SYN_RECV, TCP_SYN_SENT, and TCP_TIME_WAIT.
void FlowFree | ( | Flow * | f | ) |
cleanup & free the memory of a flow
f | flow 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().
uint8_t FlowGetProtoMapping | ( | uint8_t | proto | ) |
Function to map the protocol to the defined FLOW_PROTO_* enumeration.
proto | protocol 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().
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().
void FlowInit | ( | ThreadVars * | tv, |
Flow * | f, | ||
const Packet * | p | ||
) |
Definition at line 146 of file flow-util.c.
References Flow_::livedev, Packet_::livedev, Flow_::proto, Packet_::proto, Flow_::recursion_level, Packet_::recursion_level, SCEnter, SCLogDebug, Flow_::vlan_id, Packet_::vlan_id, Flow_::vlan_idx, and Packet_::vlan_idx.
FlowStorageId GetFlowBypassInfoID | ( | void | ) |
Definition at line 214 of file flow-util.c.
References g_bypass_info_id.
Referenced by EveAddFlow(), and PacketBypassCallback().
void RegisterFlowBypassInfo | ( | void | ) |
Definition at line 232 of file flow-util.c.
References FlowStorageRegister(), and g_bypass_info_id.
Referenced by PostConfLoadedSetup().
FlowStorageId g_bypass_info_id = { .id = -1 } |
Definition at line 212 of file flow-util.c.
Referenced by GetFlowBypassInfoID(), and RegisterFlowBypassInfo().