2021-11-25 22:31:05 -05:00
|
|
|
/** @file
|
2014-06-09 17:30:08 +02:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 12:26:45 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-06-09 17:30:08 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WS_MEMPBRK_H__
|
|
|
|
#define __WS_MEMPBRK_H__
|
|
|
|
|
2023-05-31 01:53:47 -03:00
|
|
|
#include <wireshark.h>
|
2014-06-09 17:30:08 +02:00
|
|
|
|
2015-02-12 09:07:02 +01:00
|
|
|
#ifdef HAVE_SSE4_2
|
|
|
|
#include <emmintrin.h>
|
|
|
|
#endif
|
|
|
|
|
2015-02-21 12:39:00 -08:00
|
|
|
/** The pattern object used for ws_mempbrk_exec().
|
2015-02-06 13:52:37 -05:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2023-09-22 13:42:49 -07:00
|
|
|
char patt[256];
|
2015-02-12 09:07:02 +01:00
|
|
|
#ifdef HAVE_SSE4_2
|
2023-09-22 13:42:49 -07:00
|
|
|
bool use_sse42;
|
2015-02-12 09:07:02 +01:00
|
|
|
__m128i mask;
|
|
|
|
#endif
|
2015-02-21 12:39:00 -08:00
|
|
|
} ws_mempbrk_pattern;
|
2015-02-06 13:52:37 -05:00
|
|
|
|
2015-02-21 12:39:00 -08:00
|
|
|
/** Compile the pattern for the needles to find using ws_mempbrk_exec().
|
2015-02-06 13:52:37 -05:00
|
|
|
*/
|
2023-09-22 13:42:49 -07:00
|
|
|
WS_DLL_PUBLIC void ws_mempbrk_compile(ws_mempbrk_pattern* pattern, const char *needles);
|
2015-02-06 13:52:37 -05:00
|
|
|
|
2015-02-21 12:39:00 -08:00
|
|
|
/** Scan for the needles specified by the compiled pattern.
|
|
|
|
*/
|
2023-09-22 13:42:49 -07:00
|
|
|
WS_DLL_PUBLIC const uint8_t *ws_mempbrk_exec(const uint8_t* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, unsigned char *found_needle);
|
2014-06-09 17:30:08 +02:00
|
|
|
|
2023-10-11 09:07:41 -04:00
|
|
|
/** Scan for the needles specified by the compiled pattern, starting at the
|
|
|
|
* end of the haystack and working backwards.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC const uint8_t *ws_memrpbrk_exec(const uint8_t* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, unsigned char *found_needle);
|
|
|
|
|
2014-06-09 18:20:34 +02:00
|
|
|
#endif /* __WS_MEMPBRK_H__ */
|