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>
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
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
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
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
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 \
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 \
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 \
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 \
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 \
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 \
void on_actionViewInternalsConversationHashTables_triggered();
void on_actionViewInternalsDissectorTables_triggered();
+ void on_actionViewInternalsSupportedProtocols_triggered();
void openPacketDialog(bool from_reference = false);
void on_actionViewShowPacketInNewWindow_triggered();
</property>
<addaction name="actionViewInternalsConversationHashTables"/>
<addaction name="actionViewInternalsDissectorTables"/>
+ <addaction name="actionViewInternalsSupportedProtocols"/>
</widget>
<addaction name="actionViewMainToolbar"/>
<addaction name="actionViewFilterToolbar"/>
<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>
#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"
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();
--- /dev/null
+/* 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;
+ }
+}
--- /dev/null
+/* 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:
+ */
--- /dev/null
+<?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><html><head/><body><p>Search the list of field names.</p></body></html></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><small><i>Gathering protocol information…</i></small></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>