Have a #define for whether the capture buffer size can be set.
authorGuy Harris <guy@alum.mit.edu>
Wed, 25 Mar 2015 03:22:00 +0000 (20:22 -0700)
committerGuy Harris <guy@alum.mit.edu>
Wed, 25 Mar 2015 03:22:33 +0000 (03:22 +0000)
It can be set if either 1) this is Windows (where we're assumed to be
using WinPcap, which includes calls to set the buffer size) or 2) we
have pcap_create() (in which case we also have pcap_set_buffer_size(),
at least in a normal libpcap release).

Use that rather than testing "defined(_WIN32) ||
defined(HAVE_PCAP_CREATE)"; that makes it a bit more obvious what's
being tested.

Change-Id: Id9f8455019d19206b04dd6820a748cb97ae5ad12
Reviewed-on: https://code.wireshark.org/review/7816
Reviewed-by: Guy Harris <guy@alum.mit.edu>
20 files changed:
acinclude.m4
capchild/capture_sync.c
capture_opts.c
capture_opts.h
cmake/modules/FindPCAP.cmake
cmakeconfig.h.in
config.h.win32
dumpcap.c
epan/prefs.c
epan/prefs.h
tshark.c
ui/capture_ui_utils.c
ui/capture_ui_utils.h
ui/gtk/capture_dlg.c
ui/gtk/main.c
ui/gtk/prefs_capture.c
ui/iface_lists.c
ui/qt/capture_interfaces_dialog.cpp
ui/qt/manage_interfaces_dialog.cpp
wireshark-qt.cpp

index 2d89e2278e77c056f33cb2fbfacb151e257580f8..ced7921a2166e0cea8ed207a7ba4d14fec8640f0 100644 (file)
@@ -646,7 +646,14 @@ install a newer version of the header file.])
          AC_CHECK_FUNCS(pcap_datalink_val_to_description)
          AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink pcap_lib_version)
          AC_CHECK_FUNCS(pcap_get_selectable_fd pcap_free_datalinks)
