suricata
util-port-interval-tree.c File Reference
Include dependency graph for util-port-interval-tree.c:

Go to the source code of this file.

Macros

#define STACK_SIZE   100
 

Functions

 IRB_GENERATE (PI, SCPortIntervalNode, irb, SCPortIntervalCompareAndUpdate)
 
SCPortIntervalTreeSCPortIntervalTreeInit (void)
 Function to initialize the interval tree. More...
 
void SCPortIntervalTreeFree (DetectEngineCtx *de_ctx, SCPortIntervalTree *it)
 Function to free an entire interval tree. More...
 
int SCPortIntervalInsert (DetectEngineCtx *de_ctx, SCPortIntervalTree *it, const DetectPort *p)
 Function to insert a node in the interval tree. More...
 
void SCPortIntervalFindOverlappingRanges (DetectEngineCtx *de_ctx, const uint16_t port, const uint16_t port2, const struct PI *head, DetectPort **list)
 Callee function to find all overlapping port ranges as asked by the detection engine during Stage 2 of signature grouping. More...
 

Detailed Description

Author
Shivani Bhardwaj shiva.nosp@m.ni@o.nosp@m.isf.n.nosp@m.et

Definition in file util-port-interval-tree.c.

Macro Definition Documentation

◆ STACK_SIZE

#define STACK_SIZE   100

Definition at line 200 of file util-port-interval-tree.c.

Function Documentation

◆ IRB_GENERATE()

IRB_GENERATE ( PI  ,
SCPortIntervalNode  ,
irb  ,
SCPortIntervalCompareAndUpdate   
)

◆ SCPortIntervalFindOverlappingRanges()

void SCPortIntervalFindOverlappingRanges ( DetectEngineCtx de_ctx,
const uint16_t  port,
const uint16_t  port2,
const struct PI *  head,
DetectPort **  list 
)

Callee function to find all overlapping port ranges as asked by the detection engine during Stage 2 of signature grouping.

Parameters
de_ctxDetection Engine Context
portGiven low port
port2Given high port
headPointer to the head of the tree named PI
listPointer to the list of port objects that needs to be filled/updated

Definition at line 315 of file util-port-interval-tree.c.

◆ SCPortIntervalInsert()

int SCPortIntervalInsert ( DetectEngineCtx de_ctx,
SCPortIntervalTree it,
const DetectPort p 
)

Function to insert a node in the interval tree.

Parameters
de_ctxDetection Engine Context
itPointer to the interval tree
pPointer to a DetectPort object
Returns
SC_OK if the node was inserted successfully, SC_EINVAL otherwise

Definition at line 109 of file util-port-interval-tree.c.

References de_ctx, DEBUG_VALIDATE_BUG_ON, SCPortIntervalNode::port, DetectPort_::port, SCPortIntervalNode::port2, DetectPort_::port2, SC_EINVAL, SC_OK, SCCalloc, SCFree, SCLogDebug, SCPortIntervalNode::sh, DetectPort_::sh, SigGroupHeadCopySigs(), and SCPortIntervalTree_::tree.

Here is the call graph for this function:

◆ SCPortIntervalTreeFree()

void SCPortIntervalTreeFree ( DetectEngineCtx de_ctx,
SCPortIntervalTree it 
)

Function to free an entire interval tree.

Parameters
de_ctxDetection Engine Context
itPointer to the interval tree

Definition at line 92 of file util-port-interval-tree.c.

◆ SCPortIntervalTreeInit()

SCPortIntervalTree* SCPortIntervalTreeInit ( void  )

Function to initialize the interval tree.

Returns
Pointer to the newly created interval tree

Definition at line 58 of file util-port-interval-tree.c.

References SCCalloc.