* 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.
*/
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)
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)
* 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).
* 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.
{
}
-
/**
* \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.
*/
}
}
-/* Use Alpahbet Histogram to create compressed alphabet.
+/* Use Alphabet Histogram to create compressed alphabet.
*/
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) {
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.
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) {
* 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.
*/
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 */
*
* 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.
*/
}
/**
- * \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
/* 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...");
}
}
/**
- * \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
}
/**
- * \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
*/
#define ALPHABET_SIZE 256
-/* Context for booyer moore */
+/* Context for boyer moore */
typedef struct BmCtx_ {
uint16_t bmBc[ALPHABET_SIZE];
//C99 "flexible array member"
#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
*
* \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
*
* \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
/**
* \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
/**
* \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
}
}
-
/**
* \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
*
* \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()
*
*
* \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()
*