suricata
util-prefilter.h File Reference
#include "util-debug.h"
Include dependency graph for util-prefilter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PrefilterRuleStore_
 structure for storing potential rule matches More...
 

Macros

#define PMQ_RESET(pmq)   (pmq)->rule_id_array_cnt = 0
 

Typedefs

typedef struct PrefilterRuleStore_ PrefilterRuleStore
 structure for storing potential rule matches More...
 

Functions

int PrefilterAddSidsResize (PrefilterRuleStore *pmq, uint32_t new_size)
 Add array of Signature IDs to rule ID array. More...
 
int PmqSetup (PrefilterRuleStore *)
 Setup a pmq. More...
 
void PmqReset (PrefilterRuleStore *)
 Reset a Pmq for reusage. Meant to be called after a single search. More...
 
void PmqCleanup (PrefilterRuleStore *)
 Cleanup a Pmq. More...
 
void PmqFree (PrefilterRuleStore *)
 Cleanup and free a Pmq. More...
 

Detailed Description

Macro Definition Documentation

◆ PMQ_RESET

#define PMQ_RESET (   pmq)    (pmq)->rule_id_array_cnt = 0

Definition at line 47 of file util-prefilter.h.

Typedef Documentation

◆ PrefilterRuleStore

structure for storing potential rule matches

Helper structure for the prefilter engine. The Pattern Matchers and other prefilter engines will add rule id's for potential rule matches

Function Documentation

◆ PmqCleanup()

void PmqCleanup ( PrefilterRuleStore pmq)

Cleanup a Pmq.

Parameters
pmqPattern matcher queue to be cleaned up.

Definition at line 113 of file util-prefilter.c.

References PrefilterRuleStore_::rule_id_array, and SCFree.

Referenced by PmqFree().

Here is the caller graph for this function:

◆ PmqFree()

void PmqFree ( PrefilterRuleStore pmq)

Cleanup and free a Pmq.

Parameters
pmqPattern matcher queue to be free'd.

Definition at line 126 of file util-prefilter.c.

References PmqCleanup().

Here is the call graph for this function:

◆ PmqReset()

void PmqReset ( PrefilterRuleStore pmq)

Reset a Pmq for reusage. Meant to be called after a single search.

Parameters
pmqPattern matcher to be reset.
Todo:
memset is expensive, but we need it as we merge pmq's. We might use a flag so we can clear pmq's the old way if we can.

Definition at line 102 of file util-prefilter.c.

References PMQ_RESET.

◆ PmqSetup()

int PmqSetup ( PrefilterRuleStore pmq)

Setup a pmq.

Parameters
pmqPattern matcher queue to be initialized
Return values
-1error
0ok

Definition at line 37 of file util-prefilter.c.

References PrefilterRuleStore_::rule_id_array, PrefilterRuleStore_::rule_id_array_cnt, PrefilterRuleStore_::rule_id_array_size, SCEnter, SCMalloc, SCReturnInt, and SigIntId.

◆ PrefilterAddSidsResize()

int PrefilterAddSidsResize ( PrefilterRuleStore pmq,
uint32_t  new_size 
)

Add array of Signature IDs to rule ID array.

Checks size of the array first

Parameters
pmqstorage for match results
new_sizenumber of Signature IDs needing to be stored.

Definition at line 70 of file util-prefilter.c.

References PrefilterRuleStore_::rule_id_array, PrefilterRuleStore_::rule_id_array_size, SC_ERR_MEM_ALLOC, SCLogError, SCRealloc, SigIntId, and unlikely.