-         AC_CHECK_FUNCS(pcap_create bpf_image pcap_set_tstamp_precision)
+         AC_CHECK_FUNC(pcap_create,
+         [
+           AC_DEFINE(HAVE_PCAP_CREATE, 1,
+            [Define to 1 if you have the `pcap_create' function.])
+           AC_DEFINE(CAN_SET_CAPTURE_BUFFER_SIZE, 1,
+            [Define to 1 if the capture buffer size can be set.])
+         ])
+         AC_CHECK_FUNCS(bpf_image pcap_set_tstamp_precision)
        fi
        LIBS="$ac_save_LIBS"
 ])
index 16242307726a92985ad86cf96857751b86ab12b5..ed6ecd638d48b444a25d750f95dc54dafec8db88 100644 (file)
@@ -359,7 +359,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi
     char ssampling[ARGV_NUMBER_LEN];
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     char buffer_size[ARGV_NUMBER_LEN];
 #endif
 
@@ -503,7 +503,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi
             argv = sync_pipe_add_arg(argv, &argc, "-p");
         }
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
         if (interface_opts.buffer_size != DEFAULT_CAPTURE_BUFFER_SIZE) {
             argv = sync_pipe_add_arg(argv, &argc, "-B");
             if(interface_opts.buffer_size == 0x00)
index b41f83468ea260dbb27c51b582d17ad159e99ec9..2cf37d63ae321e3b59a3ea23e919636f77453113 100644 (file)
@@ -71,7 +71,7 @@ capture_opts_init(capture_options *capture_opts)
     capture_opts->default_options.extcap_args     = NULL;
     capture_opts->default_options.extcap_pid      = INVALID_EXTCAP_PID;
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     capture_opts->default_options.buffer_size     = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
     capture_opts->default_options.monitor_mode    = FALSE;
@@ -148,7 +148,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
         g_log(log_domain, log_level, "Extcap FIFO[%02d]     : %s", i, interface_opts.extcap_fifo ? interface_opts.extcap_fifo : "(unspecified)");
         g_log(log_domain, log_level, "Extcap PID[%02d]      : %d", i, interface_opts.extcap_pid);
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
         g_log(log_domain, log_level, "Buffer size[%02d]     : %d (MB)", i, interface_opts.buffer_size);
 #endif
         g_log(log_domain, log_level, "Monitor Mode[%02d]    : %s", i, interface_opts.monitor_mode?"TRUE":"FALSE");
@@ -188,7 +188,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
     g_log(log_domain, log_level, "Extcap[df]          : %s", capture_opts->default_options.extcap ? capture_opts->default_options.extcap : "(unspecified)");
     g_log(log_domain, log_level, "Extcap FIFO[df]     : %s", capture_opts->default_options.extcap_fifo ? capture_opts->default_options.extcap_fifo : "(unspecified)");
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     g_log(log_domain, log_level, "Buffer size[df]     : %d (MB)", capture_opts->default_options.buffer_size);
 #endif
     g_log(log_domain, log_level, "Monitor Mode[df]    : %s", capture_opts->default_options.monitor_mode?"TRUE":"FALSE");
@@ -611,7 +611,7 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str
     interface_opts.extcap_args = NULL;
     interface_opts.extcap_pid = INVALID_EXTCAP_PID;
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     interface_opts.buffer_size = capture_opts->default_options.buffer_size;
 #endif
     interface_opts.monitor_mode = capture_opts->default_options.monitor_mode;
@@ -671,7 +671,7 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
             return 1;
         }
         break;
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     case 'B':        /* Buffer size */
         if (capture_opts->ifaces->len > 0) {
             interface_options interface_opts;
@@ -1097,7 +1097,7 @@ collect_ifaces(capture_options *capture_opts)
             if (interface_opts.extcap_args)
                 g_hash_table_ref(interface_opts.extcap_args);
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
             interface_opts.buffer_size =  device.buffer;
 #endif
 #ifdef HAVE_PCAP_CREATE
index 5eb928e400e31a4bb4ff9a998fced17a33b4fd53..4ace0bf97419d419fa111b61acfc0b565c78feba 100644 (file)
@@ -74,7 +74,7 @@ extern "C" {
 #define OPTSTRING_A ""
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 #define LONGOPT_BUFFER_SIZE \
     {(char *)"buffer-size", required_argument, NULL, 'B'},
 #define OPTSTRING_B "B:"
@@ -179,7 +179,7 @@ typedef struct interface_tag {
     gboolean        has_snaplen;
     int             snaplen;
     gboolean        local;
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     gint            buffer;
 #endif
 #ifdef HAVE_PCAP_CREATE
@@ -229,7 +229,7 @@ typedef struct interface_options_tag {
     GPid              extcap_pid;           /* pid of running process or INVALID_EXTCAP_PID */
     guint             extcap_child_watch;
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     int               buffer_size;
 #endif
     gboolean          monitor_mode;
index d75843e2754feed7d0cc35bf9638d07032f83323..d49cd3562916a2405eed3391c4c9b9f5ecc5583a 100644 (file)
@@ -63,8 +63,19 @@ check_function_exists( "pcap_freecode" HAVE_PCAP_FREECODE )
 check_function_exists( "pcap_breakloop" HAVE_PCAP_BREAKLOOP )
 # FIXME: The code (at least) in dumpcap assumes that PCAP_CREATE is not
 #        available on Windows
-if( NOT WIN32 )
+if( WIN32 )
+  #
+  # This is always the case with WinPcap.
+  #
+  set(CAN_SET_CAPTURE_BUFFER_SIZE TRUE)
+else()
   check_function_exists( "pcap_create" HAVE_PCAP_CREATE )
+  if ( HAVE_PCAP_CREATE )
+    #
+    # For libpcap, we can set the buffer size if we have pcap_create().
+    #
+    set( CAN_SET_CAPTURE_BUFFER_SIZE TRUE )
+  endif()
 endif()
 check_function_exists( "pcap_datalink_name_to_val" HAVE_PCAP_DATALINK_NAME_TO_VAL )
 check_function_exists( "pcap_datalink_val_to_description" HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION )
index 0ad3fb521a6eff5e58a8a164392d273898a67181..b8e15177d3a912bffc38f86c9116bb2ee477cf49 100644 (file)
 /* Define to 1 if you have the `pcap_create' function. */
 #cmakedefine HAVE_PCAP_CREATE 1
 
+/* Define to 1 if the capture buffer size can be set. */
+#cmakedefine CAN_SET_CAPTURE_BUFFER_SIZE 1
+
 /* Define to 1 if you have the `pcap_datalink_name_to_val' function. */
 #cmakedefine HAVE_PCAP_DATALINK_NAME_TO_VAL 1
 
index 88085d5701a5127bec64638f1f6e53f4cc0d719b..c0074b2888639aa61bec59205f12f2709730573d 100644 (file)
 
 @HAVE_LIBPCAP@
 @HAVE_PCAP_BREAKLOOP@
-@HAVE_PCAP_FINDALLDEVS@
 @HAVE_PCAP_DATALINK_NAME_TO_VAL@
-@HAVE_PCAP_DATALINK_VAL_TO_NAME@
+
+/* Always true in WinPcap, even without pcap_capture(). */
+/* Define to 1 if the capture buffer size can be set. */
+#define CAN_SET_CAPTURE_BUFFER_SIZE 1
+
 @HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION@
+@HAVE_PCAP_DATALINK_VAL_TO_NAME@
+@HAVE_PCAP_FINDALLDEVS@
 
 @HAVE_PCAP_LIST_DATALINKS@
 @HAVE_PCAP_FREE_DATALINKS@
index 8ca181b3ef7f5f4b061891dd6460f12327c69a0c..1bdffabbdc84be0725cb65ebcb46d5706e53b170 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -488,7 +488,7 @@ print_usage(FILE *output)
 #ifdef HAVE_PCAP_CREATE
     fprintf(output, "  -I                       capture in monitor mode, if available\n");
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     fprintf(output, "  -B <buffer size>         size of kernel buffer in MiB (def: %dMiB)\n", DEFAULT_CAPTURE_BUFFER_SIZE);
 #endif
     fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
@@ -4602,9 +4602,9 @@ DIAG_ON(cast-qual)
 #ifdef HAVE_PCAP_SETSAMPLING
         case 'm':        /* Sampling */
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
         case 'B':        /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_CREATE */
+#endif
 #ifdef HAVE_PCAP_CREATE
         case 'I':        /* Monitor mode */
 #endif
index 00890d9c66089aa6320590090404d393577dbf6b..e37cc8110be8ee3f6992d897bcc9d8b53a1ad43c 100644 (file)
@@ -167,7 +167,7 @@ static const gchar *capture_cols[7] = {
 };
 #define CAPTURE_COL_TYPE_DESCRIPTION \
     "Possible values: INTERFACE, LINK, PMODE, SNAPLEN, MONITOR, BUFFER, FILTER\n"
-#elif defined(_WIN32) && !defined (HAVE_PCAP_CREATE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
 /* Can set buffer size but not monitor mode. */
 static gint num_capture_cols = 6;
 static const gchar *capture_cols[6] = {
@@ -2389,7 +2389,7 @@ prefs_register_modules(void)
         "By default, capture in monitor mode on interface? (Ex: eth0,eth3,...)",
         (const char **)&prefs.capture_devices_monitor_mode);
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     prefs_register_string_preference(capture_module, "devices_buffersize", "Interface buffer size",
         "Interface buffer size (Ex: en0(1),en1(143),...)",
         ((const char **)&prefs.capture_devices_buffersize));
index d84de317cf5667ef5195593ebad1d47400042363..cd6398560e3832f7576693cb2fbe80d0e31724ba 100644 (file)
@@ -188,7 +188,7 @@ typedef struct _e_prefs {
   gchar       *capture_devices_descr;
   gchar       *capture_devices_hide;
   gchar       *capture_devices_monitor_mode;
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   gchar       *capture_devices_buffersize;
 #endif
   gchar       *capture_devices_snaplen;
index ea6654b243c25bfcd94b557e1480b09db02fde25..acc87e7b3795bb1004ba7b5ee20d8292ef236dfd 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -310,7 +310,7 @@ print_usage(FILE *output)
 #ifdef HAVE_PCAP_CREATE
   fprintf(output, "  -I                       capture in monitor mode, if available\n");
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   fprintf(output, "  -B <buffer size>         size of kernel buffer (def: %dMB)\n", DEFAULT_CAPTURE_BUFFER_SIZE);
 #endif
   fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
@@ -1378,9 +1378,9 @@ DIAG_ON(cast-qual)
     case 'w':        /* Write to capture file x */
     case 'y':        /* Set the pcap data link type */
     case  LONGOPT_NUM_CAP_COMMENT: /* add a capture comment */
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     case 'B':        /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_CREATE */
+#endif
 #ifdef HAVE_LIBPCAP
       status = capture_opts_add_opt(&global_capture_opts, opt, optarg, &start_capture);
       if (status != 0) {
index b5d0e3e0e1c5e1064789593f1a181c3dfeb8d5ad..589512cbd408c1681b39c6fbfc7fe85306ca35f3 100644 (file)
@@ -145,7 +145,7 @@ capture_dev_user_linktype_find(const gchar *if_name)
   return capture_dev_get_if_int_property(prefs.capture_devices_linktypes, if_name);
 }
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 gint
 capture_dev_user_buffersize_find(const gchar *if_name)
 {
index ee411e05fda673fe08f0016831750f85f4a97c29..6146e96f439585155e123edc51a805eea84b33a4 100644 (file)
@@ -54,7 +54,7 @@ char *capture_dev_user_descr_find(const gchar *if_name);
  */
 gint capture_dev_user_linktype_find(const gchar *if_name);
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 /**
  * Find user-specified buffer size that matches interface
  * name, if any.
index 8ea6100f03f8a77c77f1d261d11702dc0b1317bc..f8e2601aaff7e76978c5fd132d45902530a13dd5 100644 (file)
 #include "ui/gtk/extcap_gtk.h"
 #endif
 
-/*
- * If this is WinPcap or if we have pcap_create(), we can set the
- * buffer size.
- */
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
-#define HAVE_BUFFER_SIZE
-#endif
-
 /*
  * Symbolic names for column indices.
  */
@@ -104,7 +96,7 @@ enum
     LINK,
     PMODE,
     SNAPLEN,
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     BUFFER,
 #endif
 #ifdef HAVE_PCAP_CREATE
@@ -133,7 +125,7 @@ enum
 #define E_CAP_SNAP_CB_KEY               "cap_snap_cb"
 #define E_CAP_LT_CBX_KEY                "cap_lt_cbx"
 #define E_CAP_LT_CBX_LABEL_KEY          "cap_lt_cbx_label"
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 #define E_CAP_BUFFER_SIZE_SB_KEY        "cap_buffer_size_sb"
 #endif
 #define E_CAP_SNAP_SB_KEY               "cap_snap_sb"
@@ -329,7 +321,7 @@ gchar *col_index_to_name(gint indx)
       break;
     case SNAPLEN: col_name = g_strdup("SNAPLEN");
       break;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     case BUFFER: col_name = g_strdup("BUFFER");
       break;
 #endif
@@ -352,7 +344,7 @@ gint col_title_to_index(const gchar *name)
   if (strcmp(name, "Link-layer header") == 0) return LINK;
   if (strcmp(name, "Prom. Mode") == 0) return PMODE;
   if (strcmp(name, "Snaplen [B]") == 0) return SNAPLEN;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   if (strcmp(name, "Buffer [MiB]") == 0) return BUFFER;
 #endif
 #ifdef HAVE_PCAP_CREATE
@@ -1275,7 +1267,7 @@ insert_new_rows(GList *list)
     } else {
       device.display_name = g_strdup(if_string);
     }
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     if ((device.buffer = capture_dev_user_buffersize_find(if_string)) == -1) {
       device.buffer = global_capture_opts.default_options.buffer_size;
     }
@@ -1391,7 +1383,7 @@ insert_new_rows(GList *list)
 
 #if defined(HAVE_PCAP_CREATE)
     gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, FALSE, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, link_type_name, PMODE, (device.pmode?"enabled":"disabled"), SNAPLEN, snaplen_string, BUFFER, device.buffer, MONITOR, "no",FILTER, "",-1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
     gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, FALSE, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, link_type_name, PMODE, (device.pmode?"enabled":"disabled"), SNAPLEN, snaplen_string, BUFFER, device.buffer, FILTER, "",-1);
  #else
     gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, FALSE, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, link_type_name, PMODE, (device.pmode?"enabled":"disabled"), SNAPLEN, snaplen_string, -1);
@@ -2357,7 +2349,7 @@ update_options_table(gint indx)
       }
   #if defined(HAVE_PCAP_CREATE)
       gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname,  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
-  #elif defined(HAVE_BUFFER_SIZE)
+  #elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
       gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname,  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
   #else
       gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname,  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -2396,7 +2388,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
             *monitor_cb,
 #endif
             *filter_cm, *linktype_combo_box;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   GtkWidget *buffer_size_sb;
 #endif
 #ifdef HAVE_EXTCAP
@@ -2412,7 +2404,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
   global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, marked_interface);
   snap_cb    = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_SNAP_CB_KEY);
   snap_sb    = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_SNAP_SB_KEY);
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   buffer_size_sb = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_BUFFER_SIZE_SB_KEY);
 #endif
   promisc_cb = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_PROMISC_KEY);
