regen pidl all: rm epan/dissectors/pidl/*-stamp; pushd epan/dissectors/pidl/ && make...
[wireshark-sm.git] / wsutil / filter_files.h
blobb493d68aa930294e4c77c1aed93c45c594dd9e53
1 /** @file
3 * Declarations of routines for reading and writing the filters file.
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __FILTER_FILES_H__
13 #define __FILTER_FILES_H__
15 #include <wireshark.h>
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
22 * Capture filter file name.
24 #define CFILTER_FILE_NAME "cfilters"
27 * Display filter file name.
29 #define DFILTER_FILE_NAME "dfilters"
32 * Display filter file name.
34 #define DMACROS_FILE_NAME "dmacros"
37 * Filter lists.
39 typedef enum {
40 CFILTER_LIST, /* capture filter list - saved */
41 DFILTER_LIST, /* display filter list - saved */
42 DMACROS_LIST, /* display filter macro list - saved */
43 } filter_list_type_t;
46 * Item in a list of filters.
48 typedef struct {
49 char *name; /* filter name */
50 char *strval; /* filter expression */
51 } filter_def;
53 typedef struct {
54 filter_list_type_t type;
55 GList *list;
56 } filter_list_t;
59 * Read in a list of filters.
61 * On error, report the error via the UI.
63 WS_DLL_PUBLIC
64 WS_RETNONNULL
65 filter_list_t *ws_filter_list_read(filter_list_type_t list_type);
68 * Add a new filter to the end of a list.
69 * Returns a pointer to the newly-added entry.
71 WS_DLL_PUBLIC
72 void ws_filter_list_add(filter_list_t *list, const char *name,
73 const char *expression);
76 * Find a filter in a list by name.
77 * Returns a pointer to the found entry.
79 WS_DLL_PUBLIC
80 GList *ws_filter_list_find(filter_list_t *list, const char *name);
83 * Remove a filter from a list.
85 WS_DLL_PUBLIC
86 bool ws_filter_list_remove(filter_list_t *list, const char *name);
89 * Write out a list of filters.
91 * On error, report the error via the UI.
93 WS_DLL_PUBLIC
94 void ws_filter_list_write(filter_list_t *list);
97 * Free all filter lists
99 WS_DLL_PUBLIC
100 void ws_filter_list_free(filter_list_t *list);
102 #ifdef __cplusplus
104 #endif /* __cplusplus */
106 #endif /* __FILTER_FILES_H__ */