diff options
author | Vladimir Gavrilov <105977161+0xA50C1A1@users.noreply.github.com> | 2024-04-10 16:39:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 15:39:08 +0200 |
commit | 142c8f5afb90629762920db6703831826513e00b (patch) | |
tree | f69bced760416ce737c0525fd5fc75f64053af76 /src/include/ndpi_api.h | |
parent | 1d0be6c4f4a87e7c6d29aa35e383f7f2ba62a967 (diff) |
Add memmem() implementation (#2378)
* Add memmem() implementation
* Fix build
* Add fix to avoid too many memcmp calls
Diffstat (limited to 'src/include/ndpi_api.h')
-rw-r--r-- | src/include/ndpi_api.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index 38fac3add..00d15bbda 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -2219,6 +2219,19 @@ extern "C" { const char *ndpi_lru_cache_idx_to_name(lru_cache_type idx); + /** + * Searches for a subsequence ('needle') within a block of memory ('haystack'). + * + * @par haystack = pointer to the block of memory where the search is performed + * @par haystack_len = length of the haystack block of memory + * @par needle = pointer to the memory block representing the needle to search for + * @par needle_len = length of the needle memory block + * + * @return Pointer to the beginning of the needle within the haystack if found; + * otherwise, NULL. + */ + void* ndpi_memmem(const void* haystack, size_t haystack_len, const void* needle, + size_t needle_len); #ifdef __cplusplus } |