Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
plugin_if.h File Reference
#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
 
struct  _ext_toolbar_value_t
 
struct  _ext_toolbar_t
 
struct  _ext_toolbar_update_t
 
struct  _ws_info_t
 

Typedefs

typedef void(* ext_menubar_action_cb) (ext_menubar_gui_type gui_type, void *gui_object, void *user_data)
 
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)
 
typedef struct _ext_toolbar_value_t ext_toolbar_value_t
 
typedef struct _ext_toolbar_t ext_toolbar_t
 
typedef struct _ext_toolbar_update_t ext_toolbar_update_t
 
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 *)
 

Enumerations

enum  ext_menubar_gui_type { EXT_MENUBAR_GTK_GUI , EXT_MENUBAR_QT_GUI }
 
enum  ext_menubar_entry_t { EXT_MENUBAR_MENU , EXT_MENUBAR_ITEM , EXT_MENUBAR_SEPARATOR , EXT_MENUBAR_URL }
 
enum  ext_toolbar_entry_t { EXT_TOOLBAR_BAR , EXT_TOOLBAR_ITEM }
 
enum  ext_toolbar_item_t { EXT_TOOLBAR_BOOLEAN , EXT_TOOLBAR_BUTTON , EXT_TOOLBAR_STRING , EXT_TOOLBAR_SELECTOR }
 
enum  ext_toolbar_update_type_t {
  EXT_TOOLBAR_UPDATE_VALUE , EXT_TOOLBAR_UPDATE_DATA , EXT_TOOLBAR_UPDATE_DATABYINDEX , EXT_TOOLBAR_UPDATE_DATA_ADD ,
  EXT_TOOLBAR_UPDATE_DATA_REMOVE , EXT_TOOLBAR_SET_ACTIVE
}
 
enum  plugin_if_callback_t {
  PLUGIN_IF_FILTER_ACTION_APPLY , PLUGIN_IF_FILTER_ACTION_PREPARE , PLUGIN_IF_PREFERENCE_SAVE , PLUGIN_IF_GOTO_FRAME ,
  PLUGIN_IF_GET_WS_INFO , PLUGIN_IF_GET_FRAME_DATA , PLUGIN_IF_GET_CAPTURE_FILE , PLUGIN_IF_REMOVE_TOOLBAR
}
 

Functions

WS_DLL_PUBLIC ext_menu_text_menubar_register_menu (int proto_id, const char *menulabel, bool is_plugin)
 
WS_DLL_PUBLIC ext_menu_text_menubar_set_parentmenu (ext_menu_t *menu, const char *parentmenu)
 
WS_DLL_PUBLIC ext_menu_text_menubar_add_submenu (ext_menu_t *parent, const char *menulabel)
 
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)
 
WS_DLL_PUBLIC void ext_menubar_add_separator (ext_menu_t *parent_menu)
 
WS_DLL_PUBLIC void ext_menubar_add_website (ext_menu_t *parent, const char *label, const char *tooltip, const char *url)
 
WS_DLL_PUBLIC ext_toolbar_text_toolbar_register_toolbar (const char *toolbar_label)
 
WS_DLL_PUBLIC void ext_toolbar_unregister_toolbar (ext_toolbar_t *toolbar)
 
WS_DLL_PUBLIC void ext_toolbar_unregister_toolbar_by_name (const char *toolbar_name)
 
WS_DLL_PUBLIC ext_toolbar_text_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)
 
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)
 
WS_DLL_PUBLIC void ext_toolbar_update_data (ext_toolbar_t *entry, void *data, bool silent)
 
WS_DLL_PUBLIC void ext_toolbar_update_data_by_index (ext_toolbar_t *entry, void *data, void *idx, bool silent)
 
WS_DLL_PUBLIC void ext_toolbar_update_data_add_entry (ext_toolbar_t *entry, void *data, void *idx, bool silent)
 
WS_DLL_PUBLIC void ext_toolbar_update_data_remove_entry (ext_toolbar_t *entry, void *data, void *idx, bool silent)
 
WS_DLL_PUBLIC ext_toolbar_text_toolbar_entry_by_label (const ext_toolbar_t *toolbar, const char *label)
 
WS_DLL_PUBLIC void ext_toolbar_update_data_set_active (ext_toolbar_t *entry, bool 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.
 

Detailed Description

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 Documentation

◆ plugin_if_gui_cb

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.

Parameters
data_setA 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.

Function Documentation

◆ ext_menubar_get_entries()

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

Returns
A list of menu entries.

◆ ext_toolbar_add_val()

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.

Parameters
entriesThe list of existing toolbar entries.
valueThe value associated with the entry.
displayThe display text for the entry.
is_defaultIndicates if this entry should be set as default.
Returns
GList* The updated list of toolbar entries with the new value added.

◆ ext_toolbar_get_entries()

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

◆ ext_toolbar_register_update_cb()

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.

Parameters
entryThe toolbar entry for which to register the update callback.
callbackThe callback function to be called when the toolbar entry is updated.
item_dataUser data to be passed to the callback function when it is called.

◆ plugin_if_apply_filter()

WS_DLL_PUBLIC void plugin_if_apply_filter ( const char *  filter_string,
bool  force 
)

Applies the given filter string as display filter.

Parameters
filter_stringThe filter string to apply
forceWhether to force the filter application

◆ plugin_if_get_capture_file()

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.

Parameters
extract_cbThe callback function to extract capture file data.
user_dataUser-defined data to pass to the callback function.
Returns
Pointer to the extracted capture file data.

◆ plugin_if_get_frame_data()

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.

Parameters
extract_cbThe callback function to extract frame data.
user_dataUser-defined data to pass to the callback function.
Returns
Pointer to the extracted frame data.

◆ plugin_if_get_ws_info()

WS_DLL_PUBLIC void plugin_if_get_ws_info ( ws_info_t **  ws_info)

Takes a snapshot of status information from Wireshark.

Parameters
ws_infoPointer to a ws_info_t structure to store the status information.

◆ plugin_if_goto_frame()

WS_DLL_PUBLIC void plugin_if_goto_frame ( uint32_t  framenr)

Jumps to the given frame number.

Parameters
framenrThe frame number to jump to.

◆ plugin_if_register_gui_cb()

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.

Parameters
actionTypeThe type of action to register the callback for.
callbackThe callback function to be called when the action occurs.

◆ plugin_if_save_preference()

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.

Parameters
pref_moduleThe module name of the preference.
pref_keyThe key name of the preference.
pref_valueThe value to save for the preference.