2 * An API for Wireshark plugins
4 * This enables wireshark dissectors, especially those implemented by plugins
5 * to register menubar entries, which then will call a pre-defined callback
6 * function for the dissector or plugin.
8 * Also it implements additional methods, which allow plugins to interoperate
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 #ifndef EPAN_PLUGIN_IF_H
30 #define EPAN_PLUGIN_IF_H
34 #include "ws_symbol_export.h"
37 #include <epan/epan.h>
38 #include <epan/packet_info.h>
43 #endif /* __cplusplus */
45 #define EXT_MENUBAR_MAX_DEPTH 5
51 } ext_menubar_gui_type;
53 /* menubar callback */
54 typedef void (*ext_menubar_action_cb)(ext_menubar_gui_type gui_type, gpointer gui_object, gpointer user_data);
60 EXT_MENUBAR_SEPARATOR,
62 } ext_menubar_entry_t;
64 typedef struct _ext_menubar_t ext_menubar_t;
65 typedef ext_menubar_t ext_menu_t;
69 ext_menubar_entry_t type;
83 ext_menubar_action_cb callback;
88 /* Registers a new main menu.
90 * This will register a new main menu entry, underneath all other menu entries will
93 * @param proto_id the proto item for the protocol this menu entry belongs too
94 * @param name the entry name (the internal used one) for the menu item
95 * @param menulabel the entry label (the displayed name) for the menu item
96 * @param is_plugin must be set to TRUE for plugin registration
98 WS_DLL_PUBLIC ext_menu_t * ext_menubar_register_menu(
99 int proto_id, const gchar * menulabel, gboolean is_plugin);
101 /* Sets a parent menu for the user menu.
103 * This will set a parent menu, which allows this menu to be filtered underneath
104 * the given menu as a submenu. If the parent menu does not exist, the main menu
107 * @param menu the menu for which to add the entry
108 * @param parentmenu a valid menu name for the parent menu
110 WS_DLL_PUBLIC ext_menu_t * ext_menubar_set_parentmenu(
111 ext_menu_t * menu, const gchar * parentmenu);
113 /* Registers a new main menu.
115 * This will register a new sub menu entry, underneath the parent menu
117 * @param parent the parent menu for this submenu
118 * @param name the entry name (the internal used one) for the menu item
119 * @param menulabel the entry label (the displayed name) for the menu item
121 WS_DLL_PUBLIC ext_menu_t * ext_menubar_add_submenu(
122 ext_menu_t * parent, const gchar *menulabel);
124 /* Registers a new menubar entry.
126 * This registers a new menubar entry, which will have the given name, and
127 * call the provided callback on activation
129 * @param parent_menu the parent menu for this entry
130 * @param name the entry name (the internal used one) for the menu item
131 * @param label the entry label (the displayed name) for the menu item
132 * @param tooltip a tooltip to be displayed on mouse-over
133 * @param callback the action which will be invoked after click on the menu item
135 WS_DLL_PUBLIC void ext_menubar_add_entry(
136 ext_menu_t * parent_menu,
138 const gchar *tooltip,
139 ext_menubar_action_cb callback,
142 /* Registers a new separator entry.
144 * @note This will not work using the legacy GTK interface, due to
145 * restrictions on how separators are handled in the menu
147 * @param parent_menu the parent menu for this entry
149 WS_DLL_PUBLIC void ext_menubar_add_separator(ext_menu_t *parent_menu);
151 /* Registers a entry for a website call
153 * This registers a new menubar entry, which will call the given website, using
154 * the predefined webbrowser
156 * @param parent_menu the parent menu for this entry
157 * @param name the entry name (the internal used one) for the menu item
158 * @param label the entry label (the displayed name) for the menu item
159 * @param tooltip a tooltip to be displayed on mouse-over
160 * @param url the url for the website
162 WS_DLL_PUBLIC void ext_menubar_add_website(ext_menu_t * parent, const gchar *label,
163 const gchar *tooltip, const gchar *url);
167 * Structure definition for the plugin_if_get_ws_info function
170 typedef struct _ws_info_t
172 gboolean ws_info_supported; /* false if no libpcap */
173 file_state cf_state; /* Current state of capture file */
174 gchar *cf_filename; /* Name of capture file */
175 guint32 cf_count; /* Total number of frames */
176 guint32 cf_framenr; /**< Currently displayed frame number */
177 gboolean frame_passed_dfilter; /**< true = display, false = no display */
182 * Enumeration of possible actions, which are registered in GUI interfaces
186 /* Applies a given string as filter */
187 PLUGIN_IF_FILTER_ACTION_APPLY,
189 /* Prepares the given string as filter */
190 PLUGIN_IF_FILTER_ACTION_PREPARE,
192 /* Saves a preference entry */
193 PLUGIN_IF_PREFERENCE_SAVE,
195 /* Jumps to the provided frame number */
196 PLUGIN_IF_GOTO_FRAME,
198 /* Gets status information about the currently loaded capture file */
199 PLUGIN_IF_GET_WS_INFO
200 } plugin_if_callback_t;
203 typedef void (*plugin_if_gui_cb)(gconstpointer user_data);
205 WS_DLL_PUBLIC void plugin_if_register_gui_cb(plugin_if_callback_t actionType, plugin_if_gui_cb callback);
207 /* Applies the given filter string as display filter */
208 WS_DLL_PUBLIC void plugin_if_apply_filter(const char * filter_string, gboolean force);
210 /* Saves the given preference to the main preference storage */
211 WS_DLL_PUBLIC void plugin_if_save_preference(const char * pref_module, const char * pref_key, const char * pref_value);
213 /* Jumps to the given frame number */
214 WS_DLL_PUBLIC void plugin_if_goto_frame(guint32 framenr);
216 /* Takes a snapshot of status information from Wireshark */
217 WS_DLL_PUBLIC void plugin_if_get_ws_info(ws_info_t ** ws_info);
219 /* Private Method for retrieving the menubar entries
221 * Is only to be used by the UI interfaces to retrieve the menu entries
223 WS_DLL_PUBLIC GList * ext_menubar_get_entries(void);
227 #endif /* __cplusplus */
229 #endif /* EPAN_PLUGIN_IF_H */
237 * indent-tabs-mode: nil
240 * ex: set shiftwidth=4 tabstop=8 expandtab:
241 * :indentSize=4:tabSize=8:noTabs=true: