Get rid of some GTK+-only stuff.
[metze/wireshark/wip.git] / ui / gtk / main.h
1 /* main.h
2  * Global defines, etc.
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __MAIN_H__
24 #define __MAIN_H__
25
26 #include "cfile.h"
27 #include "capture_opts.h"
28
29 /** Global compile time version string */
30 extern void get_wireshark_gtk_compiled_info(GString *str);
31 extern void get_gui_compiled_info(GString *str);
32 /** Global runtime version string */
33 extern void get_wireshark_runtime_info(GString *str);
34
35
36 extern GtkWidget* wireless_tb;
37
38 void
39 airpcap_toolbar_encryption_cb(GtkWidget *entry, gpointer user_data);
40
41 /** User requested "Zoom In" by menu or toolbar.
42  *
43  * @param widget parent widget (unused)
44  * @param data unused
45  */
46 extern void view_zoom_in_cb(GtkWidget *widget, gpointer data);
47
48 /** User requested "Zoom Out" by menu or toolbar.
49  *
50  * @param widget parent widget (unused)
51  * @param data unused
52  */
53 extern void view_zoom_out_cb(GtkWidget *widget, gpointer data);
54
55 /** User requested "Zoom 100%" by menu or toolbar.
56  *
57  * @param widget parent widget (unused)
58  * @param data unused
59  */
60 extern void view_zoom_100_cb(GtkWidget *widget, gpointer data);
61
62 /** User requested "Protocol Info" by ptree context menu.
63  *
64  * @param widget parent widget (unused)
65  * @param data unused
66  */
67 extern void selected_ptree_info_cb(GtkWidget *widget, gpointer data);
68
69 /** User requested "Filter Reference" by ptree context menu.
70  *
71  * @param widget parent widget (unused)
72  * @param data unused
73  */
74 extern void selected_ptree_ref_cb(GtkWidget *widget, gpointer data);
75
76 /** "Apply as Filter" / "Prepare a Filter" action type. */
77 typedef enum {
78     MATCH_SELECTED_REPLACE, /**< "Selected" */
79     MATCH_SELECTED_AND,     /**< "and Selected" */
80     MATCH_SELECTED_OR,      /**< "or Selected" */
81     MATCH_SELECTED_NOT,     /**< "Not Selected" */
82     MATCH_SELECTED_AND_NOT, /**< "and not Selected" */
83     MATCH_SELECTED_OR_NOT   /**< "or not Selected" */
84 } MATCH_SELECTED_E;
85
86 /** mask MATCH_SELECTED_E values (internally used) */
87 #define MATCH_SELECTED_MASK         0x0ff
88
89 /** "bitwise or" this with MATCH_SELECTED_E value for instant apply instead of prepare only */
90 #define MATCH_SELECTED_APPLY_NOW    0x100
91
92 /** "bitwise or" this with MATCH_SELECTED_E value for copy to clipboard instead of prepare only */
93 #define MATCH_SELECTED_COPY_ONLY    0x200
94
95 /** User requested one of "Apply as Filter" or "Prepare a Filter" functions
96  *  by menu or context menu of protocol tree.
97  *
98  * @param data parent widget
99  * @param action the function to use
100  */
101 extern void match_selected_ptree_cb(gpointer data, MATCH_SELECTED_E action);
102
103 /** "Copy ..." action type. */
104 typedef enum {
105     COPY_SELECTED_DESCRIPTION,  /**< "Copy Description" */
106     COPY_SELECTED_FIELDNAME,    /**< "Copy Fieldname" */
107     COPY_SELECTED_VALUE         /**< "Copy Value" */
108 } COPY_SELECTED_E;
109
110 /** User highlighted item in details window and then right clicked and selected the copy option
111  *
112  * @param w parent widget
113  * @param data parent widget
114  * @param action the function to use
115  */
116 extern void copy_selected_plist_cb(GtkWidget *w _U_, gpointer data, COPY_SELECTED_E action);
117
118 /** Set or remove a time reference on this frame
119  *
120  * @param set TRUE = set time ref, FALSE=unset time ref
121  * @param frame pointer to frame
122  * @param row row number
123  */
124 extern void set_frame_reftime(gboolean set, frame_data *frame, gint row);
125
126 /** User requested the colorize function
127  *  by menu or context menu of protocol tree.
128  *
129  * @param w parent widget
130  * @param data parent widget
131  * @param filt_nr  1-10: use filter for color 1-10
132  *                    0: open new colorization rule dialog
133  *                  255: clear filters for color 1-10
134  */
135 extern void colorize_selected_ptree_cb(GtkWidget *w, gpointer data, guint8 filt_nr);
136
137 /** User requested one of "Apply as Filter" or "Prepare a Filter" functions
138  *  by context menu of packet list.
139  *
140  * @param data parent widget
141  * @param action the function to use
142  */
143 extern void match_selected_plist_cb(gpointer data, MATCH_SELECTED_E action);
144
145 /** User requested "Quit" by menu or toolbar.
146  *
147  * @param widget parent widget (unused)
148  * @param data unused
149  */
150 extern void file_quit_cmd_cb(GtkWidget *widget, gpointer data);
151
152 /** User requested "Print" by menu or toolbar.
153  *
154  * @param widget parent widget (unused)
155  * @param data unused
156  */
157 extern void file_print_cmd_cb(GtkWidget *widget, gpointer data);
158
159 /** User requested "Print" by packet list context menu.
160  *
161  * @param widget parent widget (unused)
162  * @param data unused
163  */
164 extern void file_print_selected_cmd_cb(GtkWidget *widget _U_, gpointer data _U_);
165
166 /** User requested "Export as Plain Text" by menu.
167  *
168  * @param widget parent widget (unused)
169  * @param data unused
170  */
171 extern void export_text_cmd_cb(GtkWidget *widget, gpointer data);
172
173 /** User requested "Export as Postscript" by menu.
174  *
175  * @param widget parent widget (unused)
176  * @param data unused
177  */
178 extern void export_ps_cmd_cb(GtkWidget *widget, gpointer data);
179
180 /** User requested "Export as PSML" by menu.
181  *
182  * @param widget parent widget (unused)
183  * @param data unused
184  */
185 extern void export_psml_cmd_cb(GtkWidget *widget, gpointer data);
186
187 /** User requested "Export as PDML" by menu.
188  *
189  * @param widget parent widget (unused)
190  * @param data unused
191  */
192 extern void export_pdml_cmd_cb(GtkWidget *widget, gpointer data);
193
194 /** User requested "Export as CSV" by menu.
195  *
196  * @param widget parent widget (unused)
197  * @param data unused
198  */
199 extern void export_csv_cmd_cb(GtkWidget *widget, gpointer data);
200
201 /** User requested "Export as C Arrays" by menu.
202  *
203  * @param widget parent widget (unused)
204  * @param data unused
205  */
206 extern void export_carrays_cmd_cb(GtkWidget *widget, gpointer data);
207
208 /** User requested "Export as JSON" by menu.
209  *
210  * @param widget parent widget (unused)
211  * @param data unused
212  */
213 extern void export_json_cmd_cb(GtkWidget *widget, gpointer data);
214
215 /** User requested "Expand Tree" by menu.
216  *
217  * @param widget parent widget (unused)
218  * @param data unused
219  */
220 extern void expand_tree_cb(GtkWidget *widget, gpointer data);
221
222 /** User requested "Collapse Tree" by menu.
223  *
224  * @param widget parent widget (unused)
225  * @param data unused
226  */
227 extern void collapse_tree_cb(GtkWidget *widget, gpointer data);
228
229 /** User requested "Expand All" by menu.
230  *
231  * @param widget parent widget (unused)
232  * @param data unused
233  */
234 extern void expand_all_cb(GtkWidget *widget, gpointer data);
235
236 /** User requested "Apply as a custom column" by menu.
237  *
238  * @param widget parent widget (unused)
239  * @param data unused
240  */
241 extern void apply_as_custom_column_cb(GtkWidget *widget, gpointer data);
242
243 /** User requested "Collapse All" by menu.
244  *
245  * @param widget parent widget (unused)
246  * @param data unused
247  */
248 extern void collapse_all_cb(GtkWidget *widget, gpointer data);
249
250 /** User requested "Resolve Name" by menu.
251  *
252  * @param widget parent widget (unused)
253  * @param data unused
254  */
255 extern void resolve_name_cb(GtkWidget *widget, gpointer data);
256
257 /** Action to take for reftime_frame_cb() */
258 typedef enum {
259     REFTIME_TOGGLE,     /**< toggle ref frame */
260     REFTIME_FIND_NEXT,  /**< find next ref frame */
261     REFTIME_FIND_PREV   /**< find previous ref frame */
262 } REFTIME_ACTION_E;
263
264 /** User requested one of the "Time Reference" functions by menu.
265  *
266  * @param widget parent widget (unused)
267  * @param data unused
268  * @param action the function to use
269  */
270 extern void reftime_frame_cb(GtkWidget *widget, gpointer data, REFTIME_ACTION_E action);
271
272 /** User requested the "Find Next Mark" function by menu.
273  *
274  * @param widget parent widget (unused)
275  * @param data unused
276  * @param action unused
277  */
278 extern void find_next_mark_cb(GtkWidget *widget, gpointer data, int action);
279
280 /** User requested the "Find Previous Mark" function by menu.
281  *
282  * @param widget parent widget (unused)
283  * @param data unused
284  * @param action unused
285  */
286 extern void find_prev_mark_cb(GtkWidget *widget, gpointer data, int action);
287
288 #if 0
289 /** Empty out the combobox entry field */
290 extern void dfilter_combo_add_empty(void);
291 #endif
292
293 /** Update various parts of the main window for a capture file "unsaved
294  *  changes" change.
295  *
296  * @param cf capture_file structure for the capture file.
297  */
298 extern void main_update_for_unsaved_changes(capture_file *cf);
299
300 #ifdef HAVE_LIBPCAP
301 /** Update various parts of the main window for a change in whether
302  * "auto scroll in live capture" is on or off.
303  *
304  * @param auto_scroll_live_in new state of "auto scroll in live capture"
305  */
306 void main_auto_scroll_live_changed(gboolean auto_scroll_live_in);
307 #endif
308
309 /** Update parts of the main window for a change in colorization. */
310 extern void main_colorize_changed(gboolean packet_list_colorize);
311
312 /** Quit the program.
313  *
314  * @return TRUE, if a file read is in progress
315  */
316 extern gboolean main_do_quit(void);
317
318 /** Rearrange the main window widgets, user changed its preferences. */
319 extern void main_widgets_rearrange(void);
320
321 /** Show or hide the main window widgets, user changed its preferences. */
322 extern void main_widgets_show_or_hide(void);
323
324 /* Update main window items based on whether we have a packet history. */
325 extern void main_set_for_packet_history(gboolean back_history, gboolean forward_history);
326
327 /** Apply a new filter string.
328  *  Call cf_filter_packets() and add this filter string to the recent filter list.
329  *
330  * @param cf the capture file
331  * @param dftext the new filter string
332  * @param force force the refiltering, even if filter string doesn't changed
333  * @return TRUE, if the filtering succeeded
334  */
335 extern gboolean main_filter_packets(capture_file *cf, const gchar *dftext,
336     gboolean force);
337
338 #ifdef _WIN32
339 /** Win32 only: Create a console. Beware: cannot be closed again. */
340 extern void create_console(void);
341 #endif
342
343 /** Change configuration profile */
344 extern void change_configuration_profile(const gchar *profile_name);
345
346 /** Update GUI for changes in fields */
347 extern void main_fields_changed (void);
348
349 /** redissect packets and update UI */
350 extern void redissect_packets(void);
351
352 /** Fetch all IP addresses from selected row */
353 extern GList *get_ip_address_list_from_packet_list_row(gpointer data);
354
355 extern GtkWidget *pkt_scrollw;
356
357 #endif /* __MAIN_H__ */