aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/main.h
blob: 4b351899084543f5d296c6748daea13b652f19c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/* main.h
 * Global defines, etc.
 *
 * $Id$
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifndef __MAIN_H__
#define __MAIN_H__

#include "globals.h"

/** @defgroup main_window_group Main window
 * The main window has the following submodules:
   @dot
  digraph main_dependencies {
      node [shape=record, fontname=Helvetica, fontsize=10];
      main [ label="main window" URL="\ref main.h"];
      menu [ label="menubar" URL="\ref menus.h"];
      toolbar [ label="toolbar" URL="\ref main_toolbar.h"];
      packet_list [ label="packet list pane" URL="\ref main_packet_list.h"];
      proto_draw [ label="packet details & bytes panes" URL="\ref main_proto_draw.h"];
      recent [ label="recent user settings" URL="\ref recent.h"];
      main -> menu [ arrowhead="open", style="solid" ];
      main -> toolbar [ arrowhead="open", style="solid" ];
      main -> packet_list [ arrowhead="open", style="solid" ];
      main -> proto_draw [ arrowhead="open", style="solid" ];
      main -> recent [ arrowhead="open", style="solid" ];
  }
  @enddot
 */

/** @file
 *  The main window, filter toolbar, program start/stop and a lot of other things
 *  @ingroup main_window_group
 *  @ingroup windows_group
 */

/** Global compile time version string */
extern GString *comp_info_str;
/** Global runtime version string */
extern GString *runtime_info_str;

extern GtkWidget* airpcap_tb;

extern void protect_thread_critical_region(void);
extern void unprotect_thread_critical_region(void);

void
airpcap_toolbar_encryption_cb(GtkWidget *entry, gpointer user_data);

/** User requested "Zoom In" by menu or toolbar.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void view_zoom_in_cb(GtkWidget *widget, gpointer data);

/** User requested "Zoom Out" by menu or toolbar.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void view_zoom_out_cb(GtkWidget *widget, gpointer data);

/** User requested "Zoom 100%" by menu or toolbar.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void view_zoom_100_cb(GtkWidget *widget, gpointer data);

/** User requested "Protocol Info" by ptree context menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void selected_ptree_info_cb(GtkWidget *widget, gpointer data);

/** User requested "Filter Reference" by ptree context menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void selected_ptree_ref_cb(GtkWidget *widget, gpointer data);

/** "Apply as Filter" / "Prepare a Filter" action type. */
typedef enum {
    MATCH_SELECTED_REPLACE, /**< "Selected" */
    MATCH_SELECTED_AND,     /**< "and Selected" */
    MATCH_SELECTED_OR,      /**< "or Selected" */
    MATCH_SELECTED_NOT,     /**< "Not Selected" */
    MATCH_SELECTED_AND_NOT, /**< "and not Selected" */
    MATCH_SELECTED_OR_NOT   /**< "or not Selected" */
} MATCH_SELECTED_E;

/** mask MATCH_SELECTED_E values (internally used) */
#define MATCH_SELECTED_MASK         0x0ff

/** "bitwise or" this with MATCH_SELECTED_E value for instant apply instead of prepare only */
#define MATCH_SELECTED_APPLY_NOW    0x100

/** "bitwise or" this with MATCH_SELECTED_E value for copy to clipboard instead of prepare only */
#define MATCH_SELECTED_COPY_ONLY    0x200

/** User requested one of "Apply as Filter" or "Prepare a Filter" functions
 *  by menu or context menu of protocol tree.
 *
 * @param widget parent widget
 * @param data parent widget
 * @param action the function to use
 */
extern void match_selected_ptree_cb(GtkWidget *widget, gpointer data, MATCH_SELECTED_E action);

/** "Copy ..." action type. */
typedef enum {
    COPY_SELECTED_DESCRIPTION,  /**< "Copy Description" */
    COPY_SELECTED_FIELDNAME,    /**< "Copy Fieldname" */
    COPY_SELECTED_VALUE         /**< "Copy Value" */
} COPY_SELECTED_E;

/** User highlighted item in details window and then right clicked and selected the copy option
 *
 * @param w parent widget
 * @param data parent widget
 * @param action the function to use
 */
extern void copy_selected_plist_cb(GtkWidget *w _U_, gpointer data, COPY_SELECTED_E action);

/** Set or remove a time reference on this frame 
 *
 * @param set TRUE = set time ref, FALSE=unset time ref
 * @param frame pointer to frame
 * @param row row number
 */
extern void set_frame_reftime(gboolean set, frame_data *frame, gint row);

