File: color_filters.h

package info (click to toggle)
wireshark 1.12.1+g01b65bf-4+deb8u14
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 234,068 kB
  • sloc: ansic: 1,912,971; xml: 84,598; cpp: 41,923; python: 30,175; perl: 25,286; lex: 6,416; sh: 6,406; pascal: 6,120; makefile: 3,968; yacc: 297; asm: 156; awk: 58; tcl: 35
file content (212 lines) | stat: -rw-r--r-- 6,145 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* color_filters.h
 * Definitions for color filters
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
#ifndef  __COLOR_FILTERS_H__
#define  __COLOR_FILTERS_H__

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

struct epan_dissect;

#define CONVERSATION_COLOR_PREFIX       "___conversation_color_filter___"
/** @file
 *  Color filters.
 */

/* Data for a color filter. */
typedef struct _color_filter {
    gchar     *filter_name;         /* name of the filter */
    gchar     *filter_text;         /* text of the filter expression */
    color_t    bg_color;            /* background color for packets that match */
    color_t    fg_color;            /* foreground color for packets that match */
    gboolean   disabled;            /* set if the filter is disabled */
    gboolean   selected;            /* set if the filter is selected in the color dialog box */

                                    /* only used inside of color_filters.c */
    struct epan_dfilter *c_colorfilter;  /* compiled filter expression */

                                    /* only used outside of color_filters.c (beside init) */
    void      *color_edit_dlg_info; /* if filter is being edited, ptr to req'd info */
} color_filter_t;


/** Init the color filters (incl. initial read from file). */
void color_filters_init(void);

/** Reload the color filters */
void color_filters_reload(void);

/** Cleanup remaining color filter zombies */
void color_filters_cleanup(void);

/** Color filters currently used?
 *
 * @return TRUE, if filters are used
 */
gboolean color_filters_used(void);

/** Are there any temporary coloring filters used?
 *
 * @return TRUE, if temporary coloring filters are used
 */
gboolean tmp_color_filters_used(void);

/** En-/disable color filters
 *
 * @param enable TRUE to enable (default)
 */
void
color_filters_enable(gboolean enable);

/** Set the filter string of a temporary color filter
 *
 * @param filt_nr a number 1-10 pointing to a temporary color
 * @param filter the new filter-string
 * @param disabled whether the filter-rule should be disabled
 */
void
color_filters_set_tmp(guint8 filt_nr, gchar *filter, gboolean disabled);

/** Reset the temporary color filters
 *
 */
void
color_filters_reset_tmp(void);

/* Prime the epan_dissect_t with all the compiler
 * color filters of the current filter list.
 *
 * @param the epan dissector details
 */
void color_filters_prime_edt(struct epan_dissect *edt);

/** Colorize a specific packet.
 *
 * @param edt the dissected packet
 * @return the matching color filter or NULL
 */
const color_filter_t *
color_filters_colorize_packet(struct epan_dissect *edt);

/** Clone the currently active filter list.
 *
 * @param user_data will be returned by each call to to color_filter_add_cb()
 */
void color_filters_clone(gpointer user_data);

/** Load filters (import) from some other filter file.
 *
 * @param path the path to the import file
 * @param user_data will be returned by each call to to color_filter_add_cb()
 * @return TRUE, if read succeeded
 */
gboolean color_filters_import(gchar *path, gpointer user_data);

/** Read filters from the global filter file (not the users file).
 *
 * @param user_data will be returned by each call to to color_filter_add_cb()
 * @return TRUE, if read succeeded
 */
gboolean color_filters_read_globals(gpointer user_data);

/** A color filter was added (while importing).
 * (color_filters.c calls this for every filter coming in)
 *
 * @param colorf the new color filter
 * @param user_data from caller
 */
void color_filter_add_cb (color_filter_t *colorf, gpointer user_data);



/** Apply a changed filter list.
 *
 * @param tmp_cfl the temporary color filter list to apply
 * @param edit_cfl the edited permanent color filter list to apply
 */
void color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl);

/** Save filters in users filter file.
 *
 * @param cfl the filter list to write
 * @return TRUE if write succeeded
 */
gboolean color_filters_write(GSList *cfl);

/** Save filters (export) to some other filter file.
 *
 * @param path the path to the filter file
 * @param cfl the filter list to write
 * @param only_selected TRUE if only the selected filters should be saved
 * @return TRUE, if write succeeded
 */
gboolean color_filters_export(gchar *path, GSList *cfl, gboolean only_selected);



/** Create a new color filter (g_malloc'ed).
 *
 * @param name the name of the filter
 * @param filter_string the filter string
 * @param bg_color background color
 * @param fg_color foreground color
 * @param disabled gboolean
 * @return the new color filter
 */
color_filter_t *color_filter_new(
    const gchar *name, const gchar *filter_string,
    color_t *bg_color, color_t *fg_color, gboolean disabled);

/** Delete a single color filter (g_free'ed).
 *
 * @param colorf the color filter to be removed
 */
void color_filter_delete(color_filter_t *colorf);




/** Delete a filter list including all entries.
 *
 * @param cfl the filter list to delete
 */
void color_filter_list_delete(GSList **cfl);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif

/*
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 4
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=4 tabstop=8 expandtab:
 * :indentSize=4:tabSize=8:noTabs=true:
 */