Fix display of Client's FQDN and clear up the confusion with the S, O and N bits...
[obnox/wireshark/wip.git] / epan / funnel.c
1 /*
2  *  funnel.c
3  *
4  * EPAN's GUI mini-API
5  *
6  * (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
7  *
8  * $Id$
9  *
10  * Wireshark - Network traffic analyzer
11  * By Gerald Combs <gerald@wireshark.org>
12  * Copyright 1998 Gerald Combs
13  *
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.
18  *
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.
23  *
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
27  */
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32
33 #include <epan/funnel.h>
34
35 typedef struct _funnel_menu_t {
36     const char *name;
37     register_stat_group_t group;
38     void (*callback)(gpointer);
39     gpointer callback_data;
40     gboolean retap;
41     struct _funnel_menu_t* next;
42 } funnel_menu_t;
43
44 static const funnel_ops_t* ops = NULL;
45 static funnel_menu_t* menus = NULL;
46
47 const funnel_ops_t* funnel_get_funnel_ops() { return ops;  }
48 void funnel_set_funnel_ops(const funnel_ops_t* o) { ops = o; }
49
50 void funnel_register_menu(const char *name,
51                           register_stat_group_t group,
52                           void (*callback)(gpointer),
53                           gpointer callback_data,
54                           gboolean retap) {
55     funnel_menu_t* m = g_malloc(sizeof(funnel_menu_t));
56     m->name = g_strdup(name);
57     m->group = group;
58     m->callback = callback;
59     m->callback_data = callback_data;
60     m->retap = retap;
61     m->next = NULL;
62     
63     if (!menus)  {
64         menus = m;
65     } else {
66         funnel_menu_t* c;
67         for (c = menus; c->next; c = c->next);
68         c->next = m;
69     }
70 }
71
72 void funnel_register_all_menus(funnel_registration_cb_t r_cb) {
73     funnel_menu_t* c;
74     for (c = menus; c; c = c->next) {
75         r_cb(c->name,c->group,c->callback,c->callback_data,c->retap);
76     }
77 }
78
79
80