@@ -2439,7 +2431,7 @@ save_options_cb(GtkWidget *win _U_, gpointer user_data _U_)
      }
   }
   device.active_dlt = dlt;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   device.buffer = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_sb));
 #endif
   device.pmode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(promisc_cb));
@@ -2548,12 +2540,12 @@ static GtkWidget *build_extcap_options(const gchar *name, GHashTable *hash) {
  * We avoid having the right column if we don't need it, because it
  * steals 3 pixels.
  */
-#if defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(HAVE_BUFFER_SIZE)
+#if defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(CAN_SET_CAPTURE_BUFFER_SIZE)
 #define HAVE_TWO_SETTING_COLUMNS
 # if !defined(HAVE_PCAP_REMOTE)
 # define BUFFER_SIZE_IN_RIGHT_COLUMN
 # endif /* !defined(HAVE_PCAP_REMOTE) */
-#endif /* defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(HAVE_BUFFER_SIZE) */
+#endif /* defined(HAVE_AIRPCAP) || defined(HAVE_PCAP_REMOTE) || defined(CAN_SET_CAPTURE_BUFFER_SIZE) */
 
 void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column _U_, gpointer userdata)
 {
@@ -2584,7 +2576,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
 
   GList           *cf_entry, *list, *cfilter_list;
   GtkAdjustment   *snap_adj;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   GtkAdjustment   *buffer_size_adj;
   GtkWidget       *buffer_size_lb, *buffer_size_sb, *buffer_size_hb;
 #endif
@@ -2631,7 +2623,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
   device.has_snaplen = FALSE;
   device.snaplen = 65535;
   device.cfilter = NULL;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
 #ifdef HAVE_EXTCAP
@@ -2943,7 +2935,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
   gtk_box_pack_start(GTK_BOX(filter_hb), compile_bt, FALSE, FALSE, 3);
 #endif
 
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   buffer_size_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
   buffer_size_lb = gtk_label_new("Buffer size:");
   gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 0);
