TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / epan / funnel.h
blob4dd24bc94b52fdebd8b29701bf02dda65ab4dd15
1 /** @file
3 * EPAN's GUI mini-API
5 * (c) 2006, Luis E. Garcia Ontanon <luis@ontanon.org>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef __FUNNEL_H__
14 #define __FUNNEL_H__
16 #include <wireshark.h>
17 #include <epan/stat_groups.h>
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
23 typedef struct _funnel_ops_id_t funnel_ops_id_t; /* Opaque pointer to ops instance */
24 typedef struct _funnel_text_window_t funnel_text_window_t ;
26 typedef void (*text_win_close_cb_t)(void*);
28 typedef void (*funnel_dlg_cb_t)(char** user_input, void* data);
29 typedef void (*funnel_dlg_cb_data_free_t)(void* data);
31 typedef bool (*funnel_bt_cb_t)(funnel_text_window_t* tw, void* data);
33 typedef void (* funnel_menu_callback)(void *);
34 typedef void (* funnel_menu_callback_data_free)(void *);
36 typedef struct _funnel_bt_t {
37 funnel_text_window_t* tw;
38 funnel_bt_cb_t func;
39 void* data;
40 void (*free_fcn)(void*);
41 void (*free_data_fcn)(void*);
42 } funnel_bt_t;
44 struct progdlg;
46 typedef struct _funnel_ops_t {
47 funnel_ops_id_t *ops_id;
48 funnel_text_window_t* (*new_text_window)(funnel_ops_id_t *ops_id, const char* label);
49 void (*set_text)(funnel_text_window_t* win, const char* text);
50 void (*append_text)(funnel_text_window_t* win, const char* text);
51 void (*prepend_text)(funnel_text_window_t* win, const char* text);
52 void (*clear_text)(funnel_text_window_t* win);
53 const char* (*get_text)(funnel_text_window_t* win);
54 void (*set_close_cb)(funnel_text_window_t* win, text_win_close_cb_t cb, void* data);
55 void (*set_editable)(funnel_text_window_t* win, bool editable);
56 void (*destroy_text_window)(funnel_text_window_t* win);
57 void (*add_button)(funnel_text_window_t* win, funnel_bt_t* cb, const char* label);
59 void (*new_dialog)(funnel_ops_id_t *ops_id,
60 const char* title,
61 const char** field_names,
62 const char** field_values,
63 funnel_dlg_cb_t dlg_cb,
64 void* data,
65 funnel_dlg_cb_data_free_t dlg_cb_data_free);
67 void (*close_dialogs)(void);
69 void (*retap_packets)(funnel_ops_id_t *ops_id);
70 void (*copy_to_clipboard)(GString *str);
72 const char * (*get_filter)(funnel_ops_id_t *ops_id);
73 void (*set_filter)(funnel_ops_id_t *ops_id, const char* filter);
74 char * (*get_color_filter_slot)(uint8_t filt_nr);
75 void (*set_color_filter_slot)(uint8_t filt_nr, const char* filter);
76 bool (*open_file)(funnel_ops_id_t *ops_id, const char* fname, const char* filter, char** error);
77 void (*reload_packets)(funnel_ops_id_t *ops_id);
78 void (*redissect_packets)(funnel_ops_id_t *ops_id);
79 void (*reload_lua_plugins)(funnel_ops_id_t *ops_id);
80 void (*apply_filter)(funnel_ops_id_t *ops_id);
82 bool (*browser_open_url)(const char *url);
83 void (*browser_open_data_file)(const char *filename);
85 struct progdlg* (*new_progress_window)(funnel_ops_id_t *ops_id, const char* label, const char* task, bool terminate_is_stop, bool *stop_flag);
86 void (*update_progress)(struct progdlg*, float pr, const char* task);
87 void (*destroy_progress_window)(struct progdlg*);
88 } funnel_ops_t;
90 WS_DLL_PUBLIC const funnel_ops_t* funnel_get_funnel_ops(void);
91 WS_DLL_PUBLIC void funnel_set_funnel_ops(const funnel_ops_t*);
93 WS_DLL_PUBLIC void funnel_register_menu(const char *name,
94 register_stat_group_t group,
95 funnel_menu_callback callback,
96 void *callback_data,
97 funnel_menu_callback_data_free callback_data_free,
98 bool retap);
99 void funnel_deregister_menus(void (*callback)(void *));
101 typedef void (*funnel_registration_cb_t)(const char *name,
102 register_stat_group_t group,
103 funnel_menu_callback callback,
104 void *callback_data,
105 bool retap);
106 typedef void (*funnel_deregistration_cb_t)(funnel_menu_callback callback);
108 WS_DLL_PUBLIC void funnel_register_all_menus(funnel_registration_cb_t r_cb);
109 WS_DLL_PUBLIC void funnel_reload_menus(funnel_deregistration_cb_t d_cb,
110 funnel_registration_cb_t r_cb);
111 WS_DLL_PUBLIC void funnel_cleanup(void);
114 * Signature of function that can be called from a custom packet menu entry
116 typedef void (* funnel_packet_menu_callback)(void *, GPtrArray*);
119 * Signature of callback function to register packet menu entries
121 typedef void (*funnel_registration_packet_cb_t)(const char *name,
122 const char *required_fields,
123 funnel_packet_menu_callback callback,
124 void *callback_data,
125 bool retap);
128 * Entry point for Wireshark GUI to obtain all registered packet menus
130 * @param r_cb function which will be called to register each packet menu entry
132 WS_DLL_PUBLIC void funnel_register_all_packet_menus(funnel_registration_packet_cb_t r_cb);
135 * Entry point for Lua code to register a packet menu
137 * @param name packet menu item's name
138 * @param required_fields fields required to be present for the packet menu to be displayed
139 * @param callback function called when the menu item is invoked. The function must take one argument and return nothing.
140 * @param callback_data Lua state for the callback function
141 * @param retap whether or not to rescan all packets
143 WS_DLL_PUBLIC void funnel_register_packet_menu(const char *name,
144 const char *required_fields,
145 funnel_packet_menu_callback callback,
146 void *callback_data,
147 bool retap);
150 * Returns whether the packet menus have been modified since they were last registered
152 * @return true if the packet menus were modified since the last registration
154 WS_DLL_PUBLIC bool funnel_packet_menus_modified(void);
157 * The functions below allow registering a funnel "console". A console is just a GUI
158 * dialog that has an input text widget, an output text widget, and for each user
159 * generated input it calls a callback to generate the corresponding output.
160 * Very simple... each console type has a name and an entry in the Tools menu to invoke it.
161 * Mainly used to present a Lua console to allow inspecting Lua internals and run Lua
162 * code using the embedded interpreter.
166 * Signature of function that can be called to evaluate code.
167 * Returns zero on success, -1 if precompilation failed, positive for runtime errors.
169 typedef int (*funnel_console_eval_cb_t)(const char *console_input,
170 char **error_ptr,
171 char **error_hint,
172 void *callback_data);
175 * Signature of function that can be called to install a logger.
177 typedef void (*funnel_console_open_cb_t)(void (*print_func)(const char *, void *), void *print_data, void *callback_data);
180 * Signature of function that can be called to remove logger.
182 typedef void (*funnel_console_close_cb_t)(void *callback_data);
185 * Signature of function that can be called to free user data.
187 typedef void (*funnel_console_data_free_cb_t)(void *callback_data);
190 * Entry point for Lua code to register a console menu
192 WS_DLL_PUBLIC void funnel_register_console_menu(const char *name,
193 funnel_console_eval_cb_t eval_cb,
194 funnel_console_open_cb_t open_cb,
195 funnel_console_close_cb_t close_cb,
196 void *callback_data,
197 funnel_console_data_free_cb_t free_data);
200 * Signature of callback function to register console menu entries
202 typedef void (*funnel_registration_console_cb_t)(const char *name,
203 funnel_console_eval_cb_t eval_cb,
204 funnel_console_open_cb_t open_cb,
205 funnel_console_close_cb_t close_cb,
206 void *callback_data);
209 * Entry point for Wireshark GUI to obtain all registered console menus
211 * @param r_cb function which will be called to register each console menu entry
213 WS_DLL_PUBLIC void funnel_register_all_console_menus(funnel_registration_console_cb_t r_cb);
215 extern void initialize_funnel_ops(void);
217 extern void funnel_dump_all_text_windows(void);
219 #ifdef __cplusplus
221 #endif /* __cplusplus */
223 #endif /* __FUNNEL_H__ */