aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorHuang Qiangxiong <qiangxiong.huang@qq.com>2019-11-17 20:25:15 +0800
committerAnders Broman <a.broman58@gmail.com>2019-12-19 05:04:17 +0000
commit623b347d1e863f7cd2d331926106321d3182d169 (patch)
tree6302532ea8d5e29ef20459dd06b8acd0a39e6ea9 /ui/qt
parent5d342b01e3311d52dc6d84fc6c5381fd2004b142 (diff)
Protobuf: add dissecting protobuf fields as wireshark fields preferences, etc.
Two enhancements and one fixed bug: 1. Add dissecting protobuf fields as wireshark (header) fields preferences. User can input the full names of protobuf fields or messages in Filter toolbar for searching. 2. Add 'protobuf_field' dissector table. Dissector based on protobuf can register itself to 'protobuf_field' keyed with the full names of fields of BYETS or STRING types. 3. A bug about search MESSAGE or ENUM type in context is fixed. 4. Another small enhancement is adding prefs_set_preference_effect_fields() which can mark a preference that affects fields change (triggering FieldsChanged event). See the linked bug for sample capture file and .proto files. Ping-Bug: 16209 Change-Id: Ibc3c45a6d596a8bb983b0d847dd6a22801af7e04 Reviewed-on: https://code.wireshark.org/review/35111 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/preference_editor_frame.cpp5
-rw-r--r--ui/qt/preferences_dialog.cpp4
-rw-r--r--ui/qt/protocol_preferences_menu.cpp7
3 files changed, 16 insertions, 0 deletions
diff --git a/ui/qt/preference_editor_frame.cpp b/ui/qt/preference_editor_frame.cpp
index eeac708db5..557f180069 100644
--- a/ui/qt/preference_editor_frame.cpp
+++ b/ui/qt/preference_editor_frame.cpp
@@ -181,6 +181,7 @@ void PreferenceEditorFrame::on_preferenceLineEdit_returnPressed()
void PreferenceEditorFrame::on_buttonBox_accepted()
{
+ unsigned int changed_flags = 0;
unsigned int apply = 0;
switch(prefs_get_type(pref_)) {
case PREF_UINT:
@@ -199,6 +200,7 @@ void PreferenceEditorFrame::on_buttonBox_accepted()
}
if (apply && module_) {
+ changed_flags = module_->prefs_changed_flags;
pref_unstash_data_t unstashed_data;
unstashed_data.module = module_;
@@ -218,6 +220,9 @@ void PreferenceEditorFrame::on_buttonBox_accepted()
on_buttonBox_rejected();
// Emit signals once UI is hidden
if (apply) {
+ if (changed_flags & PREF_EFFECT_FIELDS) {
+ wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
+ }
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
}
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index ee1a95bff0..b764ed39e6 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -264,6 +264,10 @@ void PreferencesDialog::on_buttonBox_accepted()
wsApp->setMonospaceFont(prefs.gui_qt_font_name);
+ if (redissect_flags & PREF_EFFECT_FIELDS) {
+ wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
+ }
+
if (redissect_flags & PREF_EFFECT_DISSECTION) {
/* Redissect all the packets, and re-evaluate the display filter. */
wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
diff --git a/ui/qt/protocol_preferences_menu.cpp b/ui/qt/protocol_preferences_menu.cpp
index dad7932c08..0df5d651ab 100644
--- a/ui/qt/protocol_preferences_menu.cpp
+++ b/ui/qt/protocol_preferences_menu.cpp
@@ -274,10 +274,14 @@ void ProtocolPreferencesMenu::boolPreferenceTriggered()
if (!bpa) return;
module_->prefs_changed_flags |= bpa->setBoolValue();
+ unsigned int changed_flags = module_->prefs_changed_flags;
prefs_apply(module_);
prefs_main_write();
+ if (changed_flags & PREF_EFFECT_FIELDS) {
+ wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
+ }
/* Protocol preference changes almost always affect dissection,
so don't bother checking flags */
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
@@ -294,6 +298,9 @@ void ProtocolPreferencesMenu::enumPreferenceTriggered()
prefs_apply(module_);
prefs_main_write();
+ if (changed_flags & PREF_EFFECT_FIELDS) {
+ wsApp->emitAppSignal(WiresharkApplication::FieldsChanged);
+ }
/* Protocol preference changes almost always affect dissection,
so don't bother checking flags */
wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);