| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
fifo_string_cache.h
1/* fifo_string_cache.h
2 * A string cache, possibly with a bounded size, using FIFO order to control
3 * the size.
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11#pragma once
12#include <stdbool.h>
13
14#include <glib.h>
15
16#include "ws_symbol_export.h"
17
18#ifdef __cplusplus
19 extern "C" {
20#endif /* __cplusplus */
21
26 typedef struct {
27 GHashTable *set;
28 GSList *head;
29 GSList *tail;
30 unsigned max_entries;
31} fifo_string_cache_t;
32
33// These functions are marked with WS_DLL_PUBLIC so they can be unit-tested
34
48WS_DLL_PUBLIC void
49fifo_string_cache_init(fifo_string_cache_t *fcache, unsigned max_entries, GDestroyNotify string_free_func);
50
60WS_DLL_PUBLIC void
61fifo_string_cache_free(fifo_string_cache_t *fcache);
62
70WS_DLL_PUBLIC bool
71fifo_string_cache_contains(fifo_string_cache_t *fcache, const char *entry);
72
85WS_DLL_PUBLIC bool
86fifo_string_cache_insert(fifo_string_cache_t *fcache, const char *entry);
87
88#ifdef __cplusplus
89}
90#endif /* __cplusplus */
fifo_string_cache_t
Definition fifo_string_cache.h:26
fifo_string_cache_t::tail
GSList * tail
Definition fifo_string_cache.h:29
fifo_string_cache_t::max_entries
unsigned max_entries
Definition fifo_string_cache.h:30
fifo_string_cache_t::set
GHashTable * set
Definition fifo_string_cache.h:27
fifo_string_cache_t::head
GSList * head
Definition fifo_string_cache.h:28