@@ -2966,7 +2958,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
 #else /* BUFFER_SIZE_IN_RIGHT_COLUMN */
   gtk_box_pack_start (GTK_BOX(left_vb), buffer_size_hb, FALSE, FALSE, 0);
 #endif /* BUFFER_SIZE_IN_RIGHT_COLUMN */
-#endif /* HAVE_BUFFER_SIZE */
+#endif /* CAN_SET_CAPTURE_BUFFER_SIZE */
 
 #ifdef HAVE_PCAP_REMOTE
   /*
@@ -3369,7 +3361,7 @@ static void change_pipe_name_cb(gpointer dialog _U_, gint btn, gpointer data)
             if (strcmp(optname, pipe_name) == 0) {
 #if defined(HAVE_PCAP_CREATE)
               gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, "",  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
               gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "",  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
 #else
               gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "",  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -3477,7 +3469,7 @@ add_pipe_cb(gpointer w _U_)
     device.no_addresses = 0;
     device.last_packets = 0;
     device.links        = NULL;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     device.buffer       = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
     device.active_dlt   = -1;
@@ -3507,7 +3499,7 @@ add_pipe_cb(gpointer w _U_)
     gtk_list_store_append (GTK_LIST_STORE(model), &iter);
 #if defined(HAVE_PCAP_CREATE)
     gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, "",  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
     gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "",  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
 #else
     gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, "",  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -4724,7 +4716,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_)
     gtk_tree_view_column_set_visible(column, FALSE);
   g_object_set(renderer, "xalign", 0.5f, NULL);
 
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   renderer = gtk_cell_renderer_text_new();
   column = gtk_tree_view_column_new_with_attributes("Buffer [MiB]", renderer, "text", BUFFER, NULL);
   gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
@@ -5663,7 +5655,7 @@ create_and_fill_model(GtkTreeView *view)
   guint         i;
   link_row     *linkr = NULL;
   interface_t   device;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
   gint          buffer;
 #endif
   gint          snaplen;
@@ -5671,7 +5663,7 @@ create_and_fill_model(GtkTreeView *view)
 
 #if defined(HAVE_PCAP_CREATE)
   store = gtk_list_store_new (9, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
   store = gtk_list_store_new (8, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
 #else
   store = gtk_list_store_new (7, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
@@ -5712,7 +5704,7 @@ create_and_fill_model(GtkTreeView *view)
 
       snaplen_string = g_strdup_printf("%d", device.snaplen);
 
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
       if (capture_dev_user_buffersize_find(device.name) != -1) {
         buffer = capture_dev_user_buffersize_find(device.name);
         device.buffer = buffer;
@@ -5725,7 +5717,7 @@ create_and_fill_model(GtkTreeView *view)
       gtk_list_store_append (store, &iter);
 #if defined(HAVE_PCAP_CREATE)
       gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname,  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1);
-#elif defined(HAVE_BUFFER_SIZE)
+#elif defined(CAN_SET_CAPTURE_BUFFER_SIZE)
       gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname,  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1);
 #else
       gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname,  PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1);
@@ -5780,7 +5772,7 @@ query_tooltip_tree_view_cb (GtkWidget  *widget,
       case SNAPLEN: g_snprintf(buffer, sizeof(buffer), "Limit the maximum number of bytes to be captured from each packet. This size includes the "
                 "link-layer header and all subsequent headers.");
               break;
-#ifdef HAVE_BUFFER_SIZE
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
       case BUFFER: g_snprintf (buffer, sizeof(buffer), "The memory buffer size used while capturing. "
                 "If you notice packet drops, you can try increasing this size.");
               break;
index bf31fec78a540e36c046c7fc6bd9957730a0d196..d1aa6ab8327fec32f74ddbbf7e9de79a0c853d00 100644 (file)
@@ -1198,7 +1198,7 @@ print_usage(gboolean for_help_option) {
 #ifdef HAVE_PCAP_CREATE
     fprintf(output, "  -I                       capture in monitor mode, if available\n");
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     fprintf(output, "  -B <buffer size>         size of kernel buffer (def: %dMB)\n", DEFAULT_CAPTURE_BUFFER_SIZE);
 #endif
     fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
@@ -2604,9 +2604,9 @@ DIAG_ON(cast-qual)
             case 'S':        /* "Sync" mode: used for following file ala tail -f */
             case 'w':        /* Write to capture file xxx */
             case 'y':        /* Set the pcap data link type */
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
             case 'B':        /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_CREATE */
