aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-10-31 10:03:04 +0100
committerAnders Broman <a.broman58@gmail.com>2018-11-09 05:55:11 +0000
commit11a9a501fb004bd3259f457714670ffb6d3d21e9 (patch)
treecf1a39471dff0d4e9b8a8da493d243eb53588954 /ui/qt
parent9b6b36beaeb2f58a209943d95c05486b72c6907f (diff)
Dumpcap+Qt: Add support for `-a packets:NUM` and `-b packets:NUM`.
Add the ability to rotate files after a specified number of packets (`-b packets:NUM`). Move some condition checks to capture_loop_write_packet_cb. Add `-a packets:NUM` in order to be consistent. It is functionally equivalent to the `-c` flag. Add a corresponding "packets" option to the Capture Interfaces dialog Output tab. Add initial tests for autostop and ringbuffer conditions. Change-Id: I66eb968927ed287deb8edb96db96d7c73526c257 Reviewed-on: https://code.wireshark.org/review/30534 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/capture_interfaces_dialog.cpp15
-rw-r--r--ui/qt/capture_interfaces_dialog.ui120
2 files changed, 88 insertions, 47 deletions
diff --git a/ui/qt/capture_interfaces_dialog.cpp b/ui/qt/capture_interfaces_dialog.cpp
index 0bef6cba84..b9dc86ff9c 100644
--- a/ui/qt/capture_interfaces_dialog.cpp
+++ b/ui/qt/capture_interfaces_dialog.cpp
@@ -549,6 +549,10 @@ void CaptureInterfacesDialog::updateInterfaces()
}
ui->gbNewFileAuto->setChecked(global_capture_opts.multi_files_on);
+ ui->PktCheckBox->setChecked(global_capture_opts.has_file_packets);
+ if (global_capture_opts.has_file_packets) {
+ ui->PktSpinBox->setValue(global_capture_opts.file_packets);
+ }
ui->MBCheckBox->setChecked(global_capture_opts.has_autostop_filesize);
ui->SecsCheckBox->setChecked(global_capture_opts.has_file_interval);
if (global_capture_opts.has_autostop_filesize) {
@@ -850,6 +854,10 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences()
break;
}
}
+ global_capture_opts.has_file_packets = ui->PktCheckBox->isChecked();
+ if (global_capture_opts.has_file_packets) {
+ global_capture_opts.file_packets = ui->PktSpinBox->value();
+ }
global_capture_opts.has_autostop_filesize = ui->MBCheckBox->isChecked();
if (global_capture_opts.has_autostop_filesize) {
global_capture_opts.autostop_filesize = ui->MBSpinBox->value();
@@ -878,9 +886,12 @@ bool CaptureInterfacesDialog::saveOptionsToPreferences()
QMessageBox::warning(this, tr("Error"),
tr("Multiple files: No capture file name given. You must specify a filename if you want to use multiple files."));
return false;
- } else if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_interval) {
+ } else if (!global_capture_opts.has_autostop_filesize &&
+ !global_capture_opts.has_file_interval &&
+ !global_capture_opts.has_file_duration &&
+ !global_capture_opts.has_file_packets) {
QMessageBox::warning(this, tr("Error"),
- tr("Multiple files: No file limit given. You must specify a file size or interval at which is switched to the next capture file\n if you want to use multiple files."));
+ tr("Multiple files: No file limit given. You must specify a file size, interval, or number of packets for each file."));
g_free(global_capture_opts.save_file);
global_capture_opts.save_file = NULL;
return false;
diff --git a/ui/qt/capture_interfaces_dialog.ui b/ui/qt/capture_interfaces_dialog.ui
index 7d3c416f27..181f5df332 100644
--- a/ui/qt/capture_interfaces_dialog.ui
+++ b/ui/qt/capture_interfaces_dialog.ui
@@ -262,10 +262,38 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="1" column="1">
- <widget class="QSpinBox" name="MBSpinBox">
+ <item row="0" column="3" rowspan="4">
+ <spacer name="horizontalSpacer_8">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="MBCheckBox">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="SecsCheckBox">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="SecsSpinBox">
<property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If the selected file size is exceeded, capturing switches to the next file.&lt;/p&gt;&lt;p&gt;PLEASE NOTE: One option MUST be selected.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>If the selected file size is exceeded, capturing switches to the next file.
+PLEASE NOTE: One option MUST be selected.</string>
</property>
<property name="wrapping">
<bool>true</bool>
@@ -284,30 +312,7 @@
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QComboBox" name="MBComboBox">
- <property name="toolTip">
- <string>If the selected file size is exceeded, capturing switches to the next file.
-PLEASE NOTE: One option MUST be selected.</string>
- </property>
- <item>
- <property name="text">
- <string>kilobytes</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>megabytes</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>gigabytes</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="2" column="2">
+ <item row="3" column="2">
<widget class="QComboBox" name="SecsComboBox">
<property name="toolTip">
<string>If the selected file size is exceeded, capturing switches to the next file.
@@ -331,10 +336,9 @@ PLEASE NOTE: One option MUST be selected.</string>
</widget>
</item>
<item row="2" column="1">
- <widget class="QSpinBox" name="SecsSpinBox">
+ <widget class="QSpinBox" name="MBSpinBox">
<property name="toolTip">
- <string>If the selected file size is exceeded, capturing switches to the next file.
-PLEASE NOTE: One option MUST be selected.</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If the selected file size is exceeded, capturing switches to the next file.&lt;/p&gt;&lt;p&gt;PLEASE NOTE: One option MUST be selected.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wrapping">
<bool>true</bool>
@@ -353,30 +357,56 @@ PLEASE NOTE: One option MUST be selected.</string>
</property>
</widget>
</item>
- <item row="0" column="3" rowspan="3">
- <spacer name="horizontalSpacer_8">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
+ <item row="2" column="2">
+ <widget class="QComboBox" name="MBComboBox">
+ <property name="toolTip">
+ <string>If the selected file size is exceeded, capturing switches to the next file.
+PLEASE NOTE: One option MUST be selected.</string>
</property>
- </spacer>
+ <item>
+ <property name="text">
+ <string>kilobytes</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>megabytes</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>gigabytes</string>
+ </property>
+ </item>
+ </widget>
</item>
<item row="1" column="0">
- <widget class="QCheckBox" name="MBCheckBox">
+ <widget class="QCheckBox" name="PktCheckBox">
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="SecsCheckBox">
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="PktSpinBox">
+ <property name="toolTip">
+ <string>Switch to the next file after the specified number of packets have been captured.</string>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::PlusMinus</enum>
+ </property>
+ <property name="maximum">
+ <number>2147483647</number>
+ </property>
+ <property name="value">
+ <number>100000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="PktLabel">
<property name="text">
- <string/>
+ <string>packets</string>
</property>
</widget>
</item>