summaryrefslogtreecommitdiff
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-11-22 01:07:36 +0000
committerGerald Combs <gerald@wireshark.org>2013-11-22 01:07:36 +0000
commit78266fe17eb7cf0cc6e793d2202a716fdeb77e4b (patch)
tree1a43676b46c9a684bf76709985de54081260b747 /ui/qt
parent70709e1b3566afd6054c1a63edfa3b053344026e (diff)
downloadwireshark-78266fe17eb7cf0cc6e793d2202a716fdeb77e4b.tar.gz
Add an initial "Decode As" dialog. Currently read-only.
Fixup some of the Statistics menu items. svn path=/trunk/; revision=53499
Diffstat (limited to 'ui/qt')
-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/QtShark.pro3
-rw-r--r--ui/qt/decode_as_dialog.cpp167
-rw-r--r--ui/qt/decode_as_dialog.h76
-rw-r--r--ui/qt/decode_as_dialog.ui170
-rw-r--r--ui/qt/main_window.h2
-rw-r--r--ui/qt/main_window.ui18
-rw-r--r--ui/qt/main_window_slots.cpp9
-rw-r--r--ui/qt/wireshark_application.cpp4
11 files changed, 454 insertions, 4 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index e1412ef494..587600bc22 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -37,6 +37,7 @@ set(WIRESHARK_QT_HEADERS
color_dialog.h
color_utils.h
column_preferences_frame.h
+ decode_as_dialog.h
display_filter_combo.h
display_filter_edit.h
elided_label.h
@@ -102,6 +103,7 @@ set(WIRESHARK_QT_SRC
color_utils.cpp
capture_preferences_frame.cpp
column_preferences_frame.cpp
+ decode_as_dialog.cpp
display_filter_combo.cpp
display_filter_edit.cpp
elided_label.cpp
@@ -167,6 +169,7 @@ set(DIRTY_FILES
set(WIRESHARK_QT_UI
capture_preferences_frame.ui
column_preferences_frame.ui
+ decode_as_dialog.ui
export_object_dialog.ui
file_set_dialog.ui
filter_expressions_preferences_frame.ui
diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am
index 36b3946668..855dea6074 100644
--- a/ui/qt/Makefile.am
+++ b/ui/qt/Makefile.am
@@ -128,6 +128,8 @@ capture_preferences_frame.cpp capture_preferences_frame.h: ui_capture_preference
column_preferences_frame.cpp column_preferences_frame.h: ui_column_preferences_frame.h
+decode_as_dialog.cpp decode_as_dialog.h: ui_decode_as_dialog.h
+
export_object_dialog.cpp export_object_dialog.h: ui_export_object_dialog.h
file_set_dialog.cpp file_set_dialog.h: ui_file_set_dialog.h
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index 73d6f9870e..62c5aa5f0a 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -33,6 +33,7 @@ GENERATED_HEADER_FILES =
NODIST_GENERATED_HEADER_FILES = \
ui_capture_preferences_frame.h \
ui_column_preferences_frame.h \
+ ui_decode_as_dialog.h \
ui_export_object_dialog.h \
ui_file_set_dialog.h \
ui_filter_expressions_preferences_frame.h \
@@ -106,6 +107,7 @@ MOC_HDRS = \
color_utils.h \
capture_preferences_frame.h \
column_preferences_frame.h \
+ decode_as_dialog.h \
display_filter_combo.h \
display_filter_edit.h \
elided_label.h \
@@ -159,6 +161,7 @@ MOC_HDRS = \
UI_FILES = \
capture_preferences_frame.ui \
column_preferences_frame.ui \
+ decode_as_dialog.ui \
export_object_dialog.ui \
file_set_dialog.ui \
filter_expressions_preferences_frame.ui \
@@ -247,6 +250,7 @@ WIRESHARK_QT_SRC = \
color_utils.cpp \
capture_preferences_frame.cpp \
column_preferences_frame.cpp \
+ decode_as_dialog.cpp \
display_filter_combo.cpp \
display_filter_edit.cpp \
elided_label.cpp \
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index b571c27d7c..7e0a7a2e8f 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -224,6 +224,7 @@ HEADERS_WS_C = \
FORMS += \
capture_preferences_frame.ui \
column_preferences_frame.ui \
+ decode_as_dialog.ui \
export_object_dialog.ui \
file_set_dialog.ui \
filter_expressions_preferences_frame.ui \
@@ -254,6 +255,7 @@ HEADERS += $$HEADERS_WS_C \
accordion_frame.h \
capture_preferences_frame.h \
column_preferences_frame.h \
+ decode_as_dialog.h \
elided_label.h \
export_dissection_dialog.h \
export_object_dialog.h \
@@ -549,6 +551,7 @@ SOURCES += \
color_dialog.cpp \
color_utils.cpp \
column_preferences_frame.cpp \
+ decode_as_dialog.cpp \
display_filter_combo.cpp \
display_filter_edit.cpp \
elided_label.cpp \
diff --git a/ui/qt/decode_as_dialog.cpp b/ui/qt/decode_as_dialog.cpp
new file mode 100644
index 0000000000..9e6c65b1d8
--- /dev/null
+++ b/ui/qt/decode_as_dialog.cpp
@@ -0,0 +1,167 @@
+/* stats_tree_dialog.h
+ *
+ * $Id$
+ *
+ * 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 "decode_as_dialog.h"
+#include "ui_decode_as_dialog.h"
+
+#include "epan/decode_as.h"
+#include "epan/dissectors/packet-dcerpc.h"
+
+#include "wireshark_application.h"
+
+#include <QTreeWidgetItem>
+
+#include <QDebug>
+
+const int field_col_ = 0;
+const int value_col_ = 1;
+const int default_col_ = 2;
+const int current_col_ = 3;
+
+DecodeAsDialog::DecodeAsDialog(QWidget *parent, capture_file *cf) :
+ QDialog(parent),
+ ui(new Ui::DecodeAsDialog),
+ cap_file_(cf)
+{
+ ui->setupUi(this);
+
+ connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(fillTable()));
+ fillTable();
+}
+
+DecodeAsDialog::~DecodeAsDialog()
+{
+ delete ui;
+}
+
+void DecodeAsDialog::setCaptureFile(capture_file *cf)
+{
+ cap_file_ = cf;
+ fillTable();
+}
+
+void DecodeAsDialog::fillTable()
+{
+ ui->decodeAsTreeWidget->clear();
+ dissector_all_tables_foreach_changed(buildChangedList, this);
+ decode_dcerpc_add_show_list(buildDceRpcChangedList, this);
+}
+
+void DecodeAsDialog::buildChangedList(const gchar *table_name, ftenum_t selector_type, gpointer key, gpointer value, gpointer user_data)
+{
+ DecodeAsDialog *da_dlg = (DecodeAsDialog *)user_data;
+ if (!da_dlg) return;
+
+ dissector_handle_t default_dh, current_dh;
+ QString value_str;
+ QString default_proto_name = "(none)", current_proto_name = "(none)";
+ QTreeWidgetItem *ti = new QTreeWidgetItem();
+
+ current_dh = dtbl_entry_get_handle((dtbl_entry_t *)value);
+ if (current_dh) {
+ current_proto_name = dissector_handle_get_short_name(current_dh);
+ }
+ default_dh = dtbl_entry_get_initial_handle((dtbl_entry_t *)value);
+ if (default_dh) {
+ default_proto_name = dissector_handle_get_short_name(default_dh);
+ }
+
+ switch (selector_type) {
+
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ switch (get_dissector_table_base(table_name)) {
+
+ case BASE_DEC:
+ value_str = QString::number(GPOINTER_TO_UINT(key));
+ break;
+
+ case BASE_HEX:
+ switch (get_dissector_table_selector_type(table_name)) {
+
+ case FT_UINT8:
+ value_str = QString("%1").arg(GPOINTER_TO_UINT(key), 2, 16, QChar('0'));
+ break;
+
+ case FT_UINT16:
+ value_str = QString("%1").arg(GPOINTER_TO_UINT(key), 4, 16, QChar('0'));
+ break;
+
+ case FT_UINT24:
+ value_str = QString("%1").arg(GPOINTER_TO_UINT(key), 6, 16, QChar('0'));
+ break;
+
+ case FT_UINT32:
+ value_str = QString("%1").arg(GPOINTER_TO_UINT(key), 8, 16, QChar('0'));
+ break;
+
+ default:
+ g_assert_not_reached();
+ break;
+ }
+ break;
+
+ case BASE_OCT:
+ value_str = QString::number(GPOINTER_TO_UINT(key), 8);
+ break;
+ }
+ break;
+
+ case FT_STRING:
+ case FT_STRINGZ:
+ value_str = (char *)key;
+ break;
+
+ default:
+ g_assert_not_reached();
+ break;
+ }
+
+ ti->setText(field_col_, get_dissector_table_ui_name(table_name));
+ ti->setText(value_col_, value_str);
+ ti->setText(default_col_, default_proto_name);
+ ti->setText(current_col_, current_proto_name);
+
+ da_dlg->ui->decodeAsTreeWidget->addTopLevelItem(ti);
+}
+
+void DecodeAsDialog::buildDceRpcChangedList(gpointer data, gpointer user_data)
+{
+ decode_dcerpc_bind_values_t *binding = (decode_dcerpc_bind_values_t *)data;
+ qDebug() << "=bdcecl" << binding->ifname;
+}
+
+/*
+ * 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/decode_as_dialog.h b/ui/qt/decode_as_dialog.h
new file mode 100644
index 0000000000..207214355a
--- /dev/null
+++ b/ui/qt/decode_as_dialog.h
@@ -0,0 +1,76 @@
+/* stats_tree_dialog.h
+ *
+ * $Id$
+ *
+ * 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 DECODE_AS_DIALOG_H
+#define DECODE_AS_DIALOG_H
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "cfile.h"
+
+#include <QDialog>
+
+namespace Ui {
+class DecodeAsDialog;
+}
+
+class DecodeAsDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit DecodeAsDialog(QWidget *parent = 0, capture_file *cf = NULL);
+ ~DecodeAsDialog();
+
+public slots:
+ void setCaptureFile(capture_file *cf);
+
+private:
+ Ui::DecodeAsDialog *ui;
+
+ capture_file *cap_file_;
+
+ static void buildChangedList(const gchar *table_name, ftenum_t selector_type,
+ gpointer key, gpointer value, gpointer user_data);
+ static void buildDceRpcChangedList(gpointer data, gpointer user_data);
+
+private slots:
+ void fillTable();
+};
+
+#endif // DECODE_AS_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/decode_as_dialog.ui b/ui/qt/decode_as_dialog.ui
new file mode 100644
index 0000000000..ad6eee0617
--- /dev/null
+++ b/ui/qt/decode_as_dialog.ui
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DecodeAsDialog</class>
+ <widget class="QDialog" name="DecodeAsDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>750</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Wireshark: Decode As</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeWidget" name="decodeAsTreeWidget">
+ <column>
+ <property name="text">
+ <string>Field</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Default</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Current</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1">
+ <item>
+ <widget class="QToolButton" name="newToolButton">
+ <property name="toolTip">
+ <string>Create a new profile using default settings.</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="deleteToolButton">
+ <property name="toolTip">
+ <string>Remove this profile.</string>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="copyToolButton">
+ <property name="toolTip">
+ <string>Copy this profile.</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/stock/copy-8.png</normaloff>:/stock/copy-8.png</iconset>
+ </property>
+ </widget>
+ </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>
+ <item>
+ <widget class="ElidedLabel" name="pathLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ElidedLabel</class>
+ <extends>QLabel</extends>
+ <header>elided_label.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>DecodeAsDialog</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>DecodeAsDialog</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>
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index c6ac5219ca..a296680a4d 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -277,6 +277,8 @@ private slots:
void on_actionAnalyzePAFAndNotSelected_triggered();
void on_actionAnalyzePAFOrNotSelected_triggered();
+ void on_actionAnalyzeDecodeAs_triggered();
+
void openFollowStreamDialog(follow_type_t type);
void on_actionAnalyzeFollowTCPStream_triggered();
void on_actionAnalyzeFollowUDPStream_triggered();
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index 92574efde4..c6fcb5cb38 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -309,6 +309,8 @@
<addaction name="menuApplyAsFilter"/>
<addaction name="menuPrepareAFilter"/>
<addaction name="separator"/>
+ <addaction name="actionAnalyzeDecodeAs"/>
+ <addaction name="separator"/>
<addaction name="actionAnalyzeFollowTCPStream"/>
<addaction name="actionAnalyzeFollowUDPStream"/>
<addaction name="actionAnalyzeFollowSSLStream"/>
@@ -349,17 +351,17 @@
</widget>
<addaction name="actionSummary"/>
<addaction name="actionProtocol_Hierarchy"/>
- <addaction name="actionStatisticsFlowGraph"/>
- <addaction name="menuTcpStreamGraphs"/>
+ <addaction name="actionStatisticsPacketLen"/>
<addaction name="separator"/>
<addaction name="separator"/>
<addaction name="actionStatisticsANCP"/>
<addaction name="menuBACnet"/>
<addaction name="actionStatisticsCollectd"/>
+ <addaction name="actionStatisticsFlowGraph"/>
<addaction name="actionStatisticsHART_IP"/>
<addaction name="menuHTTP"/>
- <addaction name="actionStatisticsPacketLen"/>
<addaction name="actionStatisticsSametime"/>
+ <addaction name="menuTcpStreamGraphs"/>
</widget>
<widget class="QMenu" name="menuTelephony">
<property name="title">
@@ -1360,7 +1362,7 @@
</action>
<action name="actionStatisticsFlowGraph">
<property name="text">
- <string>Flow Graph...</string>
+ <string>Flow Graph</string>
</property>
<property name="toolTip">
<string>Flow sequence diagram</string>
@@ -1494,6 +1496,14 @@
<string>UCP message statistics</string>
</property>
</action>
+ <action name="actionAnalyzeDecodeAs">
+ <property name="text">
+ <string>Decode &amp;As...</string>
+ </property>
+ <property name="toolTip">
+ <string>Change the way packets are dissected</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index d03511a15c..9e30d8953b 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -70,6 +70,7 @@
#endif
#include "capture_file_dialog.h"
+#include "decode_as_dialog.h"
#include "export_object_dialog.h"
#include "packet_comment_dialog.h"
#include "preferences_dialog.h"
@@ -1740,6 +1741,14 @@ void MainWindow::on_actionAnalyzePAFOrNotSelected_triggered()
matchSelectedFilter(MatchSelectedOrNot, false, false);
}
+void MainWindow::on_actionAnalyzeDecodeAs_triggered()
+{
+ DecodeAsDialog *da_dialog = new DecodeAsDialog(this, cap_file_);
+ connect(this, SIGNAL(setCaptureFile(capture_file*)),
+ da_dialog, SLOT(setCaptureFile(capture_file*)));
+ da_dialog->show();
+}
+
void MainWindow::openFollowStreamDialog(follow_type_t type) {
FollowStreamDialog *fsd = new FollowStreamDialog(this, type, cap_file_);
connect(fsd, SIGNAL(updateFilter(QString&, bool)), this, SLOT(filterPackets(QString&, bool)));
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 92c22e80de..4dd0b0eac5 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -25,6 +25,7 @@
#include "wsutil/filesystem.h"
+#include "epan/decode_as.h"
#include "epan/disabled_protos.h"
#include "epan/tap.h"
#include "epan/timestamp.h"
@@ -652,6 +653,9 @@ e_prefs * WiresharkApplication::readConfigurationFiles(char **gdp_path, char **d
int pf_open_errno, pf_read_errno;
e_prefs *prefs_p;
+ /* load the decode as entries of this profile */
+ load_decode_as_entries();
+
/* Read the preference files. */
prefs_p = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
&pf_open_errno, &pf_read_errno, &pf_path);