+#endif
 #ifdef HAVE_LIBPCAP
                 status = capture_opts_add_opt(&global_capture_opts, opt, optarg,
                                               &start_capture);
index 368e5021b86dacaf555a52d20a1be0fa4ffcd3d6..738f1fa874595ac803106455fbcd1dc62f362d03 100644 (file)
@@ -71,7 +71,7 @@ static GtkWidget *cur_list, *if_dev_lb, *if_name_lb, *if_linktype_lb, *if_linkty
 #ifdef HAVE_PCAP_CREATE
 static GtkWidget *if_monitor_lb, *if_monitor_cb;
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 static GtkWidget *if_buffersize_lb, *if_buffersize_cb;
 #endif
 static GtkWidget *if_snaplen_lb, *if_snaplen_cb, *if_snaplen_tg, *if_pmode_lb, *if_pmode_cb;
@@ -90,7 +90,7 @@ static void ifopts_edit_monitor_changed_cb(GtkToggleButton *tbt, gpointer udata)
 static void ifopts_edit_linktype_changed_cb(GtkComboBox *ed, gpointer udata);
 static void ifopts_edit_descr_changed_cb(GtkEditable *ed, gpointer udata);
 static void ifopts_edit_hide_changed_cb(GtkToggleButton *tbt, gpointer udata);
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 static void ifopts_edit_buffersize_changed_cb(GtkSpinButton *ed, gpointer udata);
 #endif
 static void ifopts_edit_snaplen_changed_cb(GtkSpinButton *ed, gpointer udata);
