2021-11-26 03:31:05 +00:00
|
|
|
/** @file
|
2014-06-09 15:30:08 +00:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2014-06-09 15:30:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WS_MEMPBRK_H__
|
|
|
|
#define __WS_MEMPBRK_H__
|
|
|
|
|
|
|
|
#include "ws_symbol_export.h"
|
|
|
|
|
2015-02-12 08:07:02 +00:00
|
|
|
#ifdef HAVE_SSE4_2
|
|
|
|
#include <emmintrin.h>
|
|
|
|
#endif
|
|
|
|
|
2015-02-21 20:39:00 +00:00
|
|
|
/** The pattern object used for ws_mempbrk_exec().
|
2015-02-06 18:52:37 +00:00
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
gchar patt[256];
|
2015-02-12 08:07:02 +00:00
|
|
|
#ifdef HAVE_SSE4_2
|
2015-02-06 18:52:37 +00:00
|
|
|
gboolean use_sse42;
|
2015-02-12 08:07:02 +00:00
|
|
|
__m128i mask;
|
|
|
|
#endif
|
2015-02-21 20:39:00 +00:00
|
|
|
} ws_mempbrk_pattern;
|
2015-02-06 18:52:37 +00:00
|
|
|
|
2015-02-21 20:39:00 +00:00
|
|
|
/** Compile the pattern for the needles to find using ws_mempbrk_exec().
|
2015-02-06 18:52:37 +00:00
|
|
|
*/
|
2015-02-21 20:39:00 +00:00
|
|
|
WS_DLL_PUBLIC void ws_mempbrk_compile(ws_mempbrk_pattern* pattern, const gchar *needles);
|
2015-02-06 18:52:37 +00:00
|
|
|
|
2015-02-21 20:39:00 +00:00
|
|
|
/** Scan for the needles specified by the compiled pattern.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC const guint8 *ws_mempbrk_exec(const guint8* haystack, size_t haystacklen, const ws_mempbrk_pattern* pattern, guchar *found_needle);
|
2014-06-09 15:30:08 +00:00
|
|
|
|
2014-06-09 16:20:34 +00:00
|
|
|
#endif /* __WS_MEMPBRK_H__ */
|