| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Functions
ws_mempbrk_int.h File Reference

Go to the source code of this file.

## Functions
const uint8_t * | ws_mempbrk_portable_exec (const uint8_t *haystack, size_t haystacklen, const ws_mempbrk_pattern *pattern, unsigned char *found_needle)
| Search for the first matching byte in a buffer using a precompiled pattern.

## Detailed Description

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

## Function Documentation

## ◆ ws_mempbrk_portable_exec()

const uint8_t * ws_mempbrk_portable_exec | ( | const uint8_t * | haystack,
|  | size_t | haystacklen,
|  | const ws_mempbrk_pattern * | pattern,
|  | unsigned char * | found_needle
| ) |  |

Search for the first matching byte in a buffer using a precompiled pattern.

Scans the input buffer `haystack` for the first occurrence of any byte listed in the precompiled `pattern`. If a match is found, the corresponding needle byte is written to `found_needle` (if non-NULL), and a pointer to the match location in `haystack` is returned. If no match is found, returns NULL.

Parameters

  haystack | Pointer to the input buffer to search.
  haystacklen | Length of the input buffer in bytes.
  pattern | Precompiled pattern containing target bytes.
  found_needle | Optional output pointer to receive the matched byte.

Returns
  Pointer to the first matching byte in `haystack`, or NULL if none found.