suricata
|
Go to the source code of this file.
Data Structures | |
struct | FlowEndCounters_ |
Macros | |
#define | RESET_COUNTERS(f) |
#define | FLOW_INITIALIZE(f) |
#define | FLOW_RECYCLE(f) |
macro to recycle a flow before it goes into the spare queue for reuse. | |
#define | FLOW_DESTROY(f) |
#define | FLOW_CHECK_MEMCAP(size) |
check if a memory alloc would fit in the memcap | |
Typedefs | |
typedef struct FlowEndCounters_ | FlowEndCounters |
Functions | |
Flow * | FlowAlloc (void) |
allocate a flow | |
void | FlowFree (Flow *) |
cleanup & free the memory of a flow | |
uint8_t | FlowGetProtoMapping (uint8_t) |
Function to map the protocol to the defined FLOW_PROTO_* enumeration. | |
void | FlowInit (ThreadVars *, Flow *, const Packet *) |
uint8_t | FlowGetReverseProtoMapping (uint8_t rproto) |
void | FlowEndCountersRegister (ThreadVars *t, FlowEndCounters *fec) |
Definition in file flow-util.h.
#define FLOW_CHECK_MEMCAP | ( | size | ) |
check if a memory alloc would fit in the memcap
size | memory allocation size to check |
1 | it fits |
0 | no fit |
Definition at line 134 of file flow-util.h.
#define FLOW_DESTROY | ( | f | ) |
Definition at line 119 of file flow-util.h.
#define FLOW_INITIALIZE | ( | f | ) |
Definition at line 38 of file flow-util.h.
#define FLOW_RECYCLE | ( | f | ) |
macro to recycle a flow before it goes into the spare queue for reuse.
Note that the lnext, lprev, hnext fields are untouched, those are managed by the queueing code. Same goes for fb (FlowBucket ptr) field.
Definition at line 80 of file flow-util.h.
#define RESET_COUNTERS | ( | f | ) |
Definition at line 30 of file flow-util.h.
typedef struct FlowEndCounters_ FlowEndCounters |
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 56 of file flow-util.c.
References FLOW_CHECK_MEMCAP, FLOW_INITIALIZE, FlowStorageSize(), SC_ATOMIC_ADD, SC_ATOMIC_SUB, SCCalloc, and unlikely.
Referenced by FlowGetFromFlowKey(), and LLVMFuzzerTestOneInput().
void FlowEndCountersRegister | ( | ThreadVars * | t, |
FlowEndCounters * | fec | ||
) |
Definition at line 246 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, name, 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 84 of file flow-util.c.
References FLOW_DESTROY, FlowStorageSize(), SC_ATOMIC_SUB, and SCFree.
Referenced by FlowReset(), FlowShutdown(), FlowSparePoolDestroy(), FlowSparePoolUpdate(), 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 99 of file flow-util.c.
References FLOW_PROTO_DEFAULT, FLOW_PROTO_ICMP, FLOW_PROTO_TCP, FLOW_PROTO_UDP, and proto.
Referenced by AppLayerGetTxIterator(), AppLayerParserApplyTxConfig(), AppLayerParserDestroyProtocolParserLocalStorage(), AppLayerParserGetEventInfo(), AppLayerParserGetEventInfoById(), AppLayerParserGetFirstDataDir(), AppLayerParserGetFrameIdByName(), AppLayerParserGetFrameNameById(), AppLayerParserGetProtocolParserLocalStorage(), AppLayerParserGetStateData(), AppLayerParserGetStateIdByName(), AppLayerParserGetStateNameById(), AppLayerParserGetStateProgress(), AppLayerParserGetTx(), AppLayerParserGetTxData(), AppLayerParserParse(), AppLayerParserProtocolGetLoggerBits(), AppLayerParserProtocolHasLogger(), AppLayerParserProtoIsRegistered(), AppLayerParserRegisterApplyTxConfigFunc(), AppLayerParserRegisterGetEventInfo(), AppLayerParserRegisterGetEventInfoById(), AppLayerParserRegisterGetFrameFuncs(), AppLayerParserRegisterGetStateFuncs(), AppLayerParserRegisterGetStateProgressFunc(), AppLayerParserRegisterGetTx(), AppLayerParserRegisterGetTxCnt(), AppLayerParserRegisterGetTxFilesFunc(), AppLayerParserRegisterGetTxIterator(), AppLayerParserRegisterLocalStorageFunc(), AppLayerParserRegisterLoggerBits(), AppLayerParserRegisterOptionFlags(), AppLayerParserRegisterParser(), AppLayerParserRegisterProtocolUnittests(), AppLayerParserRegisterSetStreamDepthFlag(), AppLayerParserRegisterStateDataFunc(), AppLayerParserRegisterStateFuncs(), AppLayerParserRegisterTxDataFunc(), AppLayerParserRegisterTxFreeFunc(), AppLayerParserSetStreamDepthFlag(), AppLayerParserSupportsFiles(), AppLayerRegisterThreadCounters(), AppLayerSetupCounters(), FlowGetFromFlowKey(), FlowInit(), FlowReset(), FlowSetProtoFreeFunc(), FlowShutdown(), LLVMFuzzerTestOneInput(), SCAppLayerParserRegisterLogger(), SCAppLayerParserRegisterParserAcceptableDataDirection(), and SCAppLayerParserSetStreamDepth().
uint8_t FlowGetReverseProtoMapping | ( | uint8_t | rproto | ) |
Definition at line 113 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 147 of file flow-util.c.
References Packet_::code, Flow_::code, DEBUG_VALIDATE_BUG_ON, Packet_::dp, Flow_::dp, Flow_::dst, Flow_::esp, ESP_GET_SPI, Flow_::flags, FLOW_IPV4, FLOW_IPV6, FLOW_SET_IPV4_DST_ADDR_FROM_PACKET, FLOW_SET_IPV4_SRC_ADDR_FROM_PACKET, FLOW_SET_IPV6_DST_ADDR_FROM_PACKET, FLOW_SET_IPV6_SRC_ADDR_FROM_PACKET, FlowGetProtoMapping(), FlowGetStorageById(), FlowRateGetStorageID(), FlowRateStorageEnabled(), FlowRateStoreInit(), FlowSetStorageById(), Packet_::icmp_s, Flow_::icmp_s, ThreadVars_::id, IPV4_GET_RAW_IPTTL, IPV6_GET_RAW_HLIM, Packet_::livedev, Flow_::livedev, MacSetFlowStorageEnabled(), MacSetGetFlowStorageID(), MacSetInit(), Flow_::max_ttl_toserver, Flow_::min_ttl_toserver, Packet_::proto, Flow_::proto, Flow_::protomap, Packet_::recursion_level, Flow_::recursion_level, SCEnter, SCFlowRunInitCallbacks(), SCLogDebug, SCReturn, Packet_::sp, Flow_::sp, Flow_::spi, Flow_::src, Flow_::startts, Flow_::thread_id, Flow_::timeout_policy, Packet_::ts, tv, Packet_::type, Flow_::type, Packet_::vlan_id, Flow_::vlan_id, Packet_::vlan_idx, and Flow_::vlan_idx.
Referenced by FlowGetFlowFromHash().