HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / funnel.c
blob13cf9743db95c684d3509d0114e040829d742d56
1 /*
2 * funnel.c
4 * EPAN's GUI mini-API
6 * (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
8 * $Id$
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "config.h"
31 #include <epan/funnel.h>
33 typedef struct _funnel_menu_t {
34 const char *name;
35 register_stat_group_t group;
36 void (*callback)(gpointer);
37 gpointer callback_data;
38 gboolean retap;
39 struct _funnel_menu_t* next;
40 } funnel_menu_t;
42 static const funnel_ops_t* ops = NULL;
43 static funnel_menu_t* menus = NULL;
45 const funnel_ops_t* funnel_get_funnel_ops(void) { return ops; }
46 void funnel_set_funnel_ops(const funnel_ops_t* o) { ops = o; }
48 void funnel_register_menu(const char *name,
49 register_stat_group_t group,
50 void (*callback)(gpointer),
51 gpointer callback_data,
52 gboolean retap) {
53 funnel_menu_t* m = (funnel_menu_t *)g_malloc(sizeof(funnel_menu_t));
54 m->name = g_strdup(name);
55 m->group = group;
56 m->callback = callback;
57 m->callback_data = callback_data;
58 m->retap = retap;
59 m->next = NULL;
61 if (!menus) {
62 menus = m;
63 } else {
64 funnel_menu_t* c;
65 for (c = menus; c->next; c = c->next);
66 c->next = m;
70 void funnel_register_all_menus(funnel_registration_cb_t r_cb) {
71 funnel_menu_t* c;
72 for (c = menus; c; c = c->next) {
73 r_cb(c->name,c->group,c->callback,c->callback_data,c->retap);