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>
This commit is contained in:
parent
8e6953a64b
commit
9d47bf9939
10
epan/prefs.c
10
epan/prefs.c
|
@ -2527,6 +2527,13 @@ prefs_register_modules(void)
|
|||
"Show all interfaces, including interfaces marked as hidden",
|
||||
&prefs.gui_interfaces_show_hidden);
|
||||
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
prefs_register_bool_preference(gui_module, "interfaces_remote_display",
|
||||
"Show Remote interfaces",
|
||||
"Show remote interfaces in the interface selection",
|
||||
&prefs.gui_interfaces_remote_display);
|
||||
#endif
|
||||
|
||||
register_string_like_preference(gui_module, "interfaces_hidden_types", "Hide interface types in list",
|
||||
"Hide the given interface types in the startup list",
|
||||
&prefs.gui_interfaces_hide_types, PREF_STRING, NULL, TRUE);
|
||||
|
@ -3202,6 +3209,9 @@ pre_init_prefs(void)
|
|||
if (prefs.gui_interfaces_hide_types) g_free (prefs.gui_interfaces_hide_types);
|
||||
prefs.gui_interfaces_hide_types = g_strdup("");
|
||||
prefs.gui_interfaces_show_hidden = FALSE;
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
prefs.gui_interfaces_remote_display = TRUE;
|
||||
#endif
|
||||
|
||||
prefs.gui_qt_packet_list_separator = FALSE;
|
||||
|
||||
|
|
|
@ -193,6 +193,9 @@ typedef struct _e_prefs {
|
|||
layout_pane_content_e gui_layout_content_3;
|
||||
gchar *gui_interfaces_hide_types;
|
||||
gboolean gui_interfaces_show_hidden;
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
gboolean gui_interfaces_remote_display;
|
||||
#endif
|
||||
gint console_log_level;
|
||||
gchar *capture_device;
|
||||
gchar *capture_devices_linktypes;
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue