summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorRoland Knall <roland.knall@br-automation.com>2016-12-27 10:14:32 +0100
committerRoland Knall <rknall@gmail.com>2016-12-27 11:55:51 +0000
commit9d47bf993932c064c60ea79592a06f0ffd383fd6 (patch)
tree82c7bf282defab09fec6ecf75d889df5c51387d2 /ui
parent8e6953a64b0b785918d4a234e1eb09de21cfb5b8 (diff)
downloadwireshark-9d47bf993932c064c60ea79592a06f0ffd383fd6.tar.gz
InterfaceList: Add check for remote interface
Add a check, to allow the filtering of remote only interfaces. Also add the necessary options to the type menu. Change-Id: Ib82519362454094f64abf1cbe6d7bc917990d7ac Reviewed-on: https://code.wireshark.org/review/19438 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/interface_frame.cpp19
-rw-r--r--ui/qt/interface_frame.h3
-rw-r--r--ui/qt/interface_sort_filter_model.cpp60
-rw-r--r--ui/qt/interface_sort_filter_model.h11
-rw-r--r--ui/qt/interface_tree_model.cpp10
-rw-r--r--ui/qt/interface_tree_model.h4
6 files changed, 107 insertions, 0 deletions
diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp
index 64af22da68..58175143a2 100644
--- a/ui/qt/interface_frame.cpp
+++ b/ui/qt/interface_frame.cpp
@@ -133,6 +133,17 @@ QMenu * InterfaceFrame::getSelectionMenu()
++it;
}
+#ifdef HAVE_PCAP_REMOTE
+ if ( proxyModel->remoteInterfacesExist() )
+ {
+ QAction * toggleRemoteAction = new QAction(tr("Remote interfaces"), this);
+ toggleRemoteAction->setCheckable(true);
+ toggleRemoteAction->setChecked(! proxyModel->remoteDisplay());
+ connect(toggleRemoteAction, SIGNAL(triggered()), this, SLOT(toggleRemoteInterfaces()));
+ contextMenu->addAction(toggleRemoteAction);
+ }
+#endif
+
contextMenu->addSeparator();
QAction * toggleHideAction = new QAction(tr("Show hidden interfaces"), this);
toggleHideAction->setCheckable(true);
@@ -214,6 +225,14 @@ void InterfaceFrame::toggleHiddenInterfaces()
emit typeSelectionChanged();
}
+#ifdef HAVE_PCAP_REMOTE
+void InterfaceFrame::toggleRemoteInterfaces()
+{
+ proxyModel->toggleRemoteDisplay();
+ emit typeSelectionChanged();
+}
+#endif
+
void InterfaceFrame::resetInterfaceTreeDisplay()
{
if ( proxyModel->rowCount() == 0 )
diff --git a/ui/qt/interface_frame.h b/ui/qt/interface_frame.h
index 6cc2537ff8..7c2bc579bb 100644
--- a/ui/qt/interface_frame.h
+++ b/ui/qt/interface_frame.h
@@ -66,6 +66,9 @@ public slots:
void updateSelectedInterfaces();
void interfaceListChanged();
void toggleHiddenInterfaces();
+#ifdef HAVE_PCAP_REMOTE
+ void toggleRemoteInterfaces();
+#endif
void getPoints(int idx, PointList *pts);
protected:
diff --git a/ui/qt/interface_sort_filter_model.cpp b/ui/qt/interface_sort_filter_model.cpp
index 9b850e151b..0ea989e1bd 100644
--- a/ui/qt/interface_sort_filter_model.cpp
+++ b/ui/qt/interface_sort_filter_model.cpp
@@ -46,6 +46,9 @@ void InterfaceSortFilterModel::resetAllFilter()
_filterTypes = true;
_invertTypeFilter = false;
_storeOnChange = false;
+#ifdef HAVE_PCAP_REMOTE
+ _remoteDisplay = true;
+#endif
/* Adding all columns, to have a default setting */
for ( int col = 0; col < IFTREE_COL_MAX; col++ )
@@ -72,6 +75,48 @@ void InterfaceSortFilterModel::setFilterHidden(bool filter)
invalidate();
}
+#ifdef HAVE_PCAP_REMOTE
+void InterfaceSortFilterModel::setRemoteDisplay(bool remoteDisplay)
+{
+ _remoteDisplay = remoteDisplay;
+
+ invalidate();
+}
+
+bool InterfaceSortFilterModel::remoteDisplay()
+{
+ return _remoteDisplay;
+}
+
+void InterfaceSortFilterModel::toggleRemoteDisplay()
+{
+ _remoteDisplay = ! _remoteDisplay;
+
+ if ( _storeOnChange )
+ {
+ prefs.gui_interfaces_remote_display = ! _remoteDisplay;
+
+ prefs_main_write();
+ }
+
+ invalidateFilter();
+ invalidate();
+}
+
+bool InterfaceSortFilterModel::remoteInterfacesExist()
+{
+ bool exist = false;
+
+ if ( sourceModel()->rowCount() == 0 )
+ return exist;
+
+ for (int idx = 0; idx < sourceModel()->rowCount() && ! exist; idx++)
+ exist = ((InterfaceTreeModel *)sourceModel())->isRemote(idx);
+
+ return exist;
+}
+#endif
+
void InterfaceSortFilterModel::setFilterByType(bool filter, bool invert)
{
_filterTypes = filter;
@@ -98,6 +143,9 @@ void InterfaceSortFilterModel::resetPreferenceData()
}
_filterHidden = ! prefs.gui_interfaces_show_hidden;
+#ifdef HAVE_PCAP_REMOTE
+ _remoteDisplay = prefs.gui_interfaces_remote_display;
+#endif
invalidate();
}
@@ -243,7 +291,19 @@ bool InterfaceSortFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex
return false;
if ( _filterTypes && ! isInterfaceTypeShown(type) )
+ {
+#ifdef HAVE_PCAP_REMOTE
+ /* Remote interfaces have the if type IF_WIRED, therefore would be filtered, if not explicitly checked here */
+ if ( ! _remoteDisplay || ! ((InterfaceTreeModel *)sourceModel())->isRemote(idx) )
+#endif
return false;
+ }
+
+#ifdef HAVE_PCAP_REMOTE
+ if ( _remoteDisplay && ! ((InterfaceTreeModel *)sourceModel())->isRemote(idx) )
+ return false;
+#endif
+
#endif
return true;
diff --git a/ui/qt/interface_sort_filter_model.h b/ui/qt/interface_sort_filter_model.h
index 7f28eb0151..8d421563aa 100644
--- a/ui/qt/interface_sort_filter_model.h
+++ b/ui/qt/interface_sort_filter_model.h
@@ -45,6 +45,13 @@ public:
int interfacesHidden();
void toggleFilterHidden();
+#ifdef HAVE_PCAP_REMOTE
+ void setRemoteDisplay(bool remoteDisplay);
+ bool remoteDisplay();
+ void toggleRemoteDisplay();
+ bool remoteInterfacesExist();
+#endif
+
void setInterfaceTypeVisible(int ifType, bool visible);
bool isInterfaceTypeShown(int ifType) const;
void setFilterByType(bool filter, bool invert = false);
@@ -71,6 +78,10 @@ private:
bool _invertTypeFilter;
bool _storeOnChange;
+#ifdef HAVE_PCAP_REMOTE
+ bool _remoteDisplay;
+#endif
+
QList<int> displayHiddenTypes;
QList<InterfaceTreeColumns> _columns;
diff --git a/ui/qt/interface_tree_model.cpp b/ui/qt/interface_tree_model.cpp
index 511bb14cec..d55ff7ffe4 100644
--- a/ui/qt/interface_tree_model.cpp
+++ b/ui/qt/interface_tree_model.cpp
@@ -319,6 +319,16 @@ QVariant InterfaceTreeModel::getColumnContent(int idx, int col, int role)
return InterfaceTreeModel::data(index(idx, col), role);
}
+#ifdef HAVE_PCAP_REMOTE
+bool InterfaceTreeModel::isRemote(int idx)
+{
+ interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, idx);
+ if ( device.remote_opts.src_type == CAPTURE_IFREMOTE )
+ return true;
+ return false;
+}
+#endif
+
/**
* The interface list has changed. global_capture_opts.all_ifaces may have been reloaded
* or changed with current data. beginResetModel() and endResetModel() will signalize the
diff --git a/ui/qt/interface_tree_model.h b/ui/qt/interface_tree_model.h
index 5517308791..33daff9eed 100644
--- a/ui/qt/interface_tree_model.h
+++ b/ui/qt/interface_tree_model.h
@@ -88,6 +88,10 @@ public:
QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
+#ifdef HAVE_PCAP_REMOTE
+ bool isRemote(int idx);
+#endif
+
static const QString DefaultNumericValue;
public slots: