mpm/spm: spelling

pull/8828/head
Victor Julien 3 years ago
parent a945982e8f
commit f893827c32

@ -33,14 +33,14 @@
* If you can fit the ruleset with this mpm on your box without hitting
* swap, this is the MPM to go for.
*
* \todo - Do a proper analyis of our existing MPMs and suggest a good one based
* \todo - Do a proper analysis of our existing MPMs and suggest a good one based
* on the pattern distribution and the expected traffic(say http).
* - Tried out loop unrolling without any perf increase. Need to dig deeper.
* - Irrespective of whether we cross 2 ** 16 states or not,shift to using
* uint32_t for state type, so that we can integrate it's status as a
* final state or not in the topmost byte. We are already doing it if
* state_count is > 2 ** 16.
* - Test case-senstive patterns if they have any ascii chars. If they
* - Test case-sensitive patterns if they have any ascii chars. If they
* don't treat them as nocase.
* - Carry out other optimizations we are working on. hashes, compression.
*/
@ -721,7 +721,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
k++;
}
/* if we have any non 0 transitions from our previous for search,
* store the acii codes as well the corresponding states */
* store the ascii codes as well the corresponding states */
if (k > 0) {
no_of_entries[0] = k;
if (state != 0)
@ -793,7 +793,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
k++;
}
/* if we have any non 0 transitions from our previous for search,
* store the acii codes as well the corresponding states */
* store the ascii codes as well the corresponding states */
if (k > 0) {
no_of_entries[0] = k;
if (state != 0)

@ -50,7 +50,7 @@
* the alphabet, so that it is constant inside the
* function for better optimization.
*
* \todo - Do a proper analyis of our existing MPMs and suggest a good
* \todo - Do a proper analysis of our existing MPMs and suggest a good
* one based on the pattern distribution and the expected
* traffic(say http).
@ -59,7 +59,7 @@
* integrate it's status as a final state or not in the
* topmost byte. We are already doing it if state_count is >
* 2 ** 16.
* - Test case-senstive patterns if they have any ascii chars.
* - Test case-sensitive patterns if they have any ascii chars.
* If they don't treat them as nocase.
* - Reorder the compressed alphabet to put the most common characters
* first.
@ -169,10 +169,9 @@ static void SCACTileGetConfig(void)
{
}
/**
* \internal
* \brief Count the occurences of each character in the pattern and
* \brief Count the occurrences of each character in the pattern and
* accumulate into a histogram. Really only used to detect unused
* characters, so could just set to 1 instead of counting.
*/
@ -184,7 +183,7 @@ static inline void SCACTileHistogramAlphabet(SCACTileCtx *ctx,
}
}
/* Use Alpahbet Histogram to create compressed alphabet.
/* Use Alphabet Histogram to create compressed alphabet.
*/
static void SCACTileInitTranslateTable(SCACTileCtx *ctx)
{
@ -212,7 +211,7 @@ static void SCACTileInitTranslateTable(SCACTileCtx *ctx)
SCLogDebug(" Alphabet size %d", ctx->alphabet_size);
/* Round alphabet size up to next power-of-two Leave one extra
* space For the unused-chararacters = 0 mapping.
* space For the unused-characters = 0 mapping.
*/
ctx->alphabet_size += 1; /* Extra space for unused-character */
if (ctx->alphabet_size <= 8) {
@ -1175,7 +1174,7 @@ static int CheckMatch(const SCACTileSearchCtx *ctx, PrefilterRuleStore *pmq,
if (mpm_bitarray[pindex / 8] & (1 << (pindex % 8))) {
/* Pattern already seen by this MPM. */
/* NOTE: This is faster then rechecking if it is a case-sensitive match
* since we know this pattern has already been seen, but imcrementing
* since we know this pattern has already been seen, but incrementing
* matches here could over report matches. For example if the case-sensitive
* pattern is "Foo" and the string is "Foo bar foo", matches would be reported
* as 2, when it should really be 1, since "foo" is not a true match.
@ -1188,7 +1187,7 @@ static int CheckMatch(const SCACTileSearchCtx *ctx, PrefilterRuleStore *pmq,
if (offset < (int)pat->offset || (pat->depth && i > pat->depth))
continue;
/* Double check case-sensitve match now. */
/* Double check case-sensitive match now. */
if (patterns[k] >> 31) {
const uint16_t patlen = pat->patlen;
if (SCMemcmp(pat->cs, buf_offset - patlen, patlen) != 0) {

@ -33,14 +33,14 @@
* If you can fit the ruleset with this mpm on your box without hitting
* swap, this is the MPM to go for.
*
* \todo - Do a proper analyis of our existing MPMs and suggest a good one based
* \todo - Do a proper analysis of our existing MPMs and suggest a good one based
* on the pattern distribution and the expected traffic(say http).
* - Tried out loop unrolling without any perf increase. Need to dig deeper.
* - Irrespective of whether we cross 2 ** 16 states or not,shift to using
* uint32_t for state type, so that we can integrate it's status as a
* final state or not in the topmost byte. We are already doing it if
* state_count is > 2 ** 16.
* - Test case-senstive patterns if they have any ascii chars. If they
* - Test case-sensitive patterns if they have any ascii chars. If they
* don't treat them as nocase.
* - Carry out other optimizations we are working on. hashes, compression.
*/

@ -55,7 +55,7 @@ typedef struct MpmThreadCtx_ {
typedef struct MpmPattern_ {
/* length of the pattern */
uint16_t len;
/* flags decribing the pattern */
/* flags describing the pattern */
uint8_t flags;
/* offset into the buffer where match may start */

@ -24,8 +24,8 @@
*
* Boyer Moore algorithm has a really good performance. It need two arrays
* of context for each pattern that hold applicable shifts on the text
* to seach in, based on characters not available in the pattern
* and combinations of characters that start a sufix of the pattern.
* to search in, based on characters not available in the pattern
* and combinations of characters that start a suffix of the pattern.
* If possible, we should store the context of patterns that we are going
* to search for multiple times, so we don't spend time on rebuilding them.
*/
@ -68,7 +68,7 @@ void BoyerMooreCtxToNocase(BmCtx *bm_ctx, uint8_t *needle, uint16_t needle_len)
}
/**
* \brief Setup a Booyer Moore context.
* \brief Setup a Boyer Moore context.
*
* \param str pointer to the pattern string
* \param size length of the string
@ -87,7 +87,7 @@ BmCtx *BoyerMooreCtxInit(const uint8_t *needle, uint16_t needle_len)
/* Prepare good Suffixes */
if (PreBmGs(needle, needle_len, new->bmGs) == -1) {
FatalError("Fatal error encountered in BooyerMooreCtxInit. Exiting...");
FatalError("Fatal error encountered in BoyerMoreCtxInit. Exiting...");
}
@ -95,7 +95,7 @@ BmCtx *BoyerMooreCtxInit(const uint8_t *needle, uint16_t needle_len)
}
/**
* \brief Setup a Booyer Moore context for nocase search
* \brief Setup a Boyer Moore context for nocase search
*
* \param str pointer to the pattern string
* \param size length of the string
@ -112,7 +112,7 @@ BmCtx *BoyerMooreNocaseCtxInit(uint8_t *needle, uint16_t needle_len)
}
/**
* \brief Free the memory allocated to Booyer Moore context.
* \brief Free the memory allocated to Boyer Moore context.
*
* \param bmCtx pointer to the Context for the pattern
*/

@ -29,7 +29,7 @@
#define ALPHABET_SIZE 256
/* Context for booyer moore */
/* Context for boyer moore */
typedef struct BmCtx_ {
uint16_t bmBc[ALPHABET_SIZE];
//C99 "flexible array member"

@ -33,14 +33,13 @@
#include "util-debug.h"
#include "util-spm-bs.h"
/**
* \brief Basic search improved. Limits are better handled, so
* it doesn't start searches that wont fit in the remaining buffer
*
* \param haystack pointer to the buffer to search in
* \param haystack_len length limit of the buffer
* \param neddle pointer to the pattern we ar searching for
* \param needle pointer to the pattern we ar searching for
* \param needle_len length limit of the needle
*
* \retval ptr to start of the match; NULL if no match
@ -94,7 +93,7 @@ uint8_t *BasicSearch(const uint8_t *haystack, uint32_t haystack_len, const uint8
*
* \param haystack pointer to the buffer to search in
* \param haystack_len length limit of the buffer
* \param neddle pointer to the pattern we ar searching for
* \param needle pointer to the pattern we ar searching for
* \param needle_len length limit of the needle
*
* \retval ptr to start of the match; NULL if no match

@ -20,7 +20,7 @@
*
* \author Pablo Rincon Crespo <pablo.rincon.crespo@gmail.com>
*
* Bs2Bm use a simple context array to determine the charactes
* Bs2Bm use a simple context array to determine the characters
* that are not present on the pattern. This way on partial matches
* broken by a char not present, we can skip to the next character
* making less checks
@ -34,7 +34,7 @@
/**
* \brief Array setup function for Bs2Bm of bad characters index (not found at the needle)
*
* \param neddle pointer to the pattern we ar searching for
* \param needle pointer to the pattern we ar searching for
* \param needle_len length limit of the needle
* \param badchars pointer to an empty array of bachars. The array prepared contains
* characters that can't be inside the needle_len. So the skips can be
@ -56,7 +56,7 @@ void Bs2BmBadchars(const uint8_t *needle, uint16_t needle_len, uint8_t *badchars
/**
* \brief Array setup function for Bs2BmNocase of bad characters index (not found at the needle)
*
* \param neddle pointer to the pattern we ar searching for
* \param needle pointer to the pattern we ar searching for
* \param needle_len length limit of the needle
* \param badchars pointer to an empty array of bachars. The array prepared contains
* characters that can't be inside the needle_len. So the skips can be
@ -76,7 +76,6 @@ void Bs2BmBadcharsNocase(const uint8_t *needle, uint16_t needle_len, uint8_t *ba
}
}
/**
* \brief Basic search with a bad characters array. The array badchars contains
* flags at character's ascii index that can't be inside the needle. So the skips can be
@ -84,7 +83,7 @@ void Bs2BmBadcharsNocase(const uint8_t *needle, uint16_t needle_len, uint8_t *ba
*
* \param haystack pointer to the buffer to search in
* \param haystack_len length limit of the buffer
* \param neddle pointer to the pattern we ar searching for
* \param needle pointer to the pattern we ar searching for
* \param needle_len length limit of the needle
* \param badchars pointer to an array of bachars prepared by Bs2BmBadchars()
*
@ -134,7 +133,7 @@ uint8_t *Bs2Bm(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *ne
*
* \param haystack pointer to the buffer to search in
* \param haystack_len length limit of the buffer
* \param neddle pointer to the pattern we ar searching for
* \param needle pointer to the pattern we ar searching for
* \param needle_len length limit of the needle
* \param badchars pointer to an array of bachars prepared by Bs2BmBadchars()
*

Loading…
Cancel
Save