@@ -103,7 +103,7 @@ static void ifopts_if_liststore_add(void);
 static void ifopts_write_new_monitor_mode(void);
 #endif
 static void ifopts_write_new_linklayer(void);
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 static void ifopts_write_new_buffersize(void);
 #endif
 static void ifopts_write_new_snaplen(void);
@@ -116,7 +116,7 @@ static void prom_mode_cb(GtkToggleButton *tbt, gpointer udata);
 #ifdef HAVE_PCAP_CREATE
 static GtkWidget *col_monitor_cb;
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 static GtkWidget *col_buf_cb;
 #endif
 static GtkWidget *col_snap_cb;
@@ -344,7 +344,7 @@ enum
 #ifdef HAVE_PCAP_CREATE
        DEF_MONITOR_MODE_COLUMN,
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        BUF_COLUMN,
 #endif
        HASSNAP_COLUMN,
@@ -368,7 +368,7 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
 #ifdef HAVE_PCAP_CREATE
                                                *col_monitor_lb,
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
                                                *col_buf_lb,
 #endif
                                                *col_filter_lb, *col_pmode_lb,
@@ -464,7 +464,7 @@ colopts_edit_cb(GtkWidget *w, gpointer data _U_)
        gtk_widget_show(col_snap_lb);
        row++;
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        /* create "Buffer in Megabytes" label and button */
        col_buf_cb = gtk_check_button_new();
        ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), col_buf_cb, 0, row, 1, 1);
