suricata
util-spm-bs2bm.h File Reference
#include "suricata-common.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...
 
uint8_t * Bs2Bm (const uint8_t *, uint32_t, const uint8_t *, uint16_t, const 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, const 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

◆ ALPHABET_SIZE

#define ALPHABET_SIZE   256

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

Function Documentation

◆ Bs2Bm()

uint8_t* Bs2Bm ( const uint8_t *  haystack,
uint32_t  haystack_len,
const uint8_t *  needle,
uint16_t  needle_len,
const 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
needlepointer 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 69 of file util-spm-bs2bm.c.

Referenced by Bs2bmSearch().

Here is the caller graph for this function:

◆ Bs2BmBadchars()

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

Here is the caller graph for this function:

◆ Bs2BmNocase()

uint8_t* Bs2BmNocase ( const uint8_t *  haystack,
uint32_t  haystack_len,
const uint8_t *  needle,
uint16_t  needle_len,
const 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
needlepointer 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 119 of file util-spm-bs2bm.c.

References u8_tolower.