cip: fix a leak
[metze/wireshark/wip.git] / epan / filter_expressions.h
1 /* filter_expressions.h
2  * Submitted by Edwin Groothuis <wireshark@mavetju.org>
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __FILTER_EXPRESSIONS_H__
24 #define __FILTER_EXPRESSIONS_H__
25
26 #include "ws_symbol_export.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 /** @file
33  * Filter expressions.
34  */
35
36 struct filter_expression {
37         gpointer button;        /* Filter toolbar */
38         gchar   *label;
39         gchar   *expression;
40
41         gint     index;
42         gboolean enabled;       /* Can be set to FALSE by Preferences Dialog */
43         gboolean deleted;       /* Can be set to TRUE by Preferences Dialog (GTK+ only) */
44
45         struct filter_expression *next;
46 };
47
48 WS_DLL_PUBLIC struct filter_expression **pfilter_expression_head;
49
50 /** Create a filter expression
51  *
52  * @param label Label (button) text for the expression.
53  * @param expr The display filter for the expression.
54  * @param enabled Determines if the expression is shown in the UI.
55  * @return A newly allocated and initialized struct filter_expression.
56  */
57 WS_DLL_PUBLIC
58 struct filter_expression *filter_expression_new(const gchar *label,
59     const gchar *expr, const gboolean enabled);
60
61 void filter_expression_init(void);
62
63 /** Clear the filter expression list.
64  * Frees each item in the list. Caller should set list_head to NULL afterward.
65  */
66 WS_DLL_PUBLIC
67 void filter_expression_free(struct filter_expression *list_head);
68
69 #ifdef __cplusplus
70 }
71 #endif /* __cplusplus */
72
73 #endif /* __FILTER_EXPRESSIONS_H__ */