Add a #define for the default capture buffer size and use it.
authorJeff Morriss <jeff.morriss.ws@gmail.com>
Thu, 28 Feb 2013 15:27:56 +0000 (15:27 -0000)
committerJeff Morriss <jeff.morriss.ws@gmail.com>
Thu, 28 Feb 2013 15:27:56 +0000 (15:27 -0000)
svn path=/trunk/; revision=47942

capture_opts.c
capture_opts.h
capture_sync.c
dumpcap.c
ui/gtk/capture_dlg.c
ui/iface_lists.c

index 6ab046b41b61ee66f756ae544b56c1f8ce352dc4..c297b1396f072e545fd76db2331bf70280325b8e 100644 (file)
@@ -70,7 +70,7 @@ capture_opts_init(capture_options *capture_opts, void *cf)
   capture_opts->default_options.linktype        = -1;
   capture_opts->default_options.promisc_mode    = TRUE;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
-  capture_opts->default_options.buffer_size     = 2;                /* 2 MB, In pcap-linux.c: by default request 2M for the ring buffer */
+  capture_opts->default_options.buffer_size     = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
   capture_opts->default_options.monitor_mode    = FALSE;
 #ifdef HAVE_PCAP_REMOTE
index 236d371bf5e3b5b3f600537f73b2e7d6b2a28796..adc05bd5f0e3b6c570c50d757efa9d962b65a5fc 100644 (file)
@@ -270,6 +270,9 @@ capture_opts_trim_iface(capture_options *capture_opts, const char *capture_devic
 extern void
 collect_ifaces(capture_options *capture_opts);
 
+/* Default capture buffer size in Mbytes. */
+#define DEFAULT_CAPTURE_BUFFER_SIZE 2
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index b1bc13d70d64d31bd3f33539420d04db38eb79f0..ad7378470b8786b9934926df5bf68a771d8631f3 100644 (file)
@@ -461,8 +461,7 @@ sync_pipe_start(capture_options *capture_opts) {
         }
 
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
-               /* In pcap-linux.c: by default request 2M for the ring buffer */
-        if (interface_opts.buffer_size != 2) {
+        if (interface_opts.buffer_size != DEFAULT_CAPTURE_BUFFER_SIZE) {
             argv = sync_pipe_add_arg(argv, &argc, "-B");
             g_snprintf(buffer_size, ARGV_NUMBER_LEN, "%d", interface_opts.buffer_size);
             argv = sync_pipe_add_arg(argv, &argc, buffer_size);
index 025337c2c92417d29acda55ac74f3100e8406c76..fe93f1485aef710a3b98bfc809dbf1b37ba1edfd 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -452,7 +452,7 @@ print_usage(gboolean print_ver)
     fprintf(output, "  -I                       capture in monitor mode, if available\n");
 #endif
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
-    fprintf(output, "  -B <buffer size>         size of kernel buffer in MB (def: 2MB)\n");
+    fprintf(output, "  -B <buffer size>         size of kernel buffer in MB (def: %dMB)\n", DEFAULT_CAPTURE_BUFFER_SIZE);
 #endif
     fprintf(output, "  -y <link type>           link layer type (def: first appropriate)\n");
     fprintf(output, "  -D                       print list of interfaces and exit\n");
index 85adc27c64e9f562126bb75238303a88b5618139..8f92512a70eb3de8f392800038460ea7e4519a01 100644 (file)
@@ -2590,7 +2590,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum
   device.snaplen = 65535;
   device.cfilter = NULL;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
-  device.buffer = 2;
+  device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
 
   model = gtk_tree_view_get_model(view);
@@ -3370,7 +3370,7 @@ add_pipe_cb(gpointer w _U_)
     device.last_packets = 0;
     device.links        = NULL;
 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
-    device.buffer       = 2;
+    device.buffer       = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
     device.active_dlt   = -1;
     device.locked       = FALSE;
index e7fd853ae339e799e4d19e4d2722051675ab845e..b0537d251dd18b3b52e6b456b00bde93af299d36 100644 (file)
@@ -247,7 +247,7 @@ scan_local_interfaces(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)
-        device.buffer = 2;
+        device.buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
 #endif
 
         if (global_capture_opts.ifaces->len > 0) {