diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-02 19:17:12 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-12-02 19:17:12 +0000 |
commit | 93f15d640cc3d00cd76bdd054d998e8cd2885eac (patch) | |
tree | d8b2617b828a814cfdc53a29a739ae19ec966985 | |
parent | 5e7b58ab94cce08497fef59b167191ed26e055b2 (diff) |
Specify SI units for the max filesize autostop condition. For now, keep the capture buffer size in IEC units, but document it as such.
#BACKPORT(1.10, 1.8(?))
svn path=/trunk/; revision=53728
-rw-r--r-- | capture_opts.c | 4 | ||||
-rw-r--r-- | doc/dumpcap.pod | 14 | ||||
-rw-r--r-- | doc/tshark.pod | 14 | ||||
-rw-r--r-- | doc/wireshark.pod.template | 18 | ||||
-rw-r--r-- | dumpcap.c | 14 | ||||
-rw-r--r-- | ui/gtk/capture_dlg.c | 36 | ||||
-rw-r--r-- | ui/gtk/prefs_capture.c | 4 |
7 files changed, 52 insertions, 52 deletions
diff --git a/capture_opts.c b/capture_opts.c index 089d4d0cf5..f7c7104297 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -110,7 +110,7 @@ capture_opts_init(capture_options *capture_opts) capture_opts->has_autostop_packets = FALSE; capture_opts->autostop_packets = 0; capture_opts->has_autostop_filesize = FALSE; - capture_opts->autostop_filesize = 1024; /* 1 MiB */ + capture_opts->autostop_filesize = 1000; /* 1 MB */ capture_opts->has_autostop_duration = FALSE; capture_opts->autostop_duration = 60; /* 1 min */ capture_opts->capture_comment = NULL; @@ -217,7 +217,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio g_log(log_domain, log_level, "AutostopFiles (%u) : %u", capture_opts->has_autostop_files, capture_opts->autostop_files); g_log(log_domain, log_level, "AutostopPackets (%u) : %u", capture_opts->has_autostop_packets, capture_opts->autostop_packets); - g_log(log_domain, log_level, "AutostopFilesize(%u) : %u (KiB)", capture_opts->has_autostop_filesize, capture_opts->autostop_filesize); + g_log(log_domain, log_level, "AutostopFilesize(%u) : %u (KB)", capture_opts->has_autostop_filesize, capture_opts->autostop_filesize); g_log(log_domain, log_level, "AutostopDuration(%u) : %u", capture_opts->has_autostop_duration, capture_opts->autostop_duration); } diff --git a/doc/dumpcap.pod b/doc/dumpcap.pod index dc2ef1df66..42e5d54f42 100644 --- a/doc/dumpcap.pod +++ b/doc/dumpcap.pod @@ -68,7 +68,7 @@ B<duration>:I<value> Stop writing to a capture file after I<value> seconds have elapsed. B<filesize>:I<value> Stop writing to a capture file after it reaches a size of -I<value> KiB. If this option is used together with the -b option, dumpcap will +I<value> kB. If this option is used together with the -b option, dumpcap will stop writing to the current capture file and switch to the next one if filesize is reached. Note that the filesize is limited to a maximum value of 2 GiB. @@ -99,7 +99,7 @@ B<duration>:I<value> switch to the next file after I<value> seconds have elapsed, even if the current file is not completely filled up. B<filesize>:I<value> switch to the next file after it reaches a size of -I<value> KiB. Note that the filesize is limited to a maximum value of 2 GiB. +I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB. B<files>:I<value> begin again with the first file after I<value> number of files were written (form a ring buffer). This value must be less than 100000. @@ -110,16 +110,16 @@ go to the next file. It should be noted that each B<-b> parameter takes exactly one criterion; to specify two criterion, each must be preceded by the B<-b> option. -Example: B<-b filesize:1024 -b files:5> results in a ring buffer of five files -of size one megabyte. +Example: B<-b filesize:1000 -b files:5> results in a ring buffer of five files +of size one megabyte each. =item -B E<lt>capture buffer sizeE<gt> -Set capture buffer size (in MB, default is 2MB). This is used by the +Set capture buffer size (in MiB, default is 2 MiB). This is used by the capture driver to buffer packet data until that data can be written to disk. If you encounter packet drops while capturing, try to increase this size. Note that, while B<Dumpcap> attempts to set the buffer size -to 2MB by default, and can be told to set it to a larger value, the +to 2 MiB by default, and can be told to set it to a larger value, the system or interface on which you're capturing might silently limit the capture buffer size to a lower value or raise it to a higher value. @@ -132,7 +132,7 @@ occurrence of the B<-i> option, it sets the default capture buffer size. If used after an B<-i> option, it sets the capture buffer size for the interface specified by the last B<-i> option occurring before this option. If the capture buffer size is not set specifically, -the default capture buffer size is used if provided. +the default capture buffer size is used instead. =item -c E<lt>capture packet countE<gt> diff --git a/doc/tshark.pod b/doc/tshark.pod index 10a3feb4bb..15723ea219 100644 --- a/doc/tshark.pod +++ b/doc/tshark.pod @@ -165,7 +165,7 @@ B<duration>:I<value> Stop writing to a capture file after I<value> seconds have elapsed. B<filesize>:I<value> Stop writing to a capture file after it reaches a size of -I<value> KiB. If this option is used together with the -b option, B<TShark> +I<value> kB. If this option is used together with the -b option, B<TShark> will stop writing to the current capture file and switch to the next one if filesize is reached. When reading a capture file, B<TShark> will stop reading the file after the number of bytes read exceeds this number (the complete @@ -199,7 +199,7 @@ B<duration>:I<value> switch to the next file after I<value> seconds have elapsed, even if the current file is not completely filled up. B<filesize>:I<value> switch to the next file after it reaches a size of -I<value> KiB. Note that the filesize is limited to a maximum value of 2 GiB. +I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB. B<files>:I<value> begin again with the first file after I<value> number of files were written (form a ring buffer). This value must be less than 100000. @@ -210,16 +210,16 @@ go to the next file. It should be noted that each B<-b> parameter takes exactly one criterion; to specify two criterion, each must be preceded by the B<-b> option. -Example: B<-b filesize:1024 -b files:5> results in a ring buffer of five files -of size one megabyte. +Example: B<-b filesize:1000 -b files:5> results in a ring buffer of five files +of size one megabyte each. =item -B E<lt>capture buffer sizeE<gt> -Set capture buffer size (in MB, default is 2MB). This is used by the +Set capture buffer size (in MiB, default is 2 MiB). This is used by the capture driver to buffer packet data until that data can be written to disk. If you encounter packet drops while capturing, try to increase this size. Note that, while B<Tshark> attempts to set the buffer size -to 2MB by default, and can be told to set it to a larger value, the +to 2 MiB by default, and can be told to set it to a larger value, the system or interface on which you're capturing might silently limit the capture buffer size to a lower value or raise it to a higher value. @@ -232,7 +232,7 @@ occurrence of the B<-i> option, it sets the default capture buffer size. If used after an B<-i> option, it sets the capture buffer size for the interface specified by the last B<-i> option occurring before this option. If the capture buffer size is not set specifically, -the default capture buffer size is used if provided. +the default capture buffer size is used instead. =item -c E<lt>capture packet countE<gt> diff --git a/doc/wireshark.pod.template b/doc/wireshark.pod.template index 8a0e584918..73eb0c13c1 100644 --- a/doc/wireshark.pod.template +++ b/doc/wireshark.pod.template @@ -232,7 +232,7 @@ B<duration>:I<value> Stop writing to a capture file after I<value> seconds have elapsed. B<filesize>:I<value> Stop writing to a capture file after it reaches a size of -I<value> KiB. If this option is used together with the -b option, Wireshark +I<value> kB. If this option is used together with the -b option, Wireshark will stop writing to the current capture file and switch to the next one if filesize is reached. Note that the filesize is limited to a maximum value of 2 GiB. @@ -264,7 +264,7 @@ B<duration>:I<value> switch to the next file after I<value> seconds have elapsed, even if the current file is not completely filled up. B<filesize>:I<value> switch to the next file after it reaches a size of -I<value> KiB. Note that the filesize is limited to a maximum value of 2 GiB. +I<value> kB. Note that the filesize is limited to a maximum value of 2 GiB. B<files>:I<value> begin again with the first file after I<value> number of files were written (form a ring buffer). This value must be less than 100000. @@ -275,16 +275,16 @@ go to the next file. It should be noted that each B<-b> parameter takes exactly one criterion; to specify two criterion, each must be preceded by the B<-b> option. -Example: B<-b filesize:1024 -b files:5> results in a ring buffer of five files -of size one megabyte. +Example: B<-b filesize:1000 -b files:5> results in a ring buffer of five files +of size one megabyte each. =item -B E<lt>capture buffer sizeE<gt> -Set capture buffer size (in MB, default is 2MB). This is used by the +Set capture buffer size (in MiB, default is 2 MiB). This is used by the capture driver to buffer packet data until that data can be written to disk. If you encounter packet drops while capturing, try to increase this size. Note that, while B<Wireshark> attempts to set the buffer size -to 2MB by default, and can be told to set it to a larger value, the +to 2 MiB by default, and can be told to set it to a larger value, the system or interface on which you're capturing might silently limit the capture buffer size to a lower value or raise it to a higher value. @@ -297,7 +297,7 @@ occurrence of the B<-i> option, it sets the default capture buffer size. If used after an B<-i> option, it sets the capture buffer size for the interface specified by the last B<-i> option occurring before this option. If the capture buffer size is not set specifically, -the default capture buffer size is used if provided. +the default capture buffer size is used instead. =item -c E<lt>capture packet countE<gt> @@ -2380,8 +2380,8 @@ you specify that the switch to a next file should be done after the specified time has elapsed, even if the specified capture size is not reached. The I<Ring buffer with ... files> field lets you specify the number -of files of a ring buffer. This feature will capture into to the first file -again, after the specified amount of files were used. +of files of a ring buffer. This feature will capture into the first file +again, after the specified number of files have been used. The I<Stop capture after ... files> field lets you specify the number of capture files used, until the capture is stopped. @@ -498,7 +498,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: %dMB)\n", DEFAULT_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"); fprintf(output, " -D print list of interfaces and exit\n"); @@ -2649,11 +2649,11 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld, if (interface_opts.buffer_size > 1 && pcap_setbuff(pcap_opts->pcap_h, interface_opts.buffer_size * 1024 * 1024) != 0) { sync_secondary_msg_str = g_strdup_printf( - "The capture buffer size of %dMB seems to be too high for your machine,\n" - "the default of 1MB will be used.\n" + "The capture buffer size of %d MiB seems to be too high for your machine,\n" + "the default of %d MiB will be used.\n" "\n" "Nonetheless, the capture is started.\n", - interface_opts.buffer_size); + interface_opts.buffer_size, DEFAULT_CAPTURE_BUFFER_SIZE); report_capture_error("Couldn't set the capture buffer size!", sync_secondary_msg_str); g_free(sync_secondary_msg_str); @@ -3568,11 +3568,11 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct init_capture_stop_conditions(); /* create stop conditions */ if (capture_opts->has_autostop_filesize) { - if (capture_opts->autostop_filesize > (((guint32)INT_MAX + 1) / 1024)) { - capture_opts->autostop_filesize = ((guint32)INT_MAX + 1) / 1024; + if (capture_opts->autostop_filesize > (((guint32)INT_MAX + 1) / 1000)) { + capture_opts->autostop_filesize = ((guint32)INT_MAX + 1) / 1000; } cnd_autostop_size = - cnd_new(CND_CLASS_CAPTURESIZE, (guint64)capture_opts->autostop_filesize * 1024); + cnd_new(CND_CLASS_CAPTURESIZE, (guint64)capture_opts->autostop_filesize * 1000); } if (capture_opts->has_autostop_duration) cnd_autostop_duration = diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c index 3b59739cbf..dff5ed7bb3 100644 --- a/ui/gtk/capture_dlg.c +++ b/ui/gtk/capture_dlg.c @@ -339,7 +339,7 @@ gint col_title_to_index(const gchar *name) if (strcmp(name, "Prom. Mode") == 0) return PMODE; if (strcmp(name, "Snaplen [B]") == 0) return SNAPLEN; #if defined(_WIN32) || defined(HAVE_PCAP_CREATE) - if (strcmp(name, "Buffer [MB]") == 0) return BUFFER; + if (strcmp(name, "Buffer [MiB]") == 0) return BUFFER; #endif #if defined (HAVE_PCAP_CREATE) if (strcmp(name, "Mon. Mode") == 0) return MONITOR; @@ -956,9 +956,9 @@ guint32 value) #define SIZE_UNIT_GIGABYTES 2 #define MAX_SIZE_UNITS 3 static const char *size_unit_name[MAX_SIZE_UNITS] = { - "kibibyte(s)", - "mebibyte(s)", - "gibibyte(s)" + "kilobyte(s)", + "megabyte(s)", + "gigabyte(s)" }; /* create one of the size options */ @@ -974,11 +974,11 @@ static GtkWidget *size_unit_combo_box_new(guint32 value) { /* the selected combo_box item can't be changed, once the combo_box is created, so set the matching combo_box item now */ /* gigabytes */ - if (value >= 1024 * 1024) { + if (value >= 1000 * 1000) { gtk_combo_box_set_active(GTK_COMBO_BOX(unit_combo_box), SIZE_UNIT_GIGABYTES); } else { /* megabytes */ - if (value >= 1024) { + if (value >= 1000) { gtk_combo_box_set_active(GTK_COMBO_BOX(unit_combo_box), SIZE_UNIT_MEGABYTES); } else { /* kilobytes */ @@ -988,18 +988,18 @@ static GtkWidget *size_unit_combo_box_new(guint32 value) { return unit_combo_box; } -/* convert size value from raw to displayed (e.g. 1024 Bytes -> 1 KB) */ +/* convert size value from raw to displayed (e.g. 1000 Bytes -> 1 kB) */ static guint32 size_unit_combo_box_set_value( guint32 value) { /* gigabytes */ - if (value >= 1024 * 1024) { - return value / (1024 * 1024); + if (value >= 1000 * 1000) { + return value / (1000 * 1000); } /* megabytes */ - if (value >= 1024) { - return value / (1024); + if (value >= 1000) { + return value / (1000); } /* kilobytes */ @@ -1017,22 +1017,22 @@ guint32 value) switch(unit) { case(SIZE_UNIT_KILOBYTES): - if (value > (((guint32)G_MAXINT + 1) / 1024)) { + if (value > (((guint32)G_MAXINT + 1) / 1000)) { return 0; } else { return value; } case(SIZE_UNIT_MEGABYTES): - if (value > (((guint32)G_MAXINT + 1) / (1024 * 1024))) { + if (value > (((guint32)G_MAXINT + 1) / (1000 * 1000))) { return 0; } else { - return value * 1024; + return value * 1000; } case(SIZE_UNIT_GIGABYTES): - if (value > (((guint32)G_MAXINT + 1) / (1024 * 1024 * 1024))) { + if (value > (((guint32)G_MAXINT + 1) / (1000 * 1000 * 1000))) { return 0; } else { - return value * 1024 * 1024; + return value * 1000 * 1000; } default: g_assert_not_reached(); @@ -2968,7 +2968,7 @@ void options_interface_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColum "The memory buffer size used while capturing. If you notice packet drops, you can try to increase this size."); gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_sb, FALSE, FALSE, 0); g_object_set_data(G_OBJECT(opt_edit_w), E_CAP_BUFFER_SIZE_SB_KEY, buffer_size_sb); - buffer_size_lb = gtk_label_new("megabyte(s)"); + buffer_size_lb = gtk_label_new("mebibyte(s)"); gtk_box_pack_start (GTK_BOX(buffer_size_hb), buffer_size_lb, FALSE, FALSE, 3); gtk_misc_set_alignment(GTK_MISC(buffer_size_lb), 1, 0); #ifdef HAVE_PCAP_REMOTE @@ -4714,7 +4714,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) #if defined(_WIN32) || defined(HAVE_PCAP_CREATE) renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Buffer [MB]", renderer, "text", BUFFER, NULL); + column = gtk_tree_view_column_new_with_attributes("Buffer [MiB]", renderer, "text", BUFFER, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); gtk_tree_view_column_set_reorderable(column, TRUE); g_object_set_data(G_OBJECT(column), E_MCAPTURE_COLUMNS_COL_KEY, GINT_TO_POINTER(BUFFER)); diff --git a/ui/gtk/prefs_capture.c b/ui/gtk/prefs_capture.c index c1c424b9ad..1b629a69b8 100644 --- a/ui/gtk/prefs_capture.c +++ b/ui/gtk/prefs_capture.c @@ -680,7 +680,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_) 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); - column = gtk_tree_view_column_new_with_attributes ("Default buffer size", renderer, + column = gtk_tree_view_column_new_with_attributes ("Default buffer size (MiB)", renderer, "text", BUF_COLUMN, NULL); @@ -831,7 +831,7 @@ ifopts_edit_cb(GtkWidget *w, gpointer data _U_) #endif #if defined(_WIN32) || defined(HAVE_PCAP_CREATE) - if_buffersize_lb = gtk_label_new("Default 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); gtk_widget_show(if_buffersize_lb); |