2 * Definitions for color filters
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef __COLOR_FILTERS_H__
25 #define __COLOR_FILTERS_H__
30 #include "epan/dfilter/dfilter.h"
32 /* Data for a color filter. */
33 typedef struct _color_filter {
34 gchar *filter_name; /* name of the filter */
35 gchar *filter_text; /* text of the filter expression */
36 color_t bg_color; /* background color for packets that match */
37 color_t fg_color; /* foreground color for packets that match */
38 dfilter_t *c_colorfilter; /* compiled filter expression */
39 void *edit_dialog; /* if filter is being edited, dialog
41 gboolean marked; /* set if the filter is marked in the color dialog box */
44 /* List of all color filters. */
45 extern GSList *filter_list;
46 extern GSList *removed_filter_list;
48 /** Init the color filters. */
49 void colfilter_init(void);
51 /** Save filters in users filter file.
53 * @return TRUE if write succeeded
55 gboolean write_filters(void);
57 /** Delete users filter file and reload global filters.
59 * @return TRUE if write succeeded
61 gboolean revert_filters(void);
63 /** Create a new color filter.
65 * @param name the name of the filter
66 * @param filter_string the filter string
67 * @param bg_color background color
68 * @param fg_color foreground color
69 * @return the new color filter
71 color_filter_t *new_color_filter(gchar *name, gchar *filter_string,
72 color_t *bg_color, color_t *fg_color);
74 /** Remove the color filter.
76 * @param colorf the color filter to be removed
78 void remove_color_filter(color_filter_t *colorf);
80 /** Load filters from some other filter file.
82 * @param path the path to the filter file
83 * @param arg the color filter widget
84 * @return TRUE, if read succeeded
86 gboolean read_other_filters(gchar *path, gpointer arg);
88 /** Save filters to some other filter file.
90 * @param path the path to the filter file
91 * @param only_marked TRUE if only the marked filters should be saved
92 * @return TRUE, if write succeeded
94 gboolean write_other_filters(gchar *path, gboolean only_marked);
96 /** Add a color filter.
98 * @param colorf the new color filter
99 * @param arg the color filter widget
101 void color_add_filter_cb (color_filter_t *colorf, gpointer arg);
103 void filter_list_prime_edt(epan_dissect_t *edt);