#include <epan/epan.h>
#include <epan/filesystem.h>
-#include <epan/privileges.h>
+#include <wsutil/privileges.h>
#include <epan/epan_dissect.h>
#include <epan/timestamp.h>
#include <epan/packet.h>
#include <epan/funnel.h>
#include <epan/expert.h>
#include <epan/frequency-utils.h>
-
-/* general (not GTK specific) */
-#include "file.h"
-#include "summary.h"
-#include "filters.h"
-#include "disabled_protos.h"
#include <epan/prefs.h>
-#include "filter_dlg.h"
-#include "layout_prefs.h"
-#include "color.h"
-#include "color_filters.h"
-#include "print.h"
-#include "simple_dialog.h"
-#include "register.h"
#include <epan/prefs-int.h>
-#include "ringbuffer.h"
-#include "../ui_util.h"
#include <epan/tap.h>
#include <epan/stat_cmd_args.h>
-#include "util.h"
-#include "clopts_common.h"
-#include "cmdarg_err.h"
-#include "version_info.h"
-#include "merge.h"
-#include "u3.h"
-#include "uat_gui.h"
-#include "epan/uat.h"
+#include <epan/uat.h>
+#include <epan/emem.h>
+#include <epan/column.h>
+
+/* general (not GTK specific) */
+#include "../file.h"
+#include "../summary.h"
+#include "../filters.h"
+#include "../disabled_protos.h"
+#include "../color.h"
+#include "../color_filters.h"
+#include "../print.h"
+#include "../simple_dialog.h"
+#include "../register.h"
+#include "../ringbuffer.h"
+#include "../ui_util.h"
+#include "../util.h"
+#include "../clopts_common.h"
+#include "../cmdarg_err.h"
+#include "../version_info.h"
+#include "../merge.h"
+#include "../alert_box.h"
+#include "../capture_ui_utils.h"
+#include "../log.h"
+#include <wsutil/file_util.h>
#ifdef HAVE_LIBPCAP
-#include "capture-pcap-util.h"
-#include "capture.h"
-#include "capture_sync.h"
+#include "../capture-pcap-util.h"
+#include "../capture.h"
+#include "../capture_sync.h"
#endif
#ifdef _WIN32
-#include "capture-wpcap.h"
-#include "capture_wpcap_packet.h"
+#include "../capture-wpcap.h"
+#include "../capture_wpcap_packet.h"
#include <tchar.h> /* Needed for Unicode */
#include <commctrl.h>
#endif /* _WIN32 */
/* GTK related */
-#include "statusbar.h"
-#include "alert_box.h"
-#if 0
-#include "dlg_utils.h"
-#endif
-#include "file_dlg.h"
-#include "gtkglobals.h"
-#include "colors.h"
-#include "gui_utils.h"
-#include "compat_macros.h"
-#include "color_dlg.h"
-
-#include "main.h"
-#include "main_welcome.h"
-#include "menu.h"
-#include "../main_window.h"
-#include "../menu.h"
-#include "capture_file_dlg.h"
-#include <epan/column.h>
-#include "proto_draw.h"
-#include "keys.h"
-#include "packet_win.h"
-#include "toolbar.h"
-#include "find_dlg.h"
-#include "packet_list.h"
-#include "recent.h"
-#include "follow_tcp.h"
-#include "font_utils.h"
-#include "about_dlg.h"
-#include "help_dlg.h"
-#include "decode_as_dlg.h"
-#include "webbrowser.h"
-#include "capture_dlg.h"
-#include "capture_ui_utils.h"
-#include "log.h"
-#include "../epan/emem.h"
-#include "file_util.h"
-#include "expert_comp_dlg.h"
+#include "gtk/file_dlg.h"
+#include "gtk/gtkglobals.h"
+#include "gtk/color_utils.h"
+#include "gtk/gui_utils.h"
+#include "gtk/color_dlg.h"
+#include "gtk/filter_dlg.h"
+#include "gtk/uat_gui.h"
+#include "gtk/u3.h"
+#include "gtk/main.h"
+#include "gtk/main_airpcap_toolbar.h"
+#include "gtk/main_filter_toolbar.h"
+#include "gtk/menus.h"
+#include "gtk/main_packet_list.h"
+#include "gtk/main_statusbar.h"
+#include "gtk/main_statusbar_private.h"
+#include "gtk/main_toolbar.h"
+#include "gtk/main_welcome.h"
+#include "gtk/drag_and_drop.h"
+#include "gtk/capture_file_dlg.h"
+#include "gtk/main_proto_draw.h"
+#include "gtk/keys.h"
+#include "gtk/packet_win.h"
+#include "gtk/stock_icons.h"
+#include "gtk/find_dlg.h"
+#include "gtk/recent.h"
+#include "gtk/follow_tcp.h"
+#include "gtk/font_utils.h"
+#include "gtk/about_dlg.h"
+#include "gtk/help_dlg.h"
+#include "gtk/decode_as_dlg.h"
+#include "gtk/webbrowser.h"
+#include "gtk/capture_dlg.h"
+#include "gtk/capture_if_dlg.h"
+#include "gtk/tap_dfilter_dlg.h"
+
#ifdef HAVE_LIBPCAP
#include "../image/wsicon16.xpm"
#include "../image/wsicon32.xpm"
#include "../image/wsiconcap32.xpm"
#include "../image/wsiconcap48.xpm"
#endif
-#include "../image/expert_error.xpm"
-#include "../image/expert_warn.xpm"
-#include "../image/expert_note.xpm"
-#include "../image/expert_chat.xpm"
-#include "../image/expert_none.xpm"
#ifdef HAVE_AIRPCAP
#include <airpcap.h>
#include "airpcap_loader.h"
#include "airpcap_dlg.h"
#include "airpcap_gui_utils.h"
-
-#include "./gtk/toolbar.h"
-
-#include "./image/toolbar/wep_closed_24.xpm"
#endif
#ifdef HAVE_AIRPDCAP
-/* Davide Schiera (2006-11-22): including AirPDcap project */
#include <epan/crypt/airpdcap_ws.h>
-/* Davide Schiera (2006-11-22) ---------------------------------------------- */
-#endif
-
-#ifdef NEED_G_ASCII_STRCASECMP_H
-#include "../epan/g_ascii_strcasecmp.h"
#endif
/*
*/
#define RC_FILE "gtkrc"
-#ifdef HAVE_LIBPCAP
-#define DEF_READY_MESSAGE " Ready to load or capture"
-#else
-#define DEF_READY_MESSAGE " Ready to load file"
-#endif
-
capture_file cfile;
-GtkWidget *main_display_filter_widget=NULL;
-GtkWidget *top_level = NULL, *tree_view, *byte_nb_ptr, *tv_scrollw;
-GtkWidget *pkt_scrollw;
-static GtkWidget *main_pane_v1, *main_pane_v2, *main_pane_h1, *main_pane_h2;
+
+/* "exported" main widgets */
+GtkWidget *top_level = NULL, *pkt_scrollw, *tree_view, *byte_nb_ptr;
+
+/* placement widgets (can be a bit confusing, because of the many layout possibilities */
+static GtkWidget *main_vbox, *main_pane_v1, *main_pane_v2, *main_pane_h1, *main_pane_h2;
static GtkWidget *main_first_pane, *main_second_pane;
-static GtkWidget *status_pane_left, *status_pane_right;
-static GtkWidget *menubar, *main_vbox, *main_tb, *stat_hbox, *filter_tb;
-static GtkWidget *priv_warning_dialog;
+
+/* internally used widgets */
+static GtkWidget *menubar, *main_tb, *filter_tb, *tv_scrollw, *statusbar, *welcome_pane;
#ifdef HAVE_AIRPCAP
GtkWidget *airpcap_tb;
-static GtkWidget *driver_warning_dialog;
-static int airpcap_dll_ret_val = -1;
+int airpcap_dll_ret_val = -1;
#endif
-/*
- * The order below defines the priority of info bar contexts.
- */
-typedef enum {
- STATUS_LEVEL_MAIN,
- STATUS_LEVEL_FILE,
- STATUS_LEVEL_FILTER,
- STATUS_LEVEL_HELP,
- NUM_STATUS_LEVELS
-} status_level_e;
-
-static GtkWidget *info_bar;
-static GtkWidget *packets_bar = NULL;
-static GtkWidget *profile_bar = NULL;
-static GtkWidget *welcome_pane;
-static GtkWidget *expert_info_error;
-static GtkWidget *expert_info_warn;
-static GtkWidget *expert_info_note;
-static GtkWidget *expert_info_chat;
-static GtkWidget *expert_info_none;
-static guint main_ctx, file_ctx, help_ctx, filter_ctx;
-static guint status_levels[NUM_STATUS_LEVELS];
-static guint packets_ctx;
-static guint profile_ctx;
-static gchar *packets_str = NULL;
-static gchar *profile_str = NULL;
GString *comp_info_str, *runtime_info_str;
gboolean have_capture_file = FALSE; /* XXX - is there an equivalent in cfile? */
+guint tap_update_timer_id;
+
#ifdef _WIN32
static gboolean has_console; /* TRUE if app has console */
static void destroy_console(void);
+static gboolean stdin_capture = FALSE; /* Don't grab stdin & stdout if TRUE */
#endif
static void console_log_handler(const char *log_domain,
GLogLevelFlags log_level, const char *message, gpointer user_data);
#ifdef HAVE_LIBPCAP
-static gboolean list_link_layer_types;
capture_options global_capture_opts;
-capture_options *capture_opts = &global_capture_opts;
#endif
-gboolean block_toolbar_signals = FALSE;
static void create_main_window(gint, gint, gint, e_prefs*);
static void show_main_window(gboolean);
static void file_quit_answered_cb(gpointer dialog, gint btn, gpointer data);
static void main_save_window_geometry(GtkWidget *widget);
-#define E_DFILTER_CM_KEY "display_filter_combo"
-#define E_DFILTER_FL_KEY "display_filter_list"
/* Match selected byte pattern */
static void
}
g_assert(data);
- filter_te = OBJECT_GET_DATA(data, E_DFILTER_TE_KEY);
+ filter_te = g_object_get_data(G_OBJECT(data), E_DFILTER_TE_KEY);
g_assert(filter_te);
cur_filter = gtk_editable_get_chars(GTK_EDITABLE(filter_te), 0, -1);
/* Don't change the current display filter if we only want to copy the filter */
if (action&MATCH_SELECTED_COPY_ONLY) {
GString *gtk_text_str = g_string_new("");
- g_string_sprintfa(gtk_text_str, "%s", new_filter);
+ g_string_append(gtk_text_str, new_filter);
copy_to_clipboard(gtk_text_str);
g_string_free(gtk_text_str, TRUE);
} else {
proto_abbrev = proto_registrar_get_abbrev(field_id);
- /* ask the user if the wiki page really should be opened */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL,
- PRIMARY_TEXT_START "Open Wireshark Wiki page of protocol \"%s\"?" PRIMARY_TEXT_END "\n"
+ if (!proto_is_private(field_id)) {
+ /* ask the user if the wiki page really should be opened */
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL,
+ "%sOpen Wireshark Wiki page of protocol \"%s\"?%s\n"
"\n"
"This will open the \"%s\" related Wireshark Wiki page in your Web browser.\n"
"\n"
- "The Wireshark Wiki is a collaborative approach to provide information\n"
+ "The Wireshark Wiki is a collaborative approach to provide information "
"about Wireshark in several ways (not limited to protocol specifics).\n"
"\n"
- "This Wiki is new, so the page of the selected protocol\n"
+ "This Wiki is new, so the page of the selected protocol "
"may not exist and/or may not contain valuable information.\n"
"\n"
- "As everyone can edit the Wiki and add new content (or extend existing),\n"
+ "As everyone can edit the Wiki and add new content (or extend existing), "
"you are encouraged to add information if you can.\n"
"\n"
"Hint 1: If you are new to wiki editing, try out editing the Sandbox first!\n"
"\n"
- "Hint 2: If you want to add a new protocol page, you should use the ProtocolTemplate,\n"
+ "Hint 2: If you want to add a new protocol page, you should use the ProtocolTemplate, "
"which will save you a lot of editing and will give a consistent look over the pages.",
- proto_abbrev, proto_abbrev);
- simple_dialog_set_cb(dialog, selected_ptree_info_answered_cb, (gpointer) proto_abbrev);
+ simple_dialog_primary_start(), proto_abbrev, simple_dialog_primary_end(), proto_abbrev);
+ simple_dialog_set_cb(dialog, selected_ptree_info_answered_cb, (gpointer)proto_abbrev);
+ } else {
+ /* appologize to the user that the wiki page cannot be opened */
+ dialog = simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "%sCan't open Wireshark Wiki page of protocol \"%s\"%s\n"
+ "\n"
+ "This would open the \"%s\" related Wireshark Wiki page in your Web browser.\n"
+ "\n"
+ "Since this is a private protocol, such information is not available in "
+ "a public wiki. Therefore this wiki entry is blocked.\n"
+ "\n"
+ "Sorry for the inconvenience.\n",
+ simple_dialog_primary_start(), proto_abbrev, simple_dialog_primary_end(), proto_abbrev);
+ }
}
}
+static void selected_ptree_ref_answered_cb(gpointer dialog _U_, gint btn, gpointer data)
+{
+ gchar *selected_proto_url;
+ gchar *proto_abbrev = data;
+
+ switch(btn) {
+ case(ESD_BTN_OK):
+ if (cfile.finfo_selected) {
+ /* open reference page using the protocol abbreviation */
+ selected_proto_url = g_strdup_printf("http://www.wireshark.org/docs/dfref/%c/%s", proto_abbrev[0], proto_abbrev);
+ browser_open_url(selected_proto_url);
+ g_free(selected_proto_url);
+ }
+ break;
+ case(ESD_BTN_CANCEL):
+ break;
+ default:
+ g_assert_not_reached();
+ }
+}
void
selected_ptree_ref_cb(GtkWidget *widget _U_, gpointer data _U_)
{
int field_id;
const gchar *proto_abbrev;
- gchar *selected_proto_url;
+ gpointer dialog;
if (cfile.finfo_selected) {
proto_abbrev = proto_registrar_get_abbrev(field_id);
- /* open reference page using the protocol abbreviation */
- selected_proto_url = g_strdup_printf("http://www.wireshark.org/docs/dfref/%c/%s.html", proto_abbrev[0], proto_abbrev);
- browser_open_url(selected_proto_url);
- g_free(selected_proto_url);
+ if (!proto_is_private(field_id)) {
+ /* ask the user if the wiki page really should be opened */
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL,
+ "%sOpen Wireshark filter reference page of protocol \"%s\"?%s\n"
+ "\n"
+ "This will open the \"%s\" related Wireshark filter reference page in your Web browser.\n"
+ "\n",
+ simple_dialog_primary_start(), proto_abbrev, simple_dialog_primary_end(), proto_abbrev);
+ simple_dialog_set_cb(dialog, selected_ptree_ref_answered_cb, (gpointer)proto_abbrev);
+ } else {
+ /* appologize to the user that the wiki page cannot be opened */
+ dialog = simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "%sCan't open Wireshark filter reference page of protocol \"%s\"%s\n"
+ "\n"
+ "This would open the \"%s\" related Wireshark filter reference page in your Web browser.\n"
+ "\n"
+ "Since this is a private protocol, such information is not available on "
+ "a public website. Therefore this filter entry is blocked.\n"
+ "\n"
+ "Sorry for the inconvenience.\n",
+ simple_dialog_primary_start(), proto_abbrev, simple_dialog_primary_end(), proto_abbrev);
+ }
}
}
static gchar *
-get_text_from_packet_list(gpointer data)
+get_filter_from_packet_list_row_and_column(gpointer data)
{
- gint row = GPOINTER_TO_INT(OBJECT_GET_DATA(data, E_MPACKET_LIST_ROW_KEY));
- gint column = GPOINTER_TO_INT(OBJECT_GET_DATA(data, E_MPACKET_LIST_COL_KEY));
+ gint row = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(data), E_MPACKET_LIST_ROW_KEY));
+ gint column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(data), E_MPACKET_LIST_COL_KEY));
frame_data *fdata = (frame_data *)packet_list_get_row_data(row);
if(strlen(fdata->col_expr.col_expr[column]) != 0 &&
{
match_selected_cb_do(data,
action,
- get_text_from_packet_list(data));
+ get_filter_from_packet_list_row_and_column(data));
}
/* This function allows users to right click in the details window and copy the text
* fails we display a message to the user to indicate the copy could not be completed.
*/
void
-copy_selected_plist_cb(GtkWidget *w _U_, gpointer data _U_)
+copy_selected_plist_cb(GtkWidget *w _U_, gpointer data _U_, COPY_SELECTED_E action)
{
GString *gtk_text_str = g_string_new("");
char labelstring[256];
char *stringpointer = labelstring;
- if (cfile.finfo_selected->rep->representation != 0) {
- g_string_sprintfa(gtk_text_str, "%s", cfile.finfo_selected->rep->representation); /* Get the represented data */
- }
- if (gtk_text_str->len == 0) { /* If no representation then... */
- proto_item_fill_label(cfile.finfo_selected, stringpointer); /* Try to read the value */
- g_string_sprintfa(gtk_text_str, "%s", stringpointer);
- }
- if (gtk_text_str->len == 0) { /* Could not get item so display error msg */
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to copy, try expanding or choosing another item");
- }
- else
+ switch(action)
{
- copy_to_clipboard(gtk_text_str); /* Copy string to clipboard */
- }
- g_string_free(gtk_text_str, TRUE); /* Free the memory */
-}
-
-
-/* XXX: use a preference for this setting! */
-static guint dfilter_combo_max_recent = 10;
-
-/* add a display filter to the combo box */
-/* Note: a new filter string will replace an old identical one */
-static gboolean
-dfilter_combo_add(GtkWidget *filter_cm, char *s) {
- GList *li;
- GList *dfilter_list = OBJECT_GET_DATA(filter_cm, E_DFILTER_FL_KEY);
-
-
- /* GtkCombos don't let us get at their list contents easily, so we maintain
- our own filter list, and feed it to gtk_combo_set_popdown_strings when
- a new filter is added. */
- li = g_list_first(dfilter_list);
- while (li) {
- /* If the filter is already in the list, remove the old one and
- * append the new one at the latest position (at g_list_append() below) */
- if (li->data && strcmp(s, li->data) == 0) {
- dfilter_list = g_list_remove(dfilter_list, li->data);
- break;
+ case COPY_SELECTED_DESCRIPTION:
+ if (cfile.finfo_selected->rep->representation != 0) {
+ g_string_append(gtk_text_str, cfile.finfo_selected->rep->representation);
}
- li = li->next;
- }
-
- dfilter_list = g_list_append(dfilter_list, s);
- OBJECT_SET_DATA(filter_cm, E_DFILTER_FL_KEY, dfilter_list);
- gtk_combo_set_popdown_strings(GTK_COMBO(filter_cm), dfilter_list);
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(filter_cm)->entry), g_list_last(dfilter_list)->data);
-
- return TRUE;
-}
-
-
-/* write all non empty display filters (until maximum count)
- * of the combo box GList to the user's recent file */
-void
-dfilter_recent_combo_write_all(FILE *rf) {
- GtkWidget *filter_cm = OBJECT_GET_DATA(top_level, E_DFILTER_CM_KEY);
- GList *dfilter_list = OBJECT_GET_DATA(filter_cm, E_DFILTER_FL_KEY);
- GList *li;
- guint max_count = 0;
-
-
- /* write all non empty display filter strings to the recent file (until max count) */
- li = g_list_first(dfilter_list);
- while ( li && (max_count++ <= dfilter_combo_max_recent) ) {
- if (strlen(li->data)) {
- fprintf (rf, RECENT_KEY_DISPLAY_FILTER ": %s\n", (char *)li->data);
+ break;
+ case COPY_SELECTED_FIELDNAME:
+ if (cfile.finfo_selected->hfinfo->abbrev != 0) {
+ g_string_append(gtk_text_str, cfile.finfo_selected->hfinfo->abbrev);
+ }
+ break;
+ case COPY_SELECTED_VALUE:
+ if (cfile.edt !=0 ) {
+ g_string_append(gtk_text_str,
+ get_node_field_value(cfile.finfo_selected, cfile.edt));
+ }
+ break;
+ default:
+ break;
}
- li = li->next;
- }
-}
-
-/* empty the combobox entry field */
-void
-dfilter_combo_add_empty(void) {
- GtkWidget *filter_cm = OBJECT_GET_DATA(top_level, E_DFILTER_CM_KEY);
-
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(filter_cm)->entry), "");
-}
-
-
-/* add a display filter coming from the user's recent file to the dfilter combo box */
-gboolean
-dfilter_combo_add_recent(gchar *s) {
- GtkWidget *filter_cm = OBJECT_GET_DATA(top_level, E_DFILTER_CM_KEY);
- char *dup;
-
- dup = g_strdup(s);
- if (!dfilter_combo_add(filter_cm, dup)) {
- g_free(dup);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* call cf_filter_packets() and add this filter string to the recent filter list */
-gboolean
-main_filter_packets(capture_file *cf, const gchar *dftext, gboolean force)
-{
- GtkCombo *filter_cm = OBJECT_GET_DATA(top_level, E_DFILTER_CM_KEY);
- GList *dfilter_list = OBJECT_GET_DATA(filter_cm, E_DFILTER_FL_KEY);
- GList *li;
- gboolean add_filter = TRUE;
- gboolean free_filter = TRUE;
- char *s;
- cf_status_t cf_status;
-
- s = g_strdup(dftext);
-
- cf_status = cf_filter_packets(cf, s, force);
- if (!s)
- return (cf_status == CF_OK);
-
- /* GtkCombos don't let us get at their list contents easily, so we maintain
- our own filter list, and feed it to gtk_combo_set_popdown_strings when
- a new filter is added. */
- if (cf_status == CF_OK) {
- li = g_list_first(dfilter_list);
- while (li) {
- if (li->data && strcmp(s, li->data) == 0)
- add_filter = FALSE;
- li = li->next;
+ if (gtk_text_str->len == 0) {
+ /* If no representation then... Try to read the value */
+ proto_item_fill_label(cfile.finfo_selected, stringpointer);
+ g_string_append(gtk_text_str, stringpointer);
}
- if (add_filter) {
- /* trim list size first */
- while (g_list_length(dfilter_list) >= dfilter_combo_max_recent) {
- dfilter_list = g_list_remove(dfilter_list, g_list_first(dfilter_list)->data);
- }
-
- free_filter = FALSE;
- dfilter_list = g_list_append(dfilter_list, s);
- OBJECT_SET_DATA(filter_cm, E_DFILTER_FL_KEY, dfilter_list);
- gtk_combo_set_popdown_strings(filter_cm, dfilter_list);
- gtk_entry_set_text(GTK_ENTRY(filter_cm->entry), g_list_last(dfilter_list)->data);
+ if (gtk_text_str->len == 0) {
+ /* Could not get item so display error msg */
+ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not acquire information to copy, try expanding or choosing another item");
+ } else {
+ /* Copy string to clipboard */
+ copy_to_clipboard(gtk_text_str);
}
- }
- if (free_filter)
- g_free(s);
-
- return (cf_status == CF_OK);
-}
-
-
-/* Run the current display filter on the current packet set, and
- redisplay. */
-static void
-filter_activate_cb(GtkWidget *w _U_, gpointer data)
-{
- const char *s;
-
- s = gtk_entry_get_text(GTK_ENTRY(data));
-
- main_filter_packets(&cfile, s, FALSE);
+ g_string_free(gtk_text_str, TRUE); /* Free the memory */
}
-/* redisplay with no display filter */
-static void
-filter_reset_cb(GtkWidget *w, gpointer data _U_)
-{
- GtkWidget *filter_te = NULL;
-
- if ((filter_te = OBJECT_GET_DATA(w, E_DFILTER_TE_KEY))) {
- gtk_entry_set_text(GTK_ENTRY(filter_te), "");
- }
- main_filter_packets(&cfile, NULL, FALSE);
-}
/* mark as reference time frame */
static void
}
-GtkWidget *reftime_dialog = NULL;
-
static void reftime_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
{
switch(btn) {
}
if (cfile.current_frame) {
- /* XXX hum, should better have a "cfile->current_row" here ... */
set_frame_reftime(!cfile.current_frame->flags.ref_time,
- cfile.current_frame,
- packet_list_find_row_from_data(cfile.current_frame));
+ cfile.current_frame, cfile.current_row);
}
}
void
reftime_frame_cb(GtkWidget *w _U_, gpointer data _U_, REFTIME_ACTION_E action)
{
+ static GtkWidget *reftime_dialog = NULL;
switch(action){
case REFTIME_TOGGLE:
if (cfile.current_frame) {
if(recent.gui_time_format != TS_RELATIVE && cfile.current_frame->flags.ref_time==0) {
reftime_dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO,
- PRIMARY_TEXT_START "Switch to the appropriate Time Display Format?" PRIMARY_TEXT_END "\n\n"
+ "%sSwitch to the appropriate Time Display Format?%s\n\n"
"Time References don't work well with the currently selected Time Display Format.\n\n"
- "Do you want to switch to \"Seconds Since Beginning of Capture\" now?");
+ "Do you want to switch to \"Seconds Since Beginning of Capture\" now?",
+ simple_dialog_primary_start(), simple_dialog_primary_end());
simple_dialog_set_cb(reftime_dialog, reftime_answered_cb, NULL);
} else {
- /* XXX hum, should better have a "cfile->current_row" here ... */
set_frame_reftime(!cfile.current_frame->flags.ref_time,
- cfile.current_frame,
- packet_list_find_row_from_data(cfile.current_frame));
+ cfile.current_frame, cfile.current_row);
}
}
break;
if (finfo->hfinfo->blurb != NULL &&
finfo->hfinfo->blurb[0] != '\0') {
has_blurb = TRUE;
- length = strlen(finfo->hfinfo->blurb);
+ length = (guint) strlen(finfo->hfinfo->blurb);
} else {
- length = strlen(finfo->hfinfo->name);
+ length = (guint) strlen(finfo->hfinfo->name);
}
finfo_length = finfo->length + finfo->appendix_length;
+
if (finfo_length == 0) {
len_str[0] = '\0';
} else if (finfo_length == 1) {
statusbar_push_field_msg("");
}
}
-
packet_hex_print(byte_view, byte_data, cfile.current_frame, finfo,
byte_len);
}
path = tree_find_by_field_info(GTK_TREE_VIEW(tree_view), cfile.finfo_selected);
if(path) {
/* the mouse position is at an entry, expand that one */
- gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE);
- gtk_tree_path_free(path);
+ gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE);
+ gtk_tree_path_free(path);
}
}
}
}
-/*
- * Push a message referring to file access onto the statusbar.
- */
-void
-statusbar_push_file_msg(const gchar *msg)
-{
- int i;
-
- /*g_warning("statusbar_push: %s", msg);*/
- for (i = STATUS_LEVEL_FILE + 1; i < NUM_STATUS_LEVELS; i++) {
- if (status_levels[i])
- return;
- }
- status_levels[STATUS_LEVEL_FILE]++;
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), file_ctx, msg);
-}
-
-/*
- * Pop a message referring to file access off the statusbar.
- */
-void
-statusbar_pop_file_msg(void)
-{
- /*g_warning("statusbar_pop");*/
- if (status_levels[STATUS_LEVEL_FILE] > 0) {
- status_levels[STATUS_LEVEL_FILE]--;
- }
- gtk_statusbar_pop(GTK_STATUSBAR(info_bar), file_ctx);
-}
-
-/*
- * XXX - do we need multiple statusbar contexts?
- */
-
-/*
- * Push a message referring to the currently-selected field onto the statusbar.
- */
-void
-statusbar_push_field_msg(const gchar *msg)
-{
- int i;
-
- for (i = STATUS_LEVEL_HELP + 1; i < NUM_STATUS_LEVELS; i++) {
- if (status_levels[i])
- return;
- }
- status_levels[STATUS_LEVEL_HELP]++;
-
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), help_ctx, msg);
-}
-
-/*
- * Pop a message referring to the currently-selected field off the statusbar.
- */
-void
-statusbar_pop_field_msg(void)
-{
- if (status_levels[STATUS_LEVEL_HELP] > 0) {
- status_levels[STATUS_LEVEL_HELP]--;
- }
- gtk_statusbar_pop(GTK_STATUSBAR(info_bar), help_ctx);
-}
-
-/*
- * Push a message referring to the current filter onto the statusbar.
- */
-void
-statusbar_push_filter_msg(const gchar *msg)
-{
- int i;
-
- for (i = STATUS_LEVEL_FILTER + 1; i < NUM_STATUS_LEVELS; i++) {
- if (status_levels[i])
- return;
- }
- status_levels[STATUS_LEVEL_FILTER]++;
-
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), filter_ctx, msg);
-}
-
-/*
- * Pop a message referring to the current filter off the statusbar.
- */
-void
-statusbar_pop_filter_msg(void)
-{
- if (status_levels[STATUS_LEVEL_FILTER] > 0) {
- status_levels[STATUS_LEVEL_FILTER]--;
- }
- gtk_statusbar_pop(GTK_STATUSBAR(info_bar), filter_ctx);
-}
-
-/*
- * update the packets statusbar to the current values
- */
-void packets_bar_update(void)
-{
-
- if(packets_bar) {
- /* remove old status */
- if(packets_str) {
- g_free(packets_str);
- gtk_statusbar_pop(GTK_STATUSBAR(packets_bar), packets_ctx);
- }
-
- /* do we have any packets? */
- if(cfile.count) {
- if(cfile.drops_known) {
- packets_str = g_strdup_printf(" Packets: %u Displayed: %u Marked: %u Dropped: %u",
- cfile.count, cfile.displayed_count, cfile.marked_count, cfile.drops);
- } else {
- packets_str = g_strdup_printf(" Packets: %u Displayed: %u Marked: %u",
- cfile.count, cfile.displayed_count, cfile.marked_count);
- }
- } else {
- packets_str = g_strdup(" No Packets");
- }
- gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, packets_str);
- }
-}
-
-/*
- * update the packets statusbar to the current values
- */
-void profile_bar_update(void)
-{
- if (profile_bar) {
- /* remove old status */
- if(profile_str) {
- g_free(profile_str);
- gtk_statusbar_pop(GTK_STATUSBAR(profile_bar), profile_ctx);
- }
-
- profile_str = g_strdup_printf (" Profile: %s", get_profile_name ());
-
- gtk_statusbar_push(GTK_STATUSBAR(profile_bar), profile_ctx, profile_str);
- }
-}
-
void
main_set_for_capture_file(gboolean have_capture_file_in)
{
/* write user's recent file to disk
* It is no problem to write this file, even if we do not quit */
+ write_profile_recent();
write_recent();
/* XXX - should we check whether the capture file is an
#ifdef HAVE_LIBPCAP
/* Nuke any child capture in progress. */
- capture_kill_child(capture_opts);
+ capture_kill_child(&global_capture_opts);
#endif
/* Are we in the middle of reading a capture? */
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
gtk_window_present(GTK_WINDOW(top_level));
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
- PRIMARY_TEXT_START "Save capture file before program quit?" PRIMARY_TEXT_END "\n\n"
- "If you quit the program without saving, your capture data will be discarded.");
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL,
+ "%sSave capture file before program quit?%s\n\n"
+ "If you quit the program without saving, your capture data will be discarded.",
+ simple_dialog_primary_start(), simple_dialog_primary_end());
simple_dialog_set_cb(dialog, file_quit_answered_cb, NULL);
return TRUE;
} else {
}
+static void
+main_pane_load_window_geometry(void)
+{
+ if (recent.has_gui_geometry_main_upper_pane && recent.gui_geometry_main_upper_pane)
+ gtk_paned_set_position(GTK_PANED(main_first_pane), recent.gui_geometry_main_upper_pane);
+ if (recent.has_gui_geometry_main_lower_pane && recent.gui_geometry_main_lower_pane) {
+ gtk_paned_set_position(GTK_PANED(main_second_pane), recent.gui_geometry_main_lower_pane);
+ }
+}
+
static void
main_load_window_geometry(GtkWidget *widget)
window_set_geometry(widget, &geom);
- if (recent.has_gui_geometry_main_upper_pane && recent.gui_geometry_main_upper_pane)
- gtk_paned_set_position(GTK_PANED(main_first_pane), recent.gui_geometry_main_upper_pane);
- if (recent.has_gui_geometry_main_lower_pane && recent.gui_geometry_main_lower_pane)
- gtk_paned_set_position(GTK_PANED(main_second_pane), recent.gui_geometry_main_lower_pane);
- if (recent.has_gui_geometry_status_pane && recent.gui_geometry_status_pane_left)
- gtk_paned_set_position(GTK_PANED(status_pane_left), recent.gui_geometry_status_pane_left);
- if (recent.has_gui_geometry_status_pane && recent.gui_geometry_status_pane_right)
- gtk_paned_set_position(GTK_PANED(status_pane_right), recent.gui_geometry_status_pane_right);
+ main_pane_load_window_geometry();
+ statusbar_load_window_geometry();
}
recent.gui_geometry_main_upper_pane = gtk_paned_get_position(GTK_PANED(main_first_pane));
recent.gui_geometry_main_lower_pane = gtk_paned_get_position(GTK_PANED(main_second_pane));
- recent.gui_geometry_status_pane_left = gtk_paned_get_position(GTK_PANED(status_pane_left));
- recent.gui_geometry_status_pane_right = gtk_paned_get_position(GTK_PANED(status_pane_right));
+ statusbar_save_window_geometry();
}
static void file_quit_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_)
/* save file first */
file_save_as_cmd(after_save_exit, NULL);
break;
- case(ESD_BTN_DONT_SAVE):
+ case(ESD_BTN_QUIT_DONT_SAVE):
main_do_quit();
break;
case(ESD_BTN_CANCEL):
if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) {
/* user didn't saved his current file, ask him */
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL,
- PRIMARY_TEXT_START "Save capture file before program quit?" PRIMARY_TEXT_END "\n\n"
- "If you quit the program without saving, your capture data will be discarded.");
+ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL,
+ "%sSave capture file before program quit?%s\n\n"
+ "If you quit the program without saving, your capture data will be discarded.",
+ simple_dialog_primary_start(), simple_dialog_primary_end());
simple_dialog_set_cb(dialog, file_quit_answered_cb, NULL);
} else {
/* unchanged file, just exit */
fprintf(output, " -P <key>:<path> persconf:path - personal configuration files\n");
fprintf(output, " persdata:path - personal data files\n");
fprintf(output, " -o <name>:<value> ... override preference or recent setting\n");
+ fprintf(output, " -K <keytab> keytab file to use for kerberos decryption\n");
#ifndef _WIN32
fprintf(output, " --display=DISPLAY X display to use\n");
#endif
the tap extensions. Since Gtk1 is single threaded we dont have to
worry about any locking or critical regions.
*/
-static gint
+static gboolean
update_cb(gpointer data _U_)
{
draw_tap_listeners(FALSE);
- return 1;
+ return TRUE;
}
+
+/* Restart the tap update display timer with new configured interval */
+void reset_tap_update_timer(void)
+{
+ g_source_remove(tap_update_timer_id);
+ tap_update_timer_id = g_timeout_add(prefs.tap_update_interval, update_cb, NULL);
+}
+
#else
/* if these three functions are copied to gtk1 Wireshark, since gtk1 does not
- use threads all updte_thread_mutex can be dropped and protect/unprotect
+ use threads all update_thread_mutex can be dropped and protect/unprotect
would just be empty functions.
This allows gtk2-rpcstat.c and friends to be copied unmodified to
g_static_mutex_unlock(&update_thread_mutex);
g_thread_yield();
g_get_current_time(&tv2);
- if( ((tv1.tv_sec + 2) * 1000000 + tv1.tv_usec) >
+
+ /* Assuming it took less than configured time to update tap listeners... */
+ if( (tv1.tv_sec * 1000000 + tv1.tv_usec + prefs.tap_update_interval * 1000) >
(tv2.tv_sec * 1000000 + tv2.tv_usec) ){
- g_usleep(((tv1.tv_sec + 2) * 1000000 + tv1.tv_usec) -
+ /* Wait for remainder of configured time */
+ g_usleep((tv1.tv_sec * 1000000 + tv1.tv_usec + prefs.tap_update_interval * 1000) -
(tv2.tv_sec * 1000000 + tv2.tv_usec));
}
- }
- return NULL;
+
+ return NULL;
}
#endif
void
#endif
}
-/* Set the file name in the status line, in the name for the main window,
- and in the name for the main window's icon. */
+/* Set the file name in the name for the main window and in the name for the main window's icon. */
static void
set_display_filename(capture_file *cf)
{
- const gchar *name_ptr;
- gchar *status_msg;
- gchar *size_str;
gchar *win_name;
- name_ptr = cf_get_display_name(cf);
-
if (!cf->is_tempfile && cf->filename) {
/* Add this filename to the list of recent files in the "Recent Files" submenu */
add_menu_recent_capture_file(cf->filename);
}
- /* expert info indicator */
- gtk_widget_hide(expert_info_error);
- gtk_widget_hide(expert_info_warn);
- gtk_widget_hide(expert_info_note);
- gtk_widget_hide(expert_info_chat);
- gtk_widget_hide(expert_info_none);
- switch(expert_get_highest_severity()) {
- case(PI_ERROR):
- gtk_widget_show(expert_info_error);
- break;
- case(PI_WARN):
- gtk_widget_show(expert_info_warn);
- break;
- case(PI_NOTE):
- gtk_widget_show(expert_info_note);
- break;
- case(PI_CHAT):
- gtk_widget_show(expert_info_chat);
- break;
- default:
- gtk_widget_show(expert_info_none);
- break;
- }
-
- /* statusbar */
- /* convert file size */
- if (cf->f_datalen/1024/1024 > 10) {
- size_str = g_strdup_printf("%" G_GINT64_MODIFIER "d MB", cf->f_datalen/1024/1024);
- } else if (cf->f_datalen/1024 > 10) {
- size_str = g_strdup_printf("%" G_GINT64_MODIFIER "d KB", cf->f_datalen/1024);
- } else {
- size_str = g_strdup_printf("%" G_GINT64_MODIFIER "d Bytes", cf->f_datalen);
- }
-
- status_msg = g_strdup_printf(" File: \"%s\" %s %02lu:%02lu:%02lu",
- (cf->filename) ? cf->filename : "", size_str,
- (long)cf->elapsed_time.secs/3600,
- (long)cf->elapsed_time.secs%3600/60,
- (long)cf->elapsed_time.secs%60);
- g_free(size_str);
- statusbar_push_file_msg(status_msg);
- g_free(status_msg);
-
/* window title */
- win_name = g_strdup_printf("%s - Wireshark", name_ptr);
+ win_name = g_strdup_printf("%s - Wireshark", cf_get_display_name(cf));
set_main_window_name(win_name);
g_free(win_name);
}
{
/* if we have more than 10000 packets, show a splash screen while closing */
- /* XXX - don't know a better way to decide wether to show or not,
+ /* XXX - don't know a better way to decide whether to show or not,
* as most of the time is spend in a single eth_clist_clear function,
* so we can't use a progress bar here! */
if(cf->count > 10000) {
destroy_packet_wins();
file_save_as_destroy();
- /* Clear any file-related status bar messages.
- XXX - should be "clear *ALL* file-related status bar messages;
- will there ever be more than one on the stack? */
- statusbar_pop_file_msg();
-
- /* reset expert info indicator */
- gtk_widget_hide(expert_info_error);
- gtk_widget_hide(expert_info_warn);
- gtk_widget_hide(expert_info_note);
- gtk_widget_hide(expert_info_chat);
- gtk_widget_show(expert_info_none);
-
/* Restore the standard title bar message. */
set_main_window_name("The Wireshark Network Analyzer");
set_menus_for_captured_packets(FALSE);
set_menus_for_selected_packet(cf);
set_menus_for_capture_in_progress(FALSE);
+ set_capture_if_dialog_for_capture_in_progress(FALSE);
set_menus_for_selected_tree_row(cf);
/* Set up main window for no capture file. */
splash_destroy(close_dlg);
close_dlg = NULL;
}
-
- /* go back to "No packets" */
- packets_bar_update();
}
+
static void
-main_cf_cb_file_read_start(capture_file *cf)
+main_cf_cb_file_read_start(capture_file *cf _U_)
{
- const gchar *name_ptr;
- gchar *load_msg;
-
- /* Ensure we pop any previous loaded filename */
- statusbar_pop_file_msg();
-
- name_ptr = get_basename(cf->filename);
-
- load_msg = g_strdup_printf(" Loading: %s", name_ptr);
- statusbar_push_file_msg(load_msg);
- g_free(load_msg);
+ tap_dfilter_dlg_update();
/* Set up main window for a capture file. */
main_set_for_capture_file(TRUE);
static void
main_cf_cb_file_read_finished(capture_file *cf)
{
- statusbar_pop_file_msg();
set_display_filename(cf);
/* Enable menu items that make sense if you have a capture file you've
#ifdef HAVE_LIBPCAP
static void
-main_cf_cb_live_capture_prepared(capture_options *capture_opts)
+main_capture_cb_capture_prepared(capture_options *capture_opts)
{
gchar *title;
static GList *icon_list = NULL;
/* Disable menu items that make no sense if you're currently running
a capture. */
set_menus_for_capture_in_progress(TRUE);
-
- /* update statusbar */
- statusbar_push_file_msg(" Waiting for capture input data ...");
+ set_capture_if_dialog_for_capture_in_progress(TRUE);
/* Don't set up main window for a capture file. */
main_set_for_capture_file(FALSE);
}
static void
-main_cf_cb_live_capture_update_started(capture_options *capture_opts)
+main_capture_cb_capture_update_started(capture_options *capture_opts)
{
- gchar *capture_msg;
gchar *title;
/* We've done this in "prepared" above, but it will be cleared while
g_free(title);
set_menus_for_capture_in_progress(TRUE);
+ set_capture_if_dialog_for_capture_in_progress(TRUE);
/* Enable menu items that make sense if you have some captured
packets (yes, I know, we don't have any *yet*). */
set_menus_for_captured_packets(TRUE);
- statusbar_pop_file_msg();
-
- if(capture_opts->iface) {
- capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
- get_iface_description(capture_opts),
- (capture_opts->save_file) ? capture_opts->save_file : "");
- } else {
- capture_msg = g_strdup_printf(" <live capture in progress> to file: %s",
- (capture_opts->save_file) ? capture_opts->save_file : "");
- }
-
- statusbar_push_file_msg(capture_msg);
-
- g_free(capture_msg);
-
/* Set up main window for a capture file. */
main_set_for_capture_file(TRUE);
}
static void
-main_cf_cb_live_capture_update_continue(capture_file *cf)
-{
- gchar *capture_msg;
-
-
- statusbar_pop_file_msg();
-
- /* expert info indicator */
- gtk_widget_hide(expert_info_error);
- gtk_widget_hide(expert_info_warn);
- gtk_widget_hide(expert_info_note);
- gtk_widget_hide(expert_info_chat);
- gtk_widget_hide(expert_info_none);
- switch(expert_get_highest_severity()) {
- case(PI_ERROR):
- gtk_widget_show(expert_info_error);
- break;
- case(PI_WARN):
- gtk_widget_show(expert_info_warn);
- break;
- case(PI_NOTE):
- gtk_widget_show(expert_info_note);
- break;
- case(PI_CHAT):
- gtk_widget_show(expert_info_chat);
- break;
- default:
- gtk_widget_show(expert_info_none);
- break;
- }
-
- if (cf->f_datalen/1024/1024 > 10) {
- capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d MB",
- get_iface_description(capture_opts),
- capture_opts->save_file,
- cf->f_datalen/1024/1024);
- } else if (cf->f_datalen/1024 > 10) {
- capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d KB",
- get_iface_description(capture_opts),
- capture_opts->save_file,
- cf->f_datalen/1024);
- } else {
- capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d Bytes",
- get_iface_description(capture_opts),
- capture_opts->save_file,
- cf->f_datalen);
- }
-
- statusbar_push_file_msg(capture_msg);
-}
-
-GtkWidget * stop_dlg = NULL;
-
-static void
-main_cf_cb_live_capture_update_finished(capture_file *cf)
+main_capture_cb_capture_update_finished(capture_options *capture_opts)
{
+ capture_file *cf = capture_opts->cf;
static GList *icon_list = NULL;
- if(stop_dlg != NULL) {
- simple_dialog_close(stop_dlg);
- stop_dlg = NULL;
- }
-
- /* Pop the "<live capture in progress>" message off the status bar. */
- statusbar_pop_file_msg();
-
set_display_filename(cf);
/* Enable menu items that make sense if you're not currently running
a capture. */
set_menus_for_capture_in_progress(FALSE);
+ set_capture_if_dialog_for_capture_in_progress(FALSE);
/* Enable menu items that make sense if you have a capture file
you've finished reading. */
}
gtk_window_set_icon_list(GTK_WINDOW(top_level), icon_list);
- if(capture_opts->quit_after_cap) {
+ if(global_capture_opts.quit_after_cap) {
/* command line asked us to quit after the capture */
/* don't pop up a dialog to ask for unsaved files etc. */
main_do_quit();
}
static void
-main_cf_cb_live_capture_fixed_started(capture_options *capture_opts)
+main_capture_cb_capture_fixed_started(capture_options *capture_opts _U_)
{
- gchar *capture_msg;
-
-
- /* Enable menu items that make sense if you have some captured
- packets (yes, I know, we don't have any *yet*). */
- /*set_menus_for_captured_packets(TRUE);*/
-
- statusbar_pop_file_msg();
-
- capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
- get_iface_description(capture_opts),
- (capture_opts->save_file) ? capture_opts->save_file : "");
-
- statusbar_push_file_msg(capture_msg);
- gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, " Packets: 0");
-
- g_free(capture_msg);
-
/* Don't set up main window for a capture file. */
main_set_for_capture_file(FALSE);
}
static void
-main_cf_cb_live_capture_fixed_continue(capture_file *cf)
-{
- gchar *capture_msg;
-
-
- gtk_statusbar_pop(GTK_STATUSBAR(packets_bar), packets_ctx);
-
- capture_msg = g_strdup_printf(" Packets: %u", cf_get_packet_count(cf));
-
- gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, capture_msg);
-
- g_free(capture_msg);
-}
-
-static void
-main_cf_cb_live_capture_fixed_finished(capture_file *cf _U_)
+main_capture_cb_capture_fixed_finished(capture_options *capture_opts _U_)
{
+#if 0
+ capture_file *cf = capture_opts->cf;
+#endif
static GList *icon_list = NULL;
- if(stop_dlg != NULL) {
- simple_dialog_close(stop_dlg);
- stop_dlg = NULL;
- }
-
- /* Pop the "<live capture in progress>" message off the status bar. */
- statusbar_pop_file_msg();
-
- /* Pop the "<capturing>" message off the status bar */
- gtk_statusbar_pop(GTK_STATUSBAR(packets_bar), packets_ctx);
-
/*set_display_filename(cf);*/
/* Enable menu items that make sense if you're not currently running
a capture. */
set_menus_for_capture_in_progress(FALSE);
+ set_capture_if_dialog_for_capture_in_progress(FALSE);
/* Restore the standard title bar message */
/* (just in case we have trouble opening the capture file). */
/* We don't have loaded the capture file, this will be done later.
* For now we still have simply a blank screen. */
- if(capture_opts->quit_after_cap) {
+ if(global_capture_opts.quit_after_cap) {
/* command line asked us to quit after the capture */
/* don't pop up a dialog to ask for unsaved files etc. */
main_do_quit();
}
}
-static void
-main_cf_cb_live_capture_stopping(capture_file *cf _U_)
-{
- /* Beware: this state won't be called, if the capture child
- * closes the capturing on it's own! */
-#if 0
- /* XXX - the time to stop the capture has been reduced (this was only a
- * problem on Win32 because of the capture piping), so showing a splash
- * isn't really necessary any longer. Unfortunately, the GTKClist packet
- * list seems to have problems updating after the dialog is closed, so
- * this was disabled here. */
- stop_dlg = simple_dialog(ESD_TYPE_STOP, ESD_BTN_NONE, "%sCapture stop!%s\n\nPlease wait ...",
- simple_dialog_primary_start(), simple_dialog_primary_end());
- gtk_window_set_position(GTK_WINDOW(stop_dlg), GTK_WIN_POS_CENTER_ON_PARENT);
-#endif
-}
-
-#endif
+#endif /* HAVE_LIBPCAP */
static void
main_cf_cb_packet_selected(gpointer data)
static void
main_cf_cb_field_unselected(capture_file *cf)
{
- statusbar_pop_field_msg();
set_menus_for_selected_tree_row(cf);
}
-static void
-main_cf_cb_file_safe_started(gchar * filename)
-{
- const gchar *name_ptr;
- gchar *save_msg;
-
- name_ptr = get_basename(filename);
-
- save_msg = g_strdup_printf(" Saving: %s...", name_ptr);
-
- statusbar_push_file_msg(save_msg);
- g_free(save_msg);
-}
-
-static void
-main_cf_cb_file_safe_finished(gpointer data _U_)
-{
- /* Pop the "Saving:" message off the status bar. */
- statusbar_pop_file_msg();
-}
-
-static void
-main_cf_cb_file_safe_failed(gpointer data _U_)
-{
- /* Pop the "Saving:" message off the status bar. */
- statusbar_pop_file_msg();
-}
-
static void
main_cf_cb_file_safe_reload_finished(gpointer data _U_)
{
set_menus_for_capture_file(&cfile);
}
-static void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
+static void
+main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
{
switch(event) {
case(cf_cb_file_closing):
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: Read finished");
main_cf_cb_file_read_finished(data);
break;
-#ifdef HAVE_LIBPCAP
- case(cf_cb_live_capture_prepared):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture prepared");
- main_cf_cb_live_capture_prepared(data);
- break;
- case(cf_cb_live_capture_update_started):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update started");
- main_cf_cb_live_capture_update_started(data);
- break;
- case(cf_cb_live_capture_update_continue):
- /*g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update continue");*/
- main_cf_cb_live_capture_update_continue(data);
- break;
- case(cf_cb_live_capture_update_finished):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update finished");
- main_cf_cb_live_capture_update_finished(data);
- break;
- case(cf_cb_live_capture_fixed_started):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed started");
- main_cf_cb_live_capture_fixed_started(data);
- break;
- case(cf_cb_live_capture_fixed_continue):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed continue");
- main_cf_cb_live_capture_fixed_continue(data);
- break;
- case(cf_cb_live_capture_fixed_finished):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed finished");
- main_cf_cb_live_capture_fixed_finished(data);
- break;
- case(cf_cb_live_capture_stopping):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture stopping");
- main_cf_cb_live_capture_stopping(data);
- break;
-#endif
case(cf_cb_packet_selected):
main_cf_cb_packet_selected(data);
break;
break;
case(cf_cb_file_safe_started):
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe started");
- main_cf_cb_file_safe_started(data);
break;
- case(cf_cb_file_safe_finished):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe finished");
- main_cf_cb_file_safe_finished(data);
+ case(cf_cb_file_safe_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe finished");
+ break;
+ case(cf_cb_file_safe_reload_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: reload finished");
+ main_cf_cb_file_safe_reload_finished(data);
+ break;
+ case(cf_cb_file_safe_failed):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe failed");
+ break;
+ default:
+ g_warning("main_cf_callback: event %u unknown", event);
+ g_assert_not_reached();
+ }
+}
+
+#ifdef HAVE_LIBPCAP
+static void
+main_capture_callback(gint event, capture_options *capture_opts, gpointer user_data _U_)
+{
+ switch(event) {
+ case(capture_cb_capture_prepared):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture prepared");
+ main_capture_cb_capture_prepared(capture_opts);
+ break;
+ case(capture_cb_capture_update_started):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update started");
+ main_capture_cb_capture_update_started(capture_opts);
+ break;
+ case(capture_cb_capture_update_continue):
+ /*g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update continue");*/
+ break;
+ case(capture_cb_capture_update_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture update finished");
+ main_capture_cb_capture_update_finished(capture_opts);
+ break;
+ case(capture_cb_capture_fixed_started):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed started");
+ main_capture_cb_capture_fixed_started(capture_opts);
break;
- case(cf_cb_file_safe_reload_finished):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: reload finished");
- main_cf_cb_file_safe_reload_finished(data);
+ case(capture_cb_capture_fixed_continue):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed continue");
break;
- case(cf_cb_file_safe_failed):
- g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: safe failed");
- main_cf_cb_file_safe_failed(data);
+ case(capture_cb_capture_fixed_finished):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture fixed finished");
+ main_capture_cb_capture_fixed_finished(capture_opts);
+ break;
+ case(capture_cb_capture_stopping):
+ g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture stopping");
+ /* Beware: this state won't be called, if the capture child
+ * closes the capturing on it's own! */
break;
default:
- g_warning("main_cf_callback: event %u unknown", event);
+ g_warning("main_capture_callback: event %u unknown", event);
g_assert_not_reached();
}
}
+#endif
static void
get_gui_compiled_info(GString *str)
}
static void
-get_gui_runtime_info(GString *str
-#ifndef HAVE_AIRPCAP
- _U_
-#endif
-)
+get_gui_runtime_info(GString *str)
{
#ifdef HAVE_AIRPCAP
g_string_append(str, ", ");
extern char *optarg;
gboolean arg_error = FALSE;
+ extern int splash_register_freq; /* Found in about_dlg.c */
+ const gchar *filter;
+
#ifdef _WIN32
WSADATA wsaData;
#endif /* _WIN32 */
int err;
#ifdef HAVE_LIBPCAP
gboolean start_capture = FALSE;
+ gboolean list_link_layer_types = FALSE;
#else
gboolean capture_option_specified = FALSE;
#endif
e_prefs *prefs;
char badopt;
GtkWidget *splash_win = NULL;
+ gpointer priv_warning_dialog;
GLogLevelFlags log_flags;
guint go_to_packet = 0;
int optind_initial;
int status;
gchar *cur_user, *cur_group;
+#ifdef _WIN32
#ifdef HAVE_AIRPCAP
char *err_str;
- /*gchar *cant_get_if_list_errstr;*/
+#endif
#endif
-#define OPTSTRING_INIT "a:b:c:C:Df:g:Hhi:klLm:nN:o:P:pQr:R:Ss:t:vw:X:y:z:"
+#define OPTSTRING_INIT "a:b:c:C:Df:g:Hhi:kK:lLm:nN:o:P:pQr:R:Ss:t:vw:X:y:z:"
#if defined HAVE_LIBPCAP && defined _WIN32
#define OPTSTRING_WIN32 "B:"
/*
* Attempt to get the pathname of the executable file.
*/
- init_progfile_dir_error = init_progfile_dir(argv[0]);
+ init_progfile_dir_error = init_progfile_dir(argv[0], main);
/* initialize the funnel mini-api */
initialize_funnel_ops();
#ifdef HAVE_AIRPDCAP
- /* Davide Schiera (2006-11-18): init AirPDcap context */
AirPDcapInitContext(&airpdcap_ctx);
- /* Davide Schiera (2006-11-18) ------------------------------------------- */
#endif
#ifdef _WIN32
comp_info_str = g_string_new("Compiled ");
g_string_append(comp_info_str, "with ");
- g_string_sprintfa(comp_info_str,
+ g_string_append_printf(comp_info_str,
#ifdef GTK_MAJOR_VERSION
"GTK+ %d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
GTK_MICRO_VERSION);
runtime_info_str = g_string_new("Running ");
get_runtime_version_info(runtime_info_str, get_gui_runtime_info);
+ /* Read the profile independent recent file. We have to do this here so we can */
+ /* set the profile before it can be set from the command line parameterts */
+ recent_read_static(&rf_path, &rf_open_errno);
+ if (rf_path != NULL && rf_open_errno != 0) {
+ simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "Could not open common recent file\n\"%s\": %s.",
+ rf_path, strerror(rf_open_errno));
+ }
/* "pre-scan" the command line parameters, if we have "console only"
parameters. We do this so we don't start GTK+ if we're only showing
print_usage(TRUE);
exit(0);
break;
+#ifdef _WIN32
+ case 'i':
+ if (strcmp(optarg, "-") == 0)
+ stdin_capture = TRUE;
+ break;
+#endif
case 'P': /* Path settings - change these before the Preferences and alike are processed */
status = filesystem_opt(opt, optarg);
if(status != 0) {
gtk_init (&argc, &argv);
cf_callback_add(main_cf_callback, NULL);
+#ifdef HAVE_LIBPCAP
+ capture_callback_add(main_capture_callback, NULL);
+#endif
+ cf_callback_add(statusbar_cf_callback, NULL);
+#ifdef HAVE_LIBPCAP
+ capture_callback_add(statusbar_capture_callback, NULL);
+#endif
/* Arrange that if we have no console window, and a GLib message logging
routine is called to log a message, we pop up a console window.
log_flags,
console_log_handler, NULL /* user_data */);
- /* Set the initial values in the capture_opts. This might be overwritten
+ /* Set the initial values in the capture options. This might be overwritten
by preference settings and then again by the command line parameters. */
- capture_opts_init(capture_opts, &cfile);
+ capture_opts_init(&global_capture_opts, &cfile);
- capture_opts->snaplen = MIN_PACKET_SIZE;
- capture_opts->has_ring_num_files = TRUE;
+ global_capture_opts.snaplen = MIN_PACKET_SIZE;
+ global_capture_opts.has_ring_num_files = TRUE;
#endif
+ /* Initialize whatever we need to allocate colors for GTK+ */
+ colors_init();
+
+ /* Non-blank filter means we're remote. Throttle splash screen updates. */
+ filter = get_conn_cfilter();
+ if ( *filter != '\0' )
+ splash_register_freq = 1000; /* Milliseconds */
+
/* We won't come till here, if we had a "console only" command line parameter. */
splash_win = splash_new("Loading Wireshark ...");
if (init_progfile_dir_error != NULL) {
case any dissectors register preferences. */
epan_init(register_all_protocols,register_all_protocol_handoffs,
splash_update, (gpointer) splash_win,
- failure_alert_box,open_failure_alert_box,read_failure_alert_box);
+ failure_alert_box,open_failure_alert_box,read_failure_alert_box,
+ write_failure_alert_box);
splash_update(RA_LISTENERS, NULL, (gpointer)splash_win);
We must do that before we read the preferences as well. */
prefs_register_modules();
+ prefs = read_configuration_files (&gdp_path, &dp_path);
+
/* multithread support currently doesn't seem to work in win32 gtk2.0.6 */
#if !defined(_WIN32) && defined(G_THREADS_ENABLED) && defined USE_THREADS
{
ut=g_thread_create(update_thread, NULL, FALSE, NULL);
g_thread_set_priority(ut, G_THREAD_PRIORITY_LOW);
}
-#else /* _WIN32 || GTK1.2 || !G_THREADS_ENABLED || !USE_THREADS */
+#else /* !_WIN32 && G_THREADS_ENABLED && USE_THREADS */
/* this is to keep tap extensions updating once every 3 seconds */
- gtk_timeout_add(3000, (GtkFunction)update_cb,(gpointer)NULL);
-#endif /* !_WIN32 && GTK2 && G_THREADS_ENABLED */
+ tap_update_timer_id = g_timeout_add(prefs->tap_update_interval, update_cb, NULL);
+#endif /* !_WIN32 && G_THREADS_ENABLED && USE_THREADS */
-#if HAVE_GNU_ADNS
- gtk_timeout_add(750, (GtkFunction) host_name_lookup_process, NULL);
+#if HAVE_GNU_ADNS || HAVE_C_ARES
+ g_timeout_add(750, host_name_lookup_process, NULL);
#endif
splash_update(RA_CONFIGURATION, NULL, (gpointer)splash_win);
- prefs = read_configuration_files (&gdp_path, &dp_path);
- /* Read the (static part) of the recent file. Only the static part of it will be read, */
- /* as we don't have the gui now to fill the recent lists which is done in the dynamic part. */
+ /* Read the profile dependent (static part) of the recent file. */
+ /* Only the static part of it will be read, as we don't have the gui now to fill the */
+ /* recent lists which is done in the dynamic part. */
/* We have to do this already here, so command line parameters can overwrite these values. */
- recent_read_static(&rf_path, &rf_open_errno);
+ recent_read_profile_static(&rf_path, &rf_open_errno);
+ if (rf_path != NULL && rf_open_errno != 0) {
+ simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "Could not open recent file\n\"%s\": %s.",
+ rf_path, strerror(rf_open_errno));
+ }
init_cap_file(&cfile);
+ /* Fill in capture options with values from the preferences */
+ prefs_to_capture_opts();
+
/* Now get our args */
while ((opt = getopt(argc, argv, optstring)) != -1) {
switch (opt) {
case 'B': /* Buffer size */
#endif /* _WIN32 */
#ifdef HAVE_LIBPCAP
- status = capture_opts_add_opt(capture_opts, opt, optarg, &start_capture);
+ status = capture_opts_add_opt(&global_capture_opts, opt, optarg,
+ &start_capture);
if(status != 0) {
exit(status);
}
#endif
break;
+#if defined(HAVE_HEIMDAL_KERBEROS) || defined(HAVE_MIT_KERBEROS)
+ case 'K': /* Kerberos keytab file */
+ read_keytab_file(optarg);
+ break;
+#endif
+
/*** all non capture option specific ***/
case 'C':
/* Configuration profile settings were already processed just ignore them this time*/
#endif
break;
case 'm': /* Fixed-width font for the display */
- if (prefs->gui_font_name != NULL)
- g_free(prefs->gui_font_name);
+ g_free(prefs->gui_font_name);
prefs->gui_font_name = g_strdup(optarg);
break;
case 'n': /* No name resolution */
exit(1);
}
/* No - did they specify a ring buffer option? */
- if (capture_opts->multi_files_on) {
+ if (global_capture_opts.multi_files_on) {
cmdarg_err("Ring buffer requested, but a capture isn't being done.");
exit(1);
}
/* No - was the ring buffer option specified and, if so, does it make
sense? */
- if (capture_opts->multi_files_on) {
+ if (global_capture_opts.multi_files_on) {
/* Ring buffer works only under certain conditions:
a) ring buffer does not work with temporary files;
b) real_time_mode and multi_files_on are mutually exclusive -
real_time_mode takes precedence;
c) it makes no sense to enable the ring buffer if the maximum
file size is set to "infinite". */
- if (capture_opts->save_file == NULL) {
+ if (global_capture_opts.save_file == NULL) {
cmdarg_err("Ring buffer requested, but capture isn't being saved to a permanent file.");
- capture_opts->multi_files_on = FALSE;
+ global_capture_opts.multi_files_on = FALSE;
}
-/* if (capture_opts->real_time_mode) {
+/* if (global_capture_opts.real_time_mode) {
cmdarg_err("Ring buffer requested, but an \"Update list of packets in real time\" capture is being done.");
- capture_opts->multi_files_on = FALSE;
+ global_capture_opts.multi_files_on = FALSE;
}*/
- if (!capture_opts->has_autostop_filesize && !capture_opts->has_file_duration) {
+ if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_duration) {
cmdarg_err("Ring buffer requested, but no maximum capture file size or duration were specified.");
/* XXX - this must be redesigned as the conditions changed */
-/* capture_opts->multi_files_on = FALSE;*/
+/* global_capture_opts.multi_files_on = FALSE;*/
}
}
}
if (start_capture || list_link_layer_types) {
/* Did the user specify an interface to use? */
- if (!capture_opts_trim_iface(capture_opts,
+ if (!capture_opts_trim_iface(&global_capture_opts,
(prefs->capture_device) ? get_if_name(prefs->capture_device) : NULL)) {
exit(2);
}
}
if (list_link_layer_types) {
- status = capture_opts_list_link_layer_types(capture_opts, FALSE);
+ status = capture_opts_list_link_layer_types(&global_capture_opts, FALSE);
exit(status);
}
- /* Fill in capture options with values from the preferences */
- prefs_to_capture_opts();
-
- capture_opts_trim_snaplen(capture_opts, MIN_PACKET_SIZE);
- capture_opts_trim_ring_num_files(capture_opts);
+ capture_opts_trim_snaplen(&global_capture_opts, MIN_PACKET_SIZE);
+ capture_opts_trim_ring_num_files(&global_capture_opts);
#endif /* HAVE_LIBPCAP */
/* Notify all registered modules that have had any of their preferences
set_disabled_protos_list();
}
- build_column_format_array(&cfile, TRUE);
+ build_column_format_array(&cfile.cinfo, TRUE);
/* read in rc file from global and personal configuration paths. */
rc_file = get_datafile_path(RC_FILE);
font_init();
+ stock_icons_init();
+
/* close the splash screen, as we are going to open the main window now */
splash_destroy(splash_win);
/* Read the dynamic part of the recent file, as we have the gui now ready for it. */
recent_read_dynamic(&rf_path, &rf_open_errno);
+ if (rf_path != NULL && rf_open_errno != 0) {
+ simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "Could not open recent file\n\"%s\": %s.",
+ rf_path, strerror(rf_open_errno));
+ }
+
color_filters_enable(recent.packet_list_colorize);
/* rearrange all the widgets as we now have all recent settings ready for this */
dnd_init(top_level);
- colors_init();
color_filters_init();
decode_as_init();
case CF_READ_ABORTED:
/* Exit now. */
- gtk_exit(0);
+ exit(0);
break;
}
/* Save the name of the containing directory specified in the
dfilter_free(rfcode);
cfile.rfcode = NULL;
show_main_window(FALSE);
- set_menus_for_capture_in_progress(FALSE);
+ set_menus_for_capture_in_progress(FALSE);
+ set_capture_if_dialog_for_capture_in_progress(FALSE);
}
}
} else {
#ifdef HAVE_LIBPCAP
if (start_capture) {
- if (capture_opts->save_file != NULL) {
+ if (global_capture_opts.save_file != NULL) {
/* Save the directory name for future file dialogs. */
/* (get_dirname overwrites filename) */
- s = get_dirname(g_strdup(capture_opts->save_file));
+ s = get_dirname(g_strdup(global_capture_opts.save_file));
set_last_open_dir(s);
g_free(s);
}
/* "-k" was specified; start a capture. */
show_main_window(TRUE);
- if (capture_start(capture_opts)) {
+ if (capture_start(&global_capture_opts)) {
/* The capture started. Open stat windows; we do so after creating
the main window, to avoid GTK warnings, and after successfully
opening the capture file, so we know we have something to compute
else {
show_main_window(FALSE);
set_menus_for_capture_in_progress(FALSE);
+ set_capture_if_dialog_for_capture_in_progress(FALSE);
}
/* if the user didn't supplied a capture filter, use the one to filter out remote connections like SSH */
- if (!start_capture && strlen(capture_opts->cfilter) == 0) {
- g_free(capture_opts->cfilter);
- capture_opts->cfilter = g_strdup(get_conn_cfilter());
+ if (!start_capture && strlen(global_capture_opts.cfilter) == 0) {
+ g_free(global_capture_opts.cfilter);
+ global_capture_opts.cfilter = g_strdup(get_conn_cfilter());
}
#else /* HAVE_LIBPCAP */
show_main_window(FALSE);
set_menus_for_capture_in_progress(FALSE);
+ set_capture_if_dialog_for_capture_in_progress(FALSE);
#endif /* HAVE_LIBPCAP */
}
epan_cleanup();
#ifdef HAVE_AIRPDCAP
- /* Davide Schiera (2006-11-18): destroy AirPDcap context */
AirPDcapDestroyContext(&airpdcap_ctx);
- /* Davide Schiera (2006-11-18) ------------------------------------------- */
#endif
#ifdef _WIN32
destroy_console();
#endif
- gtk_exit(0);
-
- /* This isn't reached, but we need it to keep GCC from complaining
- that "main()" returns without returning a value - it knows that
- "exit()" never returns, but it doesn't know that "gtk_exit()"
- doesn't, as GTK+ doesn't declare it with the attribute
- "noreturn". */
- return 0; /* not reached */
+ exit(0);
}
#ifdef _WIN32
void
create_console(void)
{
+ if (stdin_capture) {
+ /* We've been handed "-i -". Don't mess with stdio. */
+ return;
+ }
+
if (!has_console) {
/* We have no console to which to print the version string, so
create one and make it the standard input, output, and error. */
if (!AllocConsole())
return; /* couldn't create console */
- eth_freopen("CONIN$", "r", stdin);
- eth_freopen("CONOUT$", "w", stdout);
- eth_freopen("CONOUT$", "w", stderr);
+
+ ws_freopen("CONIN$", "r", stdin);
+ ws_freopen("CONOUT$", "w", stdout);
+ ws_freopen("CONOUT$", "w", stderr);
/* Well, we have a console now. */
has_console = TRUE;
}
-static GtkWidget *info_bar_new(void)
-{
- int i;
-
- /* tip: tooltips don't work on statusbars! */
- info_bar = gtk_statusbar_new();
- main_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(info_bar), "main");
- file_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(info_bar), "file");
- help_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(info_bar), "help");
- filter_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(info_bar), "filter");
- gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(info_bar), FALSE);
- gtk_statusbar_push(GTK_STATUSBAR(info_bar), main_ctx, DEF_READY_MESSAGE);
-
- for (i = 0; i < NUM_STATUS_LEVELS; i++) {
- status_levels[i] = 0;
- }
-
- return info_bar;
-}
-
-static GtkWidget *packets_bar_new(void)
-{
- /* tip: tooltips don't work on statusbars! */
- packets_bar = gtk_statusbar_new();
- packets_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(packets_bar), "packets");
- packets_bar_update();
- gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(packets_bar), FALSE);
-
- return packets_bar;
-}
-
-static GtkWidget *profile_bar_new(void)
-{
- /* tip: tooltips don't work on statusbars! */
- profile_bar = gtk_statusbar_new();
- profile_ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(profile_bar), "profile");
- profile_bar_update();
-
- return profile_bar;
-}
-
-
/*
* Helper for main_widgets_rearrange()
*/
/* be a bit faster */
gtk_widget_hide(main_vbox);
- /* be sure, we don't loose a widget while rearranging */
- gtk_widget_ref(menubar);
- gtk_widget_ref(main_tb);
- gtk_widget_ref(filter_tb);
-
+ /* be sure we don't lose a widget while rearranging */
+ g_object_ref(G_OBJECT(menubar));
+ g_object_ref(G_OBJECT(main_tb));
+ g_object_ref(G_OBJECT(filter_tb));
#ifdef HAVE_AIRPCAP
- gtk_widget_ref(airpcap_tb);
-#endif
-
- gtk_widget_ref(pkt_scrollw);
- gtk_widget_ref(tv_scrollw);
- gtk_widget_ref(byte_nb_ptr);
- gtk_widget_ref(stat_hbox);
- gtk_widget_ref(expert_info_error);
- gtk_widget_ref(expert_info_warn);
- gtk_widget_ref(expert_info_note);
- gtk_widget_ref(expert_info_chat);
- gtk_widget_ref(expert_info_none);
- gtk_widget_ref(info_bar);
- gtk_widget_ref(packets_bar);
- gtk_widget_ref(profile_bar);
- gtk_widget_ref(status_pane_left);
- gtk_widget_ref(status_pane_right);
- gtk_widget_ref(main_pane_v1);
- gtk_widget_ref(main_pane_v2);
- gtk_widget_ref(main_pane_h1);
- gtk_widget_ref(main_pane_h2);
- gtk_widget_ref(welcome_pane);
+ g_object_ref(G_OBJECT(airpcap_tb));
+#endif
+ g_object_ref(G_OBJECT(pkt_scrollw));
+ g_object_ref(G_OBJECT(tv_scrollw));
+ g_object_ref(G_OBJECT(byte_nb_ptr));
+ g_object_ref(G_OBJECT(statusbar));
+ g_object_ref(G_OBJECT(main_pane_v1));
+ g_object_ref(G_OBJECT(main_pane_v2));
+ g_object_ref(G_OBJECT(main_pane_h1));
+ g_object_ref(G_OBJECT(main_pane_h2));
+ g_object_ref(G_OBJECT(welcome_pane));
/* empty all containers participating */
gtk_container_foreach(GTK_CONTAINER(main_vbox), foreach_remove_a_child, main_vbox);
- gtk_container_foreach(GTK_CONTAINER(stat_hbox), foreach_remove_a_child, stat_hbox);
- gtk_container_foreach(GTK_CONTAINER(status_pane_left), foreach_remove_a_child, status_pane_left);
- gtk_container_foreach(GTK_CONTAINER(status_pane_right), foreach_remove_a_child, status_pane_right);
gtk_container_foreach(GTK_CONTAINER(main_pane_v1), foreach_remove_a_child, main_pane_v1);
gtk_container_foreach(GTK_CONTAINER(main_pane_v2), foreach_remove_a_child, main_pane_v2);
gtk_container_foreach(GTK_CONTAINER(main_pane_h1), foreach_remove_a_child, main_pane_h1);
gtk_container_foreach(GTK_CONTAINER(main_pane_h2), foreach_remove_a_child, main_pane_h2);
+ statusbar_widgets_emptying(statusbar);
+
/* add the menubar always at the top */
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
/* welcome pane */
gtk_box_pack_start(GTK_BOX(main_vbox), welcome_pane, TRUE, TRUE, 0);
- /* statusbar hbox */
- gtk_box_pack_start(GTK_BOX(main_vbox), stat_hbox, FALSE, TRUE, 0);
+ /* statusbar */
+ gtk_box_pack_start(GTK_BOX(main_vbox), statusbar, FALSE, TRUE, 0);
/* filter toolbar in statusbar hbox */
if (prefs.filter_toolbar_show_in_statusbar) {
- gtk_box_pack_start(GTK_BOX(stat_hbox), filter_tb, FALSE, TRUE, 1);
+ gtk_box_pack_start(GTK_BOX(statusbar), filter_tb, FALSE, TRUE, 1);
}
#ifdef HAVE_AIRPCAP
gtk_box_pack_start(GTK_BOX(main_vbox), airpcap_tb, FALSE, TRUE, 1);
#endif
- /* statusbar */
- gtk_box_pack_start(GTK_BOX(stat_hbox), expert_info_error, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(stat_hbox), expert_info_warn, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(stat_hbox), expert_info_note, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(stat_hbox), expert_info_chat, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(stat_hbox), expert_info_none, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(stat_hbox), status_pane_left, TRUE, TRUE, 0);
- gtk_paned_pack1(GTK_PANED(status_pane_left), info_bar, FALSE, FALSE);
- gtk_paned_pack2(GTK_PANED(status_pane_left), status_pane_right, TRUE, FALSE);
- gtk_paned_pack1(GTK_PANED(status_pane_right), packets_bar, TRUE, FALSE);
- gtk_paned_pack2(GTK_PANED(status_pane_right), profile_bar, FALSE, FALSE);
+ /* statusbar widgets */
+ statusbar_widgets_pack(statusbar);
/* hide widgets on users recent settings */
main_widgets_show_or_hide();
}
-
-/*
- * XXX - this doesn't appear to work with the paned widgets in
- * GTK+ 1.2[.x]; if you hide one of the panes, the splitter remains
- * and the other pane doesn't grow to take up the rest of the pane.
- * It does appear to work with GTK+ 2.x.
- */
void
main_widgets_show_or_hide(void)
{
gtk_widget_hide(main_tb);
}
- /*
- * Show the status hbox if either:
- *
- * 1) we're showing the filter toolbar and we want it in the status
- * line
- *
- * or
- *
- * 2) we're showing the status bar.
- */
- if ((recent.filter_toolbar_show && prefs.filter_toolbar_show_in_statusbar) ||
- recent.statusbar_show) {
- gtk_widget_show(stat_hbox);
- } else {
- gtk_widget_hide(stat_hbox);
- }
-
- if (recent.statusbar_show) {
- gtk_widget_show(status_pane_left);
- } else {
- gtk_widget_hide(status_pane_left);
- }
+ statusbar_widgets_show_or_hide(statusbar);
if (recent.filter_toolbar_show) {
gtk_widget_show(filter_tb);
}
-#ifdef HAVE_AIRPCAP
-/*
- * Changed callback for the channel combobox
- */
-static void
-airpcap_toolbar_channel_changed_cb(GtkWidget *w _U_, gpointer data)
-{
- const gchar *s;
- ULONG ch_freq;
-
- if ((data != NULL) && (w != NULL) && change_airpcap_settings) {
- s = gtk_entry_get_text(GTK_ENTRY(w));
- if ((g_ascii_strcasecmp("",s))) {
- ch_freq = airpcap_get_frequency_from_str(s);
- if (airpcap_if_active != NULL) {
- airpcap_if_active->channelInfo.Frequency = ch_freq;
- airpcap_update_channel_offset_cb(airpcap_if_active, ch_freq, GTK_WIDGET(data));
- }
- }
- }
-}
-
-/*
- * Changed callback for the channel offset combobox
- */
-static void
-on_channel_offset_cb_changed(GtkWidget *w _U_, gpointer data)
-{
- const gchar *s;
- gchar offset;
-
- if ((data != NULL) && (w != NULL) && change_airpcap_settings)
- {
- s = gtk_entry_get_text(GTK_ENTRY(w));
- if ((g_ascii_strcasecmp("",s)))
- {
- if (airpcap_if_active != NULL)
- {
- sscanf(s,"%d",&offset);
- airpcap_if_active->channelInfo.ExtChannel = offset;
- if (change_airpcap_settings != NULL)
- {
- airpcap_update_frequency_and_offset(airpcap_if_active);
- }
- }
- }
- }
-}
-
-/*
- * Callback for the wrong crc combo
- */
-static void
-airpcap_toolbar_wrong_crc_combo_cb(GtkWidget *entry, gpointer user_data)
-{
- gchar ebuf[AIRPCAP_ERRBUF_SIZE];
- PAirpcapHandle ad;
-
- if( !block_toolbar_signals && (airpcap_if_active != NULL)) {
- ad = airpcap_if_open(airpcap_if_active->name, ebuf);
-
- if (ad) {
- airpcap_if_active->CrcValidationOn = airpcap_get_validation_type(gtk_entry_get_text(GTK_ENTRY(entry)));
- airpcap_if_set_fcs_validation(ad,airpcap_if_active->CrcValidationOn);
- /* Save configuration */
- airpcap_if_store_cur_config_as_adapter_default(ad);
- airpcap_if_close(ad);
- }
- }
-}
-
-void
-airpcap_toolbar_encryption_cb(GtkWidget *entry, gpointer user_data)
-{
- /* We need to directly access the .ddl functions here... */
- gchar ebuf[AIRPCAP_ERRBUF_SIZE];
- PAirpcapHandle ad;
-
- gint n = 0;
- gint i = 0;
- airpcap_if_info_t* curr_if = NULL;
-
- /* Apply changes to the current adapter */
- if( (airpcap_if_active != NULL)) {
- ad = airpcap_if_open(airpcap_if_active->name, ebuf);
-
- if(ad) {
- if(airpcap_if_active->DecryptionOn == AIRPCAP_DECRYPTION_ON) {
- airpcap_if_active->DecryptionOn = AIRPCAP_DECRYPTION_OFF;
- airpcap_if_set_decryption_state(ad,airpcap_if_active->DecryptionOn);
- /* Save configuration */
- if(!airpcap_if_store_cur_config_as_adapter_default(ad)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Cannot save configuration!!!\nRemember that in order to store the configuration in the registry you have to:\n\n- Close all the airpcap-based applications.\n- Be sure to have administrative privileges.");
- }
- airpcap_if_close(ad);
- } else {
- airpcap_if_active->DecryptionOn = AIRPCAP_DECRYPTION_ON;
- airpcap_if_set_decryption_state(ad,airpcap_if_active->DecryptionOn);
- /* Save configuration */
- if(!airpcap_if_store_cur_config_as_adapter_default(ad)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Cannot save configuration!!!\nRemember that in order to store the configuration in the registry you have to:\n\n- Close all the airpcap-based applications.\n- Be sure to have administrative privileges.");
- }
- airpcap_if_close(ad);
- }
- }
- } else {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "No active AirPcap Adapter selected!");
- return;
- }
-
- if (!(airpcap_if_list == NULL)){
- n = g_list_length(airpcap_if_list);
-
- /* The same kind of settings should be propagated to all the adapters */
- /* Apply this change to all the adapters !!! */
- for(i = 0; i < n; i++) {
- curr_if = (airpcap_if_info_t*)g_list_nth_data(airpcap_if_list,i);
-
- if( (curr_if != NULL) && (curr_if != airpcap_if_selected) ) {
- ad = airpcap_if_open(curr_if->name, ebuf);
- if(ad) {
- curr_if->DecryptionOn = airpcap_if_selected->DecryptionOn;
- airpcap_if_set_decryption_state(ad,curr_if->DecryptionOn);
- /* Save configuration for the curr_if */
- if(!airpcap_if_store_cur_config_as_adapter_default(ad)) {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Cannot save configuration!!!\nRemember that in order to store the configuration in the registry you have to:\n\n- Close all the airpcap-based applications.\n- Be sure to have administrative privileges.");
- }
- airpcap_if_close(ad);
- }
- }
- }
- } else {
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "AirPcap Adapter Error!");
- return;
- }
-}
-
-/*
- * Callback for the Advanced Wireless Settings button
- */
-static void
-toolbar_display_airpcap_advanced_cb(GtkWidget *w, gpointer data)
-{
- int *from_widget;
-
- from_widget = (gint*)g_malloc(sizeof(gint));
- *from_widget = AIRPCAP_ADVANCED_FROM_TOOLBAR;
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_ADVANCED_FROM_KEY,from_widget);
-
- display_airpcap_advanced_cb(w,data);
-}
-
-/*
- * Callback for the Decryption Key Management button
- */
-static void
-toolbar_display_airpcap_key_management_cb(GtkWidget *w, gpointer data)
-{
- int *from_widget;
-
- from_widget = (gint*)g_malloc(sizeof(gint));
- *from_widget = AIRPCAP_ADVANCED_FROM_TOOLBAR;
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_ADVANCED_FROM_KEY,from_widget);
- display_airpcap_key_management_cb(w,data);
-}
-#endif /* HAVE_AIRPCAP */
-
-#define NO_SHIFT_MOD_MASK (GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK|GDK_LOCK_MASK))
+#define NO_SHIFT_MOD_MASK (GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK|GDK_MOD2_MASK|GDK_LOCK_MASK))
static int
-top_level_key_pressed_cb(GtkCTree *ctree _U_, GdkEventKey *event, gpointer user_data _U_)
+top_level_key_pressed_cb(GtkWidget *w _U_, GdkEventKey *event, gpointer user_data _U_)
{
if (event->keyval == GDK_F8) {
packet_list_next();
static void
create_main_window (gint pl_size, gint tv_size, gint bv_size, e_prefs *prefs)
{
- GtkWidget
- *filter_bt, *filter_cm, *filter_te,
- *filter_add_expr_bt,
- *filter_apply,
- *filter_reset,
- *expert_image;
- GList *dfilter_list = NULL;
GtkTooltips *tooltips;
-
GtkAccelGroup *accel;
gchar *title;
-#ifdef HAVE_AIRPCAP
- GtkWidget *key_management_bt = NULL,
- *advanced_bt = NULL,
- *channel_lb = NULL,
- *channel_cm = NULL,
- *channel_offset_lb = NULL,
- *channel_offset_cb = NULL,
- *wrong_crc_lb = NULL,
- *wrong_crc_cm = NULL;
-
- GtkWidget *enable_decryption_lb;
- GtkWidget *enable_decryption_cb;
- GList *enable_decryption_cb_items = NULL;
- GtkWidget *enable_decryption_en;
-
- GList *channel_list = NULL;
- GList *linktype_list = NULL;
- GList *link_list = NULL;
- GtkTooltips *airpcap_tooltips;
- /* gchar *if_label_text; */
- gint *from_widget = NULL;
- gchar *chan_str;
-#endif
-
- /* Display filter construct dialog has an Apply button, and "OK" not
- only sets our text widget, it activates it (i.e., it causes us to
- filter the capture). */
- static construct_args_t args = {
- "Wireshark: Display Filter",
- TRUE,
- TRUE,
- FALSE
- };
-
/* use user-defined title if preference is set */
title = create_user_window_title("The Wireshark Network Analyzer");
tooltips = gtk_tooltips_new();
-#ifdef HAVE_AIRPCAP
- airpcap_tooltips = gtk_tooltips_new();
-#endif
-
gtk_widget_set_name(top_level, "main window");
- SIGNAL_CONNECT(top_level, "delete_event", main_window_delete_event_cb,
+ g_signal_connect(top_level, "delete_event", G_CALLBACK(main_window_delete_event_cb),
NULL);
- SIGNAL_CONNECT(GTK_OBJECT(top_level), "window_state_event",
- G_CALLBACK (window_state_event_cb), NULL);
- SIGNAL_CONNECT(GTK_OBJECT(top_level), "key-press-event",
- G_CALLBACK (top_level_key_pressed_cb), NULL );
+ g_signal_connect(GTK_OBJECT(top_level), "window_state_event",
+ G_CALLBACK(window_state_event_cb), NULL);
+ g_signal_connect(GTK_OBJECT(top_level), "key-press-event",
+ G_CALLBACK(top_level_key_pressed_cb), NULL );
gtk_window_set_policy(GTK_WINDOW(top_level), TRUE, TRUE, FALSE);
- /* Container for menu bar, toolbar(s), paned windows and progress/info box */
+ /* Vertical container for menu bar, toolbar(s), paned windows and progress/info box */
main_vbox = gtk_vbox_new(FALSE, 1);
- gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
+ gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
gtk_container_add(GTK_CONTAINER(top_level), main_vbox);
gtk_widget_show(main_vbox);
/* Menu bar */
menubar = main_menu_new(&accel);
+
+#ifdef HAVE_IGE_MAC_INTEGRATION
+ /* MacOS X native menus are created and displayed by main_menu_new() */
+ if(!prefs->gui_macosx_style) {
+#endif
gtk_window_add_accel_group(GTK_WINDOW(top_level), accel);
gtk_widget_show(menubar);
+#ifdef HAVE_IGE_MAC_INTEGRATION
+ }
+#endif
/* Main Toolbar */
main_tb = toolbar_new();
gtk_widget_show (main_tb);
+ /* Filter toolbar */
+ filter_tb = filter_toolbar_new();
+
/* Packet list */
pkt_scrollw = packet_list_new(prefs);
- WIDGET_SET_SIZE(packet_list, -1, pl_size);
+ gtk_widget_set_size_request(packet_list, -1, pl_size);
gtk_widget_show(pkt_scrollw);
/* Tree view */
tv_scrollw = main_tree_view_new(prefs, &tree_view);
- WIDGET_SET_SIZE(tv_scrollw, -1, tv_size);
+ gtk_widget_set_size_request(tv_scrollw, -1, tv_size);
gtk_widget_show(tv_scrollw);
- SIGNAL_CONNECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)),
- "changed", tree_view_selection_changed_cb, NULL);
- SIGNAL_CONNECT(tree_view, "button_press_event", popup_menu_handler,
- OBJECT_GET_DATA(popup_menu_object, PM_TREE_VIEW_KEY));
+ g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)),
+ "changed", G_CALLBACK(tree_view_selection_changed_cb), NULL);
+ g_signal_connect(tree_view, "button_press_event", G_CALLBACK(popup_menu_handler),
+ g_object_get_data(G_OBJECT(popup_menu_object), PM_TREE_VIEW_KEY));
gtk_widget_show(tree_view);
/* Byte view. */
byte_nb_ptr = byte_view_new();
- WIDGET_SET_SIZE(byte_nb_ptr, -1, bv_size);
+ gtk_widget_set_size_request(byte_nb_ptr, -1, bv_size);
gtk_widget_show(byte_nb_ptr);
- SIGNAL_CONNECT(byte_nb_ptr, "button_press_event", popup_menu_handler,
- OBJECT_GET_DATA(popup_menu_object, PM_HEXDUMP_KEY));
+ g_signal_connect(byte_nb_ptr, "button_press_event", G_CALLBACK(popup_menu_handler),
+ g_object_get_data(G_OBJECT(popup_menu_object), PM_HEXDUMP_KEY));
/* Panes for the packet list, tree, and byte view */
gtk_widget_show(main_pane_h1);
main_pane_h2 = gtk_hpaned_new();
gtk_widget_show(main_pane_h2);
-
#ifdef HAVE_AIRPCAP
- /* airpcap toolbar */
- airpcap_tb = gtk_toolbar_new();
- gtk_toolbar_set_orientation(GTK_TOOLBAR(airpcap_tb),
- GTK_ORIENTATION_HORIZONTAL);
+ airpcap_tb = airpcap_toolbar_new();
gtk_widget_show(airpcap_tb);
-
- /* Interface Label */
- /*if(airpcap_if_active != NULL) {
- if_label_text = g_strdup_printf("%s %s\t","Current Wireless Interface: #",airpcap_get_if_string_number(airpcap_if_active));
- interface_lb = gtk_label_new(if_label_text);
- g_free(if_label_text);
- } else {
- interface_lb = gtk_label_new("No Wireless Interface Found ");
- }*/
-
- /* Add the label to the toolbar */
- /*gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), interface_lb,
- "Current Wireless Interface", "Private");
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_INTERFACE_KEY,interface_lb);
- gtk_widget_show(interface_lb);
- gtk_toolbar_insert_space(GTK_TOOLBAR(airpcap_tb),1);*/
-
-
- /* Create the "802.11 Channel:" label */
- channel_lb = gtk_label_new("802.11 Channel: ");
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_CHANNEL_LABEL_KEY,channel_lb);
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), channel_lb,
- "Current 802.11 Channel", "Private");
- gtk_widget_show(channel_lb);
-
- WIDGET_SET_SIZE(channel_lb, 85, 28);
-
- /* Create the channel combo box */
- channel_cm = gtk_combo_new();
- gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(channel_cm)->entry),FALSE);
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_CHANNEL_KEY,channel_cm);
-
- if (airpcap_if_active != NULL && airpcap_if_active->pSupportedChannels != NULL && airpcap_if_active->numSupportedChannels > 0){
- guint i = 0;
- for (; i<airpcap_if_active->numSupportedChannels; i++){
- channel_list = g_list_append(channel_list, ieee80211_mhz_to_str(airpcap_if_active->pSupportedChannels[i].Frequency));
- }
- gtk_combo_set_popdown_strings( GTK_COMBO(channel_cm), channel_list);
- airpcap_free_channel_combo_list(channel_list);
- }
-
- gtk_tooltips_set_tip(airpcap_tooltips, GTK_WIDGET(GTK_COMBO(channel_cm)->entry),
- "Change the 802.11 RF channel", NULL);
-
- WIDGET_SET_SIZE(channel_cm, 120, 28);
-
- if(airpcap_if_active != NULL) {
- chan_str = ieee80211_mhz_to_str(airpcap_if_active->channelInfo.Frequency);
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channel_cm)->entry), chan_str);
- g_free(chan_str);
- }
- else {
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channel_cm)->entry),"");
- }
- gtk_widget_show(channel_cm);
-
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), channel_cm,
- "802.11 Channel", "Private");
-
- /* gtk_toolbar_append_space(GTK_TOOLBAR(airpcap_tb)); */
-
- /* Create the "Channel Offset:" label */
- channel_offset_lb = gtk_label_new("Channel Offset: ");
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_CHANNEL_OFFSET_LABEL_KEY,channel_offset_lb);
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), channel_offset_lb,
- "Current 802.11 Channel Offset", "Private");
- gtk_widget_show(channel_offset_lb);
-
- WIDGET_SET_SIZE(channel_offset_lb, 80, 28);
-
- /* Start: Channel offset combo box */
- channel_offset_cb = gtk_combo_new();
- gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(channel_offset_cb)->entry),FALSE);
- OBJECT_SET_DATA(airpcap_tb, AIRPCAP_TOOLBAR_CHANNEL_OFFSET_KEY, channel_offset_cb);
-
- if(airpcap_if_active != NULL){
- airpcap_update_channel_offset_cb(airpcap_if_active, airpcap_if_active->channelInfo.Frequency, channel_offset_cb);
- airpcap_update_channel_offset_combo_entry(channel_offset_cb, airpcap_if_active->channelInfo.ExtChannel);
- } else {
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(channel_offset_cb)->entry),"");
- }
-
- gtk_tooltips_set_tip(airpcap_tooltips, GTK_WIDGET(GTK_COMBO(channel_offset_cb)->entry),
- "Change channel offset", NULL);
-
- WIDGET_SET_SIZE(channel_offset_cb, 50, 28);
-
- gtk_widget_show(channel_offset_cb);
-
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), channel_offset_cb,
- "802.11 Channel Offset", "Private");
-
- gtk_toolbar_append_space(GTK_TOOLBAR(airpcap_tb));
-
- /* callback for channel combo box */
- SIGNAL_CONNECT(GTK_COMBO(channel_cm)->entry,"changed", airpcap_toolbar_channel_changed_cb, channel_offset_cb);
- /* callback for channel offset combo box */
- SIGNAL_CONNECT(GTK_COMBO(channel_offset_cb)->entry,"changed", on_channel_offset_cb_changed, channel_offset_cb);
- /* End: Channel offset combo box */
-
- /* Wrong CRC Label */
- wrong_crc_lb = gtk_label_new(" FCS Filter: ");
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_FCS_FILTER_LABEL_KEY,wrong_crc_lb);
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), wrong_crc_lb,
- "", "Private");
- gtk_widget_show(wrong_crc_lb);
-
- /* Wrong CRC combo */
- wrong_crc_cm = gtk_combo_new();
- gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(wrong_crc_cm)->entry),FALSE);
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_FCS_FILTER_KEY,wrong_crc_cm);
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), wrong_crc_cm,
- "", "Private");
-
- WIDGET_SET_SIZE(wrong_crc_cm, 100, -1);
-
- linktype_list = g_list_append(linktype_list, AIRPCAP_VALIDATION_TYPE_NAME_ALL);
- linktype_list = g_list_append(linktype_list, AIRPCAP_VALIDATION_TYPE_NAME_CORRECT);
- linktype_list = g_list_append(linktype_list, AIRPCAP_VALIDATION_TYPE_NAME_CORRUPT);
-
- gtk_combo_set_popdown_strings( GTK_COMBO(wrong_crc_cm), linktype_list) ;
- g_list_free(linktype_list);
- gtk_tooltips_set_tip(airpcap_tooltips, GTK_WIDGET(GTK_COMBO(wrong_crc_cm)->entry),
- "Select the 802.11 FCS filter that the wireless adapter will apply.",
- NULL);
-
- if(airpcap_if_active != NULL)
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(wrong_crc_cm)->entry), airpcap_get_validation_name(airpcap_if_active->CrcValidationOn));
- else
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(wrong_crc_cm)->entry),"");
-
- SIGNAL_CONNECT(GTK_COMBO(wrong_crc_cm)->entry,"changed",airpcap_toolbar_wrong_crc_combo_cb,airpcap_tb);
- gtk_widget_show(wrong_crc_cm);
-
- gtk_toolbar_append_space(GTK_TOOLBAR(airpcap_tb));
-
- /* Decryption mode combo box */
- enable_decryption_lb = gtk_label_new ("Decryption Mode: ");
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_DECRYPTION_LABEL_KEY,enable_decryption_lb);
- gtk_widget_set_name (enable_decryption_lb, "enable_decryption_lb");
- gtk_widget_show (enable_decryption_lb);
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), enable_decryption_lb,
- NULL, "Private");
-
- enable_decryption_cb = gtk_combo_new ();
- gtk_widget_set_name (enable_decryption_cb, "enable_decryption_cb");
- gtk_widget_show (enable_decryption_cb);
- WIDGET_SET_SIZE (enable_decryption_cb, 83, -1);
- update_decryption_mode_list(enable_decryption_cb);
-
- enable_decryption_en = GTK_COMBO (enable_decryption_cb)->entry;
- gtk_widget_set_name (enable_decryption_en, "enable_decryption_en");
- gtk_widget_show (enable_decryption_en);
- gtk_editable_set_editable (GTK_EDITABLE (enable_decryption_en), FALSE);
- GTK_WIDGET_UNSET_FLAGS (enable_decryption_en, GTK_CAN_FOCUS);
-
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), enable_decryption_cb,
- "Choose a Decryption Mode", "Private");
-
- /* Set current decryption mode!!!! */
- update_decryption_mode_cm(enable_decryption_cb);
- SIGNAL_CONNECT (enable_decryption_en, "changed",on_enable_decryption_en_changed, airpcap_tb);
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_DECRYPTION_KEY,enable_decryption_cb);
-
- gtk_toolbar_append_space(GTK_TOOLBAR(airpcap_tb));
-
- /* Advanced button */
- advanced_bt = gtk_button_new_with_label("Wireless Settings...");
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_ADVANCED_KEY,advanced_bt);
-
- SIGNAL_CONNECT(advanced_bt, "clicked", toolbar_display_airpcap_advanced_cb, airpcap_tb);
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), advanced_bt,
- "Set Advanced Wireless Settings", "Private");
-
-
- gtk_widget_show(advanced_bt);
-
- /* Key Management button */
- key_management_bt = gtk_button_new_with_label("Decryption Keys...");
- OBJECT_SET_DATA(airpcap_tb,AIRPCAP_TOOLBAR_KEY_MANAGEMENT_KEY,key_management_bt);
-
- SIGNAL_CONNECT(key_management_bt, "clicked", toolbar_display_airpcap_key_management_cb, airpcap_tb);
- gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), key_management_bt,
- "Manage Decryption Keys", "Private");
- gtk_widget_show(key_management_bt);
-
- /* If no airpcap interface is present, gray everything */
- if(airpcap_if_active == NULL) {
- if(airpcap_if_list == NULL || g_list_length(airpcap_if_list) == 0) {
- /*No airpcap device found */
- airpcap_enable_toolbar_widgets(airpcap_tb,FALSE);
- /* recent.airpcap_toolbar_show = TRUE; */
- } else {
- /* default adapter is not airpcap... or is airpcap but is not found*/
- airpcap_set_toolbar_stop_capture(airpcap_if_active);
- airpcap_enable_toolbar_widgets(airpcap_tb,FALSE);
- /* recent.airpcap_toolbar_show = TRUE; */
- }
- } else {
- airpcap_set_toolbar_stop_capture(airpcap_if_active);
- /* recent.airpcap_toolbar_show = TRUE; */
- }
#endif
-
- /* filter toolbar */
- filter_tb = gtk_toolbar_new();
- gtk_toolbar_set_orientation(GTK_TOOLBAR(filter_tb),
- GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show(filter_tb);
-
- /* Create the "Filter:" button */
- filter_bt = BUTTON_NEW_FROM_STOCK(WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY);
- SIGNAL_CONNECT(filter_bt, "clicked", display_filter_construct_cb, &args);
- gtk_widget_show(filter_bt);
- OBJECT_SET_DATA(top_level, E_FILT_BT_PTR_KEY, filter_bt);
-
- gtk_toolbar_append_widget(GTK_TOOLBAR(filter_tb), filter_bt,
- "Open the \"Display Filter\" dialog, to edit/apply filters", "Private");
-
- /* Create the filter combobox */
- filter_cm = gtk_combo_new();
- dfilter_list = NULL;
- gtk_combo_disable_activate(GTK_COMBO(filter_cm));
- gtk_combo_set_case_sensitive(GTK_COMBO(filter_cm), TRUE);
- OBJECT_SET_DATA(filter_cm, E_DFILTER_FL_KEY, dfilter_list);
- filter_te = GTK_COMBO(filter_cm)->entry;
- main_display_filter_widget=filter_te;
- OBJECT_SET_DATA(filter_bt, E_FILT_TE_PTR_KEY, filter_te);
- OBJECT_SET_DATA(filter_te, E_DFILTER_CM_KEY, filter_cm);
- OBJECT_SET_DATA(top_level, E_DFILTER_CM_KEY, filter_cm);
- SIGNAL_CONNECT(filter_te, "activate", filter_activate_cb, filter_te);
- SIGNAL_CONNECT(filter_te, "changed", filter_te_syntax_check_cb, NULL);
- WIDGET_SET_SIZE(filter_cm, 400, -1);
- gtk_widget_show(filter_cm);
- gtk_toolbar_append_widget(GTK_TOOLBAR(filter_tb), filter_cm,
- NULL, NULL);
- /* setting a tooltip for a combobox will do nothing, so add it to the corresponding text entry */
- gtk_tooltips_set_tip(tooltips, filter_te,
- "Enter a display filter, or choose one of your recently used filters. "
- "The background color of this field is changed by a continuous syntax check (green is valid, red is invalid, yellow may have unexpected results).",
- NULL);
-
- /* Create the "Add Expression..." button, to pop up a dialog
- for constructing filter comparison expressions. */
- filter_add_expr_bt = BUTTON_NEW_FROM_STOCK(WIRESHARK_STOCK_ADD_EXPRESSION);
- OBJECT_SET_DATA(filter_tb, E_FILT_FILTER_TE_KEY, filter_te);
- SIGNAL_CONNECT(filter_add_expr_bt, "clicked", filter_add_expr_bt_cb, filter_tb);
- gtk_widget_show(filter_add_expr_bt);
- gtk_toolbar_append_widget(GTK_TOOLBAR(filter_tb), filter_add_expr_bt,
- "Add an expression to this filter string", "Private");
-
- /* Create the "Clear" button */
- filter_reset = BUTTON_NEW_FROM_STOCK(GTK_STOCK_CLEAR);
- OBJECT_SET_DATA(filter_reset, E_DFILTER_TE_KEY, filter_te);
- SIGNAL_CONNECT(filter_reset, "clicked", filter_reset_cb, NULL);
- gtk_widget_show(filter_reset);
- gtk_toolbar_append_widget(GTK_TOOLBAR(filter_tb), filter_reset,
- "Clear this filter string and update the display", "Private");
-
- /* Create the "Apply" button */
- filter_apply = BUTTON_NEW_FROM_STOCK(GTK_STOCK_APPLY);
- OBJECT_SET_DATA(filter_apply, E_DFILTER_CM_KEY, filter_cm);
- SIGNAL_CONNECT(filter_apply, "clicked", filter_activate_cb, filter_te);
- gtk_widget_show(filter_apply);
- gtk_toolbar_append_widget(GTK_TOOLBAR(filter_tb), filter_apply,
- "Apply this filter string to the display", "Private");
-
- /* Sets the text entry widget pointer as the E_DILTER_TE_KEY data
- * of any widget that ends up calling a callback which needs
- * that text entry pointer */
- set_menu_object_data("/File/Open...", E_DFILTER_TE_KEY, filter_te);
- set_menu_object_data("/Edit/Copy/As Filter", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Display Filters...", E_FILT_TE_PTR_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Follow TCP Stream", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Follow UDP Stream", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Follow SSL Stream", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Apply as Filter/Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Apply as Filter/Not Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Apply as Filter/... and Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Apply as Filter/... or Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Apply as Filter/... and not Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Apply as Filter/... or not Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Prepare a Filter/Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Prepare a Filter/Not Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Prepare a Filter/... and Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Prepare a Filter/... or Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Prepare a Filter/... and not Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Analyze/Prepare a Filter/... or not Selected", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Conversation Filter/Ethernet", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Conversation Filter/IP", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Conversation Filter/TCP", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Conversation Filter/UDP", E_DFILTER_TE_KEY,
- filter_te);
- set_menu_object_data("/Conversation Filter/PN-CBA Server", E_DFILTER_TE_KEY,
- filter_te);
- set_toolbar_object_data(E_DFILTER_TE_KEY, filter_te);
- OBJECT_SET_DATA(popup_menu_object, E_DFILTER_TE_KEY, filter_te);
- OBJECT_SET_DATA(popup_menu_object, E_MPACKET_LIST_KEY, packet_list);
-
- /* expert info indicator */
- expert_image = xpm_to_widget_from_parent(top_level, expert_error_xpm);
- gtk_tooltips_set_tip(tooltips, expert_image, "ERROR is the highest expert info level", NULL);
- gtk_widget_show(expert_image);
- expert_info_error = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(expert_info_error), expert_image);
- SIGNAL_CONNECT(expert_info_error, "button_press_event", expert_comp_dlg_cb, NULL);
-
- expert_image = xpm_to_widget_from_parent(top_level, expert_warn_xpm);
- gtk_tooltips_set_tip(tooltips, expert_image, "WARNING is the highest expert info level", NULL);
- gtk_widget_show(expert_image);
- expert_info_warn = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(expert_info_warn), expert_image);
- SIGNAL_CONNECT(expert_info_warn, "button_press_event", expert_comp_dlg_cb, NULL);
-
- expert_image = xpm_to_widget_from_parent(top_level, expert_note_xpm);
- gtk_tooltips_set_tip(tooltips, expert_image, "NOTE is the highest expert info level", NULL);
- gtk_widget_show(expert_image);
- expert_info_note = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(expert_info_note), expert_image);
- SIGNAL_CONNECT(expert_info_note, "button_press_event", expert_comp_dlg_cb, NULL);
-
- expert_image = xpm_to_widget_from_parent(top_level, expert_chat_xpm);
- gtk_tooltips_set_tip(tooltips, expert_image, "CHAT is the highest expert info level", NULL);
- gtk_widget_show(expert_image);
- expert_info_chat = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(expert_info_chat), expert_image);
- SIGNAL_CONNECT(expert_info_chat, "button_press_event", expert_comp_dlg_cb, NULL);
-
- expert_image = xpm_to_widget_from_parent(top_level, expert_none_xpm);
- gtk_tooltips_set_tip(tooltips, expert_image, "No expert info", NULL);
- gtk_widget_show(expert_image);
- expert_info_none = gtk_event_box_new();
- gtk_container_add(GTK_CONTAINER(expert_info_none), expert_image);
- SIGNAL_CONNECT(expert_info_none, "button_press_event", expert_comp_dlg_cb, NULL);
- gtk_widget_show(expert_info_none);
-
-
- /* info (main) statusbar */
- info_bar = info_bar_new();
- gtk_widget_show(info_bar);
-
- /* packets statusbar */
- packets_bar = packets_bar_new();
- gtk_widget_show(packets_bar);
-
- /* profile statusbar */
- profile_bar = profile_bar_new();
- gtk_widget_show(profile_bar);
-
- /* Filter/status hbox */
- stat_hbox = gtk_hbox_new(FALSE, 1);
- gtk_container_border_width(GTK_CONTAINER(stat_hbox), 0);
- gtk_widget_show(stat_hbox);
-
- /* Pane for the statusbar */
- status_pane_left = gtk_hpaned_new();
- gtk_widget_show(status_pane_left);
- status_pane_right = gtk_hpaned_new();
- gtk_widget_show(status_pane_right);
+ /* status bar */
+ statusbar = statusbar_new();
+ gtk_widget_show(statusbar);
/* Pane for the welcome screen */
welcome_pane = welcome_new();
gtk_widget_show(welcome_pane);
}
-#ifdef HAVE_AIRPCAP
-static void
-driver_warning_dialog_cb(gpointer dialog, gint btn _U_, gpointer data _U_)
-{
- gboolean r;
-
- r = simple_dialog_check_get(dialog);
- recent.airpcap_driver_check_show = !r;
-}
-#endif
-
static void
show_main_window(gboolean doing_work)
{
gdk_window_raise(top_level->window);
#ifdef HAVE_AIRPCAP
- /*
- * This will read the decryption keys from the preferences file, and will
- * store them into the registry...
- */
- if(airpcap_if_list != NULL && g_list_length(airpcap_if_list) > 0){
- if (!airpcap_check_decryption_keys(airpcap_if_list)) {
- /* Ask the user what to do ...*/
- airpcap_keys_check_w(NULL,NULL);
- } else {
- /* Keys from lists are equals, or wireshark has got no keys */
- airpcap_load_decryption_keys(airpcap_if_list);
- }
- }
-
- switch (airpcap_dll_ret_val) {
-
- case AIRPCAP_DLL_OK:
- break;
-
- case AIRPCAP_DLL_OLD:
- if(recent.airpcap_driver_check_show) {
- driver_warning_dialog = simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s",
- "WARNING: The version of AirPcap on this system\n"
- "does not support driver-level decryption. Please\n"
- "download a more recent version from\n" "http://www.cacetech.com/support/downloads.htm \n");
- simple_dialog_check_set(driver_warning_dialog,"Don't show this message again.");
- simple_dialog_set_cb(driver_warning_dialog, driver_warning_dialog_cb, NULL);
- }
- break;
-
-#if 0
- /*
- * XXX - Maybe we need to warn the user if one of the following happens???
- */
- case AIRPCAP_DLL_ERROR:
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DLL_ERROR\n");
- break;
-
- case AIRPCAP_DLL_NOT_FOUND:
- simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s","AIRPCAP_DDL_NOT_FOUND\n");
- break;
-#endif
- }
+ airpcap_toolbar_show(airpcap_tb);
#endif /* HAVE_AIRPCAP */
}
#ifdef HAVE_LIBPCAP
/* Set promiscuous mode from the preferences setting. */
/* the same applies to other preferences settings as well. */
- capture_opts->promisc_mode = prefs.capture_prom_mode;
- capture_opts->show_info = prefs.capture_show_info;
- capture_opts->real_time_mode = prefs.capture_real_time;
+ global_capture_opts.promisc_mode = prefs.capture_prom_mode;
+ global_capture_opts.use_pcapng = prefs.capture_pcap_ng;
+ global_capture_opts.show_info = prefs.capture_show_info;
+ global_capture_opts.real_time_mode = prefs.capture_real_time;
auto_scroll_live = prefs.capture_auto_scroll;
#endif /* HAVE_LIBPCAP */
void change_configuration_profile (const gchar *profile_name)
{
char *gdp_path, *dp_path;
+ char *rf_path;
+ int rf_open_errno;
/* First check if profile exists */
if (!profile_exists(profile_name)) {
return;
}
+ /* Get the current geometry, before writing it to disk */
+ main_save_window_geometry(top_level);
+
+ if (profile_exists(get_profile_name())) {
+ /* Write recent file for profile we are leaving, if it still exists */
+ write_profile_recent();
+ }
+
/* Set profile name and update the status bar */
set_profile_name (profile_name);
profile_bar_update ();
/* Reset current preferences and apply the new */
prefs_reset();
+ menu_prefs_reset();
+
(void) read_configuration_files (&gdp_path, &dp_path);
+
+ recent_read_profile_static(&rf_path, &rf_open_errno);
+ if (rf_path != NULL && rf_open_errno != 0) {
+ simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
+ "Could not open common recent file\n\"%s\": %s.",
+ rf_path, strerror(rf_open_errno));
+ }
+ timestamp_set_type (recent.gui_time_format);
+ color_filters_enable(recent.packet_list_colorize);
+ menu_recent_read_finished();
+ main_pane_load_window_geometry();
+ recent.gui_time_format = timestamp_get_type ();
+
+ prefs_to_capture_opts();
prefs_apply_all();
/* Update window view and redraw the toolbar */
/* Reload color filters */
color_filters_reload();
+ /* Reload list of interfaces on welcome page */
+ welcome_if_panel_reload();
+
/* Recreate the packet list according to new preferences */
packet_list_recreate ();
+ cfile.cinfo.columns_changed = FALSE; /* Reset value */
user_font_apply();
}
+
+/** redissect packets and update UI */
+void redissect_packets(void)
+{
+ cf_redissect_packets(&cfile);
+ status_expert_update();
+}