diff options
-rw-r--r-- | gtk/capture_prefs.c | 27 | ||||
-rw-r--r-- | gtk/prefs_dlg.c | 70 | ||||
-rw-r--r-- | tethereal.c | 22 |
3 files changed, 89 insertions, 30 deletions
diff --git a/gtk/capture_prefs.c b/gtk/capture_prefs.c index 00742c5c06..18d25c5907 100644 --- a/gtk/capture_prefs.c +++ b/gtk/capture_prefs.c @@ -1,7 +1,7 @@ /* capture_prefs.c * Dialog box for capture preferences * - * $Id: capture_prefs.c,v 1.12 2002/06/28 01:59:46 guy Exp $ + * $Id: capture_prefs.c,v 1.13 2002/07/17 00:22:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -26,6 +26,8 @@ #include "config.h" #endif +#ifdef HAVE_LIBPCAP + #include <string.h> #include <errno.h> #include <gtk/gtk.h> @@ -43,8 +45,6 @@ #include "pcap-util.h" #include "main.h" -#ifdef HAVE_LIBPCAP - #define DEVICE_KEY "device" #define PROM_MODE_KEY "prom_mode" #define CAPTURE_REAL_TIME_KEY "capture_real_time" @@ -167,25 +167,4 @@ capture_prefs_destroy(GtkWidget *w _U_) { } -#else /* HAVE_LIBPCAP */ - -/* - * Stub routines. - */ - -void -capture_prefs_apply(GtkWidget *w) -{ -} - -void -capture_prefs_destroy(GtkWidget *w) -{ -} - -void -capture_prefs_fetch(GtkWidget *w) -{ -} - #endif /* HAVE_LIBPCAP */ diff --git a/gtk/prefs_dlg.c b/gtk/prefs_dlg.c index 8e8959ce85..fe3773174e 100644 --- a/gtk/prefs_dlg.c +++ b/gtk/prefs_dlg.c @@ -1,7 +1,7 @@ /* prefs_dlg.c * Routines for handling preferences * - * $Id: prefs_dlg.c,v 1.48 2002/06/16 00:58:38 guy Exp $ + * $Id: prefs_dlg.c,v 1.49 2002/07/17 00:22:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -249,7 +249,10 @@ prefs_cb(GtkWidget *w _U_, gpointer dummy _U_) { GtkWidget *main_vb, *top_hb, *bbox, *prefs_nb, *ct_sb, *frame, *ok_bt, *apply_bt, *save_bt, *cancel_bt; - GtkWidget *print_pg, *column_pg, *stream_pg, *gui_pg, *capture_pg; + GtkWidget *print_pg, *column_pg, *stream_pg, *gui_pg; +#ifdef HAVE_LIBPCAP + GtkWidget *capture_pg; +#endif GtkWidget *nameres_pg; gchar label_str[MAX_TREE_NODE_NAME_LEN], *label_ptr = label_str; GtkCTreeNode *ct_node; @@ -816,7 +819,16 @@ prefs_main_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) column_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_COLUMN_PAGE_KEY)); stream_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_STREAM_PAGE_KEY)); gui_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_GUI_PAGE_KEY)); +#ifdef HAVE_LIBPCAP +#ifdef _WIN32 + /* Is WPcap loaded? */ + if (has_wpcap) { +#endif /* _WIN32 */ capture_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_CAPTURE_PAGE_KEY)); +#ifdef _WIN32 + } +#endif /* _WIN32 */ +#endif /* HAVE_LIBPCAP */ nameres_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_NAMERES_PAGE_KEY)); prefs_module_foreach(module_prefs_fetch, &must_redissect); @@ -825,7 +837,16 @@ prefs_main_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) column_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_COLUMN_PAGE_KEY)); stream_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_STREAM_PAGE_KEY)); gui_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_GUI_PAGE_KEY)); +#ifdef HAVE_LIBPCAP +#ifdef _WIN32 + /* Is WPcap loaded? */ + if (has_wpcap) { +#endif /* _WIN32 */ capture_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_CAPTURE_PAGE_KEY)); +#ifdef _WIN32 + } +#endif /* _WIN32 */ +#endif /* HAVE_LIBPCAP */ nameres_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_NAMERES_PAGE_KEY)); prefs_apply_all(); @@ -850,7 +871,16 @@ prefs_main_apply_cb(GtkWidget *apply_bt _U_, gpointer parent_w) column_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_COLUMN_PAGE_KEY)); stream_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_STREAM_PAGE_KEY)); gui_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_GUI_PAGE_KEY)); +#ifdef HAVE_LIBPCAP +#ifdef _WIN32 + /* Is WPcap loaded? */ + if (has_wpcap) { +#endif /* _WIN32 */ capture_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_CAPTURE_PAGE_KEY)); +#ifdef _WIN32 + } +#endif /* _WIN32 */ +#endif /* HAVE_LIBPCAP */ nameres_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_NAMERES_PAGE_KEY)); prefs_module_foreach(module_prefs_fetch, &must_redissect); @@ -859,7 +889,16 @@ prefs_main_apply_cb(GtkWidget *apply_bt _U_, gpointer parent_w) column_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_COLUMN_PAGE_KEY)); stream_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_STREAM_PAGE_KEY)); gui_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_GUI_PAGE_KEY)); +#ifdef HAVE_LIBPCAP +#ifdef _WIN32 + /* Is WPcap loaded? */ + if (has_wpcap) { +#endif /* _WIN32 */ capture_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_CAPTURE_PAGE_KEY)); +#ifdef _WIN32 + } +#endif /* _WIN32 */ +#endif /* HAVE_LIBPCAP */ nameres_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_NAMERES_PAGE_KEY)); prefs_apply_all(); @@ -884,7 +923,16 @@ prefs_main_save_cb(GtkWidget *save_bt _U_, gpointer parent_w) column_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_COLUMN_PAGE_KEY)); stream_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_STREAM_PAGE_KEY)); gui_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_GUI_PAGE_KEY)); +#ifdef HAVE_LIBPCAP +#ifdef _WIN32 + /* Is WPcap loaded? */ + if (has_wpcap) { +#endif /* _WIN32 */ capture_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_CAPTURE_PAGE_KEY)); +#ifdef _WIN32 + } +#endif /* _WIN32 */ +#endif /* HAVE_LIBPCAP */ nameres_prefs_fetch(gtk_object_get_data(GTK_OBJECT(parent_w), E_NAMERES_PAGE_KEY)); prefs_module_foreach(module_prefs_fetch, &must_redissect); @@ -923,7 +971,16 @@ prefs_main_save_cb(GtkWidget *save_bt _U_, gpointer parent_w) column_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_COLUMN_PAGE_KEY)); stream_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_STREAM_PAGE_KEY)); gui_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_GUI_PAGE_KEY)); +#ifdef HAVE_LIBPCAP +#ifdef _WIN32 + /* Is WPcap loaded? */ + if (has_wpcap) { +#endif /* _WIN32 */ capture_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_CAPTURE_PAGE_KEY)); +#ifdef _WIN32 + } +#endif /* _WIN32 */ +#endif /* HAVE_LIBPCAP */ nameres_prefs_apply(gtk_object_get_data(GTK_OBJECT(parent_w), E_NAMERES_PAGE_KEY)); prefs_apply_all(); @@ -1046,7 +1103,16 @@ prefs_main_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_) column_prefs_destroy(gtk_object_get_data(GTK_OBJECT(prefs_w), E_COLUMN_PAGE_KEY)); stream_prefs_destroy(gtk_object_get_data(GTK_OBJECT(prefs_w), E_STREAM_PAGE_KEY)); gui_prefs_destroy(gtk_object_get_data(GTK_OBJECT(prefs_w), E_GUI_PAGE_KEY)); +#ifdef HAVE_LIBPCAP +#ifdef _WIN32 + /* Is WPcap loaded? */ + if (has_wpcap) { +#endif /* _WIN32 */ capture_prefs_destroy(gtk_object_get_data(GTK_OBJECT(prefs_w), E_CAPTURE_PAGE_KEY)); +#ifdef _WIN32 + } +#endif /* _WIN32 */ +#endif /* HAVE_LIBPCAP */ nameres_prefs_destroy(gtk_object_get_data(GTK_OBJECT(prefs_w), E_NAMERES_PAGE_KEY)); /* Free up the saved preferences (both for "prefs" and for registered diff --git a/tethereal.c b/tethereal.c index b9be16df37..f34cb7d990 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.148 2002/07/16 07:15:04 guy Exp $ + * $Id: tethereal.c,v 1.149 2002/07/17 00:22:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -217,6 +217,7 @@ print_usage(gboolean print_ver) fprintf(stderr, "\tdefault is libpcap\n"); } +#ifdef HAVE_LIBPCAP static int get_positive_int(const char *string, const char *name) { @@ -247,7 +248,6 @@ get_positive_int(const char *string, const char *name) return number; } -#ifdef HAVE_LIBPCAP /* * Given a string of the form "<autostop criterion>:<value>", as might appear * as an argument to a "-a" option, parse it and set the criterion in @@ -324,7 +324,10 @@ main(int argc, char *argv[]) gboolean capture_option_specified = FALSE; #endif int out_file_type = WTAP_FILE_PCAP; - gchar *cf_name = NULL, *rfilter = NULL, *if_text; + gchar *cf_name = NULL, *rfilter = NULL; +#ifdef HAVE_LIBPCAP + gchar *if_text; +#endif dfilter_t *rfcode = NULL; e_prefs *prefs; char badopt; @@ -673,14 +676,20 @@ main(int argc, char *argv[]) } /* See if we're writing a capture file and the file is a pipe */ +#ifdef HAVE_LIBPCAP ld.output_to_pipe = FALSE; +#endif if (cfile.save_file != NULL) { if (!strcmp(cfile.save_file, "-")) { /* stdout */ g_free(cfile.save_file); cfile.save_file = g_strdup(""); +#ifdef HAVE_LIBPCAP ld.output_to_pipe = TRUE; - } else { +#endif + } +#ifdef HAVE_LIBPCAP + else { err = test_for_fifo(cfile.save_file); switch (err) { @@ -700,6 +709,7 @@ main(int argc, char *argv[]) exit(2); } } +#endif } #ifdef HAVE_LIBPCAP @@ -1516,7 +1526,9 @@ wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr, } if (passed) { /* The packet passed the read filter. */ +#ifdef HAVE_LIBPCAP ld.packet_count++; +#endif if (!wtap_dump(pdh, phdr, pseudo_header, buf, &err)) { #ifdef HAVE_LIBPCAP if (ld.pch != NULL && !quiet) { @@ -1627,7 +1639,9 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr, } if (passed) { /* The packet passed the read filter. */ +#ifdef HAVE_LIBPCAP ld.packet_count++; +#endif if (verbose) { /* Print the information in the protocol tree. */ print_args.to_file = TRUE; |