|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include "ws_symbol_export.h"#include "ws_attributes.h"#include <glib.h>#include <epan/epan.h>#include <epan/frame_data.h>#include <epan/cfile.h>Go to the source code of this file.
Classes | |
| struct | _ext_menubar_t |
| Represents a node in the plugin-registered menubar tree (menu, item, separator, or URL). More... | |
| struct | _ext_toolbar_value_t |
| A single selectable value entry for a selector-type toolbar item. More... | |
| struct | _ext_toolbar_t |
| Represents a node in the plugin-registered toolbar tree (bar or item). More... | |
| struct | _ext_toolbar_update_t |
| Carries the parameters for a single toolbar item update operation. More... | |
| struct | _ws_info_t |
Typedefs | |
| typedef void(* | ext_menubar_action_cb) (ext_menubar_gui_type gui_type, void *gui_object, void *user_data) |
| Callback invoked when a menubar item is activated. | |
| typedef struct _ext_menubar_t | ext_menubar_t |
| typedef ext_menubar_t | ext_menu_t |
| typedef void(* | ext_toolbar_action_cb) (void *toolbar_item, void *item_data, void *user_data) |
| Callback invoked when a toolbar item's value or button state changes. | |
| typedef struct _ext_toolbar_value_t | ext_toolbar_value_t |
| A single selectable value entry for a selector-type toolbar item. | |
| typedef struct _ext_toolbar_t | ext_toolbar_t |
| Represents a node in the plugin-registered toolbar tree (bar or item). | |
| typedef struct _ext_toolbar_update_t | ext_toolbar_update_t |
| Carries the parameters for a single toolbar item update operation. | |
| typedef struct _ws_info_t | ws_info_t |
| typedef void(* | plugin_if_gui_cb) (GHashTable *data_set) |
| Callback function type for GUI-related actions. | |
| typedef void *(* | plugin_if_frame_data_cb) (frame_data *, void *) |
| typedef void *(* | plugin_if_capture_file_cb) (capture_file *, void *) |
Functions | |
| WS_DLL_PUBLIC ext_menu_t * | ext_menubar_register_menu (int proto_id, const char *menulabel, bool is_plugin) |
| Registers a new main menu. | |
| WS_DLL_PUBLIC ext_menu_t * | ext_menubar_set_parentmenu (ext_menu_t *menu, const char *parentmenu) |
| Sets a parent menu for the user menu. | |
| WS_DLL_PUBLIC ext_menu_t * | ext_menubar_add_submenu (ext_menu_t *parent, const char *menulabel) |
| Registers a new main menu. | |
| WS_DLL_PUBLIC void | ext_menubar_add_entry (ext_menu_t *parent_menu, const char *label, const char *tooltip, ext_menubar_action_cb callback, void *user_data) |
| Registers a new menubar entry. | |
| WS_DLL_PUBLIC void | ext_menubar_add_separator (ext_menu_t *parent_menu) |
| Registers a new separator entry. | |
| WS_DLL_PUBLIC void | ext_menubar_add_website (ext_menu_t *parent, const char *label, const char *tooltip, const char *url) |
| Registers a entry for a website call. | |
| WS_DLL_PUBLIC ext_toolbar_t * | ext_toolbar_register_toolbar (const char *toolbar_label) |
| Registers a toolbar. | |
| WS_DLL_PUBLIC void | ext_toolbar_unregister_toolbar (ext_toolbar_t *toolbar) |
| Removes a toolbar from the system. | |
| WS_DLL_PUBLIC void | ext_toolbar_unregister_toolbar_by_name (const char *toolbar_name) |
| Removes a toolbar from the system by providing the name of the toolbar. | |
| WS_DLL_PUBLIC ext_toolbar_t * | ext_toolbar_add_entry (ext_toolbar_t *parent_bar, ext_toolbar_item_t type, const char *label, const char *defvalue, const char *tooltip, bool capture_only, GList *value_list, bool is_required, const char *valid_regex, ext_toolbar_action_cb callback, void *user_data) |
| Registers a new toolbar entry. | |
| WS_DLL_PUBLIC GList * | ext_toolbar_add_val (GList *entries, char *value, char *display, bool is_default) |
| Adds a new value entry to an existing toolbar. | |
| WS_DLL_PUBLIC void | ext_toolbar_register_update_cb (ext_toolbar_t *entry, ext_toolbar_action_cb callback, void *item_data) |
| Registers a callback for toolbar updates. | |
| WS_DLL_PUBLIC void | ext_toolbar_update_value (ext_toolbar_t *entry, void *data, bool silent) |
| Updates the entry values. | |
| WS_DLL_PUBLIC void | ext_toolbar_update_data (ext_toolbar_t *entry, void *data, bool silent) |
| Updates the entry data. | |
| WS_DLL_PUBLIC void | ext_toolbar_update_data_by_index (ext_toolbar_t *entry, void *data, void *idx, bool silent) |
| Updates the entry data by index. | |
| WS_DLL_PUBLIC void | ext_toolbar_update_data_add_entry (ext_toolbar_t *entry, void *data, void *idx, bool silent) |
| Adds the entry data by index. | |
| WS_DLL_PUBLIC void | ext_toolbar_update_data_remove_entry (ext_toolbar_t *entry, void *data, void *idx, bool silent) |
| Removes an entry data by index. | |
| WS_DLL_PUBLIC ext_toolbar_t * | ext_toolbar_entry_by_label (const ext_toolbar_t *toolbar, const char *label) |
| Searches for and returns an entry from the toolbar with the given label. | |
| WS_DLL_PUBLIC void | ext_toolbar_update_data_set_active (ext_toolbar_t *entry, bool status) |
| Sets the UI element for the given entry to the specified status. | |
| WS_DLL_PUBLIC void | plugin_if_register_gui_cb (plugin_if_callback_t actionType, plugin_if_gui_cb callback) |
| Registers a callback function for GUI-related actions. | |
| WS_DLL_PUBLIC void | plugin_if_apply_filter (const char *filter_string, bool force) |
| Applies the given filter string as display filter. | |
| WS_DLL_PUBLIC void | plugin_if_save_preference (const char *pref_module, const char *pref_key, const char *pref_value) |
| Saves a preference to the main preference storage. | |
| WS_DLL_PUBLIC void | plugin_if_goto_frame (uint32_t framenr) |
| Jumps to the given frame number. | |
| WS_DLL_PUBLIC void | plugin_if_get_ws_info (ws_info_t **ws_info) |
| Takes a snapshot of status information from Wireshark. | |
| WS_DLL_PUBLIC void * | plugin_if_get_frame_data (plugin_if_frame_data_cb extract_cb, void *user_data) |
| Gets frame_data for current packet, data are extracted by extract_cb. | |
| WS_DLL_PUBLIC void * | plugin_if_get_capture_file (plugin_if_capture_file_cb extract_cb, void *user_data) |
| Gets capture_file, data are extracted by extract_cb. | |
| WS_DLL_PUBLIC GList * | ext_menubar_get_entries (void) |
| Private Method for retrieving the menubar entries. | |
| WS_DLL_PUBLIC GList * | ext_toolbar_get_entries (void) |
| Private Method for retrieving the toolbar entries. | |
An API for Wireshark plugins
This enables wireshark dissectors, especially those implemented by plugins to register menubar entries, which then will call a pre-defined callback function for the dissector or plugin.
Also it implements additional methods, which allow plugins to interoperate with the main GUI.
Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs
SPDX-License-Identifier: GPL-2.0-or-later
| typedef ext_menubar_t ext_menu_t |
Convenience alias — a menu is the root form of ext_menubar_t
| typedef void(* ext_menubar_action_cb) (ext_menubar_gui_type gui_type, void *gui_object, void *user_data) |
Callback invoked when a menubar item is activated.
| gui_type | The GUI toolkit that triggered the action (see ext_menubar_gui_type). |
| gui_object | Toolkit-specific widget or window object associated with the event. |
| user_data | Caller-supplied context pointer registered with the menu item. |
| typedef void(* ext_toolbar_action_cb) (void *toolbar_item, void *item_data, void *user_data) |
Callback invoked when a toolbar item's value or button state changes.
| toolbar_item | Handle to the toolbar widget that was activated. |
| item_data | Current value or state data for the toolbar item. |
| user_data | Caller-supplied context pointer registered with the item. |
| typedef void(* plugin_if_gui_cb) (GHashTable *data_set) |
Callback function type for GUI-related actions.
This function type is used for callbacks that are registered to handle specific GUI-related actions in Wireshark. The callback will receive a GHashTable containing relevant data for the action being performed.
| data_set | A GHashTable containing data relevant to the GUI action. The specific keys and values in the hash table will depend on the action type for which the callback is registered. |
| enum ext_menubar_entry_t |
| enum ext_menubar_gui_type |
| enum ext_toolbar_entry_t |
| enum ext_toolbar_item_t |
Specifies the kind of update operation to apply to a toolbar item.
| enum plugin_if_callback_t |
Identifies a GUI action that a plugin can invoke through the plugin interface callback mechanism.
| Enumerator | |
|---|---|
| PLUGIN_IF_FILTER_ACTION_APPLY | Apply the provided display filter string immediately to the packet list |
| PLUGIN_IF_FILTER_ACTION_PREPARE | Stage the provided display filter string in the filter bar without applying it |
| PLUGIN_IF_PREFERENCE_SAVE | Persist a preference key/value entry to the active profile |
| PLUGIN_IF_GOTO_FRAME | Scroll the packet list to the specified frame number |
| PLUGIN_IF_GET_WS_INFO | Retrieve status information about the currently loaded capture file |
| PLUGIN_IF_GET_FRAME_DATA | Retrieve frame_data fields for the currently selected packet |
| PLUGIN_IF_GET_CAPTURE_FILE | Retrieve the capture_file structure for the current capture |
| PLUGIN_IF_REMOVE_TOOLBAR | Unregister and remove a previously added plugin toolbar from the GUI |
| WS_DLL_PUBLIC void ext_menubar_add_entry | ( | ext_menu_t * | parent_menu, |
| const char * | label, | ||
| const char * | tooltip, | ||
| ext_menubar_action_cb | callback, | ||
| void * | user_data | ||
| ) |
Registers a new menubar entry.
This registers a new menubar entry, which will have the given name, and call the provided callback on activation
| parent_menu | the parent menu for this entry |
| label | the entry label (the displayed name) for the menu item |
| tooltip | a tooltip to be displayed on mouse-over |
| callback | the action which will be invoked after click on the menu item |
| user_data | a user data pointer |
| WS_DLL_PUBLIC void ext_menubar_add_separator | ( | ext_menu_t * | parent_menu | ) |
Registers a new separator entry.
| parent_menu | the parent menu for this entry |
| WS_DLL_PUBLIC ext_menu_t * ext_menubar_add_submenu | ( | ext_menu_t * | parent, |
| const char * | menulabel | ||
| ) |
Registers a new main menu.
This will register a new sub menu entry, underneath the parent menu
| parent | the parent menu for this submenu |
| menulabel | the entry label (the displayed name) for the menu item |
| WS_DLL_PUBLIC void ext_menubar_add_website | ( | ext_menu_t * | parent, |
| const char * | label, | ||
| const char * | tooltip, | ||
| const char * | url | ||
| ) |
Registers a entry for a website call.
This registers a new menubar entry, which will call the given website, using the predefined webbrowser
| parent | the parent menu for this entry |
| label | the entry label (the displayed name) for the menu item |
| tooltip | a tooltip to be displayed on mouse-over |
| url | the url for the website |
| WS_DLL_PUBLIC GList * ext_menubar_get_entries | ( | void | ) |
Private Method for retrieving the menubar entries.
Is only to be used by the UI interfaces to retrieve the menu entries
| WS_DLL_PUBLIC ext_menu_t * ext_menubar_register_menu | ( | int | proto_id, |
| const char * | menulabel, | ||
| bool | is_plugin | ||
| ) |
Registers a new main menu.
This will register a new main menu entry, underneath all other menu entries will be sorted
| proto_id | the proto item for the protocol this menu entry belongs too |
| menulabel | the entry label (the displayed name) for the menu item |
| is_plugin | must be set to true for plugin registration |
| WS_DLL_PUBLIC ext_menu_t * ext_menubar_set_parentmenu | ( | ext_menu_t * | menu, |
| const char * | parentmenu | ||
| ) |
Sets a parent menu for the user menu.
This will set a parent menu, which allows this menu to be filtered underneath the given menu as a submenu. If the parent menu does not exist, the main menu will be used
| menu | the menu for which to add the entry |
| parentmenu | a valid menu name for the parent menu |
| WS_DLL_PUBLIC ext_toolbar_t * ext_toolbar_add_entry | ( | ext_toolbar_t * | parent_bar, |
| ext_toolbar_item_t | type, | ||
| const char * | label, | ||
| const char * | defvalue, | ||
| const char * | tooltip, | ||
| bool | capture_only, | ||
| GList * | value_list, | ||
| bool | is_required, | ||
| const char * | valid_regex, | ||
| ext_toolbar_action_cb | callback, | ||
| void * | user_data | ||
| ) |
Registers a new toolbar entry.
This registers a new toolbar entry, which will have the given name, and call the provided callback on activation
The callback will be fired on different events, depending on the item type and the implementation of the item type in a GUI element. The following types should behave as following
| parent_bar | the parent toolbar for this entry |
| type | type of the toolbar item |
| label | the entry label (the displayed name) for the item |
| defvalue | the default value for the toolbar element |
| tooltip | a tooltip to be displayed on mouse-over |
| capture_only | entry is only active, if capture is active |
| value_list | a non-null list of values, if the item type is EXT_TOOLBAR_SELECTOR |
| is_required | if the item is required to be shown in the toolbar, if false, the user can choose to hide the item |
| valid_regex | a validation regular expression for EXT_TOOLBAR_STRING |
| callback | the action which will be invoked after click on the item |
| user_data | a user data pointer |
| WS_DLL_PUBLIC GList * ext_toolbar_add_val | ( | GList * | entries, |
| char * | value, | ||
| char * | display, | ||
| bool | is_default | ||
| ) |
Adds a new value entry to an existing toolbar.
| entries | The list of existing toolbar entries. |
| value | The value associated with the entry. |
| display | The display text for the entry. |
| is_default | Indicates if this entry should be set as default. |
| WS_DLL_PUBLIC ext_toolbar_t * ext_toolbar_entry_by_label | ( | const ext_toolbar_t * | toolbar, |
| const char * | label | ||
| ) |
Searches for and returns an entry from the toolbar with the given label.
| toolbar | The toolbar to search in |
| label | The label of the entry to search for |
| WS_DLL_PUBLIC GList * ext_toolbar_get_entries | ( | void | ) |
Private Method for retrieving the toolbar entries.
Is only to be used by the UI interfaces to retrieve the toolbar entries
| WS_DLL_PUBLIC ext_toolbar_t * ext_toolbar_register_toolbar | ( | const char * | toolbar_label | ) |
Registers a toolbar.
This will register a new toolbar, which can contain various gui elements
| toolbar_label | the entry label (the displayed name) for the toolbar item |
| WS_DLL_PUBLIC void ext_toolbar_register_update_cb | ( | ext_toolbar_t * | entry, |
| ext_toolbar_action_cb | callback, | ||
| void * | item_data | ||
| ) |
Registers a callback for toolbar updates.
This function allows you to register a callback that will be called whenever a toolbar entry is updated. The callback will receive the updated entry, the type of update, and any user data associated with the entry.
| entry | The toolbar entry for which to register the update callback. |
| callback | The callback function to be called when the toolbar entry is updated. |
| item_data | User data to be passed to the callback function when it is called. |
| WS_DLL_PUBLIC void ext_toolbar_unregister_toolbar | ( | ext_toolbar_t * | toolbar | ) |
Removes a toolbar from the system.
This will remove the provided toolbar from the application
| toolbar | the toolbar to be removed |
| WS_DLL_PUBLIC void ext_toolbar_unregister_toolbar_by_name | ( | const char * | toolbar_name | ) |
Removes a toolbar from the system by providing the name of the toolbar.
This will remove the provided toolbar from the application
| toolbar_name | the name of the toolbar to be removed |
| WS_DLL_PUBLIC void ext_toolbar_update_data | ( | ext_toolbar_t * | entry, |
| void * | data, | ||
| bool | silent | ||
| ) |
Updates the entry data.
Update the data for the entry, it is up to the implemented widget, to interpret the given character data
| entry | the entry to be updated |
| data | the data for the entry |
| silent | the update for the entry should not trigger additional actions |
| WS_DLL_PUBLIC void ext_toolbar_update_data_add_entry | ( | ext_toolbar_t * | entry, |
| void * | data, | ||
| void * | idx, | ||
| bool | silent | ||
| ) |
Adds the entry data by index.
This is used to add a single entry to a selector list, by giving it's new value and a new display entry. If the value already exists, the selector may choose to ignore the command
| entry | the toolbar item to be updated |
| data | the display data for the entry to be added |
| idx | the value for the entry to be added |
| silent | the adding of the entry should not trigger additional actions |
| WS_DLL_PUBLIC void ext_toolbar_update_data_by_index | ( | ext_toolbar_t * | entry, |
| void * | data, | ||
| void * | idx, | ||
| bool | silent | ||
| ) |
Updates the entry data by index.
This is used to update a single entry of a selector list, by giving it's value and a new display entry
| entry | the toolbar item to be updated |
| data | the display data for the entry |
| idx | the value for the entry to be updated |
| silent | the update for the entry should not trigger additional actions |
| WS_DLL_PUBLIC void ext_toolbar_update_data_remove_entry | ( | ext_toolbar_t * | entry, |
| void * | data, | ||
| void * | idx, | ||
| bool | silent | ||
| ) |
Removes an entry data by index.
This is used to remove a single entry to a selector list, by giving it's value and a display entry. If the value already exists, the selector may choose to ignore the command. Both value and display must be given, as it is not established, how the entry is found in the selector list
| entry | the toolbar item to be updated |
| data | the display data for the entry to be removed |
| idx | the value for the entry to be removed |
| silent | the removal of the entry should not trigger additional actions |
| WS_DLL_PUBLIC void ext_toolbar_update_data_set_active | ( | ext_toolbar_t * | entry, |
| bool | status | ||
| ) |
Sets the UI element for the given entry to the specified status.
| entry | The toolbar entry to update |
| status | The status to set |
| WS_DLL_PUBLIC void ext_toolbar_update_value | ( | ext_toolbar_t * | entry, |
| void * | data, | ||
| bool | silent | ||
| ) |
Updates the entry values.
Update the values for the entry, it is up to the implemented widget, to interpret the given character values
| entry | the entry to be updated |
| data | the data for the entry |
| silent | the update for the entry should not trigger additional actions |
| WS_DLL_PUBLIC void plugin_if_apply_filter | ( | const char * | filter_string, |
| bool | force | ||
| ) |
Applies the given filter string as display filter.
| filter_string | The filter string to apply |
| force | Whether to force the filter application |
| WS_DLL_PUBLIC void * plugin_if_get_capture_file | ( | plugin_if_capture_file_cb | extract_cb, |
| void * | user_data | ||
| ) |
Gets capture_file, data are extracted by extract_cb.
| extract_cb | The callback function to extract capture file data. |
| user_data | User-defined data to pass to the callback function. |
| WS_DLL_PUBLIC void * plugin_if_get_frame_data | ( | plugin_if_frame_data_cb | extract_cb, |
| void * | user_data | ||
| ) |
Gets frame_data for current packet, data are extracted by extract_cb.
| extract_cb | The callback function to extract frame data. |
| user_data | User-defined data to pass to the callback function. |
| WS_DLL_PUBLIC void plugin_if_get_ws_info | ( | ws_info_t ** | ws_info | ) |
Takes a snapshot of status information from Wireshark.
| ws_info | Pointer to a ws_info_t structure to store the status information. |
| WS_DLL_PUBLIC void plugin_if_goto_frame | ( | uint32_t | framenr | ) |
Jumps to the given frame number.
| framenr | The frame number to jump to. |
| WS_DLL_PUBLIC void plugin_if_register_gui_cb | ( | plugin_if_callback_t | actionType, |
| plugin_if_gui_cb | callback | ||
| ) |
Registers a callback function for GUI-related actions.
| actionType | The type of action to register the callback for. |
| callback | The callback function to be called when the action occurs. |
| WS_DLL_PUBLIC void plugin_if_save_preference | ( | const char * | pref_module, |
| const char * | pref_key, | ||
| const char * | pref_value | ||
| ) |
Saves a preference to the main preference storage.
| pref_module | The module name of the preference. |
| pref_key | The key name of the preference. |
| pref_value | The value to save for the preference. |