/** User requested the colorize function
 *  by menu or context menu of protocol tree.
 *
 * @param w parent widget
 * @param data parent widget
 * @param filt_nr  1-10: use filter for color 1-10
 *                    0: open new colorization rule dialog
 *                  255: clear filters for color 1-10
 */
extern void colorize_selected_ptree_cb(GtkWidget *w, gpointer data, guint8 filt_nr);

/** User requested one of "Apply as Filter" or "Prepare a Filter" functions
 *  by context menu of packet list.
 *
 * @param widget parent widget (unused)
 * @param data parent widget
 * @param action the function to use
 */
extern void match_selected_plist_cb(GtkWidget *widget, gpointer data, MATCH_SELECTED_E action);

/** User requested "Quit" by menu or toolbar.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void file_quit_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Print" by menu or toolbar.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void file_print_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Print" by packet list context menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void file_print_selected_cmd_cb(GtkWidget *widget _U_, gpointer data _U_);

/** User requested "Export as Plain Text" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void export_text_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Export as Postscript" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void export_ps_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Export as PSML" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void export_psml_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Export as PDML" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void export_pdml_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Export as CSV" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void export_csv_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Export as C Arrays" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void export_carrays_cmd_cb(GtkWidget *widget, gpointer data);

/** User requested "Expand Tree" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void expand_tree_cb(GtkWidget *widget, gpointer data);

/** User requested "Expand All" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void expand_all_cb(GtkWidget *widget, gpointer data);

/** User requested "Apply as a custom column" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void apply_as_custom_column_cb(GtkWidget *widget, gpointer data);

/** User requested "Collapse All" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void collapse_all_cb(GtkWidget *widget, gpointer data);

/** User requested "Resolve Name" by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 */
extern void resolve_name_cb(GtkWidget *widget, gpointer data);

/** Action to take for reftime_frame_cb() */
typedef enum {
    REFTIME_TOGGLE,     /**< toggle ref frame */
    REFTIME_FIND_NEXT,  /**< find next ref frame */
    REFTIME_FIND_PREV   /**< find previous ref frame */
} REFTIME_ACTION_E;

/** User requested one of the "Time Reference" functions by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 * @param action the function to use
 */
extern void reftime_frame_cb(GtkWidget *widget, gpointer data, REFTIME_ACTION_E action);

/** User requested the "Find Next Mark" function by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 * @param action unused
 */
extern void find_next_mark_cb(GtkWidget *widget, gpointer data, int action);

/** User requested the "Find Previous Mark" function by menu.
 *
 * @param widget parent widget (unused)
 * @param data unused
 * @param action unused
 */
extern void find_prev_mark_cb(GtkWidget *widget, gpointer data, int action);

/** Add a display filter coming from the user's recent file to the dfilter combo box.
 *
 * @param dftext the filter string
 */
extern gboolean dfilter_combo_add_recent(gchar *dftext);

#if 0
/** Empty out the combobox entry field */
extern void dfilter_combo_add_empty(void);
#endif
/** Write all non empty display filters (until maximum count)
 *  of the combo box GList to the user's recent file.
 *
 * @param rf the recent file
 */
extern void dfilter_recent_combo_write_all(FILE *rf);

/** Quit the program.
 *
 * @return TRUE, if a file read is in progress
 */
extern gboolean main_do_quit(void);

/** Rearrange the main window widgets, user changed it's preferences. */
extern void main_widgets_rearrange(void);

/** Show or hide the main window widgets, user changed it's preferences. */
extern void main_widgets_show_or_hide(void);

/** Apply a new filter string.
 *  Call cf_filter_packets() and add this filter string to the recent filter list.
 *
 * @param cf the capture file
 * @param dftext the new filter string
 * @param force force the refiltering, even if filter string doesn't changed
 * @return TRUE, if the filtering succeeded
 */
extern gboolean main_filter_packets(capture_file *cf, const gchar *dftext,
    gboolean force);

#ifdef _WIN32
/** Win32 only: Create a console. Beware: cannot be closed again. */
extern void create_console(void);
#endif

#if defined(_WIN32) || ! defined USE_THREADS
/** Restart the tap update display timer with new configured interval */
extern void reset_tap_update_timer(void);
#endif

/** Fill in capture options with values from the preferences */
extern void prefs_to_capture_opts(void);

/** Change configuration profile */
extern void change_configuration_profile(const gchar *profile_name);

/** redissect packets and update UI */
extern void redissect_packets(void);

/** Fetch all IP addresses from selected row */
extern GList *get_ip_address_list_from_packet_list_row(gpointer data);

extern GtkWidget *pkt_scrollw;

#endif /* __MAIN_H__ */