Add dissector for Generic Network Virtualization Encapsulation (Geneve).
[metze/wireshark/wip.git] / filters.h
1 /* filters.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  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #ifndef FILTERS_H
25 #define FILTERS_H
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31 /*
32  * Filter lists.
33  */
34 typedef enum {
35         CFILTER_LIST,           /* capture filter list - saved */
36         DFILTER_LIST,           /* display filter list - saved */
37         CFILTER_EDITED_LIST,    /* capture filter list - currently edited */
38         DFILTER_EDITED_LIST     /* display filter list - currently edited */
39 } filter_list_type_t;
40
41 /*
42  * Item in a list of filters.
43  */
44 typedef struct {
45   char *name;           /* filter name */
46   char *strval;         /* filter expression */
47 } filter_def;
48
49 /*
50  * Read in a list of filters.
51  *
52  * On success, "*pref_path_return" is set to NULL.
53  * On error, "*pref_path_return" is set to point to the pathname of
54  * the file we tried to read - it should be freed by our caller -
55  * and "*errno_return" is set to the error.
56  */
57 void read_filter_list(filter_list_type_t list_type, char **pref_path_return,
58     int *errno_return);
59
60 /*
61  * Get a pointer to the first entry in a filter list.
62  */
63 GList *get_filter_list_first(filter_list_type_t list);
64
65 /*
66  * Add a new filter to the end of a list.
67  * Returns a pointer to the newly-added entry.
68  */
69 GList *add_to_filter_list(filter_list_type_t list, const char *name,
70     const char *expression);
71
72 /*
73  * Remove a filter from a list.
74  */
75 void remove_from_filter_list(filter_list_type_t list, GList *fl_entry);
76
77 /*
78  * Write out a list of filters.
79  *
80  * On success, "*pref_path_return" is set to NULL.
81  * On error, "*pref_path_return" is set to point to the pathname of
82  * the file we tried to read - it should be freed by our caller -
83  * and "*errno_return" is set to the error.
84  */
85 void save_filter_list(filter_list_type_t list_type, char **pref_path_return,
86     int *errno_return);
87
88 /*
89  * Clone the filter list so it can be edited.
90  */
91 void copy_filter_list(filter_list_type_t dest_type, filter_list_type_t src_type);
92
93 #ifdef __cplusplus
94 }
95 #endif /* __cplusplus */
96
97 #endif /* FILTERS_H */