* rename REGISTER_STAT_GROUP_E -> register_stat_group_t
[metze/wireshark/wip.git] / epan / funnel.h
1 /*
2  *  funnel.h
3  *
4  * EPAN's GUI mini-API
5  *
6  * (c) 2006, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
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 #ifndef _FUNNEL_H
29 #define _FUNNEL_H
30
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif
34
35 #include <glib.h>
36 #include "../stat_menu.h"
37
38 typedef struct _funnel_text_window_t funnel_text_window_t ;
39 typedef struct _funnel_tree_window_t funnel_tree_window_t ;
40 typedef struct _funnel_node_t funnel_node_t ;
41
42 typedef void (*text_win_close_cb_t)(void*);
43
44 typedef void (*funnel_dlg_cb_t)(gchar** user_input, void* data);
45
46 typedef gboolean (*funnel_bt_cb_t)(funnel_text_window_t* tw, void* data);
47
48 typedef struct _funnel_bt_t {
49         funnel_text_window_t* tw;
50         funnel_bt_cb_t func;
51         void* data;
52 } funnel_bt_t;
53
54 typedef struct _funnel_ops_t {
55     funnel_text_window_t* (*new_text_window)(const gchar* label);
56     void (*set_text)(funnel_text_window_t*  win, const gchar* text);
57     void (*append_text)(funnel_text_window_t*  win, const gchar* text);
58     void (*prepend_text)(funnel_text_window_t*  win, const gchar* text);
59     void (*clear_text)(funnel_text_window_t*  win);
60     const gchar* (*get_text)(funnel_text_window_t*  win);
61     void (*set_close_cb)(funnel_text_window_t*  win, text_win_close_cb_t cb, void* data);
62     void (*set_editable)(funnel_text_window_t*  win, gboolean editable);
63     void (*destroy_text_window)(funnel_text_window_t*  win);
64     void (*add_button)(funnel_text_window_t*  win, funnel_bt_t* cb, const gchar* label);
65 #if 0
66     funnel_node_t* (*new_tree_window)(const gchar* title, gchar** columns);
67     funnel_node_t* (*add_node)(funnel_node_t* node, gchar** values);
68     void  (*remove_node)(funnel_node_t* node);
69     void  (*set_cell)(funnel_node_t* node, gchar* column, const gchar* text);
70
71     void (*set_filter)(const gchar* filter_string);
72
73 #endif
74
75     void (*new_dialog)(const gchar* title,
76                                    const gchar** fieldnames,
77                                    funnel_dlg_cb_t dlg_cb,
78                                    void* data);
79     
80     void (*logger)(const gchar *log_domain,
81                    GLogLevelFlags log_level,
82                    const gchar *message,
83                    gpointer user_data);
84         
85         void (*retap_packets)(void);
86 } funnel_ops_t;
87
88
89 extern const funnel_ops_t* funnel_get_funnel_ops(void);
90 extern void funnel_set_funnel_ops(const funnel_ops_t*);
91
92
93 extern void funnel_register_menu(const char *name,
94                                  register_stat_group_t group,
95                                  void (*callback)(gpointer),
96                                  gpointer callback_data,
97                                  gboolean retap);
98
99
100 typedef void (*funnel_registration_cb_t)(const char *name,
101                                          register_stat_group_t group,
102                                          void (*callback)(gpointer),
103                                          gpointer callback_data,
104                                          gboolean retap);
105
106 extern void funnel_register_all_menus(funnel_registration_cb_t r_cb);
107
108 extern void initialize_funnel_ops(void);
109
110 extern void funnel_dump_all_text_windows(void);
111
112 #endif