@@ -566,7 +566,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
        GtkCellRenderer   *renderer;
        GtkTreeView       *list_view;
        GtkTreeSelection  *selection;
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        GtkAdjustment     *buffer_size_adj;
 #endif
        GtkAdjustment     *snaplen_adj;
@@ -612,7 +612,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
 #ifdef HAVE_PCAP_CREATE
                                        G_TYPE_BOOLEAN, /* Monitor mode         */
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
                                        G_TYPE_INT,                     /* Buffer size                          */
 #endif
                                        G_TYPE_BOOLEAN, /* Has snap length              */
@@ -675,7 +675,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
        gtk_tree_view_append_column (list_view, column);
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        renderer = gtk_cell_renderer_spin_new ();
        buffer_size_adj = (GtkAdjustment *) gtk_adjustment_new(DEFAULT_CAPTURE_BUFFER_SIZE, 1, 65535, 1.0, 10.0, 0.0);
        g_object_set(G_OBJECT(renderer), "adjustment", buffer_size_adj, NULL);
@@ -829,7 +829,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_)
        row++;
 #endif
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        if_buffersize_lb = gtk_label_new("Default buffer size (MiB):");
        ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), if_buffersize_lb, 0, row, 1, 1);
        gtk_misc_set_alignment(GTK_MISC(if_buffersize_lb), 1.0f, 0.5f);
@@ -973,7 +973,7 @@ colopts_edit_ok_cb(GtkWidget *w _U_, gpointer parent_w)
        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(col_snap_cb))) {
                prefs.capture_columns = g_list_append(prefs.capture_columns, g_strdup("SNAPLEN"));
        }
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(col_buf_cb))) {
                prefs.capture_columns = g_list_append(prefs.capture_columns, g_strdup("BUFFER"));
        }
@@ -1016,7 +1016,7 @@ ifopts_edit_ok_cb(GtkWidget *w _U_, gpointer parent_w)
                /* create/write new "hidden" interfaces string */
                ifopts_write_new_hide();
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
                /* create/write new "buffersize" interfaces string */
                ifopts_write_new_buffersize();
 #endif
