suricata
util-prefilter.c File Reference
#include "suricata-common.h"
#include "util-prefilter.h"
Include dependency graph for util-prefilter.c:

Go to the source code of this file.

Functions

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

Detailed Description

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

Pattern matcher utility Functions

Definition in file util-prefilter.c.

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, SCLogError, SCRealloc, SigIntId, and unlikely.