diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/capture_dlg.c | 18 | ||||
-rw-r--r-- | gtk/display_opts.c | 22 | ||||
-rw-r--r-- | gtk/main.c | 34 |
3 files changed, 48 insertions, 26 deletions
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c index c96ccb1f75..bad40af210 100644 --- a/gtk/capture_dlg.c +++ b/gtk/capture_dlg.c @@ -1,7 +1,7 @@ /* capture_dlg.c * Routines for packet capture windows * - * $Id: capture_dlg.c,v 1.53 2002/01/10 07:43:39 guy Exp $ + * $Id: capture_dlg.c,v 1.54 2002/01/10 11:05:50 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -333,7 +333,7 @@ capture_prep_cb(GtkWidget *w, gpointer d) promisc_cb = dlg_check_button_new_with_label_with_mnemonic( "Capture packets in _promiscuous mode", accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(promisc_cb), prefs.capture_prom_mode); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(promisc_cb), promisc_mode); gtk_container_add(GTK_CONTAINER(main_vb), promisc_cb); gtk_widget_show(promisc_cb); @@ -347,7 +347,7 @@ capture_prep_cb(GtkWidget *w, gpointer d) /* Ring buffer mode is allowed only if we're not doing an "Update list of packets in real time" capture, so force it off if we're doing such a capture. */ - if (prefs.capture_real_time) + if (sync_mode) cfile.ringbuffer_on = FALSE; gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(ringbuffer_on_tb),cfile.ringbuffer_on); gtk_signal_connect(GTK_OBJECT(ringbuffer_on_tb), "toggled", @@ -371,7 +371,7 @@ capture_prep_cb(GtkWidget *w, gpointer d) /* Misc row: Capture file checkboxes */ sync_cb = dlg_check_button_new_with_label_with_mnemonic( "_Update list of packets in real time", accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sync_cb), prefs.capture_real_time); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sync_cb), sync_mode); gtk_signal_connect(GTK_OBJECT(sync_cb), "toggled", GTK_SIGNAL_FUNC(capture_prep_adjust_sensitivity), GTK_OBJECT(cap_open_w)); gtk_container_add(GTK_CONTAINER(main_vb), sync_cb); @@ -379,7 +379,7 @@ capture_prep_cb(GtkWidget *w, gpointer d) auto_scroll_cb = dlg_check_button_new_with_label_with_mnemonic( "_Automatic scrolling in live capture", accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(auto_scroll_cb), prefs.capture_auto_scroll); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(auto_scroll_cb), auto_scroll_live); gtk_container_add(GTK_CONTAINER(main_vb), auto_scroll_cb); gtk_widget_show(auto_scroll_cb); @@ -682,18 +682,18 @@ capture_prep_ok_cb(GtkWidget *ok_bt, gpointer parent_w) { else if (cfile.snap < MIN_PACKET_SIZE) cfile.snap = MIN_PACKET_SIZE; - prefs.capture_prom_mode = GTK_TOGGLE_BUTTON (promisc_cb)->active; + promisc_mode = GTK_TOGGLE_BUTTON (promisc_cb)->active; - prefs.capture_real_time = GTK_TOGGLE_BUTTON (sync_cb)->active; + sync_mode = GTK_TOGGLE_BUTTON (sync_cb)->active; - prefs.capture_auto_scroll = GTK_TOGGLE_BUTTON (auto_scroll_cb)->active; + auto_scroll_live = GTK_TOGGLE_BUTTON (auto_scroll_cb)->active; prefs.name_resolve = PREFS_RESOLV_NONE; prefs.name_resolve |= (GTK_TOGGLE_BUTTON (m_resolv_cb)->active ? PREFS_RESOLV_MAC : PREFS_RESOLV_NONE); prefs.name_resolve |= (GTK_TOGGLE_BUTTON (n_resolv_cb)->active ? PREFS_RESOLV_NETWORK : PREFS_RESOLV_NONE); prefs.name_resolve |= (GTK_TOGGLE_BUTTON (t_resolv_cb)->active ? PREFS_RESOLV_TRANSPORT : PREFS_RESOLV_NONE); - cfile.ringbuffer_on = GTK_TOGGLE_BUTTON (ringbuffer_on_tb)->active && !(prefs.capture_real_time); + cfile.ringbuffer_on = GTK_TOGGLE_BUTTON (ringbuffer_on_tb)->active && !(sync_mode); if (cfile.ringbuffer_on == TRUE) { if (save_file == NULL) { simple_dialog(ESD_TYPE_CRIT, NULL, diff --git a/gtk/display_opts.c b/gtk/display_opts.c index 0903691f35..126c11109a 100644 --- a/gtk/display_opts.c +++ b/gtk/display_opts.c @@ -1,7 +1,7 @@ /* display_opts.c * Routines for packet display windows * - * $Id: display_opts.c,v 1.22 2001/06/18 06:18:03 guy Exp $ + * $Id: display_opts.c,v 1.23 2002/01/10 11:05:50 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -64,11 +64,13 @@ extern capture_file cfile; /* Display callback data keys */ -#define E_DISPLAY_TIME_ABS_KEY "display_time_abs" -#define E_DISPLAY_DATE_TIME_ABS_KEY "display_date_time_abs" -#define E_DISPLAY_TIME_REL_KEY "display_time_rel" -#define E_DISPLAY_TIME_DELTA_KEY "display_time_delta" -#define E_DISPLAY_AUTO_SCROLL_KEY "display_auto_scroll" +#define E_DISPLAY_TIME_ABS_KEY "display_time_abs" +#define E_DISPLAY_DATE_TIME_ABS_KEY "display_date_time_abs" +#define E_DISPLAY_TIME_REL_KEY "display_time_rel" +#define E_DISPLAY_TIME_DELTA_KEY "display_time_delta" +#ifdef HAVE_LIBPCAP +#define E_DISPLAY_AUTO_SCROLL_KEY "display_auto_scroll" +#endif #define E_DISPLAY_M_NAME_RESOLUTION_KEY "display_mac_name_resolution" #define E_DISPLAY_N_NAME_RESOLUTION_KEY "display_network_name_resolution" #define E_DISPLAY_T_NAME_RESOLUTION_KEY "display_transport_name_resolution" @@ -169,13 +171,15 @@ display_opt_cb(GtkWidget *w, gpointer d) { gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0); gtk_widget_show(button); +#ifdef HAVE_LIBPCAP button = dlg_check_button_new_with_label_with_mnemonic( "_Automatic scrolling in live capture", accel_group); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), prefs.capture_auto_scroll); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), auto_scroll_live); gtk_object_set_data(GTK_OBJECT(display_opt_w), E_DISPLAY_AUTO_SCROLL_KEY, button); gtk_box_pack_start(GTK_BOX(main_vb), button, TRUE, TRUE, 0); gtk_widget_show(button); +#endif button = dlg_check_button_new_with_label_with_mnemonic( "Enable _MAC name resolution", accel_group); @@ -282,9 +286,11 @@ get_display_options(GtkWidget *parent_w) if (GTK_TOGGLE_BUTTON (button)->active) timestamp_type = DELTA; +#ifdef HAVE_LIBPCAP button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), E_DISPLAY_AUTO_SCROLL_KEY); - prefs.capture_auto_scroll = (GTK_TOGGLE_BUTTON (button)->active); + auto_scroll_live = (GTK_TOGGLE_BUTTON (button)->active); +#endif prefs.name_resolve = PREFS_RESOLV_NONE; button = (GtkWidget *) gtk_object_get_data(GTK_OBJECT(parent_w), diff --git a/gtk/main.c b/gtk/main.c index ca945e0ec9..ab84ed7485 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.224 2002/01/10 09:51:23 guy Exp $ + * $Id: main.c,v 1.225 2002/01/10 11:05:50 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1062,9 +1062,20 @@ main(int argc, char *argv[]) to the "prefs.capture_prom_mode" setting in the preferences file; it should do what the parent process tells it to do, and if the parent process wants it not to run in promiscuous mode, it'll - tell it so with a "-p" flag. */ + tell it so with a "-p" flag. + + Otherwise, set promiscuous mode from the preferences setting. */ if (capture_child) - prefs->capture_prom_mode = TRUE; + promisc_mode = TRUE; + else + promisc_mode = prefs->capture_prom_mode; + + /* Set "Update list of packets in real time" mode from the preferences + setting. */ + sync_mode = prefs->capture_real_time; + + /* And do the same for "Automatic scrolling in live capture" mode. */ + auto_scroll_live = prefs->capture_auto_scroll; #endif /* Read the capture filter file. */ @@ -1226,7 +1237,12 @@ main(int argc, char *argv[]) #endif break; case 'l': /* Automatic scrolling in live capture mode */ - prefs->capture_auto_scroll = TRUE; +#ifdef HAVE_LIBPCAP + auto_scroll_live = TRUE; +#else + capture_option_specified = TRUE; + arg_error = TRUE; +#endif break; case 'm': /* Fixed-width font for the display */ if (prefs->gui_font_name != NULL) @@ -1264,7 +1280,7 @@ main(int argc, char *argv[]) break; case 'p': /* Don't capture in promiscuous mode */ #ifdef HAVE_LIBPCAP - prefs->capture_prom_mode = FALSE; + promisc_mode = FALSE; #else capture_option_specified = TRUE; arg_error = TRUE; @@ -1301,7 +1317,7 @@ main(int argc, char *argv[]) break; case 'S': /* "Sync" mode: used for following file ala tail -f */ #ifdef HAVE_LIBPCAP - prefs->capture_real_time = TRUE; + sync_mode = TRUE; #else capture_option_specified = TRUE; arg_error = TRUE; @@ -1411,15 +1427,15 @@ main(int argc, char *argv[]) if (cfile.ringbuffer_on) { /* Ring buffer works only under certain conditions: a) ring buffer does not work with temporary files; - b) prefs->capture_real_time and cfile.ringbuffer_on are mutually - exclusive - prefs->capture_real_time takes precedence; + b) sync_mode and cfile.ringbuffer_on are mutually exclusive - + sync_mode takes precedence; c) it makes no sense to enable the ring buffer if the maximum file size is set to "infinite". */ if (cfile.save_file == NULL) { fprintf(stderr, "ethereal: Ring buffer requested, but capture isn't being saved to a permanent file.\n"); cfile.ringbuffer_on = FALSE; } - if (prefs->capture_real_time == TRUE) { + if (sync_mode) { fprintf(stderr, "ethereal: Ring buffer requested, but an \"Update list of packets in real time\" capture is being done.\n"); cfile.ringbuffer_on = FALSE; } |