aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-10-01 10:18:56 -0700
committerGerald Combs <gerald@wireshark.org>2015-10-01 21:11:47 +0000
commit77a918188267f8f45bc9f51aa81bb24ee27765c5 (patch)
treee20d4a2747646ad7076f17bb168a5f0c709d06ce
parentcf3d279e046053aa39846f108ad4769189211bda (diff)
Add the supported protocols internals dialog.
Includes a bonus search field. Change-Id: I0b101b725d531a59c8a2fdbfbf4690b507135546 Reviewed-on: https://code.wireshark.org/review/10731 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--ui/qt/CMakeLists.txt3
-rw-r--r--ui/qt/Makefile.am2
-rw-r--r--ui/qt/Makefile.common4
-rw-r--r--ui/qt/Wireshark.pro2
-rw-r--r--ui/qt/main_window.h1
-rw-r--r--ui/qt/main_window.ui9
-rw-r--r--ui/qt/main_window_slots.cpp7
-rw-r--r--ui/qt/supported_protocols_dialog.cpp136
-rw-r--r--ui/qt/supported_protocols_dialog.h64
-rw-r--r--ui/qt/supported_protocols_dialog.ui125
10 files changed, 353 insertions, 0 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index 7be8a8fce1..efb028110b 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -130,6 +130,7 @@ set(WIRESHARK_QT_HEADERS
service_response_time_dialog.h
simple_statistics_dialog.h
stock_icon_tool_button.h
+ supported_protocols_dialog.h
syntax_line_edit.h
tap_parameter_dialog.h
tcp_stream_dialog.h
@@ -269,6 +270,7 @@ set(WIRESHARK_QT_SRC
sparkline_delegate.cpp
stock_icon.cpp
stock_icon_tool_button.cpp
+ supported_protocols_dialog.cpp
syntax_line_edit.cpp
tap_parameter_dialog.cpp
tcp_stream_dialog.cpp
@@ -384,6 +386,7 @@ set(WIRESHARK_QT_UI
search_frame.ui
sequence_dialog.ui
splash_overlay.ui
+ supported_protocols_dialog.ui
tap_parameter_dialog.ui
tcp_stream_dialog.ui
time_shift_dialog.ui
diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am
index 5bc4678f52..e4198c630a 100644
--- a/ui/qt/Makefile.am
+++ b/ui/qt/Makefile.am
@@ -264,6 +264,8 @@ sctp_graph_byte_dialog.$(OBJEXT): ui_sctp_graph_byte_dialog.h
splash_overlay.$(OBJEXT): ui_splash_overlay.h
+supported_protocols_dialog.$(OBJEXT): ui_supported_protocols_dialog.h
+
tap_parameter_dialog.$(OBJEXT): ui_tap_parameter_dialog.h
tcp_stream_dialog.$(OBJEXT): ui_tcp_stream_dialog.h
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index e12e96e90f..ab8c3c9086 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -97,6 +97,7 @@ NODIST_GENERATED_HEADER_FILES = \
ui_search_frame.h \
ui_sequence_dialog.h \
ui_splash_overlay.h \
+ ui_supported_protocols_dialog.h \
ui_tap_parameter_dialog.h \
ui_tcp_stream_dialog.h \
ui_time_shift_dialog.h \
@@ -251,6 +252,7 @@ MOC_HDRS = \
splash_overlay.h \
stats_tree_dialog.h \
stock_icon_tool_button.h \
+ supported_protocols_dialog.h \
syntax_line_edit.h \
tap_parameter_dialog.h \
tcp_stream_dialog.h \
@@ -334,6 +336,7 @@ UI_FILES = \
search_frame.ui \
sequence_dialog.ui \
splash_overlay.ui \
+ supported_protocols_dialog.ui \
tap_parameter_dialog.ui \
tcp_stream_dialog.ui \
time_shift_dialog.ui \
@@ -497,6 +500,7 @@ WIRESHARK_QT_SRC = \
splash_overlay.cpp \
stock_icon.cpp \
stock_icon_tool_button.cpp \
+ supported_protocols_dialog.cpp \
syntax_line_edit.cpp \
tap_parameter_dialog.cpp \
tcp_stream_dialog.cpp \
diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro
index 6129b5af8d..9e6a6a1c66 100644
--- a/ui/qt/Wireshark.pro
+++ b/ui/qt/Wireshark.pro
@@ -275,6 +275,7 @@ FORMS += \
search_frame.ui \
sequence_dialog.ui \
splash_overlay.ui \
+ supported_protocols_dialog.ui \
tap_parameter_dialog.ui \
tcp_stream_dialog.ui \
time_shift_dialog.ui \
@@ -648,6 +649,7 @@ HEADERS += \
simple_dialog.h \
sparkline_delegate.h \
stock_icon_tool_button.h \
+ supported_protocols_dialog.h \
syntax_line_edit.h \
tap_parameter_dialog.h \
time_shift_dialog.h \
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index 7c8bc82bf6..8f25f1e334 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -394,6 +394,7 @@ private slots:
void on_actionViewInternalsConversationHashTables_triggered();
void on_actionViewInternalsDissectorTables_triggered();
+ void on_actionViewInternalsSupportedProtocols_triggered();
void openPacketDialog(bool from_reference = false);
void on_actionViewShowPacketInNewWindow_triggered();
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index e1bd077c5d..090d00dfef 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -309,6 +309,7 @@
</property>
<addaction name="actionViewInternalsConversationHashTables"/>
<addaction name="actionViewInternalsDissectorTables"/>
+ <addaction name="actionViewInternalsSupportedProtocols"/>
</widget>
<addaction name="actionViewMainToolbar"/>
<addaction name="actionViewFilterToolbar"/>
@@ -2377,6 +2378,14 @@
<string>Show each dissector table and its entries</string>
</property>
</action>
+ <action name="actionViewInternalsSupportedProtocols">
+ <property name="text">
+ <string>Supported Protocols</string>
+ </property>
+ <property name="toolTip">
+ <string>Show the currently supported protocols and display filter fields</string>
+ </property>
+ </action>
<action name="actionContextCopyBytesHexTextDump">
<property name="text">
<string>Bytes as Hex + ASCII Dump</string>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index e3d7dae4e7..2579f02169 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -134,6 +134,7 @@
#include "sequence_dialog.h"
#include "stats_tree_dialog.h"
#include "stock_icon.h"
+#include "supported_protocols_dialog.h"
#include "tap_parameter_dialog.h"
#include "tcp_stream_dialog.h"
#include "time_shift_dialog.h"
@@ -2330,6 +2331,12 @@ void MainWindow::on_actionViewInternalsDissectorTables_triggered()
dissector_tables_dlg->show();
}
+void MainWindow::on_actionViewInternalsSupportedProtocols_triggered()
+{
+ SupportedProtocolsDialog *supported_protocols_dlg = new SupportedProtocolsDialog(this);
+ supported_protocols_dlg->show();
+}
+
void MainWindow::on_actionViewShowPacketInNewWindow_triggered()
{
openPacketDialog();
diff --git a/ui/qt/supported_protocols_dialog.cpp b/ui/qt/supported_protocols_dialog.cpp
new file mode 100644
index 0000000000..0a1930794d
--- /dev/null
+++ b/ui/qt/supported_protocols_dialog.cpp
@@ -0,0 +1,136 @@
+/* supported_protocols_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 "supported_protocols_dialog.h"
+#include "ui_supported_protocols_dialog.h"
+
+#include "config.h"
+
+#include <glib.h>
+
+#include <epan/proto.h>
+
+#include <QTreeWidgetItem>
+#include <QElapsedTimer>
+
+#include "wireshark_application.h"
+
+enum { name_col_, filter_col_, type_col_, descr_col_ };
+
+SupportedProtocolsDialog::SupportedProtocolsDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::SupportedProtocolsDialog),
+ field_count_(0)
+{
+ ui->setupUi(this);
+ setWindowTitle(wsApp->windowTitleString(tr("Supported Protocols")));
+
+ // XXX Use recent settings instead
+ if (parent) resize(parent->width() * 3 / 4, parent->height());
+
+ // Some of our names are unreasonably long.
+ int one_em = fontMetrics().height();
+ ui->protoTreeWidget->setColumnWidth(name_col_, one_em * 15);
+ ui->protoTreeWidget->setColumnWidth(filter_col_, one_em * 10);
+ ui->protoTreeWidget->setColumnWidth(type_col_, one_em * 12);
+ ui->protoTreeWidget->setColumnWidth(descr_col_, one_em * 30);
+
+ QTimer::singleShot(0, this, SLOT(fillTree()));
+}
+
+SupportedProtocolsDialog::~SupportedProtocolsDialog()
+{
+ delete ui;
+}
+
+void SupportedProtocolsDialog::updateStatistics()
+{
+ QLocale locale = QLocale::system();
+ QString hint = tr("%1 protocols, %2 fields.")
+ .arg(locale.toString(ui->protoTreeWidget->topLevelItemCount()))
+ .arg(locale.toString(field_count_));
+ ui->hintLabel->setText(hint);
+}
+
+void SupportedProtocolsDialog::fillTree()
+{
+ void *proto_cookie;
+ QList <QTreeWidgetItem *> proto_list;
+
+ for (int proto_id = proto_get_first_protocol(&proto_cookie); proto_id != -1;
+ proto_id = proto_get_next_protocol(&proto_cookie)) {
+ protocol_t *protocol = find_protocol_by_id(proto_id);
+ QTreeWidgetItem *proto_ti = new QTreeWidgetItem();
+ proto_ti->setText(name_col_, proto_get_protocol_short_name(protocol));
+ proto_ti->setText(filter_col_, proto_get_protocol_filter_name(proto_id));
+ // type_col_ empty
+ proto_ti->setText(descr_col_, proto_get_protocol_long_name(protocol));
+ proto_ti->setData(name_col_, Qt::UserRole, proto_id);
+ proto_list << proto_ti;
+ }
+
+ updateStatistics();
+ ui->protoTreeWidget->invisibleRootItem()->addChildren(proto_list);
+ ui->protoTreeWidget->sortByColumn(name_col_, Qt::AscendingOrder);
+
+ foreach (QTreeWidgetItem *proto_ti, proto_list) {
+ void *field_cookie;
+ int proto_id = proto_ti->data(name_col_, Qt::UserRole).toInt();
+ QList <QTreeWidgetItem *> field_list;
+ for (header_field_info *hfinfo = proto_get_first_protocol_field(proto_id, &field_cookie); hfinfo != NULL;
+ hfinfo = proto_get_next_protocol_field(proto_id, &field_cookie)) {
+ if (hfinfo->same_name_prev_id != -1) continue;
+
+ QTreeWidgetItem *field_ti = new QTreeWidgetItem();
+ field_ti->setText(name_col_, hfinfo->name);
+ field_ti->setText(filter_col_, hfinfo->abbrev);
+ field_ti->setText(type_col_, ftype_pretty_name(hfinfo->type));
+ field_ti->setText(descr_col_, hfinfo->blurb);
+ field_list << field_ti;
+
+ field_count_++;
+ if (field_count_ % 1000 == 0) updateStatistics();
+ }
+ std::sort(field_list.begin(), field_list.end());
+ proto_ti->addChildren(field_list);
+ }
+
+ updateStatistics();
+ ui->protoTreeWidget->sortByColumn(name_col_, Qt::AscendingOrder);
+}
+
+// Copied from DisplayFilterExpressionDialog
+void SupportedProtocolsDialog::on_searchLineEdit_textChanged(const QString &search_re)
+{
+ QTreeWidgetItemIterator it(ui->protoTreeWidget);
+ QRegExp regex(search_re, Qt::CaseInsensitive);
+ while (*it) {
+ bool hidden = true;
+ if (search_re.isEmpty() || (*it)->text(0).contains(regex)) {
+ hidden = false;
+ }
+ (*it)->setHidden(hidden);
+ if (!hidden && (*it)->parent()) {
+ (*it)->parent()->setHidden(false);
+ }
+ ++it;
+ }
+}
diff --git a/ui/qt/supported_protocols_dialog.h b/ui/qt/supported_protocols_dialog.h
new file mode 100644
index 0000000000..1dd8ea2046
--- /dev/null
+++ b/ui/qt/supported_protocols_dialog.h
@@ -0,0 +1,64 @@
+/* supported_protocols_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 SUPPORTED_PROTOCOLS_DIALOG_H
+#define SUPPORTED_PROTOCOLS_DIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class SupportedProtocolsDialog;
+}
+
+class SupportedProtocolsDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit SupportedProtocolsDialog(QWidget *parent = 0);
+ ~SupportedProtocolsDialog();
+
+private:
+ Ui::SupportedProtocolsDialog *ui;
+
+ int field_count_;
+ void updateStatistics();
+
+private slots:
+ void fillTree();
+
+ void on_searchLineEdit_textChanged(const QString &search_re);
+};
+
+#endif // SUPPORTED_PROTOCOLS_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:
+ */
diff --git a/ui/qt/supported_protocols_dialog.ui b/ui/qt/supported_protocols_dialog.ui
new file mode 100644
index 0000000000..fd1c6a2eb1
--- /dev/null
+++ b/ui/qt/supported_protocols_dialog.ui
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SupportedProtocolsDialog</class>
+ <widget class="QDialog" name="SupportedProtocolsDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>540</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeWidget" name="protoTreeWidget">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Filter</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="searchLabel">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Search the list of field names.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Search:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="searchLineEdit"/>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="hintLabel">
+ <property name="text">
+ <string>&lt;small&gt;&lt;i&gt;Gathering protocol information…&lt;/i&gt;&lt;/small&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>SupportedProtocolsDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>SupportedProtocolsDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>