suricata
util-port-interval-tree.h File Reference
Include dependency graph for util-port-interval-tree.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SCPortIntervalTree_
 

Typedefs

typedef struct SCPortIntervalTree_ SCPortIntervalTree
 

Functions

SCPortIntervalTreeSCPortIntervalTreeInit (void)
 Function to initialize the interval tree. More...
 
void SCPortIntervalTreeFree (DetectEngineCtx *, SCPortIntervalTree *)
 Function to free an entire interval tree. More...
 
int SCPortIntervalInsert (DetectEngineCtx *, SCPortIntervalTree *, const DetectPort *)
 Function to insert a node in the interval tree. More...
 
void SCPortIntervalFindOverlappingRanges (DetectEngineCtx *, const uint16_t, const uint16_t, const struct PI *, DetectPort **)
 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.h.

Typedef Documentation

◆ SCPortIntervalTree

Function Documentation

◆ 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.