forked from osmocom/wireshark
Add Service Response Time dialog for SCSI.
SCSI requires parameter data to be passed into the tap. Provide a new dialog that can handle SCSI commands. Bug: 14144 Change-Id: I4561f251ec38753a28befee33b8b994b04b92230 Reviewed-on: https://code.wireshark.org/review/24955 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
5fcb223263
commit
386f354f87
|
@ -85,7 +85,6 @@
|
|||
#include <epan/prefs.h>
|
||||
#include <epan/conversation.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/srt_table.h>
|
||||
#include <epan/reassemble.h>
|
||||
#include <epan/expert.h>
|
||||
#include "packet-scsi.h"
|
||||
|
@ -1006,7 +1005,7 @@ scsistat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
|
|||
return 1;
|
||||
}
|
||||
|
||||
static guint
|
||||
guint
|
||||
scsistat_param(register_srt_t* srt, const char* opt_arg, char** err)
|
||||
{
|
||||
int pos = 0;
|
||||
|
|
|
@ -23,7 +23,12 @@
|
|||
#ifndef __PACKET_SCSI_H_
|
||||
#define __PACKET_SCSI_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <epan/exceptions.h>
|
||||
#include <epan/srt_table.h>
|
||||
|
||||
/* Structure containing itl nexus data :
|
||||
* The itlq nexus is a structure containing data specific
|
||||
|
@ -316,6 +321,12 @@ extern value_string_ext scsi_asc_val_ext;
|
|||
try_end_data_offset=offset_arg;
|
||||
|
||||
|
||||
WS_DLL_PUBLIC guint scsistat_param(register_srt_t* srt, const char* opt_arg, char** err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -183,6 +183,7 @@ set(WIRESHARK_QT_HEADERS
|
|||
rtp_audio_stream.h
|
||||
rtp_player_dialog.h
|
||||
rtp_stream_dialog.h
|
||||
scsi_service_response_time_dialog.h
|
||||
sctp_all_assocs_dialog.h
|
||||
sctp_assoc_analyse_dialog.h
|
||||
sctp_chunk_statistics_dialog.h
|
||||
|
@ -390,6 +391,7 @@ set(WIRESHARK_QT_SRC
|
|||
rtp_audio_stream.cpp
|
||||
rtp_player_dialog.cpp
|
||||
rtp_stream_dialog.cpp
|
||||
scsi_service_response_time_dialog.cpp
|
||||
sctp_all_assocs_dialog.cpp
|
||||
sctp_assoc_analyse_dialog.cpp
|
||||
sctp_chunk_statistics_dialog.cpp
|
||||
|
|
|
@ -313,6 +313,7 @@ MOC_HDRS = \
|
|||
rtp_audio_stream.h \
|
||||
rtp_player_dialog.h \
|
||||
rtp_stream_dialog.h \
|
||||
scsi_service_response_time_dialog.h \
|
||||
sctp_all_assocs_dialog.h \
|
||||
sctp_assoc_analyse_dialog.h \
|
||||
search_frame.h \
|
||||
|
@ -633,6 +634,7 @@ WIRESHARK_QT_SRC = \
|
|||
rtp_audio_stream.cpp \
|
||||
rtp_player_dialog.cpp \
|
||||
rtp_stream_dialog.cpp \
|
||||
scsi_service_response_time_dialog.cpp \
|
||||
sctp_all_assocs_dialog.cpp \
|
||||
sctp_assoc_analyse_dialog.cpp \
|
||||
sctp_chunk_statistics_dialog.cpp \
|
||||
|
|
|
@ -382,7 +382,7 @@ void RpcServiceResponseTimeDialog::fillVersionCombo()
|
|||
}
|
||||
}
|
||||
|
||||
void RpcServiceResponseTimeDialog::fillTree()
|
||||
void RpcServiceResponseTimeDialog::provideParameterData()
|
||||
{
|
||||
void *tap_data = NULL;
|
||||
const QString program_name = program_combo_->currentText();
|
||||
|
@ -428,8 +428,6 @@ void RpcServiceResponseTimeDialog::fillTree()
|
|||
}
|
||||
|
||||
set_srt_table_param_data(srt_, tap_data);
|
||||
|
||||
ServiceResponseTimeDialog::fillTree();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -55,13 +55,13 @@ public:
|
|||
void setOncRpcProgramAndVersion(int program, int version);
|
||||
void setRpcNameAndVersion(const QString &program_name, int version);
|
||||
|
||||
protected:
|
||||
virtual void provideParameterData();
|
||||
|
||||
public slots:
|
||||
void dceRpcProgramChanged(const QString &program_name);
|
||||
void oncRpcProgramChanged(const QString &program_name);
|
||||
|
||||
protected slots:
|
||||
virtual void fillTree();
|
||||
|
||||
private:
|
||||
RpcFamily dlg_type_;
|
||||
QComboBox *program_combo_;
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
/* scsi_service_response_time_dialog.cpp
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
||||
* Local Variables:
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
||||
* :indentSize=4:tabSize=8:noTabs=true:
|
||||
*/
|
|
@ -0,0 +1,60 @@
|
|||
/* scsi_service_response_time_dialog.h
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __SCSI_SERVICE_RESPONSE_TIME_DIALOG_H__
|
||||
#define __SCSI_SERVICE_RESPONSE_TIME_DIALOG_H__
|
||||
|
||||
#include "service_response_time_dialog.h"
|
||||
|
||||
class QComboBox;
|
||||
|
||||
class ScsiServiceResponseTimeDialog : public ServiceResponseTimeDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
ScsiServiceResponseTimeDialog(QWidget &parent, CaptureFile &cf, struct register_srt *srt, const QString filter);
|
||||
static TapParameterDialog *createScsiSrtDialog(QWidget &parent, const QString, const QString opt_arg, CaptureFile &cf);
|
||||
|
||||
void setScsiCommand(int command);
|
||||
|
||||
protected:
|
||||
virtual void provideParameterData();
|
||||
|
||||
private:
|
||||
QComboBox *command_combo_;
|
||||
};
|
||||
|
||||
#endif // __SCSI_SERVICE_RESPONSE_TIME_DIALOG_H__
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
||||
* Local Variables:
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
||||
* :indentSize=4:tabSize=8:noTabs=true:
|
||||
*/
|
|
@ -28,6 +28,7 @@
|
|||
#include <ui/service_response_time.h>
|
||||
|
||||
#include "rpc_service_response_time_dialog.h"
|
||||
#include "scsi_service_response_time_dialog.h"
|
||||
#include "wireshark_application.h"
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
@ -65,6 +66,8 @@ gboolean register_service_response_tables(const void *, void *value, void*)
|
|||
} else if (strcmp(short_name, "RPC") == 0) {
|
||||
short_name = "ONC-RPC";
|
||||
tpd_creator = RpcServiceResponseTimeDialog::createOncRpcSrtDialog;
|
||||
} else if (strcmp(short_name, "SCSI") == 0) {
|
||||
tpd_creator = ScsiServiceResponseTimeDialog::createScsiSrtDialog;
|
||||
}
|
||||
|
||||
cfg_str_to_srt_[cfg_abbr] = srt;
|
||||
|
@ -284,6 +287,8 @@ void ServiceResponseTimeDialog::fillTree()
|
|||
srt_data_.srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*));
|
||||
srt_data_.user_data = this;
|
||||
|
||||
provideParameterData();
|
||||
|
||||
srt_table_dissector_init(srt_, srt_data_.srt_array, NULL, NULL);
|
||||
|
||||
QString display_filter = displayFilter();
|
||||
|
|
|
@ -55,8 +55,11 @@ protected:
|
|||
// gtk:service_response_table.h:init_srt_table
|
||||
void addSrtTable(const struct _srt_stat_table *srt_table);
|
||||
|
||||
|
||||
virtual void provideParameterData() {}
|
||||
|
||||
protected slots:
|
||||
virtual void fillTree();
|
||||
void fillTree();
|
||||
|
||||
private:
|
||||
// Callbacks for register_tap_listener
|
||||
|
|
Loading…
Reference in New Issue