2021-11-30 13:01:36 +00:00
|
|
|
/** @file
|
|
|
|
*
|
2016-10-01 06:54:57 +00:00
|
|
|
* Model for the interface data for display in the interface frame
|
2012-01-04 22:13:01 +00:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2016-10-01 06:54:57 +00:00
|
|
|
#ifndef INTERFACE_TREE_MODEL_H
|
|
|
|
#define INTERFACE_TREE_MODEL_H
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2015-01-03 20:52:54 +00:00
|
|
|
#include <config.h>
|
2012-08-03 23:30:47 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBPCAP
|
2014-06-30 05:38:29 +00:00
|
|
|
#include "ui/capture.h"
|
2016-10-01 06:54:57 +00:00
|
|
|
#include "ui/capture_globals.h"
|
2012-08-03 23:30:47 +00:00
|
|
|
#endif
|
|
|
|
|
2016-10-01 06:54:57 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMap>
|
2016-10-03 14:31:36 +00:00
|
|
|
#include <QItemSelection>
|
2012-01-04 22:13:01 +00:00
|
|
|
|
2013-11-25 14:15:49 +00:00
|
|
|
typedef QList<int> PointList;
|
|
|
|
|
2015-04-28 08:26:46 +00:00
|
|
|
enum InterfaceTreeColumns
|
|
|
|
{
|
|
|
|
IFTREE_COL_EXTCAP,
|
2016-10-03 14:31:36 +00:00
|
|
|
IFTREE_COL_EXTCAP_PATH,
|
2015-04-28 08:26:46 +00:00
|
|
|
IFTREE_COL_NAME,
|
2018-08-12 01:55:01 +00:00
|
|
|
IFTREE_COL_DESCRIPTION,
|
|
|
|
IFTREE_COL_DISPLAY_NAME,
|
|
|
|
IFTREE_COL_COMMENT,
|
2016-10-03 14:31:36 +00:00
|
|
|
IFTREE_COL_HIDDEN,
|
2016-10-25 09:26:26 +00:00
|
|
|
IFTREE_COL_DLT,
|
|
|
|
IFTREE_COL_PROMISCUOUSMODE,
|
2016-10-03 14:31:36 +00:00
|
|
|
IFTREE_COL_TYPE,
|
2015-04-28 08:26:46 +00:00
|
|
|
IFTREE_COL_STATS,
|
2022-04-21 14:00:50 +00:00
|
|
|
IFTREE_COL_ACTIVE,
|
2016-10-25 09:26:26 +00:00
|
|
|
IFTREE_COL_SNAPLEN,
|
|
|
|
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
|
|
|
|
IFTREE_COL_BUFFERLEN,
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_PCAP_CREATE
|
|
|
|
IFTREE_COL_MONITOR_MODE,
|
|
|
|
#endif
|
|
|
|
IFTREE_COL_CAPTURE_FILTER,
|
2016-10-25 12:27:56 +00:00
|
|
|
IFTREE_COL_PIPE_PATH,
|
2016-10-01 15:54:13 +00:00
|
|
|
IFTREE_COL_MAX /* is not being displayed, it is the definition for the maximum numbers of columns */
|
2015-04-28 08:26:46 +00:00
|
|
|
};
|
|
|
|
|
2016-10-01 06:54:57 +00:00
|
|
|
class InterfaceTreeModel : public QAbstractTableModel
|
2012-01-04 22:13:01 +00:00
|
|
|
{
|
2021-10-22 23:28:36 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-01-04 22:13:01 +00:00
|
|
|
public:
|
2016-10-01 06:54:57 +00:00
|
|
|
InterfaceTreeModel(QObject *parent);
|
|
|
|
~InterfaceTreeModel();
|
2012-08-03 23:30:47 +00:00
|
|
|
|
2016-10-01 06:54:57 +00:00
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
|
2016-10-17 13:01:24 +00:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
2015-04-28 08:26:46 +00:00
|
|
|
|
2016-10-01 06:54:57 +00:00
|
|
|
void updateStatistic(unsigned int row);
|
|
|
|
#ifdef HAVE_LIBPCAP
|
|
|
|
void stopStatistic();
|
|
|
|
#endif
|
|
|
|
|
2016-10-03 14:31:36 +00:00
|
|
|
QString interfaceError();
|
|
|
|
QItemSelection selectedDevices();
|
|
|
|
bool updateSelectedDevices(QItemSelection sourceSelection);
|
|
|
|
|
2016-10-06 15:04:45 +00:00
|
|
|
QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
|
2016-10-03 14:31:36 +00:00
|
|
|
|
2016-12-27 09:14:32 +00:00
|
|
|
#ifdef HAVE_PCAP_REMOTE
|
|
|
|
bool isRemote(int idx);
|
|
|
|
#endif
|
|
|
|
|
2016-10-25 09:26:26 +00:00
|
|
|
static const QString DefaultNumericValue;
|
|
|
|
|
2016-10-01 06:54:57 +00:00
|
|
|
public slots:
|
|
|
|
void interfaceListChanged();
|
2012-08-03 23:30:47 +00:00
|
|
|
|
|
|
|
private:
|
2016-10-01 06:54:57 +00:00
|
|
|
QVariant toolTipForInterface(int idx) const;
|
2017-01-10 23:33:46 +00:00
|
|
|
QMap<QString, PointList> points;
|
2022-04-21 14:00:50 +00:00
|
|
|
QMap<QString, bool> active;
|
2016-10-01 06:54:57 +00:00
|
|
|
|
2013-10-11 21:26:26 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2012-08-31 22:25:51 +00:00
|
|
|
if_stat_cache_t *stat_cache_;
|
2013-10-11 21:26:26 +00:00
|
|
|
#endif // HAVE_LIBPCAP
|
2012-01-04 22:13:01 +00:00
|
|
|
};
|
|
|
|
|
2016-10-01 06:54:57 +00:00
|
|
|
#endif // INTERFACE_TREE_MODEL_H
|