suricata
|
Flow data structure. More...
#include <flow.h>
Flow data structure.
The flow is a global data structure that is created for new packets of a flow and then looked up for the following packets of a flow.
Locking
The flow is updated/used by multiple packets at the same time. This is why there is a flow-mutex. It's a mutex and not a spinlock because some operations on the flow can be quite expensive, thus spinning would be too expensive.
The flow "header" (addresses, ports, proto, recursion level) are static after the initialization and remain read-only throughout the entire live of a flow. This is why we can access those without protection of the lock.
union { ... } |
union { ... } |
union { ... } |
AppLayerParserState* Flow_::alparser |
application level storage ptrs. parser internal state
Definition at line 488 of file flow.h.
Referenced by AppLayerFrameDump(), AppLayerFrameNewByAbsoluteOffset(), AppLayerFrameNewByPointer(), AppLayerFrameNewByRelativeOffset(), AppLayerFramesFreeContainer(), AppLayerFramesGetContainer(), AppLayerFramesSetupContainer(), AppLayerParserParse(), AppLayerProtoDetectReset(), DeStateUpdateInspectTransactionId(), FlowCleanupAppLayer(), FlowForceReassemblyNeedReassembly(), LLVMFuzzerTestOneInput(), Prefilter(), and StreamTcpDisableAppLayer().
AppProto Flow_::alproto |
application level protocol
Definition at line 463 of file flow.h.
Referenced by AppLayerFramesSetupContainer(), AppLayerHandleTCPData(), AppLayerIncAllocErrorCounter(), AppLayerIncGapErrorCounter(), AppLayerIncInternalErrorCounter(), AppLayerIncParserErrorCounter(), AppLayerIncTxCounter(), AppLayerParserSetTransactionInspectId(), AppLayerParserStateCleanup(), AppLayerProtoDetectReset(), AppLayerRequestProtocolChange(), DetectEngineInspectBufferGeneric(), DetectRunFrameInspectRule(), DetectRunStoreStateTx(), EveAddAppProto(), FlowForceReassemblyNeedReassembly(), FlowGetAppProtocol(), FrameJsonLogOneFrame(), JsonBuildFileInfoRecord(), LLVMFuzzerTestOneInput(), Prefilter(), RulesDumpMatchArray(), and RulesDumpTxMatchArray().
AppProto Flow_::alproto_expect |
expected app protocol: used in protocol change/upgrade like in STARTTLS.
Definition at line 472 of file flow.h.
Referenced by AppLayerRequestProtocolChange(), and EveAddAppProto().
AppProto Flow_::alproto_orig |
original application level protocol. Used to indicate the previous protocol when changing to another protocol , e.g. with STARTTLS.
Definition at line 469 of file flow.h.
Referenced by AppLayerRequestProtocolChange(), and EveAddAppProto().
AppProto Flow_::alproto_tc |
Definition at line 465 of file flow.h.
Referenced by AppLayerHandleTCPData(), AppLayerHandleUdp(), AppLayerProtoDetectReset(), AppLayerRequestProtocolChange(), and EveAddAppProto().
AppProto Flow_::alproto_ts |
Definition at line 464 of file flow.h.
Referenced by AppLayerHandleTCPData(), AppLayerHandleUdp(), AppLayerProtoDetectReset(), AppLayerRequestProtocolChange(), and EveAddAppProto().
void* Flow_::alstate |
application layer state
Definition at line 489 of file flow.h.
Referenced by DeStateUpdateInspectTransactionId(), DetectFileInspectGeneric(), EveFTPDataAddMetadata(), FlowCleanupAppLayer(), FlowForceReassemblyNeedReassembly(), FlowGetAppState(), LLVMFuzzerTestOneInput(), and SMTPProcessDataChunk().
uint32_t Flow_::de_ctx_version |
Port Flow_::dp |
tcp/udp destination port
Definition at line 372 of file flow.h.
Referenced by FlowGetDestinationPort(), FlowGetFromFlowKey(), FlowInit(), and LLVMFuzzerTestOneInput().
FlowAddress Flow_::dst |
Definition at line 359 of file flow.h.
Referenced by FlowGetFromFlowKey(), FlowInit(), and LLVMFuzzerTestOneInput().
struct { ... } Flow_::esp |
struct FlowBucket_* Flow_::fb |
Definition at line 501 of file flow.h.
Referenced by FlowGetFromFlowKey().
uint8_t Flow_::ffr_tc |
Definition at line 394 of file flow.h.
Referenced by FlowForceReassemblyNeedReassembly().
uint8_t Flow_::ffr_ts |
Definition at line 393 of file flow.h.
Referenced by FlowForceReassemblyNeedReassembly().
uint16_t Flow_::file_flags |
file tracking/extraction flags
Definition at line 436 of file flow.h.
Referenced by FileFlowToFlags().
uint32_t Flow_::flags |
generic flags
Definition at line 434 of file flow.h.
Referenced by ExceptionPolicyParse(), FlowChangeProto(), FlowClearMemory(), FlowGetFlags(), FlowGetFromFlowKey(), FlowGetPacketDirection(), FlowHandlePacketUpdate(), FlowHasAlerts(), FlowInit(), FlowSetChangeProtoFlag(), FlowSetHasAlertsFlag(), FlowSetIPOnlyFlag(), FlowSwap(), FlowUnsetChangeProtoFlag(), LLVMFuzzerTestOneInput(), and StreamTcpReassembleHandleSegment().
uint32_t Flow_::flow_hash |
flow hash - the flow hash before hash table size mod.
Definition at line 412 of file flow.h.
Referenced by FlowGetFromFlowKey().
FlowStateType Flow_::flow_state |
Definition at line 425 of file flow.h.
Referenced by FlowHandlePacketUpdate(), FlowUpdateState(), and PacketBypassCallback().
GenericVar* Flow_::flowvar |
Definition at line 499 of file flow.h.
Referenced by EveAddMetadata(), FlowVarAddIdValue(), FlowVarAddIntNoLock(), FlowVarAddKeyValue(), FlowVarGet(), and FlowVarGetByKey().
struct { ... } Flow_::icmp_d |
struct { ... } Flow_::icmp_s |
Referenced by FlowInit().
struct timeval Flow_::lastts |
Definition at line 412 of file flow.h.
Referenced by AppLayerExpectationCreate(), FlowGetFromFlowKey(), FlowGetLastTimeAsParts(), and FlowHandlePacketUpdate().
struct LiveDevice_* Flow_::livedev |
uint8_t Flow_::max_ttl_toserver |
Definition at line 481 of file flow.h.
Referenced by FlowInit().
uint8_t Flow_::min_ttl_toserver |
struct Flow_* Flow_::next |
Definition at line 407 of file flow.h.
Referenced by FlowGetFromFlowKey(), FlowQueuePrivateAppendFlow(), FlowQueuePrivateAppendPrivate(), FlowQueuePrivateGetFromTop(), FlowQueuePrivatePrependFlow(), FlowReset(), FlowShutdown(), and StatsReleaseCounters().
uint32_t Flow_::probing_parser_toclient_alproto_masks |
Definition at line 432 of file flow.h.
Referenced by AppLayerProtoDetectReset(), and FlowSwap().
uint32_t Flow_::probing_parser_toserver_alproto_masks |
Definition at line 431 of file flow.h.
Referenced by AppLayerProtoDetectReset(), and FlowSwap().
uint8_t Flow_::proto |
Definition at line 378 of file flow.h.
Referenced by AppLayerFrameDump(), AppLayerFrameNewByAbsoluteOffset(), AppLayerFrameNewByPointer(), AppLayerFrameNewByRelativeOffset(), AppLayerFramesSetupContainer(), AppLayerParserParse(), AppLayerParserSetTransactionInspectId(), DetectEngineInspectBufferGeneric(), DetectRunFrameInspectRule(), DetectRunStoreStateTx(), EveHTTP2AddMetadata(), EveIKEAddMetadata(), EveNFSAddMetadata(), EveNFSAddMetadataRPC(), EveSMBAddMetadata(), FlowCleanupAppLayer(), FlowGetDisruptionFlags(), FlowGetFromFlowKey(), FlowInit(), FlowReset(), FlowShutdown(), FrameJsonLogOneFrame(), FramesPrune(), HttpXFFGetIPFromTx(), JsonModbusAddMetadata(), JsonMQTTAddMetadata(), JsonQuicAddMetadata(), JsonRFBAddMetadata(), JsonSIPAddMetadata(), LLVMFuzzerTestOneInput(), StreamTcpAppLayerIsDisabled(), UTHAddStreamToFlow(), and UTHRemoveSessionFromFlow().
void* Flow_::protoctx |
protocol specific data pointer, e.g. for TcpSession
Definition at line 454 of file flow.h.
Referenced by AppLayerFrameDump(), AppLayerFrameNewByAbsoluteOffset(), AppLayerFrameNewByPointer(), AppLayerFrameNewByRelativeOffset(), AppLayerFramesSetupContainer(), AppLayerFramesSlide(), AppLayerParserTriggerRawStreamReassembly(), DetectEngineInspectStreamPayload(), FlowClearMemory(), FlowForceReassemblyNeedReassembly(), FlowGetDisruptionFlags(), FramesPrune(), LLVMFuzzerTestOneInput(), SMTPProcessDataChunk(), StreamTcpAppLayerIsDisabled(), StreamTcpDetectLogFlush(), StreamTcpDisableAppLayer(), StreamTcpPruneSession(), StreamTcpReassembleDepthReached(), StreamTcpSessionPktFree(), UTHAddSessionToFlow(), UTHAddStreamToFlow(), and UTHRemoveSessionFromFlow().
uint16_t Flow_::protodetect_dp |
destination port to be used in protocol detection. This is meant for use with STARTTLS and HTTP CONNECT detection 0 if not used
Definition at line 440 of file flow.h.
Referenced by AppLayerRequestProtocolChange().
uint8_t Flow_::protomap |
mapping to Flow's protocol specific protocols for timeouts and state and free functions.
Definition at line 458 of file flow.h.
Referenced by AppLayerIncAllocErrorCounter(), AppLayerIncGapErrorCounter(), AppLayerIncInternalErrorCounter(), AppLayerIncParserErrorCounter(), AppLayerIncTxCounter(), AppLayerParserParse(), AppLayerParserStateCleanup(), FlowGetFromFlowKey(), and LLVMFuzzerTestOneInput().
uint8_t Flow_::recursion_level |
Definition at line 379 of file flow.h.
Referenced by FlowGetFromFlowKey(), and FlowInit().
const struct SigGroupHead_* Flow_::sgh_toclient |
const struct SigGroupHead_* Flow_::sgh_toserver |
Port Flow_::sp |
tcp/udp source port
Definition at line 361 of file flow.h.
Referenced by FlowGetFromFlowKey(), FlowGetPacketDirection(), FlowGetSourcePort(), FlowInit(), and LLVMFuzzerTestOneInput().
FlowAddress Flow_::src |
Definition at line 359 of file flow.h.
Referenced by FlowGetFromFlowKey(), FlowGetPacketDirection(), FlowInit(), and LLVMFuzzerTestOneInput().
struct timeval Flow_::startts |
Definition at line 501 of file flow.h.
Referenced by EveAddFlow(), and FlowGetFromFlowKey().
uint32_t Flow_::tenant_id |
FlowThreadId Flow_::thread_id[2] |
Thread ID for the stream/detect portion of this flow
Definition at line 405 of file flow.h.
Referenced by FlowForceReassemblyForFlow().
uint32_t Flow_::timeout_at |
timestamp in seconds of the moment this flow will timeout according to the timeout policy. Does not take emergency mode into account.
Definition at line 402 of file flow.h.
Referenced by FlowHandlePacketUpdate().
uint32_t Flow_::timeout_policy |
timeout policy value in seconds to add to the lastts.tv_sec when a packet has been received.
Definition at line 423 of file flow.h.
Referenced by FlowHandlePacketUpdate().
uint64_t Flow_::todstbytecnt |
Definition at line 507 of file flow.h.
Referenced by EveAddFlow(), and FlowHandlePacketUpdate().
uint32_t Flow_::todstpktcnt |
Definition at line 505 of file flow.h.
Referenced by EveAddFlow(), and FlowHandlePacketUpdate().
uint64_t Flow_::tosrcbytecnt |
Definition at line 508 of file flow.h.
Referenced by EveAddFlow().
uint32_t Flow_::tosrcpktcnt |
Definition at line 506 of file flow.h.
Referenced by EveAddFlow().
FlowRefCount Flow_::use_cnt |
how many references exist to this flow right now
On receiving a packet the counter is incremented while the flow bucked is locked, which is also the case on timeout pruning.
Definition at line 386 of file flow.h.
Referenced by FlowShutdown(), and UTHBuildPacketOfFlows().
uint16_t Flow_::vlan_id[2] |
Definition at line 380 of file flow.h.
Referenced by FlowGetFromFlowKey(), and FlowInit().
uint8_t Flow_::vlan_idx |
Definition at line 388 of file flow.h.
Referenced by FlowInit().