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

Go to the source code of this file.

Typedefs

typedef void(* SCFlowInitCallbackFn) (ThreadVars *tv, Flow *f, const Packet *p, void *user)
 Function type for flow initialization callbacks. More...
 
typedef void(* SCFlowUpdateCallbackFn) (ThreadVars *tv, Flow *f, Packet *p, void *user)
 Function type for flow update callbacks. More...
 
typedef void(* SCFlowFinishCallbackFn) (ThreadVars *tv, Flow *f, void *user)
 Function type for flow finish callbacks. More...
 

Functions

bool SCFlowRegisterInitCallback (SCFlowInitCallbackFn fn, void *user)
 Register a flow init callback. More...
 
void SCFlowRunInitCallbacks (ThreadVars *tv, Flow *f, const Packet *p)
 
bool SCFlowRegisterUpdateCallback (SCFlowUpdateCallbackFn fn, void *user)
 Register a flow update callback. More...
 
void SCFlowRunUpdateCallbacks (ThreadVars *tv, Flow *f, Packet *p)
 
bool SCFlowRegisterFinishCallback (SCFlowFinishCallbackFn fn, void *user)
 Register a flow init callback. More...
 
void SCFlowRunFinishCallbacks (ThreadVars *tv, Flow *f)
 

Typedef Documentation

◆ SCFlowFinishCallbackFn

typedef void(* SCFlowFinishCallbackFn) (ThreadVars *tv, Flow *f, void *user)

Function type for flow finish callbacks.

Once registered with SCFlowRegisterFinshCallback, this function will be called when Suricata is done with a flow.

Parameters
tvThe ThreadVars data structure for the thread finishing the flow.
fThe flow being finshed.
userThe user data provided during callback registration.

Definition at line 100 of file flow-callbacks.h.

◆ SCFlowInitCallbackFn

typedef void(* SCFlowInitCallbackFn) (ThreadVars *tv, Flow *f, const Packet *p, void *user)

Function type for flow initialization callbacks.

Once registered with SCFlowRegisterInitCallback, this function will be called every time a flow is initialized, or in other words, every time Suricata picks up a flow.

Parameters
tvThe ThreadVars data structure for the thread creating the flow.
fThe newly initialized flow.
pThe packet related to creating the new flow.
userThe user data provided during callback registration.

Definition at line 36 of file flow-callbacks.h.

◆ SCFlowUpdateCallbackFn

typedef void(* SCFlowUpdateCallbackFn) (ThreadVars *tv, Flow *f, Packet *p, void *user)

Function type for flow update callbacks.

Once registered with SCFlowRegisterUpdateCallback, this function will be called every time a flow is updated by a packet (basically everytime a packet is seen on a flow).

Parameters
tvThe ThreadVars data structure for the thread updating the flow.
fThe flow being updated.
pThe packet responsible for the flow update.
userThe user data provided during callback registration.

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

Function Documentation

◆ SCFlowRegisterFinishCallback()

bool SCFlowRegisterFinishCallback ( SCFlowFinishCallbackFn  fn,
void *  user 
)

Register a flow init callback.

Register a user provided function to be called every time a flow is finished.

Parameters
fnPointer to function to be called
userAdditional user data to be passed to callback
Returns
true if callback was registered, otherwise false if the callback could not be registered due to memory allocation error.

Definition at line 102 of file flow-callbacks.c.

References FlowFinishCallback_::Callback, SCCalloc, and FlowFinishCallback_::user.

◆ SCFlowRegisterInitCallback()

bool SCFlowRegisterInitCallback ( SCFlowInitCallbackFn  fn,
void *  user 
)

Register a flow init callback.

Register a user provided function to be called every time a flow is initialized for use.

Parameters
fnPointer to function to be called
userAdditional user data to be passed to callback
Returns
true if callback was registered, otherwise false if the callback could not be registered due to memory allocation error.

Definition at line 44 of file flow-callbacks.c.

References FlowInitCallback_::Callback, SCCalloc, FlowInitCallback_::user, and FlowFinishCallback_::user.

◆ SCFlowRegisterUpdateCallback()

bool SCFlowRegisterUpdateCallback ( SCFlowUpdateCallbackFn  fn,
void *  user 
)

Register a flow update callback.

Register a user provided function to be called everytime a flow is updated.

Parameters
fnPointer to function to be called
userAdditional user data to be passed to callback
Returns
true if callback was registered, otherwise false if the callback could not be registered due to memory allocation error.

Definition at line 73 of file flow-callbacks.c.

References FlowUpdateCallback_::Callback, SCCalloc, FlowUpdateCallback_::user, and FlowFinishCallback_::user.

◆ SCFlowRunFinishCallbacks()

void SCFlowRunFinishCallbacks ( ThreadVars tv,
Flow f 
)

Definition at line 122 of file flow-callbacks.c.

◆ SCFlowRunInitCallbacks()

void SCFlowRunInitCallbacks ( ThreadVars tv,
Flow f,
const Packet p 
)

Definition at line 64 of file flow-callbacks.c.

◆ SCFlowRunUpdateCallbacks()

void SCFlowRunUpdateCallbacks ( ThreadVars tv,
Flow f,
Packet p 
)

Definition at line 93 of file flow-callbacks.c.