From 51300b3c834a3877d567fb57ae78ec74ec8ba80d Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Mon, 11 Dec 2017 11:29:07 +0100 Subject: fix compilation without pcap. Fix a regression introduced by I09beab751c9c2917f017b6c082166d86ca693544. Change-Id: I57b971086470e836f4147500143c35494118e754 Reviewed-on: https://code.wireshark.org/review/24765 Petri-Dish: Dario Lombardo Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- capture_opts.c | 15 ++++++++++++--- ui/iface_lists.c | 6 ++++++ ui/iface_lists.h | 14 ++++++++------ wireshark-qt.cpp | 4 ++++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/capture_opts.c b/capture_opts.c index f7eb768082..9e6991cc40 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -13,6 +13,10 @@ #include #include +#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP) +#include "capture_opts.h" +#endif + #ifdef HAVE_LIBPCAP #include @@ -21,7 +25,6 @@ #include -#include "capture_opts.h" #include "ringbuffer.h" #include @@ -34,8 +37,9 @@ #include "ui/filter_files.h" static gboolean capture_opts_output_to_pipe(const char *save_file, gboolean *is_pipe); +#endif - +#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP) void capture_opts_init(capture_options *capture_opts) { @@ -46,7 +50,9 @@ capture_opts_init(capture_options *capture_opts) capture_opts->default_options.descr = NULL; capture_opts->default_options.cfilter = NULL; capture_opts->default_options.has_snaplen = FALSE; +#ifdef HAVE_LIBPCAP capture_opts->default_options.snaplen = WTAP_MAX_PACKET_SIZE_STANDARD; +#endif capture_opts->default_options.linktype = -1; /* use interface default */ capture_opts->default_options.promisc_mode = TRUE; capture_opts->default_options.if_type = IF_WIRED; @@ -103,8 +109,9 @@ capture_opts_init(capture_options *capture_opts) capture_opts->has_file_interval = FALSE; capture_opts->file_interval = 60; /* 1 min */ capture_opts->has_ring_num_files = FALSE; +#ifdef HAVE_LIBPCAP capture_opts->ring_num_files = RINGBUFFER_MIN_NUM_FILES; - +#endif capture_opts->has_autostop_files = FALSE; capture_opts->autostop_files = 1; capture_opts->has_autostop_packets = FALSE; @@ -118,7 +125,9 @@ capture_opts_init(capture_options *capture_opts) capture_opts->output_to_pipe = FALSE; capture_opts->capture_child = FALSE; } +#endif +#ifdef HAVE_LIBPCAP void capture_opts_cleanup(capture_options *capture_opts) { diff --git a/ui/iface_lists.c b/ui/iface_lists.c index e4294d2cd8..965bb3f45b 100644 --- a/ui/iface_lists.c +++ b/ui/iface_lists.c @@ -414,17 +414,23 @@ fill_in_local_interfaces_worker(void *arg _U_) g_async_queue_push(local_interface_done_q, GINT_TO_POINTER(TRUE)); return NULL; } +#endif +#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP) void fill_in_local_interfaces_start(void) { +#ifdef HAVE_LIBPCAP if (!local_interface_done_q) { g_mutex_init(&global_capture_opts_mtx); local_interface_done_q = g_async_queue_new(); } local_if_thread = g_thread_new("fill_in_local_interfaces_worker", &fill_in_local_interfaces_worker, NULL); +#endif } +#endif +#ifdef HAVE_LIBPCAP void fill_in_local_interfaces_wait(void(*update_cb)(void)) { diff --git a/ui/iface_lists.h b/ui/iface_lists.h index 0c2738ff14..a0cfe624df 100644 --- a/ui/iface_lists.h +++ b/ui/iface_lists.h @@ -12,6 +12,14 @@ extern "C" { #endif /* __cplusplus */ +#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP) +/* + * Update the global interface list in the background. Create it if we + * haven't done so already. + */ +extern void fill_in_local_interfaces_start(void); +#endif + #ifdef HAVE_LIBPCAP /* * Used when sorting an interface list into alphabetical order by @@ -24,12 +32,6 @@ extern gint if_list_comparator_alph(const void *first_arg, const void *second_ar */ extern void scan_local_interfaces(void (*update_cb)(void)); -/* - * Update the global interface list in the background. Create it if we - * haven't done so already. - */ -extern void fill_in_local_interfaces_start(void); - /* * Wait for the global interface list creation to finish. */ diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index 360ad10c37..26c52008f2 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -96,6 +96,10 @@ #include "caputils/capture-pcap-util.h" +#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP) +#include "ui/capture_globals.h" +#endif + #include #ifdef _WIN32 -- cgit v1.2.3