suricata
util-prefilter.c File Reference
#include "suricata-common.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

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:

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().

Referenced by AppLayerProtoDetectDestroyCtxThread(), DetectEngineThreadCtxInit(), FTPMemcapGlobalCounter(), MpmACRegister(), MpmACTileRegister(), SCACBSPrintInfo(), and SMTPStateAlloc().

Here is the call graph for this function:

Here is the caller graph for this function:

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 101 of file util-prefilter.c.

References PrefilterRuleStore_::rule_id_array_cnt.

Referenced by FTPMemcapGlobalCounter(), PacketPatternCleanup(), and SMTPProcessDataChunk().

Here is the caller graph for this function:

int PmqSetup ( PrefilterRuleStore pmq)

Setup a pmq.

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

Definition at line 36 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.

Referenced by AppLayerProtoDetectGetCtxThread(), DetectEngineResetMaxSigId(), FTPMemcapGlobalCounter(), MpmACRegister(), MpmACTileRegister(), SCACBSPrintInfo(), and SMTPStateAlloc().

Here is the caller graph for this function:

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 69 of file util-prefilter.c.

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