Go to the documentation of this file.
104 Packet *p1 = NULL, *p2 = NULL;
105 const int server = f->
ffr_tc;
106 const int client = f->
ffr_ts;
130 FlowDeReference(&p1->
flow);
154 FlowWorkerFlowTimeout(
tv, p1, fw, detect_thread);
157 FlowWorkerFlowTimeout(
tv, p2, fw, detect_thread);
174 if (f->
proto == IPPROTO_TCP) {
176 #ifdef CAPTURE_OFFLOAD
177 state != FLOW_STATE_CAPTURE_BYPASSED &&
183 int cnt = FlowFinish(
tv, f, fw, detect_thread);
222 #ifdef CAPTURE_OFFLOAD
223 case FLOW_STATE_CAPTURE_BYPASSED:
259 if (fw->
dtv == NULL) {
260 FlowWorkerThreadDeinit(
tv, fw);
266 FlowWorkerThreadDeinit(
tv, fw);
272 void *detect_thread = NULL;
274 FlowWorkerThreadDeinit(
tv, fw);
282 FlowWorkerThreadDeinit(
tv, fw);
287 FlowWorkerThreadDeinit(
tv, fw);
311 if (detect_thread != NULL) {
348 static void FlowPruneFiles(
Packet *p)
361 Packet *p,
void *detect_thread)
379 if (detect_thread != NULL) {
401 FlowWorkerStreamTCPUpdate(
tv, fw, p, detect_thread);
407 if (detect_thread != NULL) {
428 FlowDeReference(&p->
flow);
435 static inline void FlowWorkerProcessInjectedFlows(
ThreadVars *
tv,
443 if (injected.
len > 0) {
447 CheckWorkQueue(
tv, fw, detect_thread, &counters, &injected);
448 UpdateCounters(
tv, fw, &counters);
456 static inline void FlowWorkerProcessLocalFlows(
ThreadVars *
tv,
465 UpdateCounters(
tv, fw, &counters);
517 if (detect_thread == NULL &&
524 FlowWorkerStreamTCPUpdate(
tv, fw, p, detect_thread);
527 }
else if (p->
flow && p->
proto == IPPROTO_UDP) {
538 if (detect_thread != NULL) {
551 if (p->
flow != NULL) {
554 if (p->
proto == IPPROTO_TCP) {
565 FlowDeReference(&p->
flow);
570 FlowWorkerProcessInjectedFlows(
tv, fw, p, detect_thread);
573 FlowWorkerProcessLocalFlows(
tv, fw, p, detect_thread);
606 return "flow-inject";
615 static void FlowWorkerExitPrintStats(
ThreadVars *
tv,
void *data)
#define PKT_IS_TOCLIENT(p)
FlowQueuePrivate work_queue
struct FlowQueue_ * flow_queue
TmEcode OutputFlowLog(ThreadVars *tv, void *thread_data, Flow *f)
Run flow logger(s)
void TimeSetByThread(const int thread_id, const struct timeval *tv)
@ PROFILE_FLOWWORKER_DETECT
void FlowSparePoolReturnFlow(Flow *f)
@ PROFILE_FLOWWORKER_FLOW_INJECTED
struct FlowWorkerThreadData_ FlowWorkerThreadData
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
void PacketPoolReturnPacket(Packet *p)
Return packet to Packet pool.
#define FLOW_PKT_LAST_PSEUDO
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
@ PROFILE_FLOWWORKER_FLOW_EVICTED
const char * ProfileFlowWorkerIdToString(enum ProfileFlowWorkerId fwi)
void OutputLoggerExitPrintStats(ThreadVars *tv, void *thread_data)
@ PROFILE_FLOWWORKER_TCPPRUNE
#define TM_FLAG_DETECT_TM
uint32_t flows_aside_pkt_inject
void AppLayerRegisterThreadCounters(ThreadVars *tv)
Registers per flow counters for all protocols.
TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
#define FLOW_PKT_TOSERVER
FileContainer * AppLayerParserGetFiles(const Flow *f, const uint8_t direction)
void FlowHandlePacket(ThreadVars *tv, FlowLookupStruct *fls, Packet *p)
Entry point for packet flow handling.
void FlowQueuePrivatePrependFlow(FlowQueuePrivate *fqc, Flow *f)
uint16_t flows_aside_needs_work
StreamTcpThread * stream_thread
void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
@ PROFILE_FLOWWORKER_STREAM
#define APP_LAYER_PARSER_EOF_TS
TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data)
void DisableDetectFlowFileFlags(Flow *f)
disable file features we don't need Called if we have no detection engine.
simple fifo queue for packets
#define FLOW_TIMEOUT_REASSEMBLY_DONE
#define FLOWWORKER_PROFILING_START(p, id)
#define FLOWLOCK_UNLOCK(fb)
TmEcode(* ThreadDeinit)(ThreadVars *, void *)
#define PKT_SET_SRC(p, src_val)
AppLayerParserState * alparser
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
DetectEngineThreadCtx * DetectEngineThreadCtxPtr
void FilePrune(FileContainer *ffc)
uint16_t flows_aside_pkt_inject
@ FLOW_STATE_LOCAL_BYPASSED
#define PKT_IS_TOSERVER(p)
TmEcode OutputFlowLogThreadInit(ThreadVars *tv, void *initdata, void **data)
thread init for the flow logger This will run the thread init functions for the individual registered...
Packet * PacketDequeueNoLock(PacketQueueNoLock *qnl)
uint16_t local_bypass_bytes
struct FlowTimeoutCounters FlowTimeoutCounters
void FlowHandlePacketUpdate(Flow *f, Packet *p, ThreadVars *tv, DecodeThreadVars *dtv)
Update Packet and Flow.
#define FLOWLOCK_WRLOCK(fb)
int FlowForceReassemblyNeedReassembly(Flow *f)
Check if a flow needs forced reassembly, or any other processing.
TmEcode StreamTcp(ThreadVars *, Packet *, void *, PacketQueueNoLock *pq)
@ STREAM_HAS_UNPROCESSED_SEGMENTS_NEED_ONLY_DETECTION
Per thread variable structure.
int DetectEngineEnabled(void)
Check if detection is enabled.
TmEcode(* Func)(ThreadVars *, Packet *, void *)
#define FLOW_PKT_TOCLIENT_FIRST
uint16_t local_bypass_pkts
@ PROFILE_FLOWWORKER_APPLAYERUDP
struct FlowWorkerThreadData_::@118 cnt
Flow * FlowQueuePrivateGetFromTop(FlowQueuePrivate *fqc)
#define FLOWWORKER_PROFILING_END(p, id)
void StreamTcpPruneSession(Flow *f, uint8_t flags)
Remove idle TcpSegments from TcpSession.
TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data)
TmModule tmm_modules[TMM_SIZE]
#define APP_LAYER_PARSER_EOF_TC
int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *f)
Handle a app layer UDP message.
#define DEBUG_ASSERT_FLOW_LOCKED(f)
int FlowClearMemory(Flow *f, uint8_t proto_map)
Function clear the flow memory before queueing it to spare flow queue.
void TmModuleFlowWorkerRegister(void)
FlowQueuePrivate spare_queue
void * FlowWorkerGetDetectCtxPtr(void *flow_worker)
void PacketEnqueueNoLock(PacketQueueNoLock *qnl, Packet *p)
FlowQueuePrivate FlowQueueExtractPrivate(FlowQueue *fq)
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
void AppLayerParserTransactionsCleanup(Flow *f)
remove obsolete (inspected and logged) transactions
unsigned short FlowStateType
void DecodeThreadVarsFree(ThreadVars *tv, DecodeThreadVars *dtv)
void FlowFree(Flow *f)
cleanup & free the memory of a flow
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
@ PROFILE_FLOWWORKER_SIZE
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
uint16_t both_bypass_bytes
TmEcode(* ThreadInit)(ThreadVars *, const void *, void **)
void PacketUpdateEngineEventCounters(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
void(* ThreadExitPrintStats)(ThreadVars *, void *)
TmEcode Detect(ThreadVars *tv, Packet *p, void *data)
Detection engine thread wrapper.
void StreamTcpDetectLogFlush(ThreadVars *tv, StreamTcpThread *stt, Flow *f, Packet *p, PacketQueueNoLock *pq)
create packets in both directions to flush out logging and detection before switching protocols....
void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x)
Adds a value of type uint64_t to the local counter.
void * output_thread_flow
TmEcode OutputFlowLogThreadDeinit(ThreadVars *tv, void *thread_data)
TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data)
Structure to hold thread specific data for all decode modules.
#define SC_ATOMIC_INITPTR(name)
DecodeThreadVars * DecodeThreadVarsAlloc(ThreadVars *tv)
Alloc and setup DecodeThreadVars.
PacketQueueNoLock decode_pq
@ PROFILE_FLOWWORKER_FLOW
TcpReassemblyThreadCtx * ra_ctx
#define FLOW_END_FLAG_TIMEOUT
void AppLayerParserStateSetFlag(AppLayerParserState *pstate, uint8_t flag)
int FlowChangeProto(Flow *f)
Check if change proto flag is set for flow.
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.
SC_ATOMIC_DECLARE(DetectEngineThreadCtxPtr, detect_thread)
uint16_t StatsRegisterCounter(const char *name, struct ThreadVars_ *tv)
Registers a normal, unqualified counter.
#define FLOW_PKT_TOSERVER_FIRST
uint16_t both_bypass_pkts
#define DEBUG_VALIDATE_BUG_ON(exp)
#define TM_FLAG_STREAM_TM
TmEcode StreamTcpThreadDeinit(ThreadVars *tv, void *data)
void FlowWorkerReplaceDetectCtx(void *flow_worker, void *detect_ctx)
Packet * FlowForceReassemblyPseudoPacketGet(int direction, Flow *f, TcpSession *ssn)
uint32_t flows_aside_needs_work