2006-02-04 19:56:50 +00:00
|
|
|
/*
|
|
|
|
* funnel.c
|
|
|
|
*
|
|
|
|
* EPAN's GUI mini-API
|
|
|
|
*
|
2008-08-05 21:03:46 +00:00
|
|
|
* (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
|
2006-02-04 19:56:50 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2006-02-04 19:56:50 +00:00
|
|
|
* 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
|
2014-02-25 20:42:35 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-02-04 19:56:50 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-28 17:40:07 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2006-02-04 19:56:50 +00:00
|
|
|
#include <epan/funnel.h>
|
|
|
|
|
|
|
|
typedef struct _funnel_menu_t {
|
|
|
|
const char *name;
|
2006-09-27 17:12:42 +00:00
|
|
|
register_stat_group_t group;
|
2006-02-04 19:56:50 +00:00
|
|
|
void (*callback)(gpointer);
|
|
|
|
gpointer callback_data;
|
2006-02-05 20:02:41 +00:00
|
|
|
gboolean retap;
|
2006-02-04 19:56:50 +00:00
|
|
|
struct _funnel_menu_t* next;
|
|
|
|
} funnel_menu_t;
|
|
|
|
|
|
|
|
static const funnel_ops_t* ops = NULL;
|
|
|
|
static funnel_menu_t* menus = NULL;
|
|
|
|
|
2011-05-17 22:18:32 +00:00
|
|
|
const funnel_ops_t* funnel_get_funnel_ops(void) { return ops; }
|
2006-02-04 19:56:50 +00:00
|
|
|
void funnel_set_funnel_ops(const funnel_ops_t* o) { ops = o; }
|
|
|
|
|
2006-02-05 03:59:56 +00:00
|
|
|
void funnel_register_menu(const char *name,
|
2006-09-27 17:12:42 +00:00
|
|
|
register_stat_group_t group,
|
2006-02-05 03:59:56 +00:00
|
|
|
void (*callback)(gpointer),
|
2006-02-05 20:02:41 +00:00
|
|
|
gpointer callback_data,
|
|
|
|
gboolean retap) {
|
2013-03-20 01:18:10 +00:00
|
|
|
funnel_menu_t* m = (funnel_menu_t *)g_malloc(sizeof(funnel_menu_t));
|
2006-02-04 19:56:50 +00:00
|
|
|
m->name = g_strdup(name);
|
|
|
|
m->group = group;
|
|
|
|
m->callback = callback;
|
|
|
|
m->callback_data = callback_data;
|
2006-02-05 20:02:41 +00:00
|
|
|
m->retap = retap;
|
2006-02-04 19:56:50 +00:00
|
|
|
m->next = NULL;
|
2014-02-25 20:42:35 +00:00
|
|
|
|
2006-02-04 19:56:50 +00:00
|
|
|
if (!menus) {
|
|
|
|
menus = m;
|
|
|
|
} else {
|
|
|
|
funnel_menu_t* c;
|
|
|
|
for (c = menus; c->next; c = c->next);
|
|
|
|
c->next = m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-05 03:59:56 +00:00
|
|
|
void funnel_register_all_menus(funnel_registration_cb_t r_cb) {
|
2006-02-04 19:56:50 +00:00
|
|
|
funnel_menu_t* c;
|
|
|
|
for (c = menus; c; c = c->next) {
|
2006-02-05 20:02:41 +00:00
|
|
|
r_cb(c->name,c->group,c->callback,c->callback_data,c->retap);
|
2006-02-04 19:56:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:41:10 +00:00
|
|
|
/*
|
|
|
|
* 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:
|
|
|
|
*/
|