Wireshark  4.3.0
The Wireshark network protocol analyzer
interface_tree_model.h
Go to the documentation of this file.
1 
12 #ifndef INTERFACE_TREE_MODEL_H
13 #define INTERFACE_TREE_MODEL_H
14 
15 #include <config.h>
16 #include <wireshark.h>
17 
18 #ifdef HAVE_LIBPCAP
19 #include "ui/capture.h"
20 #include "ui/capture_globals.h"
21 #endif
22 
23 #include <QAbstractTableModel>
24 #include <QList>
25 #include <QMap>
26 #include <QItemSelection>
27 
28 typedef QList<int> PointList;
29 
30 enum InterfaceTreeColumns
31 {
32  IFTREE_COL_EXTCAP,
33  IFTREE_COL_EXTCAP_PATH,
34  IFTREE_COL_NAME,
35  IFTREE_COL_DESCRIPTION,
36  IFTREE_COL_DISPLAY_NAME,
37  IFTREE_COL_COMMENT,
38  IFTREE_COL_HIDDEN,
39  IFTREE_COL_DLT,
40  IFTREE_COL_PROMISCUOUSMODE,
41  IFTREE_COL_TYPE,
42  IFTREE_COL_STATS,
43  IFTREE_COL_ACTIVE,
44  IFTREE_COL_SNAPLEN,
45 #ifdef CAN_SET_CAPTURE_BUFFER_SIZE
46  IFTREE_COL_BUFFERLEN,
47 #endif
48 #ifdef HAVE_PCAP_CREATE
49  IFTREE_COL_MONITOR_MODE,
50 #endif
51  IFTREE_COL_CAPTURE_FILTER,
52  IFTREE_COL_PIPE_PATH,
53  IFTREE_COL_MAX /* is not being displayed, it is the definition for the maximum numbers of columns */
54 };
55 
56 class InterfaceTreeModel : public QAbstractTableModel
57 {
58  Q_OBJECT
59 
60 public:
61  InterfaceTreeModel(QObject *parent);
63 
64  int rowCount(const QModelIndex &parent = QModelIndex()) const;
65  int columnCount(const QModelIndex &parent = QModelIndex()) const;
66  QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
67  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
68 
69  void updateStatistic(unsigned int row);
70 #ifdef HAVE_LIBPCAP
71  void stopStatistic();
72 #endif
73 
74  QString interfaceError();
75  QItemSelection selectedDevices();
76  bool updateSelectedDevices(QItemSelection sourceSelection);
77 
78  QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
79 
80 #ifdef HAVE_PCAP_REMOTE
81  bool isRemote(int idx);
82 #endif
83 
84  static const QString DefaultNumericValue;
85 
86 public slots:
87  void interfaceListChanged();
88 
89 private:
90  QVariant toolTipForInterface(int idx) const;
91  QMap<QString, PointList> points;
92  QMap<QString, bool> active;
93 
94 #ifdef HAVE_LIBPCAP
95  if_stat_cache_t *stat_cache_;
96 #endif // HAVE_LIBPCAP
97 };
98 
99 #endif // INTERFACE_TREE_MODEL_H
Definition: interface_tree_model.h:57
InterfaceTreeModel(QObject *parent)
Definition: interface_tree_model.cpp:42
void interfaceListChanged()
Definition: interface_tree_model.cpp:357