suricata
util-spm-bs2bm.h File Reference
#include "suricata-common.h"
#include "suricata.h"
Include dependency graph for util-spm-bs2bm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ALPHABET_SIZE   256
 

Functions

void Bs2BmBadchars (const uint8_t *, uint16_t, uint8_t *)
 Array setup function for Bs2Bm of bad characters index (not found at the needle) More...
 
void Bs2BmBadcharsNocase (const uint8_t *, uint16_t, uint8_t *)
 Array setup function for Bs2BmNocase of bad characters index (not found at the needle) More...
 
uint8_t * Bs2Bm (const uint8_t *, uint32_t, const uint8_t *, uint16_t, uint8_t[])
 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 faster. More...
 
uint8_t * Bs2BmNocase (const uint8_t *, uint32_t, const uint8_t *, uint16_t, uint8_t[])
 Basic search case less 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 faster. More...
 

Detailed Description

Macro Definition Documentation

#define ALPHABET_SIZE   256

Definition at line 30 of file util-spm-bs2bm.h.

Function Documentation

uint8_t* Bs2Bm ( const uint8_t *  haystack,
uint32_t  haystack_len,
const uint8_t *  needle,
uint16_t  needle_len,
uint8_t  badchars[] 
)

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 faster.

Parameters
haystackpointer to the buffer to search in
haystack_lenlength limit of the buffer
neddlepointer to the pattern we ar searching for
needle_lenlength limit of the needle
badcharspointer to an array of bachars prepared by Bs2BmBadchars()
Return values
ptrto start of the match; NULL if no match

Definition at line 93 of file util-spm-bs2bm.c.

Referenced by Bs2bmSearch().

Here is the caller graph for this function:

void Bs2BmBadchars ( const uint8_t *  needle,
uint16_t  needle_len,
uint8_t *  badchars 
)

Array setup function for Bs2Bm of bad characters index (not found at the needle)

Parameters
neddlepointer to the pattern we ar searching for
needle_lenlength limit of the needle
badcharspointer to an empty array of bachars. The array prepared contains characters that can't be inside the needle_len. So the skips can be faster

Definition at line 43 of file util-spm-bs2bm.c.

References ALPHABET_SIZE.

Referenced by Bs2bmNocaseSearch(), and Bs2bmSearch().

Here is the caller graph for this function:

void Bs2BmBadcharsNocase ( const uint8_t *  needle,
uint16_t  needle_len,
uint8_t *  badchars 
)

Array setup function for Bs2BmNocase of bad characters index (not found at the needle)

Parameters
neddlepointer to the pattern we ar searching for
needle_lenlength limit of the needle
badcharspointer to an empty array of bachars. The array prepared contains characters that can't be inside the needle_len. So the skips can be faster

Definition at line 65 of file util-spm-bs2bm.c.

References ALPHABET_SIZE, and u8_tolower.

uint8_t* Bs2BmNocase ( const uint8_t *  haystack,
uint32_t  haystack_len,
const uint8_t *  needle,
uint16_t  needle_len,
uint8_t  badchars[] 
)

Basic search case less 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 faster.

Parameters
haystackpointer to the buffer to search in
haystack_lenlength limit of the buffer
neddlepointer to the pattern we ar searching for
needle_lenlength limit of the needle
badcharspointer to an array of bachars prepared by Bs2BmBadchars()
Return values
ptrto start of the match; NULL if no match

Definition at line 142 of file util-spm-bs2bm.c.

References u8_tolower.

Referenced by Bs2bmNocaseSearch().

Here is the caller graph for this function: