Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
traffic_tab.h
Go to the documentation of this file.
1
10#ifndef TRAFFIC_TAB_H
11#define TRAFFIC_TAB_H
12
13#include "config.h"
14
16#include <ui/qt/filter_action.h>
18#include <ui/qt/widgets/detachable_tabwidget.h>
20
21#include <QTabWidget>
22#include <QTreeView>
23#include <QFile>
24#include <QUrl>
25#include <QAbstractItemDelegate>
26#include <QSortFilterProxyModel>
27
36typedef ATapDataModel * (*ATapModelCallback)(int protoId, QString filter);
37
45typedef QAbstractItemDelegate * (*ATapCreateDelegate)(QWidget * parent);
46
48{
49public:
50 TabData();
51 TabData(const TabData &) = default;
52 TabData &operator=(const TabData &) = default;
53
54 TabData(QString name, int proto);
55
56 QString name() const;
57 int protoId() const;
58
59private:
60 QString _name;
61 int _protoId;
62};
63
64Q_DECLARE_METATYPE(TabData)
65
66
75{
76 Q_OBJECT
77
78public:
79 TrafficTab(QWidget *parent = nullptr);
80 virtual ~TrafficTab();
81
96 void setProtocolInfo(QString tableName, TrafficTypesList * trafficList, GList ** recentList, GList ** recentColumnList, ATapModelCallback createModel);
97
106 void setDelegate(ATapCreateDelegate createDelegate);
107
120 void setFilter(QString filter = QString());
121
127 void setNameResolution(bool checked);
128
136 void disableTap();
137
147 QMenu * createCopyMenu(QWidget * parent = nullptr);
148
156 bool hasNameResolution(int tabIdx = -1);
157
158#ifdef HAVE_MAXMINDDB
166 bool hasGeoIPData(int tabIdx = -1);
167
175 QUrl createGeoIPMap(bool onlyJSON, int tabIdx = -1);
176#endif
177
185 QVariant currentItemData(int role = Qt::DisplayRole);
186
192 void useNanosecondTimestamps(bool useNSTime);
193 ATapDataModel * dataModelForTabIndex(int tabIdx = -1);
194
195public slots:
196
202 void useAbsoluteTime(bool absolute);
203
204 void setOpenTabs(QList<int> protocols);
205
206signals:
207 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
208 void tabDataChanged(int idx);
209 void retapRequired();
210 void disablingTaps();
211 void tabsChanged(QList<int> protocols);
212 void columnsHaveChanged(QList<int> columns);
213
214protected slots:
215
216 virtual void detachTab(int idx, QPoint pos) override;
217 virtual void attachTab(QWidget * content, QString name) override;
218
219private:
220 QList<int> _allProtocols;
221 QMap<int, int> _tabs;
222 ATapModelCallback _createModel;
223 ATapCreateDelegate _createDelegate;
224 GList ** _recentList;
225 GList ** _recentColumnList;
226
227 bool _disableTaps;
228 bool _nameResolution;
229
230 QTreeView * createTree(int protoId);
231 TrafficDataFilterProxy * modelForTabIndex(int tabIdx = -1);
232 TrafficDataFilterProxy * modelForWidget(QWidget * widget);
233 ATapDataModel * dataModelForWidget(QWidget * widget);
234
235 void insertProtoTab(int protoId, bool emitSignals = true);
236 void removeProtoTab(int protoId, bool emitSignals = true);
237
238#ifdef HAVE_MAXMINDDB
239 bool writeGeoIPMapFile(QFile * fp, bool json_only, TrafficDataFilterProxy * model);
240#endif
241
242private slots:
243 void modelReset();
244
245 void doCurrentIndexChange(const QModelIndex & cur, const QModelIndex & prev);
246};
247
248#endif // TRAFFIC_TAB_H
DataModel for tap user data.
Definition atap_data_model.h:33
Definition detachable_tabwidget.h:24
Definition traffic_tab.h:48
Definition traffic_tree.h:76
A QTabWidget class, providing tap information.
Definition traffic_tab.h:75
Definition traffic_types_list.h:100
ATapDataModel *(* ATapModelCallback)(int protoId, QString filter)
Callback for creating an ATapDataModel.
Definition traffic_tab.h:36
QAbstractItemDelegate *(* ATapCreateDelegate)(QWidget *parent)
Callback for creating an item delegate.
Definition traffic_tab.h:45