Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
interface_tree_model.h
1 /* interface_tree_model.h
2  * Model for the interface data for display in the interface frame
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef INTERFACE_TREE_MODEL_H
12 #define INTERFACE_TREE_MODEL_H
13 
14 #include <config.h>
15 
16 #ifdef HAVE_LIBPCAP
17 #include "ui/capture.h"
18 #include "ui/capture_globals.h"
19 #endif
20 
21 #include <glib.h>
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_INTERFACE_NAME,
36  IFTREE_COL_INTERFACE_COMMENT,
37  IFTREE_COL_HIDDEN,
38  IFTREE_COL_DLT,
39  IFTREE_COL_PROMISCUOUSMODE,
40  IFTREE_COL_TYPE,
41  IFTREE_COL_STATS,
42  IFTREE_COL_SNAPLEN,
43 #ifdef CAN_SET_CAPTURE_BUFFER_SIZE
44  IFTREE_COL_BUFFERLEN,
45 #endif
46 #ifdef HAVE_PCAP_CREATE
47  IFTREE_COL_MONITOR_MODE,
48 #endif
49  IFTREE_COL_CAPTURE_FILTER,
50  IFTREE_COL_PIPE_PATH,
51  IFTREE_COL_MAX /* is not being displayed, it is the definition for the maximum numbers of columns */
52 };
53 
54 class InterfaceTreeModel : public QAbstractTableModel
55 {
56  Q_OBJECT
57 public:
58  InterfaceTreeModel(QObject *parent);
60 
61  int rowCount(const QModelIndex &parent = QModelIndex()) const;
62  int columnCount(const QModelIndex &parent = QModelIndex()) const;
63  QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const;
64  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
65 
66  void updateStatistic(unsigned int row);
67 #ifdef HAVE_LIBPCAP
68  void stopStatistic();
69 #endif
70 
71  QString interfaceError();
72  QItemSelection selectedDevices();
73  bool updateSelectedDevices(QItemSelection sourceSelection);
74 
75  QVariant getColumnContent(int idx, int col, int role = Qt::DisplayRole);
76 
77 #ifdef HAVE_PCAP_REMOTE
78  bool isRemote(int idx);
79 #endif
80 
81  static const QString DefaultNumericValue;
82 
83 public slots:
84  void getPoints(int idx, PointList *pts);
85 
86 protected slots:
87  void interfaceListChanged();
88 
89 private:
90  QVariant toolTipForInterface(int idx) const;
91  QMap<QString, PointList> points;
92 
93 #ifdef HAVE_LIBPCAP
94  if_stat_cache_t *stat_cache_;
95 #endif // HAVE_LIBPCAP
96 };
97 
98 #endif // INTERFACE_TREE_MODEL_H
99 
100 /*
101  * Editor modelines
102  *
103  * Local Variables:
104  * c-basic-offset: 4
105  * tab-width: 8
106  * indent-tabs-mode: nil
107  * End:
108  *
109  * ex: set shiftwidth=4 tabstop=8 expandtab:
110  * :indentSize=4:tabSize=8:noTabs=true:
111  */
Definition: interface_tree_model.h:54
void interfaceListChanged()
Definition: interface_tree_model.cpp:319
InterfaceTreeModel(QObject *parent)
Definition: interface_tree_model.cpp:42