From Michal Labedzki via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9333 :
[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.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27  */
28 #ifndef _FUNNEL_H
29 #define _FUNNEL_H
30
31 #include <glib.h>
32 #include "../stat_menu.h"
33 #include "ws_symbol_export.h"
34
35 typedef struct _funnel_progress_window_t funnel_progress_window_t ;
36 typedef struct _funnel_text_window_t funnel_text_window_t ;
37 typedef struct _funnel_tree_window_t funnel_tree_window_t ;
38 typedef struct _funnel_node_t funnel_node_t ;
39
40 typedef void (*text_win_close_cb_t)(void*);
41
42 typedef void (*funnel_dlg_cb_t)(gchar** user_input, void* data);
43
44 typedef gboolean (*funnel_bt_cb_t)(funnel_text_window_t* tw, void* data);
45
46 typedef struct _funnel_bt_t {
47         funnel_text_window_t* tw;
48         funnel_bt_cb_t func;
49         void* data;
50         void (*free_fcn)(void*);
51         void (*free_data_fcn)(void*);
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
66     void (*new_dialog)(const gchar* title,
67                        const gchar** fieldnames,
68                        funnel_dlg_cb_t dlg_cb,
69                        void* data);
70
71
72     void (*logger)(const gchar *log_domain,
73                    GLogLevelFlags log_level,
74                    const gchar *message,
75                    gpointer user_data);
76
77
78     void (*retap_packets)(void);
79     void (*copy_to_clipboard)(GString *str);
80
81     gchar * (*get_filter)(void);
82     void (*set_filter)(const char*);
83     void (*set_color_filter_slot)(guint8 flit_nr, const gchar* filter);
84     gboolean (*open_file)(const char* fname, const char* filter, const char** error);
85     void (*reload)(void);
86     void (*apply_filter)(void);
87
88     gboolean (*browser_open_url)(const gchar *url);
89     void (*browser_open_data_file)(const gchar *filename);
90
91     funnel_progress_window_t* (*new_progress_window)(const gchar* label, const gchar* task, gboolean terminate_is_stop, gboolean *stop_flag);
92     void (*update_progress)(funnel_progress_window_t*, float pr, const gchar* task);
93     void (*destroy_progress_window)(funnel_progress_window_t*);
94 } funnel_ops_t;
95
96 WS_DLL_PUBLIC const funnel_ops_t* funnel_get_funnel_ops(void);
97 WS_DLL_PUBLIC void funnel_set_funnel_ops(const funnel_ops_t*);
98
99 WS_DLL_PUBLIC void funnel_register_menu(const char *name,
100                                  register_stat_group_t group,
101                                  void (*callback)(gpointer),
102                                  gpointer callback_data,
103                                  gboolean retap);
104
105 typedef void (*funnel_registration_cb_t)(const char *name,
106                                          register_stat_group_t group,
107                                          void (*callback)(gpointer),
108                                          gpointer callback_data,
109                                          gboolean retap);
110
111 WS_DLL_PUBLIC void funnel_register_all_menus(funnel_registration_cb_t r_cb);
112
113 extern void initialize_funnel_ops(void);
114
115 extern void funnel_dump_all_text_windows(void);
116
117 #endif