From Jakub Zawadzki via bug 4273:
[obnox/wireshark/wip.git] / gtk / filter_utils.h
1 /* filter_utils.h
2  *
3  * $Id$
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  */
23
24 #define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
25
26 /* Filter actions */
27 #define ACTION_MATCH            0
28 #define ACTION_PREPARE          1
29 #define ACTION_FIND_FRAME       2
30 #define ACTION_FIND_NEXT        3
31 #define ACTION_FIND_PREVIOUS    4
32 #define ACTION_COLORIZE         5
33 #define ACTION_WEB_LOOKUP       6
34
35 /* Action type - says what to do with the filter */
36 #define ACTYPE_SELECTED         0
37 #define ACTYPE_NOT_SELECTED     1
38 #define ACTYPE_AND_SELECTED     2
39 #define ACTYPE_OR_SELECTED      3
40 #define ACTYPE_AND_NOT_SELECTED 4
41 #define ACTYPE_OR_NOT_SELECTED  5
42
43 /* Encoded callback arguments */
44 #define CALLBACK_MATCH(type, extra)         ((ACTION_MATCH<<16) | ((type)<<8) | (extra))
45 #define CALLBACK_PREPARE(type, extra)       ((ACTION_PREPARE<<16) | ((type)<<8) | (extra))
46 #define CALLBACK_FIND_FRAME(type, extra)    ((ACTION_FIND_FRAME<<16) | ((type)<<8) | (extra))
47 #define CALLBACK_FIND_NEXT(type, extra)     ((ACTION_FIND_NEXT<<16) | ((type)<<8) | (extra))
48 #define CALLBACK_FIND_PREVIOUS(type, extra) ((ACTION_FIND_PREVIOUS<<16) | ((type)<<8) | (extra))
49 #define CALLBACK_COLORIZE(type, extra)      ((ACTION_COLORIZE<<16) | ((type)<<8) | (extra))
50 #define CALLBACK_WEB_LOOKUP                 (ACTION_WEB_LOOKUP<<16)
51
52 /* Extract components of callback argument */
53 #define FILTER_ACTION(cb_arg)           (((cb_arg)>>16) & 0xff)
54 #define FILTER_ACTYPE(cb_arg)           (((cb_arg)>>8) & 0xff)
55 #define FILTER_EXTRA(cb_arg)            ((cb_arg) & 0xff)
56
57
58 extern void apply_selected_filter (guint callback_action, char *filter);