diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-09-25 14:33:54 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-09-27 16:19:05 +0000 |
commit | 6d10efc6dd66c70110581b8c49cc3da0f0a72a25 (patch) | |
tree | 6f922060b2096a8747763eaecb13522b918d109e | |
parent | d4b3a96830d580572ac42e7d03b78c47fe34bbf2 (diff) |
Qt: Add the Dissector Tables dialog.
Add the "Internals" menu under the View menu instead of at the top level
for now at least. Add the Dissector Tables dialog there.
Change-Id: Ieb23b0015591bac196e4ef94e3443832288333f9
Reviewed-on: https://code.wireshark.org/review/10654
Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r-- | epan/disabled_protos.c | 2 | ||||
-rw-r--r-- | epan/packet.c | 8 | ||||
-rw-r--r-- | epan/packet.h | 8 | ||||
-rw-r--r-- | epan/wslua/wslua_dissector.c | 2 | ||||
-rw-r--r-- | ui/gtk/dissector_tables_dlg.c | 10 | ||||
-rw-r--r-- | ui/gtk/proto_dlg.c | 2 | ||||
-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/dissector_tables_dialog.cpp | 292 | ||||
-rw-r--r-- | ui/qt/dissector_tables_dialog.h | 74 | ||||
-rw-r--r-- | ui/qt/dissector_tables_dialog.ui | 78 | ||||
-rw-r--r-- | ui/qt/main_window.h | 2 | ||||
-rw-r--r-- | ui/qt/main_window.ui | 16 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 7 |
16 files changed, 497 insertions, 16 deletions
diff --git a/epan/disabled_protos.c b/epan/disabled_protos.c index 2a86f0c281..71bc1b97cb 100644 --- a/epan/disabled_protos.c +++ b/epan/disabled_protos.c @@ -730,7 +730,7 @@ sort_dissector_table_entries(const char *table_name _U_, } static void -sort_heur_dissector_tables(const char *table_name, heur_dissector_list_t *list, gpointer w) +sort_heur_dissector_tables(const char *table_name, struct heur_dissector_list *list, gpointer w) { if (list) { heur_dissector_table_foreach(table_name, sort_dissector_table_entries, w); diff --git a/epan/packet.c b/epan/packet.c index 25378b4846..64c3e0d913 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -2279,7 +2279,7 @@ dissector_all_heur_tables_foreach_table_func (gpointer key, const gpointer value heur_dissector_foreach_table_info_t *info; info = (heur_dissector_foreach_table_info_t *)user_data; - (*info->caller_func)((gchar*)key, (heur_dissector_list_t *)value, info->caller_data); + (*info->caller_func)((gchar*)key, (struct heur_dissector_list *)value, info->caller_data); } /* @@ -2289,10 +2289,10 @@ dissector_all_heur_tables_foreach_table_func (gpointer key, const gpointer value static void dissector_all_heur_tables_foreach_list_func (gpointer key, gpointer user_data) { - heur_dissector_list_t *list; + struct heur_dissector_list *list; heur_dissector_foreach_table_info_t *info; - list = (heur_dissector_list_t *)g_hash_table_lookup(heur_dissector_lists, key); + list = (struct heur_dissector_list *)g_hash_table_lookup(heur_dissector_lists, key); info = (heur_dissector_foreach_table_info_t *)user_data; (*info->caller_func)((gchar*)key, list, info->caller_data); } @@ -2337,7 +2337,7 @@ display_heur_dissector_table_entries(const char *table_name, } static void -dissector_dump_heur_decodes_display(const gchar *table_name, heur_dissector_list_t *listptr _U_, const gpointer user_data _U_) +dissector_dump_heur_decodes_display(const gchar *table_name, struct heur_dissector_list *listptr _U_, const gpointer user_data _U_) { heur_dissector_table_foreach(table_name, display_heur_dissector_table_entries, NULL); } diff --git a/epan/packet.h b/epan/packet.h index cd81bc2ddb..cfd3d8c66e 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -378,7 +378,7 @@ struct heur_dissector_list; typedef struct heur_dissector_list *heur_dissector_list_t; -typedef struct { +typedef struct heur_dtbl_entry { heur_dissector_t dissector; protocol_t *protocol; /* this entry's protocol */ gchar *list_name; /* the list name this entry is in the list of */ @@ -395,9 +395,9 @@ typedef struct { WS_DLL_PUBLIC heur_dissector_list_t register_heur_dissector_list(const char *name); typedef void (*DATFunc_heur) (const gchar *table_name, - heur_dtbl_entry_t *entry, gpointer user_data); -typedef void (*DATFunc_heur_table) (const gchar *table_name, - heur_dissector_list_t *table, gpointer user_data); + struct heur_dtbl_entry *entry, gpointer user_data); +typedef void (*DATFunc_heur_table) (const char *table_name, + struct heur_dissector_list *table, gpointer user_data); /** Iterate over heuristic dissectors in a table. * diff --git a/epan/wslua/wslua_dissector.c b/epan/wslua/wslua_dissector.c index 7472d76037..0a31266a36 100644 --- a/epan/wslua/wslua_dissector.c +++ b/epan/wslua/wslua_dissector.c @@ -259,7 +259,7 @@ WSLUA_CONSTRUCTOR DissectorTable_list (lua_State *L) { /* this is the DATFunc_heur_table function used for dissector_all_heur_tables_foreach_table() so we can get all heuristic dissector list names. This pushes the name into a table at stack index 1 */ static void -heur_dissector_tables_list_func(const gchar *table_name, heur_dissector_list_t *table _U_, gpointer user_data) { +heur_dissector_tables_list_func(const gchar *table_name, struct heur_dissector_list *table _U_, gpointer user_data) { dissector_tables_foreach_table_info_t *data = (dissector_tables_foreach_table_info_t*) user_data; lua_pushstring(data->L, table_name); lua_rawseti(data->L, 1, data->num); diff --git a/ui/gtk/dissector_tables_dlg.c b/ui/gtk/dissector_tables_dlg.c index 05edd7c2a6..c4aa5ddd2e 100644 --- a/ui/gtk/dissector_tables_dlg.c +++ b/ui/gtk/dissector_tables_dlg.c @@ -113,7 +113,7 @@ proto_add_to_list(dissector_tables_tree_info_t *tree_info, static void decode_proto_add_to_list (const gchar *table_name _U_, ftenum_t selector_type, - gpointer key, gpointer value _U_, gpointer user_data) + gpointer key, gpointer value, gpointer user_data) { GtkTreeStore *store; const gchar *proto_name; @@ -180,7 +180,7 @@ table_name_add_to_list(dissector_tables_tree_info_t *tree_info, static void display_heur_dissector_table_entries(const char *table_name _U_, - heur_dtbl_entry_t *dtbl_entry, gpointer user_data) + struct heur_dtbl_entry *dtbl_entry, gpointer user_data) { dissector_tables_tree_info_t *tree_info = (dissector_tables_tree_info_t*)user_data; GtkTreeStore *store; @@ -199,7 +199,7 @@ display_heur_dissector_table_entries(const char *table_name _U_, } static void -display_heur_dissector_table_names(const char *table_name, heur_dissector_list_t *list, gpointer w) +display_heur_dissector_table_names(const char *table_name, struct heur_dissector_list *list, gpointer w) { dissector_tables_trees_t *dis_tbl_trees; dissector_tables_tree_info_t *tree_info; @@ -216,7 +216,7 @@ display_heur_dissector_table_names(const char *table_name, heur_dissector_list_t } static void -display_dissector_table_names(const char *table_name, const char *ui_name, gpointer w) +display_dissector_table_names(const char *table_name, const char *ui_name, void *w) { dissector_tables_trees_t *dis_tbl_trees; dissector_tables_tree_info_t *tree_info; @@ -393,7 +393,7 @@ dissector_tables_dlg_init(void) g_signal_connect(dissector_tables_dlg_w, "destroy", G_CALLBACK(win_destroy_cb), NULL); /* Fill the table with data */ - dissector_all_tables_foreach_table(display_dissector_table_names, (gpointer)&dis_tbl_trees, NULL); + dissector_all_tables_foreach_table(display_dissector_table_names, &dis_tbl_trees, NULL); dissector_all_heur_tables_foreach_table(display_heur_dissector_table_names, (gpointer)&dis_tbl_trees, NULL); diff --git a/ui/gtk/proto_dlg.c b/ui/gtk/proto_dlg.c index 992b901040..8b378a4a68 100644 --- a/ui/gtk/proto_dlg.c +++ b/ui/gtk/proto_dlg.c @@ -531,7 +531,7 @@ populate_heur_dissector_table_entries(const char *table_name _U_, } static void -populate_heur_dissector_tables(const char *table_name, heur_dissector_list_t *list, gpointer w) +populate_heur_dissector_tables(const char *table_name, struct heur_dissector_list *list, gpointer w) { if (list) { heur_dissector_table_foreach(table_name, populate_heur_dissector_table_entries, w); diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt index f7854eeef9..5131499ee4 100644 --- a/ui/qt/CMakeLists.txt +++ b/ui/qt/CMakeLists.txt @@ -50,6 +50,7 @@ set(WIRESHARK_QT_HEADERS display_filter_combo.h display_filter_edit.h display_filter_expression_dialog.h + dissector_tables_dialog.h elided_label.h enabled_protocols_dialog.h endpoint_dialog.h @@ -192,6 +193,7 @@ set(WIRESHARK_QT_SRC display_filter_combo.cpp display_filter_edit.cpp display_filter_expression_dialog.cpp + dissector_tables_dialog.cpp elided_label.cpp enabled_protocols_dialog.cpp endpoint_dialog.cpp @@ -326,6 +328,7 @@ set(WIRESHARK_QT_UI compiled_filter_output.ui decode_as_dialog.ui display_filter_expression_dialog.ui + dissector_tables_dialog.ui enabled_protocols_dialog.ui expert_info_dialog.ui export_object_dialog.ui diff --git a/ui/qt/Makefile.am b/ui/qt/Makefile.am index e3df64d4a4..f7a5c51679 100644 --- a/ui/qt/Makefile.am +++ b/ui/qt/Makefile.am @@ -156,6 +156,8 @@ decode_as_dialog.$(OBJEXT): ui_decode_as_dialog.h display_filter_expression_dialog.$(OBJEXT): ui_display_filter_expression_dialog.h +dissector_tables_dialog.$(OBJEXT): ui_dissector_tables_dialog.h + enabled_protocols_dialog.$(OBJEXT): ui_enabled_protocols_dialog.h expert_info_dialog.$(OBJEXT): ui_expert_info_dialog.h diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common index 87956cd51c..ae27c10472 100644 --- a/ui/qt/Makefile.common +++ b/ui/qt/Makefile.common @@ -43,6 +43,7 @@ NODIST_GENERATED_HEADER_FILES = \ ui_compiled_filter_output.h \ ui_decode_as_dialog.h \ ui_display_filter_expression_dialog.h \ + ui_dissector_tables_dialog.h \ ui_enabled_protocols_dialog.h \ ui_expert_info_dialog.h \ ui_export_object_dialog.h \ @@ -164,6 +165,7 @@ MOC_HDRS = \ display_filter_combo.h \ display_filter_edit.h \ display_filter_expression_dialog.h \ + dissector_tables_dialog.h \ elided_label.h \ enabled_protocols_dialog.h \ endpoint_dialog.h \ @@ -276,6 +278,7 @@ UI_FILES = \ compiled_filter_output.ui \ decode_as_dialog.ui \ display_filter_expression_dialog.ui \ + dissector_tables_dialog.ui \ enabled_protocols_dialog.ui \ expert_info_dialog.ui \ export_object_dialog.ui \ @@ -411,6 +414,7 @@ WIRESHARK_QT_SRC = \ display_filter_combo.cpp \ display_filter_edit.cpp \ display_filter_expression_dialog.cpp \ + dissector_tables_dialog.cpp \ elided_label.cpp \ enabled_protocols_dialog.cpp \ endpoint_dialog.cpp \ diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro index 33c8228b13..5ed21fe398 100644 --- a/ui/qt/Wireshark.pro +++ b/ui/qt/Wireshark.pro @@ -222,6 +222,7 @@ FORMS += \ compiled_filter_output.ui \ decode_as_dialog.ui \ display_filter_expression_dialog.ui \ + dissector_tables_dialog.ui \ enabled_protocols_dialog.ui \ expert_info_dialog.ui \ export_object_dialog.ui \ @@ -298,6 +299,7 @@ HEADERS += $$HEADERS_WS_C \ conversation_dialog.h \ decode_as_dialog.h \ display_filter_expression_dialog.h \ + dissector_tables_dialog.h \ elided_label.h \ enabled_protocols_dialog.h \ endpoint_dialog.h \ @@ -678,6 +680,7 @@ SOURCES += \ display_filter_combo.cpp \ display_filter_edit.cpp \ display_filter_expression_dialog.cpp \ + dissector_tables_dialog.cpp \ elided_label.cpp \ enabled_protocols_dialog.cpp \ endpoint_dialog.cpp \ diff --git a/ui/qt/dissector_tables_dialog.cpp b/ui/qt/dissector_tables_dialog.cpp new file mode 100644 index 0000000000..7cd4e07a3c --- /dev/null +++ b/ui/qt/dissector_tables_dialog.cpp @@ -0,0 +1,292 @@ +/* dissector_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 "dissector_tables_dialog.h" +#include "ui_dissector_tables_dialog.h" + +#include "config.h" + +#include <epan/packet.h> + +#include <QTreeWidgetItem> + +#include "wireshark_application.h" +enum { + col_table_name_, + col_short_name_ +}; + +enum { + top_level_type_ = 1000, + table_type_, + string_type_, + integer_type_, + custom_type_, + heuristic_type_ +}; + +class DissectorTableTreeWidgetItem : public QTreeWidgetItem +{ +public: + DissectorTableTreeWidgetItem(QString table_name, QString short_name) : QTreeWidgetItem (table_type_) { + setText(col_table_name_, table_name); + setText(col_short_name_, short_name); + } +}; + +class IntegerTableTreeWidgetItem : public QTreeWidgetItem +{ +public: + IntegerTableTreeWidgetItem(unsigned port, QString proto_name) : + QTreeWidgetItem (integer_type_), + port_(port) + { + setText(col_table_name_, QString::number(port_)); + setText(col_short_name_, proto_name); + } + bool operator< (const QTreeWidgetItem &other) const + { + if (other.type() != integer_type_) return QTreeWidgetItem::operator< (other); + const IntegerTableTreeWidgetItem *other_row = static_cast<const IntegerTableTreeWidgetItem *>(&other); + + if (treeWidget()->sortColumn() == col_table_name_) { + return port_ < other_row->port_; + } + return QTreeWidgetItem::operator< (other); + } + +private: + unsigned port_; +}; + +DissectorTablesDialog::DissectorTablesDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::DissectorTablesDialog) +{ + 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); + + on_tableTreeWidget_itemSelectionChanged(); + + QTreeWidgetItem *string_ti = new QTreeWidgetItem(ui->tableTreeWidget, top_level_type_); + string_ti->setText(col_table_name_, tr("String Tables")); + string_ti->setFirstColumnSpanned(true); + string_ti->setExpanded(true); + + QTreeWidgetItem *integer_ti = new QTreeWidgetItem(ui->tableTreeWidget, top_level_type_); + integer_ti->setText(col_table_name_, tr("Integer Tables")); + integer_ti->setFirstColumnSpanned(true); + integer_ti->setExpanded(true); + + QTreeWidgetItem *custom_ti = new QTreeWidgetItem(ui->tableTreeWidget, top_level_type_); + custom_ti->setText(col_table_name_, tr("Custom Tables")); + custom_ti->setFirstColumnSpanned(true); + custom_ti->setExpanded(true); + + dissector_all_tables_foreach_table(gatherTableNames, this, NULL); + + string_ti->addChildren(string_dissectors_); + integer_ti->addChildren(integer_dissectors_); + integer_ti->addChildren(custom_dissectors_); + + QTreeWidgetItem *heuristic_ti = new QTreeWidgetItem(ui->tableTreeWidget, top_level_type_); + heuristic_ti->setText(col_table_name_, tr("Heuristic Tables")); + heuristic_ti->setFirstColumnSpanned(true); + heuristic_ti->setExpanded(true); + + dissector_all_heur_tables_foreach_table(gatherHeurTableNames, this, NULL); + + heuristic_ti->addChildren(heuristic_dissectors_); + + ui->tableTreeWidget->sortByColumn(col_table_name_, Qt::AscendingOrder); + ui->tableTreeWidget->resizeColumnToContents(col_table_name_); +} + +DissectorTablesDialog::~DissectorTablesDialog() +{ + delete ui; +} + +void DissectorTablesDialog::gatherTableNames(const char *short_name, const char *table_name, gpointer dlg_ptr) +{ + DissectorTablesDialog *dt_dlg = qobject_cast<DissectorTablesDialog *>((DissectorTablesDialog *)dlg_ptr); + if (!dt_dlg) return; + + ftenum_t selector_type = get_dissector_table_selector_type(short_name); + DissectorTableTreeWidgetItem *dt_ti = new DissectorTableTreeWidgetItem(table_name, short_name); + + switch (selector_type) { + case FT_UINT8: + case FT_UINT16: + case FT_UINT24: + case FT_UINT32: + dt_dlg->integer_dissectors_ << dt_ti; + break; + case FT_STRING: + case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: + dt_dlg->string_dissectors_ << dt_ti; + break; + case FT_BYTES: + dt_dlg->custom_dissectors_ << dt_ti; + break; + default: + // Assert? + delete dt_ti; + return; + } + + QList<QTreeWidgetItem *> proto_decode_list; + dissector_table_foreach(short_name, gatherProtocolDecodes, &proto_decode_list); + + dt_ti->addChildren(proto_decode_list); +} + +void DissectorTablesDialog::gatherProtocolDecodes(const char *, ftenum_t selector_type, gpointer key, gpointer value, gpointer list_ptr) +{ + QList<QTreeWidgetItem *> *pdl_ptr = dynamic_cast<QList<QTreeWidgetItem *> *>((QList<QTreeWidgetItem *> *)list_ptr); + if (!pdl_ptr) return; + + dtbl_entry_t *dtbl_entry; + dissector_handle_t handle; + + dtbl_entry = (dtbl_entry_t*)value; + handle = dtbl_entry_get_handle(dtbl_entry); + const QString proto_name = dissector_handle_get_short_name(handle); + QTreeWidgetItem *ti = NULL; + + switch (selector_type) { + case FT_UINT8: + case FT_UINT16: + case FT_UINT24: + case FT_UINT32: + { + ti = new IntegerTableTreeWidgetItem(GPOINTER_TO_UINT(key), proto_name); + break; + } + + case FT_STRING: + case FT_STRINGZ: + case FT_UINT_STRING: + case FT_STRINGZPAD: + { + ti = new QTreeWidgetItem(string_type_); + ti->setText(col_table_name_, (const char *)key); + ti->setText(col_short_name_, proto_name); + break; + } + + case FT_BYTES: + { + const QString dissector_name = dissector_handle_get_dissector_name(handle); + ti = new QTreeWidgetItem(string_type_); + ti->setText(col_table_name_, dissector_name); + ti->setText(col_short_name_, proto_name); + break; + } + + default: + g_assert_not_reached(); + } + + if (ti) *pdl_ptr << ti; +} + +void DissectorTablesDialog::gatherHeurTableNames(const char *table_name, heur_dissector_list *list, gpointer dlg_ptr) +{ + DissectorTablesDialog *dt_dlg = qobject_cast<DissectorTablesDialog *>((DissectorTablesDialog *)dlg_ptr); + if (!dt_dlg) return; + + QTreeWidgetItem *ti = new QTreeWidgetItem(heuristic_type_); + ti->setText(col_table_name_, table_name); + ti->setFirstColumnSpanned(true); + + dt_dlg->heuristic_dissectors_ << ti; + + if (list) { + QList<QTreeWidgetItem *> heur_decode_list; + heur_dissector_table_foreach(table_name, gatherHeurProtocolDecodes, &heur_decode_list); + ti->addChildren(heur_decode_list); + } +} + +void DissectorTablesDialog::gatherHeurProtocolDecodes(const char *, struct heur_dtbl_entry *dtbl_entry, gpointer list_ptr) +{ + QList<QTreeWidgetItem *> *hdl_ptr = dynamic_cast<QList<QTreeWidgetItem *> *>((QList<QTreeWidgetItem *> *)list_ptr); + if (!hdl_ptr) return; + + if (dtbl_entry->protocol) { + QTreeWidgetItem *ti = new QTreeWidgetItem(heuristic_type_); + ti->setText(col_table_name_, proto_get_protocol_long_name(dtbl_entry->protocol)); + ti->setText(col_short_name_, proto_get_protocol_short_name(dtbl_entry->protocol)); + *hdl_ptr << ti; + } +} + +void DissectorTablesDialog::on_tableTreeWidget_itemSelectionChanged() +{ + int type = top_level_type_; + QStringList header_labels; + + if (ui->tableTreeWidget->currentItem()) { + type = ui->tableTreeWidget->currentItem()->type(); + } + + switch (type) { + case table_type_: + header_labels << tr("Table Name") << tr("Selector Name"); + break; + case string_type_: + header_labels << tr("String") << tr("Dissector"); + break; + case integer_type_: + header_labels << tr("Port") << tr("Dissector"); + break; + case custom_type_: + header_labels << tr("String") << tr("Dissector"); + break; + case heuristic_type_: + header_labels << tr("Protocol") << tr("Short Name"); + break; + case top_level_type_: + header_labels << tr("Table Type") << QString(); + break; + } + + ui->tableTreeWidget->setHeaderLabels(header_labels); +} + +/* + * 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/dissector_tables_dialog.h b/ui/qt/dissector_tables_dialog.h new file mode 100644 index 0000000000..512fb359df --- /dev/null +++ b/ui/qt/dissector_tables_dialog.h @@ -0,0 +1,74 @@ +/* dissector_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 DISSECTOR_TABLES_DIALOG_H +#define DISSECTOR_TABLES_DIALOG_H + +#include <glib.h> + +#include <epan/ftypes/ftypes.h> + +#include <QDialog> + +namespace Ui { +class DissectorTablesDialog; +} + +class QTreeWidgetItem; + +class DissectorTablesDialog : public QDialog +{ + Q_OBJECT + +public: + explicit DissectorTablesDialog(QWidget *parent = 0); + ~DissectorTablesDialog(); + +private slots: + void on_tableTreeWidget_itemSelectionChanged(); + +private: + Ui::DissectorTablesDialog *ui; + QList<QTreeWidgetItem *> string_dissectors_; + QList<QTreeWidgetItem *> integer_dissectors_; + QList<QTreeWidgetItem *> custom_dissectors_; + QList<QTreeWidgetItem *> heuristic_dissectors_; + + static void gatherTableNames(const char *short_name, const char *table_name, gpointer dlg_ptr); + static void gatherProtocolDecodes(const char *, ftenum_t selector_type, gpointer key, gpointer value, gpointer list_ptr); + static void gatherHeurTableNames(const char *table_name, struct heur_dissector_list *list, gpointer dlg_ptr); + static void gatherHeurProtocolDecodes(const char *, struct heur_dtbl_entry *dtbl_entry, gpointer list_ptr); +}; + +#endif // DISSECTOR_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/dissector_tables_dialog.ui b/ui/qt/dissector_tables_dialog.ui new file mode 100644 index 0000000000..8a882d8422 --- /dev/null +++ b/ui/qt/dissector_tables_dialog.ui @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DissectorTablesDialog</class> + <widget class="QDialog" name="DissectorTablesDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTreeWidget" name="tableTreeWidget"> + <column> + <property name="text"> + <string>Table Name</string> + </property> + </column> + <column> + <property name="text"> + <string>Short Name</string> + </property> + </column> + </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>DissectorTablesDialog</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>DissectorTablesDialog</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 1982da37a9..40fbc53d42 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -392,6 +392,8 @@ private slots: void on_actionViewColorizeNewConversationRule_triggered(); void on_actionViewResizeColumns_triggered(); + void on_actionViewInternalsDissectorTables_triggered(); + void openPacketDialog(bool from_reference = false); void on_actionViewShowPacketInNewWindow_triggered(); void on_actionContextShowLinkedPacketInNewWindow_triggered(); diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui index 558f6ca848..6daf9d5824 100644 --- a/ui/qt/main_window.ui +++ b/ui/qt/main_window.ui @@ -303,6 +303,12 @@ <addaction name="actionViewColorizeResetColorization"/> <addaction name="actionViewColorizeNewConversationRule"/> </widget> + <widget class="QMenu" name="menuInternals"> + <property name="title"> + <string>Internals</string> + </property> + <addaction name="actionViewInternalsDissectorTables"/> + </widget> <addaction name="actionViewMainToolbar"/> <addaction name="actionViewFilterToolbar"/> <addaction name="actionViewWirelessToolbar"/> @@ -327,6 +333,8 @@ <addaction name="separator"/> <addaction name="actionViewResizeColumns"/> <addaction name="separator"/> + <addaction name="menuInternals"/> + <addaction name="separator"/> <addaction name="actionViewShowPacketInNewWindow"/> <addaction name="actionViewReload"/> </widget> @@ -2349,6 +2357,14 @@ <string>Show or hide the packet bytes</string> </property> </action> + <action name="actionViewInternalsDissectorTables"> + <property name="text"> + <string>Dissector Tables</string> + </property> + <property name="toolTip"> + <string>Show each dissector table and its entries</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 09d3069c4d..f93b7174dc 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -93,6 +93,7 @@ #include "decode_as_dialog.h" #include "display_filter_edit.h" #include "display_filter_expression_dialog.h" +#include "dissector_tables_dialog.h" #include "endpoint_dialog.h" #include "expert_info_dialog.h" #include "export_object_dialog.h" @@ -2315,6 +2316,12 @@ void MainWindow::openPacketDialog(bool from_reference) } } +void MainWindow::on_actionViewInternalsDissectorTables_triggered() +{ + DissectorTablesDialog *dissector_tables_dlg = new DissectorTablesDialog(this); + dissector_tables_dlg->show(); +} + void MainWindow::on_actionViewShowPacketInNewWindow_triggered() { openPacketDialog(); |