MAX_MCS_INDEX is a valid array index.
[metze/wireshark/wip.git] / epan / dissector_filters.c
1 /* dissector_filters.c
2  * Routines for dissector-generated conversation filters for use as
3  * display and color filters
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 #include "config.h"
25
26 #include <glib.h>
27 #include "packet.h"
28
29 #include "dissector_filters.h"
30
31
32 GList *conv_filter_list = NULL;
33
34
35 void register_conversation_filter(const char *proto_name, const char *display_name,
36                                         is_filter_valid_func is_filter_valid, build_filter_string_func build_filter_string) {
37     conversation_filter_t *entry;
38
39     entry = (conversation_filter_t *)g_malloc(sizeof(conversation_filter_t));
40
41     entry->proto_name           = proto_name;
42     entry->display_name         = display_name;
43     entry->is_filter_valid      = is_filter_valid;
44     entry->build_filter_string  = build_filter_string;
45
46     conv_filter_list = g_list_append(conv_filter_list, entry);
47 }
48
49 struct conversation_filter_s* find_conversation_filter(const char *name)
50 {
51     GList *list_entry = conv_filter_list;
52     conversation_filter_t* filter;
53
54     while (list_entry != NULL) {
55         filter = (conversation_filter_t*)list_entry->data;
56         if (!strcmp(filter->proto_name, name))
57             return filter;
58
59         list_entry = g_list_next(list_entry);
60     }
61
62     return NULL;
63 }
64
65 /*
66  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
67  *
68  * Local variables:
69  * c-basic-offset: 4
70  * tab-width: 8
71  * indent-tabs-mode: nil
72  * End:
73  *
74  * vi: set shiftwidth=4 tabstop=8 expandtab:
75  * :indentSize=4:tabSize=8:noTabs=true:
76  */