epan/dissectors/packet-dcerpc.c fix warnings
[metze/wireshark/wip.git] / color_filters.h
1 /* color_filters.h
2  * Definitions for color filters
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 #ifndef  __COLOR_FILTERS_H__
25 #define  __COLOR_FILTERS_H__
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30
31 struct epan_dissect;
32
33 #define CONVERSATION_COLOR_PREFIX       "___conversation_color_filter___"
34 /** @file
35  *  Color filters.
36  */
37
38 /* Data for a color filter. */
39 typedef struct _color_filter {
40     gchar     *filter_name;         /* name of the filter */
41     gchar     *filter_text;         /* text of the filter expression */
42     color_t    bg_color;            /* background color for packets that match */
43     color_t    fg_color;            /* foreground color for packets that match */
44     gboolean   disabled;            /* set if the filter is disabled */
45     gboolean   selected;            /* set if the filter is selected in the color dialog box */
46
47                                     /* only used inside of color_filters.c */
48     struct epan_dfilter *c_colorfilter;  /* compiled filter expression */
49
50                                     /* only used outside of color_filters.c (beside init) */
51     void      *color_edit_dlg_info; /* if filter is being edited, ptr to req'd info */
52 } color_filter_t;
53
54
55 /** Init the color filters (incl. initial read from file). */
56 void color_filters_init(void);
57
58 /** Reload the color filters */
59 void color_filters_reload(void);
60
61 /** Cleanup remaining color filter zombies */
62 void color_filters_cleanup(void);
63
64 /** Color filters currently used?
65  *
66  * @return TRUE, if filters are used
67  */
68 gboolean color_filters_used(void);
69
70 /** Are there any temporary coloring filters used?
71  *
72  * @return TRUE, if temporary coloring filters are used
73  */
74 gboolean tmp_color_filters_used(void);
75
76 /** En-/disable color filters
77  *
78  * @param enable TRUE to enable (default)
79  */
80 void
81 color_filters_enable(gboolean enable);
82
83 /** Set the filter string of a temporary color filter
84  *
85  * @param filt_nr a number 1-10 pointing to a temporary color
86  * @param filter the new filter-string
87  * @param disabled whether the filter-rule should be disabled
88  */
89 void
90 color_filters_set_tmp(guint8 filt_nr, gchar *filter, gboolean disabled);
91
92 /** Reset the temporary color filters
93  *
94  */
95 void
96 color_filters_reset_tmp(void);
97
98 /* Prime the epan_dissect_t with all the compiler
99  * color filters of the current filter list.
100  *
101  * @param the epan dissector details
102  */
103 void color_filters_prime_edt(struct epan_dissect *edt);
104
105 /** Colorize a specific packet.
106  *
107  * @param edt the dissected packet
108  * @return the matching color filter or NULL
109  */
110 const color_filter_t *
111 color_filters_colorize_packet(struct epan_dissect *edt);
112
113 /** Clone the currently active filter list.
114  *
115  * @param user_data will be returned by each call to to color_filter_add_cb()
116  */
117 void color_filters_clone(gpointer user_data);
118
119 /** Load filters (import) from some other filter file.
120  *
121  * @param path the path to the import file
122  * @param user_data will be returned by each call to to color_filter_add_cb()
123  * @return TRUE, if read succeeded
124  */
125 gboolean color_filters_import(gchar *path, gpointer user_data);
126
127 /** Read filters from the global filter file (not the users file).
128  *
129  * @param user_data will be returned by each call to to color_filter_add_cb()
130  * @return TRUE, if read succeeded
131  */
132 gboolean color_filters_read_globals(gpointer user_data);
133
134 /** A color filter was added (while importing).
135  * (color_filters.c calls this for every filter coming in)
136  *
137  * @param colorf the new color filter
138  * @param user_data from caller
139  */
140 void color_filter_add_cb (color_filter_t *colorf, gpointer user_data);
141
142
143
144 /** Apply a changed filter list.
145  *
146  * @param tmp_cfl the temporary color filter list to apply
147  * @param edit_cfl the edited permanent color filter list to apply
148  */
149 void color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl);
150
151 /** Save filters in users filter file.
152  *
153  * @param cfl the filter list to write
154  * @return TRUE if write succeeded
155  */
156 gboolean color_filters_write(GSList *cfl);
157
158 /** Save filters (export) to some other filter file.
159  *
160  * @param path the path to the filter file
161  * @param cfl the filter list to write
162  * @param only_selected TRUE if only the selected filters should be saved
163  * @return TRUE, if write succeeded
164  */
165 gboolean color_filters_export(gchar *path, GSList *cfl, gboolean only_selected);
166
167
168
169 /** Create a new color filter (g_malloc'ed).
170  *
171  * @param name the name of the filter
172  * @param filter_string the filter string
173  * @param bg_color background color
174  * @param fg_color foreground color
175  * @param disabled gboolean
176  * @return the new color filter
177  */
178 color_filter_t *color_filter_new(
179     const gchar *name, const gchar *filter_string,
180     color_t *bg_color, color_t *fg_color, gboolean disabled);
181
182 /** Delete a single color filter (g_free'ed).
183  *
184  * @param colorf the color filter to be removed
185  */
186 void color_filter_delete(color_filter_t *colorf);
187
188
189
190
191 /** Delete a filter list including all entries.
192  *
193  * @param cfl the filter list to delete
194  */
195 void color_filter_list_delete(GSList **cfl);
196
197 #ifdef __cplusplus
198 }
199 #endif /* __cplusplus */
200
201 #endif
202
203 /*
204  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
205  *
206  * Local variables:
207  * c-basic-offset: 4
208  * tab-width: 8
209  * indent-tabs-mode: nil
210  * End:
211  *
212  * vi: set shiftwidth=4 tabstop=8 expandtab:
213  * :indentSize=4:tabSize=8:noTabs=true:
214  */