Clean up exp_pdu_open() API.
[metze/wireshark/wip.git] / ui / filter_files.h
1 /* filter_filess.h
2  * Declarations of routines for reading and writing the filters file.
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10
11 #ifndef __UI_FILTERS_H__
12 #define __UI_FILTERS_H__
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17
18 /*
19  * Old filter file name.
20  */
21 #define FILTER_FILE_NAME      "filters"
22
23 /*
24  * Capture filter file name.
25  */
26 #define CFILTER_FILE_NAME     "cfilters"
27
28 /*
29  * Display filter file name.
30  */
31 #define DFILTER_FILE_NAME     "dfilters"
32
33 /*
34  * Filter lists.
35  */
36 typedef enum {
37   CFILTER_LIST,        /* capture filter list - saved */
38   DFILTER_LIST,        /* display filter list - saved */
39   CFILTER_EDITED_LIST, /* capture filter list - currently edited. GTK+ only. */
40   DFILTER_EDITED_LIST  /* display filter list - currently edited. GTK+ only. */
41 } filter_list_type_t;
42
43 /*
44  * Item in a list of filters.
45  */
46 typedef struct {
47   char *name;          /* filter name */
48   char *strval;        /* filter expression */
49 } filter_def;
50
51 /*
52  * Read in a list of filters.
53  *
54  * On error, report the error via the UI.
55  */
56 void read_filter_list(filter_list_type_t list_type);
57
58 /*
59  * Get a pointer to the first entry in a filter list.
60  */
61 GList *get_filter_list_first(filter_list_type_t list);
62
63 /*
64  * Add a new filter to the end of a list.
65  * Returns a pointer to the newly-added entry.
66  */
67 GList *add_to_filter_list(filter_list_type_t list, const char *name,
68                           const char *expression);
69
70 /*
71  * Remove a filter from a list.
72  */
73 void remove_from_filter_list(filter_list_type_t list, GList *fl_entry);
74
75 /*
76  * Write out a list of filters.
77  *
78  * On error, report the error via the UI.
79  */
80 void save_filter_list(filter_list_type_t list_type);
81
82 /*
83  * Clone the filter list so it can be edited. GTK+ only.
84  */
85 void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type);
86
87 /*
88  * Free all filter lists
89  */
90 void free_filter_lists(void);
91
92 #ifdef __cplusplus
93 }
94 #endif /* __cplusplus */
95
96 #endif /* __UI_FILTERS_H__ */
97
98 /*
99  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
100  *
101  * Local Variables:
102  * c-basic-offset: 2
103  * tab-width: 8
104  * indent-tabs-mode: nil
105  * End:
106  *
107  * vi: set shiftwidth=2 tabstop=8 expandtab:
108  * :indentSize=2:tabSize=8:noTabs=true:
109  */