suricata
|
#include "suricata-common.h"
Go to the source code of this file.
Data Structures | |
struct | BmCtx_ |
Macros | |
#define | ALPHABET_SIZE 256 |
Typedefs | |
typedef struct BmCtx_ | BmCtx |
Functions | |
BmCtx * | BoyerMooreCtxInit (const uint8_t *needle, uint16_t needle_len) |
Setup a Boyer Moore context. More... | |
BmCtx * | BoyerMooreNocaseCtxInit (uint8_t *needle, uint16_t needle_len) |
Setup a Boyer Moore context for nocase search. More... | |
void | BoyerMooreCtxToNocase (BmCtx *, uint8_t *, uint16_t) |
Given a BmCtx structure, recreate the pre/suffixes for nocase. More... | |
uint8_t * | BoyerMoore (const uint8_t *x, const uint16_t m, const uint8_t *y, const uint32_t n, const BmCtx *bm_ctx) |
Boyer Moore search algorithm Is better as the pattern length increases and for big buffers to search in. The algorithm needs a context of two arrays already prepared by prep_bad_chars() and prep_good_suffix() More... | |
uint8_t * | BoyerMooreNocase (const uint8_t *x, const uint16_t m, const uint8_t *y, const uint32_t n, const BmCtx *bm_ctx) |
Boyer Moore search algorithm Is better as the pattern length increases and for big buffers to search in. The algorithm needs a context of two arrays already prepared by prep_bad_chars() and prep_good_suffix() More... | |
void | BoyerMooreCtxDeInit (BmCtx *) |
Free the memory allocated to Boyer Moore context. More... | |
void | SpmBMRegister (void) |
Definition in file util-spm-bm.h.
#define ALPHABET_SIZE 256 |
Definition at line 31 of file util-spm-bm.h.
uint8_t* BoyerMoore | ( | const uint8_t * | x, |
const uint16_t | m, | ||
const uint8_t * | y, | ||
const uint32_t | n, | ||
const BmCtx * | bm_ctx | ||
) |
Boyer Moore search algorithm Is better as the pattern length increases and for big buffers to search in. The algorithm needs a context of two arrays already prepared by prep_bad_chars() and prep_good_suffix()
y | pointer to the buffer to search in |
n | length limit of the buffer |
x | pointer to the pattern we ar searching for |
m | length limit of the needle |
bmBc | pointer to an array of BoyerMooreSuffixes prepared by prep_good_suffix() |
bmGs | pointer to an array of bachars prepared by prep_bad_chars() |
ptr | to start of the match; NULL if no match |
Definition at line 300 of file util-spm-bm.c.
References BmCtx_::bmBc, BmCtx_::bmGs, m, and unlikely.
Referenced by BoyerMooreSearch().
void BoyerMooreCtxDeInit | ( | BmCtx * | bmctx | ) |
Free the memory allocated to Boyer Moore context.
bmCtx | pointer to the Context for the pattern |
Definition at line 119 of file util-spm-bm.c.
References SCEnter, SCFree, and SCReturn.
Referenced by BoyerMooreNocaseSearch(), and BoyerMooreSearch().
BmCtx* BoyerMooreCtxInit | ( | const uint8_t * | needle, |
uint16_t | needle_len | ||
) |
Setup a Boyer Moore context.
Prepare and return a Boyer Moore context
str | pointer to the pattern string |
size | length of the string |
BmCtx | pointer to the newly created Context for the pattern \initonly BoyerMoore contexts should be created at init |
Definition at line 78 of file util-spm-bm.c.
References FatalError, SCMalloc, and unlikely.
Referenced by BoyerMooreNocaseCtxInit(), and BoyerMooreSearch().
void BoyerMooreCtxToNocase | ( | BmCtx * | bm_ctx, |
uint8_t * | needle, | ||
uint16_t | needle_len | ||
) |
Given a BmCtx structure, recreate the pre/suffixes for nocase.
BmCtx | pointer to the already created BmCtx (with BoyerMooreCtxInit()) |
str | pointer to the pattern string |
size | length of the string |
Definition at line 58 of file util-spm-bm.c.
Referenced by BoyerMooreNocaseCtxInit().
uint8_t* BoyerMooreNocase | ( | const uint8_t * | x, |
const uint16_t | m, | ||
const uint8_t * | y, | ||
const uint32_t | n, | ||
const BmCtx * | bm_ctx | ||
) |
Boyer Moore search algorithm Is better as the pattern length increases and for big buffers to search in. The algorithm needs a context of two arrays already prepared by prep_bad_chars() and prep_good_suffix()
y | pointer to the buffer to search in |
n | length limit of the buffer |
x | pointer to the pattern we ar searching for |
m | length limit of the needle |
bmBc | pointer to an array of BoyerMooreSuffixes prepared by prep_good_suffix() |
bmGs | pointer to an array of bachars prepared by prep_bad_chars() |
ptr | to start of the match; NULL if no match |
Definition at line 338 of file util-spm-bm.c.
References BmCtx_::bmBc, BmCtx_::bmGs, m, u8_tolower, and unlikely.
Referenced by BoyerMooreNocaseSearch().
BmCtx* BoyerMooreNocaseCtxInit | ( | uint8_t * | needle, |
uint16_t | needle_len | ||
) |
Setup a Boyer Moore context for nocase search.
str | pointer to the pattern string |
size | length of the string |
BmCtx | pointer to the newly created Context for the pattern \initonly BoyerMoore contexts should be created at init |
Definition at line 105 of file util-spm-bm.c.
References BoyerMooreCtxInit(), and BoyerMooreCtxToNocase().
Referenced by BoyerMooreNocaseSearch().
void SpmBMRegister | ( | void | ) |
Definition at line 475 of file util-spm-bm.c.
References SpmTableElmt_::InitGlobalThreadCtx, SpmTableElmt_::name, SPM_BM, and spm_table.
Referenced by SpmTableSetup().