| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
funnel.h
Go to the documentation of this file.
1
13#pragma once
14#include <wireshark.h>
15#include <epan/stat_groups.h>
16
17#ifdef __cplusplus
18 extern "C" {
19#endif /* __cplusplus */
20
21 typedef struct _funnel_ops_id_t funnel_ops_id_t; /* Opaque pointer to ops instance */
22 typedef struct _funnel_text_window_t funnel_text_window_t ;
23
24 typedef void (*text_win_close_cb_t)(void*);
25
26 typedef void (*funnel_dlg_cb_t)(char** user_input, void* data);
27 typedef void (*funnel_dlg_cb_data_free_t)(void* data);
28
29 typedef bool (*funnel_bt_cb_t)(funnel_text_window_t* tw, void* data);
30
31 typedef void (* funnel_menu_callback)(void *);
32 typedef void (* funnel_menu_callback_data_free)(void *);
33
37 typedef struct _funnel_bt_t {
38 funnel_text_window_t* tw;
39 funnel_bt_cb_t func;
40 void* data;
41 void (*free_fcn)(void*);
42 void (*free_data_fcn)(void*);
43} funnel_bt_t;
44
45
47 struct progdlg;
48
49
53 typedef struct _funnel_ops_t {
54 funnel_ops_id_t* ops_id;
55
62 funnel_text_window_t* (*new_text_window)(funnel_ops_id_t *ops_id, const char* label);
63
69 void (*set_text)(funnel_text_window_t* win, const char* text);
70
76 void (*append_text)(funnel_text_window_t* win, const char* text);
77
83 void (*prepend_text)(funnel_text_window_t* win, const char* text);
84
89 void (*clear_text)(funnel_text_window_t* win);
90
96 const char* (*get_text)(funnel_text_window_t* win);
97
104 void (*set_close_cb)(funnel_text_window_t* win, text_win_close_cb_t cb, void* data);
105
111 void (*set_editable)(funnel_text_window_t* win, bool editable);
112
117 void (*destroy_text_window)(funnel_text_window_t* win);
118
125 void (*add_button)(funnel_text_window_t* win, funnel_bt_t* cb, const char* label);
126
137 void (*new_dialog)(funnel_ops_id_t *ops_id,
138 const char* title,
139 const char** field_names,
140 const char** field_values,
141 funnel_dlg_cb_t dlg_cb,
142 void* data,
143 funnel_dlg_cb_data_free_t dlg_cb_data_free);
144
148 void (*close_dialogs)(void);
149
154 void (*retap_packets)(funnel_ops_id_t *ops_id);
155
160 void (*copy_to_clipboard)(GString *str);
161
167 const char* (*get_filter)(funnel_ops_id_t *ops_id);
168
174 void (*set_filter)(funnel_ops_id_t *ops_id, const char* filter);
175
181 char* (*get_color_filter_slot)(uint8_t filt_nr);
182
188 void (*set_color_filter_slot)(uint8_t filt_nr, const char* filter);
189
198 bool (*open_file)(funnel_ops_id_t *ops_id, const char* fname, const char* filter, char** error);
199
204 void (*reload_packets)(funnel_ops_id_t *ops_id);
205
210 void (*redissect_packets)(funnel_ops_id_t *ops_id);
211
216 void (*reload_lua_plugins)(funnel_ops_id_t *ops_id);
217
222 void (*apply_filter)(funnel_ops_id_t *ops_id);
223
229 bool (*browser_open_url)(const char *url);
230
235 void (*browser_open_data_file)(const char *filename);
236
246 struct progdlg* (*new_progress_window)(funnel_ops_id_t *ops_id, const char* label, const char* task, bool terminate_is_stop, bool *stop_flag);
247
254 void (*update_progress)(struct progdlg* dlg, float pr, const char* task);
255
260 void (*destroy_progress_window)(struct progdlg* dlg);
261} funnel_ops_t;
262
268WS_DLL_PUBLIC const funnel_ops_t* funnel_get_funnel_ops(void);
269
274WS_DLL_PUBLIC void funnel_set_funnel_ops(const funnel_ops_t *o);
275
281WS_DLL_PUBLIC bool funnel_menu_registered(void);
282
293WS_DLL_PUBLIC void funnel_register_menu(const char *name,
294 register_stat_group_t group,
295 funnel_menu_callback callback,
296 void *callback_data,
297 funnel_menu_callback_data_free callback_data_free,
298 bool retap);
299
305 void funnel_deregister_menus(funnel_menu_callback callback);
306
307 typedef void (*funnel_registration_cb_t)(const char *name,
308 register_stat_group_t group,
309 funnel_menu_callback callback,
310 void *callback_data,
311 bool retap);
312 typedef void (*funnel_deregistration_cb_t)(funnel_menu_callback callback);
313
320WS_DLL_PUBLIC void funnel_reload_menus(funnel_deregistration_cb_t d_cb,
321 funnel_registration_cb_t r_cb);
322
330WS_DLL_PUBLIC void funnel_cleanup(void);
331
335 typedef void (* funnel_packet_menu_callback)(void *, GPtrArray*);
336
340 typedef void (*funnel_registration_packet_cb_t)(const char *name,
341 const char *required_fields,
342 funnel_packet_menu_callback callback,
343 void *callback_data,
344 bool retap);
345
351WS_DLL_PUBLIC void funnel_register_all_packet_menus(funnel_registration_packet_cb_t r_cb);
352
362WS_DLL_PUBLIC void funnel_register_packet_menu(const char *name,
363 const char *required_fields,
364 funnel_packet_menu_callback callback,
365 void *callback_data,
366 bool retap);
367
373WS_DLL_PUBLIC bool funnel_packet_menus_modified(void);
374
375/*
376 * The functions below allow registering a funnel "console". A console is just a GUI
377 * dialog that has an input text widget, an output text widget, and for each user
378 * generated input it calls a callback to generate the corresponding output.
379 * Very simple... each console type has a name and an entry in the Tools menu to invoke it.
380 * Mainly used to present a Lua console to allow inspecting Lua internals and run Lua
381 * code using the embedded interpreter.
382 */
383
388 typedef int (*funnel_console_eval_cb_t)(const char *console_input,
389 char **error_ptr,
390 char **error_hint,
391 void *callback_data);
392
396 typedef void (*funnel_console_open_cb_t)(void (*print_func)(const char *, void *), void *print_data, void *callback_data);
397
401 typedef void (*funnel_console_close_cb_t)(void *callback_data);
402
406 typedef void (*funnel_console_data_free_cb_t)(void *callback_data);
407
411WS_DLL_PUBLIC void funnel_register_console_menu(const char *name,
412 funnel_console_eval_cb_t eval_cb,
413 funnel_console_open_cb_t open_cb,
414 funnel_console_close_cb_t close_cb,
415 void *callback_data,
416 funnel_console_data_free_cb_t free_data);
417
421 typedef void (*funnel_registration_console_cb_t)(const char *name,
422 funnel_console_eval_cb_t eval_cb,
423 funnel_console_open_cb_t open_cb,
424 funnel_console_close_cb_t close_cb,
425 void *callback_data);
426
434WS_DLL_PUBLIC void funnel_ops_init(funnel_registration_cb_t r_cb, funnel_registration_console_cb_t rconsole_cb);
435
436#ifdef __cplusplus
437}
438#endif /* __cplusplus */
funnel_ops_init
WS_DLL_PUBLIC void funnel_ops_init(funnel_registration_cb_t r_cb, funnel_registration_console_cb_t rconsole_cb)
Register the funnel menus. This is done outside of epan_init() because the funnel operations depend o...
Definition funnel.c:302
funnel_packet_menu_callback
void(* funnel_packet_menu_callback)(void *, GPtrArray *)
Definition funnel.h:335
funnel_ops_t
struct _funnel_ops_t funnel_ops_t
Vtable of GUI operations provided to the Lua funnel API, abstracting all UI interactions behind funct...
funnel_menu_registered
WS_DLL_PUBLIC bool funnel_menu_registered(void)
Checks if a menu is registered.
Definition funnel.c:309
funnel_register_console_menu
WS_DLL_PUBLIC void funnel_register_console_menu(const char *name, funnel_console_eval_cb_t eval_cb, funnel_console_open_cb_t open_cb, funnel_console_close_cb_t close_cb, void *callback_data, funnel_console_data_free_cb_t free_data)
Definition funnel.c:260
funnel_registration_console_cb_t
void(* funnel_registration_console_cb_t)(const char *name, funnel_console_eval_cb_t eval_cb, funnel_console_open_cb_t open_cb, funnel_console_close_cb_t close_cb, void *callback_data)
Definition funnel.h:421
funnel_cleanup
WS_DLL_PUBLIC void funnel_cleanup(void)
Cleans up resources used by the funnel subsystem.
Definition funnel.c:314
funnel_packet_menus_modified
WS_DLL_PUBLIC bool funnel_packet_menus_modified(void)
Returns whether the packet menus have been modified since they were last registered.
Definition funnel.c:252
funnel_set_funnel_ops
WS_DLL_PUBLIC void funnel_set_funnel_ops(const funnel_ops_t *o)
Set the funnel operations.
Definition funnel.c:80
funnel_console_open_cb_t
void(* funnel_console_open_cb_t)(void(*print_func)(const char *, void *), void *print_data, void *callback_data)
Definition funnel.h:396
funnel_register_menu
WS_DLL_PUBLIC void funnel_register_menu(const char *name, register_stat_group_t group, funnel_menu_callback callback, void *callback_data, funnel_menu_callback_data_free callback_data_free, bool retap)
Registers a menu callback.
Definition funnel.c:120
funnel_register_packet_menu
WS_DLL_PUBLIC void funnel_register_packet_menu(const char *name, const char *required_fields, funnel_packet_menu_callback callback, void *callback_data, bool retap)
Entry point for Lua code to register a packet menu.
Definition funnel.c:198
funnel_deregister_menus
void funnel_deregister_menus(funnel_menu_callback callback)
Deregisters a menu callback.
Definition funnel.c:147
funnel_console_data_free_cb_t
void(* funnel_console_data_free_cb_t)(void *callback_data)
Definition funnel.h:406
funnel_bt_t
struct _funnel_bt_t funnel_bt_t
Represents a button attached to a funnel text window, bundling its callback, data,...
funnel_get_funnel_ops
WS_DLL_PUBLIC const funnel_ops_t * funnel_get_funnel_ops(void)
Get the funnel operations.
Definition funnel.c:75
funnel_register_all_packet_menus
WS_DLL_PUBLIC void funnel_register_all_packet_menus(funnel_registration_packet_cb_t r_cb)
Entry point for Wireshark GUI to obtain all registered packet menus.
Definition funnel.c:237
funnel_reload_menus
WS_DLL_PUBLIC void funnel_reload_menus(funnel_deregistration_cb_t d_cb, funnel_registration_cb_t r_cb)
Reloads the menus by deregistering and registering them again using provided callbacks.
Definition funnel.c:173
funnel_console_eval_cb_t
int(* funnel_console_eval_cb_t)(const char *console_input, char **error_ptr, char **error_hint, void *callback_data)
Definition funnel.h:388
funnel_console_close_cb_t
void(* funnel_console_close_cb_t)(void *callback_data)
Definition funnel.h:401
funnel_registration_packet_cb_t
void(* funnel_registration_packet_cb_t)(const char *name, const char *required_fields, funnel_packet_menu_callback callback, void *callback_data, bool retap)
Definition funnel.h:340
stat_groups.h
register_stat_group_t
enum register_stat_group_e register_stat_group_t
_funnel_bt_t
Represents a button attached to a funnel text window, bundling its callback, data,...
Definition funnel.h:37
_funnel_bt_t::free_fcn
void(* free_fcn)(void *)
Definition funnel.h:41
_funnel_bt_t::tw
funnel_text_window_t * tw
Definition funnel.h:38
_funnel_bt_t::free_data_fcn
void(* free_data_fcn)(void *)
Definition funnel.h:42
_funnel_bt_t::data
void * data
Definition funnel.h:40
_funnel_bt_t::func
funnel_bt_cb_t func
Definition funnel.h:39
_funnel_ops_id_t
Definition funnel_statistics.cpp:253
_funnel_ops_t
Vtable of GUI operations provided to the Lua funnel API, abstracting all UI interactions behind funct...
Definition funnel.h:53
_funnel_ops_t::close_dialogs
void(* close_dialogs)(void)
Closes all open funnel dialogs.
Definition funnel.h:148
_funnel_ops_t::reload_packets
void(* reload_packets)(funnel_ops_id_t *ops_id)
Reloads the current capture file from disk.
Definition funnel.h:204
_funnel_ops_t::browser_open_url
bool(* browser_open_url)(const char *url)
Opens a URL in the system's default web browser.
Definition funnel.h:229
_funnel_ops_t::destroy_progress_window
void(* destroy_progress_window)(struct progdlg *dlg)
Destroys a progress dialog and releases its resources.
Definition funnel.h:260
_funnel_ops_t::browser_open_data_file
void(* browser_open_data_file)(const char *filename)
Opens a local data file in the system's default application.
Definition funnel.h:235
_funnel_ops_t::set_text
void(* set_text)(funnel_text_window_t *win, const char *text)
Replaces the entire contents of a text window with the given text.
Definition funnel.h:69
_funnel_ops_t::add_button
void(* add_button)(funnel_text_window_t *win, funnel_bt_t *cb, const char *label)
Adds a button to a text window.
Definition funnel.h:125
_funnel_ops_t::ops_id
funnel_ops_id_t * ops_id
Definition funnel.h:54
_funnel_ops_t::retap_packets
void(* retap_packets)(funnel_ops_id_t *ops_id)
Triggers a retap of all packets, re-running tap listeners without full redissection.
Definition funnel.h:154
_funnel_ops_t::set_color_filter_slot
void(* set_color_filter_slot)(uint8_t filt_nr, const char *filter)
Assigns a display filter string to a color filter slot.
Definition funnel.h:188
_funnel_ops_t::set_close_cb
void(* set_close_cb)(funnel_text_window_t *win, text_win_close_cb_t cb, void *data)
Registers a callback to be invoked when a text window is closed.
Definition funnel.h:104
_funnel_ops_t::new_dialog
void(* new_dialog)(funnel_ops_id_t *ops_id, const char *title, const char **field_names, const char **field_values, funnel_dlg_cb_t dlg_cb, void *data, funnel_dlg_cb_data_free_t dlg_cb_data_free)
Opens a modal input dialog with a set of labeled fields.
Definition funnel.h:137
_funnel_ops_t::copy_to_clipboard
void(* copy_to_clipboard)(GString *str)
Copies the contents of a GString to the system clipboard.
Definition funnel.h:160
_funnel_ops_t::reload_lua_plugins
void(* reload_lua_plugins)(funnel_ops_id_t *ops_id)
Reloads all Lua plugins and redissects packets.
Definition funnel.h:216
_funnel_ops_t::destroy_text_window
void(* destroy_text_window)(funnel_text_window_t *win)
Destroys a text window and releases its associated resources.
Definition funnel.h:117
_funnel_ops_t::prepend_text
void(* prepend_text)(funnel_text_window_t *win, const char *text)
Prepends text to the beginning of a text window's contents.
Definition funnel.h:83
_funnel_ops_t::set_filter
void(* set_filter)(funnel_ops_id_t *ops_id, const char *filter)
Applies a new display filter string to the packet list.
Definition funnel.h:174
_funnel_ops_t::clear_text
void(* clear_text)(funnel_text_window_t *win)
Clears all text content from a text window.
Definition funnel.h:89
_funnel_ops_t::redissect_packets
void(* redissect_packets)(funnel_ops_id_t *ops_id)
Forces a full redissection of all packets in the current capture.
Definition funnel.h:210
_funnel_ops_t::set_editable
void(* set_editable)(funnel_text_window_t *win, bool editable)
Sets whether a text window's content is user-editable.
Definition funnel.h:111
_funnel_ops_t::apply_filter
void(* apply_filter)(funnel_ops_id_t *ops_id)
Applies the currently set display filter to the packet list.
Definition funnel.h:222
_funnel_ops_t::update_progress
void(* update_progress)(struct progdlg *dlg, float pr, const char *task)
Updates the progress bar and task description of a progress dialog.
Definition funnel.h:254
_funnel_ops_t::append_text
void(* append_text)(funnel_text_window_t *win, const char *text)
Appends text to the end of a text window's contents.
Definition funnel.h:76
_funnel_ops_t::open_file
bool(* open_file)(funnel_ops_id_t *ops_id, const char *fname, const char *filter, char **error)
Opens a capture file, optionally applying a display filter.
Definition funnel.h:198
_funnel_text_window_t
Definition tap-funnel.c:21
print_data
Definition print.c:41
progdlg
Define the structure describing a progress dialog.
Definition progress_frame.h:28