suricata
flow-queue.h File Reference
#include "suricata-common.h"
#include "flow.h"
Include dependency graph for flow-queue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  FlowQueue_
 

Macros

#define FQLOCK_MUTEX
 
#define FQLOCK_INIT(q)   SCMutexInit(&(q)->m, NULL)
 
#define FQLOCK_DESTROY(q)   SCMutexDestroy(&(q)->m)
 
#define FQLOCK_LOCK(q)   SCMutexLock(&(q)->m)
 
#define FQLOCK_TRYLOCK(q)   SCMutexTrylock(&(q)->m)
 
#define FQLOCK_UNLOCK(q)   SCMutexUnlock(&(q)->m)
 

Typedefs

typedef struct FlowQueue_ FlowQueue
 

Functions

FlowQueueFlowQueueNew (void)
 
FlowQueueFlowQueueInit (FlowQueue *)
 
void FlowQueueDestroy (FlowQueue *)
 Destroy a flow queue. More...
 
void FlowEnqueue (FlowQueue *, Flow *)
 add a flow to a queue More...
 
FlowFlowDequeue (FlowQueue *)
 remove a flow from the queue More...
 
void FlowMoveToSpare (Flow *)
 Transfer a flow from a queue to the spare queue. More...
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Definition in file flow-queue.h.

Macro Definition Documentation

#define FQLOCK_DESTROY (   q)    SCMutexDestroy(&(q)->m)

Definition at line 66 of file flow-queue.h.

Referenced by FlowQueueDestroy().

#define FQLOCK_INIT (   q)    SCMutexInit(&(q)->m, NULL)

Definition at line 65 of file flow-queue.h.

Referenced by FlowQueueInit().

#define FQLOCK_LOCK (   q)    SCMutexLock(&(q)->m)

Definition at line 67 of file flow-queue.h.

Referenced by FlowDequeue(), FlowEnqueue(), FlowMoveToSpare(), and FlowUpdateSpareFlows().

#define FQLOCK_MUTEX

Spinlocks or Mutex for the flow queues.

Definition at line 32 of file flow-queue.h.

#define FQLOCK_TRYLOCK (   q)    SCMutexTrylock(&(q)->m)

Definition at line 68 of file flow-queue.h.

#define FQLOCK_UNLOCK (   q)    SCMutexUnlock(&(q)->m)

Definition at line 69 of file flow-queue.h.

Referenced by FlowDequeue(), FlowEnqueue(), FlowMoveToSpare(), and FlowUpdateSpareFlows().

Typedef Documentation

typedef struct FlowQueue_ FlowQueue

Function Documentation

Flow* FlowDequeue ( FlowQueue q)

remove a flow from the queue

Parameters
qqueue
Return values
fflow or NULL if empty list.

Definition at line 105 of file flow-queue.c.

References FlowQueue_::bot, BUG_ON, FQLOCK_LOCK, FQLOCK_UNLOCK, FlowQueue_::len, Flow_::lnext, Flow_::lprev, and FlowQueue_::top.

Referenced by FlowGetFromFlowKey(), FlowSetupPacket(), FlowShutdown(), and FlowUpdateSpareFlows().

Here is the caller graph for this function:

void FlowEnqueue ( FlowQueue q,
Flow f 
)

add a flow to a queue

Parameters
qqueue
fflow

Definition at line 72 of file flow-queue.c.

References FlowQueue_::bot, BUG_ON, FQLOCK_LOCK, FQLOCK_UNLOCK, FlowQueue_::len, Flow_::lnext, Flow_::lprev, and FlowQueue_::top.

Referenced by FlowDisableFlowManagerThread(), FlowInitConfig(), and FlowUpdateSpareFlows().

Here is the caller graph for this function:

void FlowMoveToSpare ( Flow f)

Transfer a flow from a queue to the spare queue.

Parameters
fthe flow to be transfered
qthe source queue, where the flow will be removed. This queue is locked.
Note
spare queue needs locking

Definition at line 146 of file flow-queue.c.

References FlowQueue_::bot, flow_spare_q, FQLOCK_LOCK, FQLOCK_UNLOCK, FlowQueue_::len, Flow_::lnext, Flow_::lprev, and FlowQueue_::top.

void FlowQueueDestroy ( FlowQueue q)

Destroy a flow queue.

Parameters
qthe flow queue to destroy

Definition at line 61 of file flow-queue.c.

References FQLOCK_DESTROY.

Referenced by FlowShutdown(), and TmModuleFlowRecyclerRegister().

Here is the caller graph for this function:

FlowQueue* FlowQueueInit ( FlowQueue )

Definition at line 47 of file flow-queue.c.

References FQLOCK_INIT.

Referenced by FlowInitConfig(), FlowQueueNew(), and TmModuleFlowRecyclerRegister().

Here is the caller graph for this function:

FlowQueue* FlowQueueNew ( void  )

Definition at line 36 of file flow-queue.c.

References FlowQueueInit(), SC_ERR_FATAL, SCLogError, and SCMalloc.

Here is the call graph for this function: