aboutsummaryrefslogtreecommitdiffstats
path: root/epan/funnel.h
diff options
context:
space:
mode:
Diffstat (limited to 'epan/funnel.h')
-rw-r--r--epan/funnel.h120
1 files changed, 107 insertions, 13 deletions
diff --git a/epan/funnel.h b/epan/funnel.h
index 24ae0b3ead..7b3e8d9570 100644
--- a/epan/funnel.h
+++ b/epan/funnel.h
@@ -1,5 +1,4 @@
-/*
- * funnel.h
+/** @file
*
* EPAN's GUI mini-API
*
@@ -14,10 +13,8 @@
#ifndef __FUNNEL_H__
#define __FUNNEL_H__
-#include <glib.h>
+#include <wireshark.h>
#include <epan/stat_groups.h>
-#include "ws_symbol_export.h"
-#include <ws_log_defs.h>
#ifdef __cplusplus
extern "C" {
@@ -48,7 +45,7 @@ struct progdlg;
typedef struct _funnel_ops_t {
funnel_ops_id_t *ops_id;
- funnel_text_window_t* (*new_text_window)(const char* label);
+ funnel_text_window_t* (*new_text_window)(funnel_ops_id_t *ops_id, const char* label);
void (*set_text)(funnel_text_window_t* win, const char* text);
void (*append_text)(funnel_text_window_t* win, const char* text);
void (*prepend_text)(funnel_text_window_t* win, const char* text);
@@ -59,7 +56,8 @@ typedef struct _funnel_ops_t {
void (*destroy_text_window)(funnel_text_window_t* win);
void (*add_button)(funnel_text_window_t* win, funnel_bt_t* cb, const char* label);
- void (*new_dialog)(const gchar* title,
+ void (*new_dialog)(funnel_ops_id_t *ops_id,
+ const gchar* title,
const gchar** field_names,
const gchar** field_values,
funnel_dlg_cb_t dlg_cb,
@@ -68,12 +66,6 @@ typedef struct _funnel_ops_t {
void (*close_dialogs)(void);
- void (*logger)(const gchar *log_domain,
- enum ws_log_level log_level,
- const gchar *message,
- gpointer user_data);
-
-
void (*retap_packets)(funnel_ops_id_t *ops_id);
void (*copy_to_clipboard)(GString *str);
@@ -118,6 +110,108 @@ WS_DLL_PUBLIC void funnel_reload_menus(funnel_deregistration_cb_t d_cb,
funnel_registration_cb_t r_cb);
WS_DLL_PUBLIC void funnel_cleanup(void);
+/**
+ * Signature of function that can be called from a custom packet menu entry
+ */
+typedef void (* funnel_packet_menu_callback)(gpointer, GPtrArray*);
+
+/**
+ * Signature of callback function to register packet menu entries
+ */
+typedef void (*funnel_registration_packet_cb_t)(const char *name,
+ const char *required_fields,
+ funnel_packet_menu_callback callback,
+ gpointer callback_data,
+ gboolean retap);
+
+/**
+ * Entry point for Wireshark GUI to obtain all registered packet menus
+ *
+ * @param r_cb function which will be called to register each packet menu entry
+ */
+WS_DLL_PUBLIC void funnel_register_all_packet_menus(funnel_registration_packet_cb_t r_cb);
+
+/**
+ * Entry point for Lua code to register a packet menu
+ *
+ * @param name packet menu item's name
+ * @param required_fields fields required to be present for the packet menu to be displayed
+ * @param callback function called when the menu item is invoked. The function must take one argument and return nothing.
+ * @param callback_data Lua state for the callback function
+ * @param retap whether or not to rescan all packets
+ */
+WS_DLL_PUBLIC void funnel_register_packet_menu(const char *name,
+ const char *required_fields,
+ funnel_packet_menu_callback callback,
+ gpointer callback_data,
+ gboolean retap);
+
+/**
+ * Returns whether the packet menus have been modified since they were last registered
+ *
+ * @return TRUE if the packet menus were modified since the last registration
+ */
+WS_DLL_PUBLIC gboolean funnel_packet_menus_modified(void);
+
+/*
+ * The functions below allow registering a funnel "console". A console is just a GUI
+ * dialog that has an input text widget, an output text widget, and for each user
+ * generated input it calls a callback to generate the corresponding output.
+ * Very simple... each console type has a name and an entry in the Tools menu to invoke it.
+ * Mainly used to present a Lua console to allow inspecting Lua internals and run Lua
+ * code using the embedded interpreter.
+ */
+
+/**
+ * Signature of function that can be called to evaluate code.
+ * Returns zero on success, -1 if precompilation failed, positive for runtime errors.
+ */
+typedef int (*funnel_console_eval_cb_t)(const char *console_input,
+ char **error_ptr,
+ char **error_hint,
+ void *callback_data);
+
+/**
+ * Signature of function that can be called to install a logger.
+ */
+typedef void (*funnel_console_open_cb_t)(void (*print_func)(const char *, void *), void *print_data, void *callback_data);
+
+/**
+ * Signature of function that can be called to remove logger.
+ */
+typedef void (*funnel_console_close_cb_t)(void *callback_data);
+
+/**
+ * Signature of function that can be called to free user data.
+ */
+typedef void (*funnel_console_data_free_cb_t)(void *callback_data);
+
+/**
+ * Entry point for Lua code to register a 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);
+
+/**
+ * Signature of callback function to register console menu entries
+ */
+typedef 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);
+
+/**
+ * Entry point for Wireshark GUI to obtain all registered console menus
+ *
+ * @param r_cb function which will be called to register each console menu entry
+ */
+WS_DLL_PUBLIC void funnel_register_all_console_menus(funnel_registration_console_cb_t r_cb);
+
extern void initialize_funnel_ops(void);
extern void funnel_dump_all_text_windows(void);