diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 20:34:10 +0000 |
commit | e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch) | |
tree | 68cb5ef9081156392f1dd62a00c6ccc1451b93df /ui/qt/scsi_service_response_time_dialog.cpp | |
parent | Initial commit. (diff) | |
download | wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip |
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/scsi_service_response_time_dialog.cpp')
-rw-r--r-- | ui/qt/scsi_service_response_time_dialog.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/ui/qt/scsi_service_response_time_dialog.cpp b/ui/qt/scsi_service_response_time_dialog.cpp new file mode 100644 index 0000000..807235e --- /dev/null +++ b/ui/qt/scsi_service_response_time_dialog.cpp @@ -0,0 +1,86 @@ +/* scsi_service_response_time_dialog.cpp + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "scsi_service_response_time_dialog.h" + +#include <algorithm> +#include <stdio.h> + +#include <epan/srt_table.h> +#include <epan/conversation.h> +#include <epan/dissectors/packet-scsi.h> + +#include <ui/qt/utils/qt_ui_utils.h> + +#include <QComboBox> +#include <QHBoxLayout> +#include <QLabel> + +ScsiServiceResponseTimeDialog::ScsiServiceResponseTimeDialog(QWidget &parent, CaptureFile &cf, struct register_srt *srt, const QString filter) : + ServiceResponseTimeDialog(parent, cf, srt, filter) +{ + setRetapOnShow(false); + setHint(tr("<small><i>Select a command and enter a filter if desired, then press Apply.</i></small>")); + + QHBoxLayout *filter_layout = filterLayout(); + command_combo_ = new QComboBox(this); + + filter_layout->insertStretch(0, 1); + filter_layout->insertWidget(0, command_combo_); + filter_layout->insertWidget(0, new QLabel(tr("Command:"))); + + setWindowSubtitle(tr("SCSI Service Response Times")); + + QStringList commands; + commands << "SBC (disk)" << "SSC (tape)" << "MMC (cd/dvd)" << "SMC (tape robot)" << "OSD (object based)"; + command_combo_->addItems(commands); +} + +TapParameterDialog *ScsiServiceResponseTimeDialog::createScsiSrtDialog(QWidget &parent, const QString, const QString opt_arg, CaptureFile &cf) +{ + QString filter; + bool have_args = false; + QString command; + + // rpc,srt,scsi,command[,<filter> + QStringList args_l = QString(opt_arg).split(','); + if (args_l.length() > 0) { + command = args_l[0]; + if (args_l.length() > 1) { + filter = QStringList(args_l.mid(1)).join(","); + } + have_args = true; + } + + ScsiServiceResponseTimeDialog *scsi_dlg = new ScsiServiceResponseTimeDialog(parent, cf, get_srt_table_by_name("scsi"), filter); + + if (have_args) { + if (!command.isEmpty()) { + scsi_dlg->setScsiCommand(command.toInt()); + } + } + + return scsi_dlg; +} + +void ScsiServiceResponseTimeDialog::setScsiCommand(int command) +{ + command_combo_->setCurrentIndex(command); + fillTree(); +} + +void ScsiServiceResponseTimeDialog::provideParameterData() +{ + char* err; + QString command; + + command = QString(",%1").arg(command_combo_->currentIndex()); + + scsistat_param(srt_, command.toStdString().c_str(), &err); +} |