@@ -1116,7 +1116,7 @@ ifopts_edit_ifsel_cb(GtkTreeSelection     *selection _U_,
 #ifdef HAVE_PCAP_CREATE
        gboolean            monitor_mode;
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        gint                buffersize;
 #endif
        gint                snaplen;
@@ -1134,7 +1134,7 @@ ifopts_edit_ifsel_cb(GtkTreeSelection     *selection _U_,
 #ifdef HAVE_PCAP_CREATE
                           DEF_MONITOR_MODE_COLUMN,   &monitor_mode,
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
                           BUF_COLUMN,                &buffersize,
 #endif
                           HASSNAP_COLUMN,            &hassnap,
@@ -1151,7 +1151,7 @@ ifopts_edit_ifsel_cb(GtkTreeSelection     *selection _U_,
        /* display the interface name from current interfaces selection */
        gtk_label_set_text(GTK_LABEL(if_name_lb), desc);
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        /* display the buffer size from current interfaces selection */
        gtk_spin_button_set_value(GTK_SPIN_BUTTON (if_buffersize_cb), buffersize);
 #endif
@@ -1397,7 +1397,7 @@ ifopts_edit_linktype_changed_cb(GtkComboBox *cb, gpointer udata)
        }
 }
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 /*
  * Buffer size entry changed callback; update list_store for currently selected interface.
  */
@@ -1600,7 +1600,7 @@ ifopts_options_add(GtkListStore *list_store, if_info_t *if_info)
        gboolean monitor_mode;
 #endif
        gint     linktype;
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        gint buffersize;
 #endif
        gint snaplen;
@@ -1647,7 +1647,7 @@ ifopts_options_add(GtkListStore *list_store, if_info_t *if_info)
                free_if_capabilities(caps);
        }
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
        buffersize = capture_dev_user_buffersize_find(if_info->name);
        if (buffersize == -1) {
                buffersize = DEFAULT_CAPTURE_BUFFER_SIZE;
@@ -1733,7 +1733,7 @@ ifopts_options_add(GtkListStore *list_store, if_info_t *if_info)
 #ifdef HAVE_PCAP_CREATE
                             DEF_MONITOR_MODE_COLUMN, monitor_mode,
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
                             BUF_COLUMN,              buffersize,
 #endif
                             HASSNAP_COLUMN,          hassnap,
@@ -1906,7 +1906,7 @@ ifopts_write_new_linklayer(void)
        }
 }
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 /*
  * Create/write new interfaces buffer size string based on current CList.
  * Put it into the preferences value.
index 1dfb9b88c3f44413577645e596dd3fdc02fa1094..a78eb4c18600e544b75dea220b6e5749e10d399b 100644 (file)
@@ -285,7 +285,7 @@ scan_local_interfaces(void (*update_cb)(void))
             device.snaplen = global_capture_opts.default_options.snaplen;
         }
         device.cfilter      = g_strdup(global_capture_opts.default_options.cfilter);
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
         if ((device.buffer = capture_dev_user_buffersize_find(if_info->name)) == -1) {
             device.buffer = global_capture_opts.default_options.buffer_size;
         }
@@ -350,7 +350,7 @@ scan_local_interfaces(void (*update_cb)(void))
             device.hidden       = FALSE;
             device.selected     = TRUE;
             device.type         = IF_PIPE;
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
             device.buffer = interface_opts.buffer_size;
 #endif
 #if defined(HAVE_PCAP_CREATE)
index 2e164770f018a77b0fe6684f6c9691f44691bb97..80a807458b2b3e0a6e81810aa9bdd281f8698d52 100644 (file)
@@ -65,7 +65,7 @@
 
 const int stat_update_interval_ = 1000; // ms
 
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 #define SHOW_BUFFER_COLUMN 1
 #endif
 
index 6248b80e575e16d4c9fa2bd063223cfd7a6526ca..a72a071193d14c327737bf50ba0ae2460a23e03e 100644 (file)
@@ -271,7 +271,7 @@ void ManageInterfacesDialog::pipeAccepted()
         device.no_addresses = 0;
         device.last_packets = 0;
         device.links        = NULL;
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
         device.buffer       = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
         device.active_dlt = -1;
@@ -535,7 +535,7 @@ void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *r
         } else {
             device.display_name = g_strdup(if_string);
         }
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
         if ((device.buffer = capture_dev_user_buffersize_find(if_string)) == -1) {
             device.buffer = global_capture_opts.default_options.buffer_size;
         }
index 9ecb7b73e1cb64b46894e2d0c26ac7c471c32886..16393af02a9a21042eeb14a933615bb6600d8d2d 100644 (file)
@@ -183,7 +183,7 @@ print_usage(gboolean for_help_option) {
 #ifdef HAVE_PCAP_CREATE
     fprintf(output, "  -I                       capture in monitor mode, if available\n");
 #endif
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
     fprintf(output, "  -B <buffer size>         size of kernel buffer (def: %dMB)\n", DEFAULT_CAPTURE_BUFFER_SIZE);
 #endif
     fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
@@ -896,9 +896,9 @@ DIAG_ON(cast-qual)
         case 'S':        /* "Sync" mode: used for following file ala tail -f */
         case 'w':        /* Write to capture file xxx */
         case 'y':        /* Set the pcap data link type */
-#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
+#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
         case 'B':        /* Buffer size */
-#endif /* _WIN32 or HAVE_PCAP_CREATE */
+#endif
 #ifdef HAVE_LIBPCAP
             status = capture_opts_add_opt(&global_capture_opts, opt, optarg,
                                           &start_capture);