diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-09-30 16:54:40 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-10-01 17:25:28 +0000 |
commit | a013823934b437c43960959ee725858e1b75ed15 (patch) | |
tree | 3e7246733dd48eff2a320a83c01baed81b182d93 /ui/qt | |
parent | 6193e3c74b9a5d4296c67cbb138f231861d56fba (diff) |
Add the conversation hash tables internals dialog.
The GTK+ version dumps "new" and "old" hash values. It looks like
neither are valid since the code in conversation.c and
conversation_hashtables_dlg.c have diverged.
For now just dump the addresses and ports for each hash table in the Qt
UI.
Change-Id: I832522dff06da769bd4ad3ead3d541206f283a90
Reviewed-on: https://code.wireshark.org/review/10713
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/CMakeLists.txt | 3 | ||||
-rw-r--r-- | ui/qt/Makefile.am | 2 | ||||
-rw-r--r-- | ui/qt/Makefile.common | 4 | ||||
-rw-r--r-- | ui/qt/Wireshark.pro | 3 | ||||
-rw-r--r-- | ui/qt/conversation_hash_tables_dialog.cpp | 101 | ||||
-rw-r--r-- | ui/qt/conversation_hash_tables_dialog.h | 58 | ||||
-rw-r--r-- | ui/qt/conversation_hash_tables_dialog.ui | 67 | ||||
-rw-r--r-- | ui/qt/main_window.h | 1 | ||||
-rw-r--r-- | ui/qt/main_window.ui | 9 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 7 |
10 files changed, 255 insertions, 0 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt index ae7d48b57c..7be8a8fce1 100644 --- a/ui/qt/CMakeLists.txt +++ b/ui/qt/CMakeLists.txt @@ -46,6 +46,7 @@ set(WIRESHARK_QT_HEADERS column_editor_frame.h compiled_filter_output.h conversation_dialog.h + conversation_hash_tables_dialog.h decode_as_dialog.h display_filter_combo.h display_filter_edit.h @@ -190,6 +191,7 @@ set(WIRESHARK_QT_SRC column_editor_frame.cpp compiled_filter_output.cpp conversation_dialog.cpp + conversation_hash_tables_dialog.cpp decode_as_dialog.cpp display_filter_combo.cpp display_filter_edit.cpp @@ -330,6 +332,7 @@ set(WIRESHARK_QT_UI column_preferences_frame.ui column_editor_frame.ui compiled_filter_output.ui + conversation_hash_tables_dialog.ui decode_as_dialog.ui display_filter_expression_dialog.ui dissector_tables_dialog.ui diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am index f7a5c51679..5bc4678f52 100644 --- a/ui/qt/Makefile.am +++ b/ui/qt/Makefile.am @@ -152,6 +152,8 @@ column_preferences_frame.$(OBJEXT): ui_column_preferences_frame.h compiled_filter_output.$(OBJEXT): ui_compiled_filter_output.h +conversation_hash_tables_dialog.$(OBJEXT): ui_conversation_hash_tables_dialog.h + decode_as_dialog.$(OBJEXT): ui_decode_as_dialog.h display_filter_expression_dialog.$(OBJEXT): ui_display_filter_expression_dialog.h diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common index 1aefdb1c80..e12e96e90f 100644 --- a/ui/qt/Makefile.common +++ b/ui/qt/Makefile.common @@ -41,6 +41,7 @@ NODIST_GENERATED_HEADER_FILES = \ ui_column_preferences_frame.h \ ui_column_editor_frame.h \ ui_compiled_filter_output.h \ + ui_conversation_hash_tables_dialog.h \ ui_decode_as_dialog.h \ ui_display_filter_expression_dialog.h \ ui_dissector_tables_dialog.h \ @@ -161,6 +162,7 @@ MOC_HDRS = \ column_editor_frame.h \ compiled_filter_output.h \ conversation_dialog.h \ + conversation_hash_tables_dialog.h \ decode_as_dialog.h \ display_filter_combo.h \ display_filter_edit.h \ @@ -277,6 +279,7 @@ UI_FILES = \ column_preferences_frame.ui \ column_editor_frame.ui \ compiled_filter_output.ui \ + conversation_hash_tables_dialog.ui \ decode_as_dialog.ui \ display_filter_expression_dialog.ui \ dissector_tables_dialog.ui \ @@ -411,6 +414,7 @@ WIRESHARK_QT_SRC = \ column_editor_frame.cpp \ compiled_filter_output.cpp \ conversation_dialog.cpp \ + conversation_hash_tables_dialog.cpp \ decode_as_dialog.cpp \ display_filter_combo.cpp \ display_filter_edit.cpp \ diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro index 4ea7dfc530..6129b5af8d 100644 --- a/ui/qt/Wireshark.pro +++ b/ui/qt/Wireshark.pro @@ -220,6 +220,7 @@ FORMS += \ column_preferences_frame.ui \ column_editor_frame.ui \ compiled_filter_output.ui \ + conversation_hash_tables_dialog.ui \ decode_as_dialog.ui \ display_filter_expression_dialog.ui \ dissector_tables_dialog.ui \ @@ -297,6 +298,7 @@ HEADERS += $$HEADERS_WS_C \ column_editor_frame.h \ compiled_filter_output.h \ conversation_dialog.h \ + conversation_hash_tables_dialog.h \ decode_as_dialog.h \ display_filter_expression_dialog.h \ dissector_tables_dialog.h \ @@ -677,6 +679,7 @@ SOURCES += \ column_editor_frame.cpp \ compiled_filter_output.cpp \ conversation_dialog.cpp \ + conversation_hash_tables_dialog.cpp \ decode_as_dialog.cpp \ display_filter_combo.cpp \ display_filter_edit.cpp \ diff --git a/ui/qt/conversation_hash_tables_dialog.cpp b/ui/qt/conversation_hash_tables_dialog.cpp new file mode 100644 index 0000000000..15b90f5bbf --- /dev/null +++ b/ui/qt/conversation_hash_tables_dialog.cpp @@ -0,0 +1,101 @@ +/* conversation_hash_tables_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 "conversation_hash_tables_dialog.h" +#include "ui_conversation_hash_tables_dialog.h" + +#include "config.h" + +#include <glib.h> + +#include <epan/conversation.h> +#include <epan/conversation_debug.h> + +#include "qt_ui_utils.h" +#include "wireshark_application.h" + +ConversationHashTablesDialog::ConversationHashTablesDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::ConversationHashTablesDialog) +{ + ui->setupUi(this); + + setWindowTitle(wsApp->windowTitleString(tr("Dissector Tables"))); + + // XXX Use recent settings instead + if (parent) resize(parent->width() * 3 / 4, parent->height() * 3 / 4); + + QString html; + + html += "<h3>Conversation Hash Tables</h3>\n"; + + html += hashTableToHtmlTable("conversation_hashtable_exact", get_conversation_hashtable_exact()); + html += hashTableToHtmlTable("conversation_hashtable_no_addr2", get_conversation_hashtable_no_addr2()); + html += hashTableToHtmlTable("conversation_hashtable_no_port2", get_conversation_hashtable_no_port2()); + html += hashTableToHtmlTable("conversation_hashtable_no_addr2_or_port2", get_conversation_hashtable_no_addr2_or_port2()); + + ui->conversationTextEdit->setHtml(html); +} + +ConversationHashTablesDialog::~ConversationHashTablesDialog() +{ + delete ui; +} + +const QString ConversationHashTablesDialog::hashTableToHtmlTable(const QString table_name, struct _GHashTable *hash_table) +{ + GList *conversation_keys = NULL; + if (hash_table) conversation_keys = g_hash_table_get_keys(hash_table); + int num_keys = g_list_length(conversation_keys); + + QString html_table = QString("<p>%1, %2 entries</p>").arg(table_name).arg(num_keys); + if (num_keys < 1) return html_table; + + int one_em = fontMetrics().height(); + html_table += QString("<table cellpadding=\"%1\">\n").arg(one_em / 4); + + html_table += "<tr><th align=\"left\">Address 1</th><th align=\"left\">Port 1</th><th align=\"left\">Address 2</th><th align=\"left\">Port 2</th></tr>\n"; + + // XXX Add a column for the hash value. + for (GList *ck_entry = conversation_keys; ck_entry; ck_entry = g_list_next(ck_entry)) { + const conversation_key *conv_key = (conversation_key *) ck_entry->data; + html_table += QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>\n") + .arg(address_to_qstring(&conv_key->addr1)) + .arg(conv_key->port1) + .arg(address_to_qstring(&conv_key->addr2)) + .arg(conv_key->port2); + } + html_table += "</table>\n"; + return html_table; +} + +/* + * 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/conversation_hash_tables_dialog.h b/ui/qt/conversation_hash_tables_dialog.h new file mode 100644 index 0000000000..9b0752cad5 --- /dev/null +++ b/ui/qt/conversation_hash_tables_dialog.h @@ -0,0 +1,58 @@ +/* conversation_hash_tables_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 CONVERSATION_HASH_TABLES_DIALOG_H +#define CONVERSATION_HASH_TABLES_DIALOG_H + +#include <QDialog> + +namespace Ui { +class ConversationHashTablesDialog; +} + +class ConversationHashTablesDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ConversationHashTablesDialog(QWidget *parent = 0); + ~ConversationHashTablesDialog(); + +private: + Ui::ConversationHashTablesDialog *ui; + + const QString hashTableToHtmlTable(const QString table_name, struct _GHashTable *hash_table); +}; + +#endif // CONVERSATION_HASH_TABLES_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/conversation_hash_tables_dialog.ui b/ui/qt/conversation_hash_tables_dialog.ui new file mode 100644 index 0000000000..ee58791f1c --- /dev/null +++ b/ui/qt/conversation_hash_tables_dialog.ui @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ConversationHashTablesDialog</class> + <widget class="QDialog" name="ConversationHashTablesDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>640</width> + <height>450</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTextEdit" name="conversationTextEdit"/> + </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>ConversationHashTablesDialog</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>ConversationHashTablesDialog</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 99d51f0b31..7c8bc82bf6 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -392,6 +392,7 @@ private slots: void on_actionViewColorizeNewConversationRule_triggered(); void on_actionViewResizeColumns_triggered(); + void on_actionViewInternalsConversationHashTables_triggered(); void on_actionViewInternalsDissectorTables_triggered(); void openPacketDialog(bool from_reference = false); diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index ef65821ce3..e1bd077c5d 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -307,6 +307,7 @@ <property name="title"> <string>Internals</string> </property> + <addaction name="actionViewInternalsConversationHashTables"/> <addaction name="actionViewInternalsDissectorTables"/> </widget> <addaction name="actionViewMainToolbar"/> @@ -2360,6 +2361,14 @@ <string>Show or hide the packet bytes</string> </property> </action> + <action name="actionViewInternalsConversationHashTables"> + <property name="text"> + <string>Conversation Hash Tables</string> + </property> + <property name="toolTip"> + <string>Show each conversation hash table</string> + </property> + </action> <action name="actionViewInternalsDissectorTables"> <property name="text"> <string>Dissector Tables</string> diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index ccc9dfb13d..e3d7dae4e7 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -89,6 +89,7 @@ #include "color_utils.h" #include "coloring_rules_dialog.h" #include "conversation_dialog.h" +#include "conversation_hash_tables_dialog.h" #include "enabled_protocols_dialog.h" #include "decode_as_dialog.h" #include "display_filter_edit.h" @@ -2317,6 +2318,12 @@ void MainWindow::openPacketDialog(bool from_reference) } } +void MainWindow::on_actionViewInternalsConversationHashTables_triggered() +{ + ConversationHashTablesDialog *conversation_hash_tables_dlg = new ConversationHashTablesDialog(this); + conversation_hash_tables_dlg->show(); +} + void MainWindow::on_actionViewInternalsDissectorTables_triggered() { DissectorTablesDialog *dissector_tables_dlg = new DissectorTablesDialog(this); |