suricata
util-spm-bs.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "util-debug.h"
#include "util-spm-bs.h"
Include dependency graph for util-spm-bs.c:

Go to the source code of this file.

Functions

uint8_t * BasicSearch (const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint16_t needle_len)
 Basic search improved. Limits are better handled, so it doesn't start searches that wont fit in the remaining buffer. More...
 
uint8_t * BasicSearchNocase (const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint16_t needle_len)
 Basic search case less. More...
 
uint32_t BasicSearchNocaseIndex (const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint16_t needle_len)
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t
Pablo Rincon Crespo pablo.nosp@m..rin.nosp@m.con.c.nosp@m.resp.nosp@m.o@gma.nosp@m.il.c.nosp@m.om

bs is a bruteforce search. It will try to search the pattern from all characters until the available text len is less than the length of the pattern. It needs no context but it time cost is not good.

Definition in file util-spm-bs.c.

Function Documentation

◆ BasicSearch()

uint8_t* BasicSearch ( const uint8_t *  haystack,
uint32_t  haystack_len,
const uint8_t *  needle,
uint16_t  needle_len 
)

Basic search improved. Limits are better handled, so it doesn't start searches that wont fit in the remaining buffer.

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
Return values
ptrto start of the match; NULL if no match

Definition at line 47 of file util-spm-bs.c.

References SCEnter, SCLogDebug, and SCReturnPtr.

Referenced by UTHmemsearch().

Here is the caller graph for this function:

◆ BasicSearchNocase()

uint8_t* BasicSearchNocase ( const uint8_t *  haystack,
uint32_t  haystack_len,
const uint8_t *  needle,
uint16_t  needle_len 
)

Basic search case less.

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
Return values
ptrto start of the match; NULL if no match

Definition at line 101 of file util-spm-bs.c.

References u8_tolower.

Referenced by BasicSearchNocaseIndex().

Here is the caller graph for this function:

◆ BasicSearchNocaseIndex()

uint32_t BasicSearchNocaseIndex ( const uint8_t *  haystack,
uint32_t  haystack_len,
const uint8_t *  needle,
uint16_t  needle_len 
)

Definition at line 134 of file util-spm-bs.c.

References BasicSearchNocase().

Here is the call graph for this function: