Wireshark 4.5.0
The Wireshark network protocol analyzer
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
194 qlonglong countSelectedItems(int role = Qt::DisplayRole);
195
202 QList<QList<QVariant> > selectedItemsIOGData();
203
209 void useNanosecondTimestamps(bool useNSTime);
210 ATapDataModel * dataModelForTabIndex(int tabIdx = -1);
211
212public slots:
213
219 void useAbsoluteTime(bool absolute);
220 void limitToDisplayFilter(bool limit);
221 void setMachineReadable(bool machine);
222
223 void setOpenTabs(QList<int> protocols);
224
225signals:
226 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
227 void tabDataChanged(int idx, int selcounter);
228 void retapRequired();
229 void disablingTaps();
230 void tabsChanged(QList<int> protocols);
231 void columnsHaveChanged(QList<int> columns);
232
233protected slots:
234
235 virtual void detachTab(int idx, QPoint pos) override;
236 virtual void attachTab(QWidget * content, QString name) override;
237
238private:
239 QList<int> _allProtocols;
240 QMap<int, int> _tabs;
241 ATapModelCallback _createModel;
242 ATapCreateDelegate _createDelegate;
243 GList ** _recentList;
244 GList ** _recentColumnList;
245
246 bool _disableTaps;
247 bool _nameResolution;
248 bool _absoluteTime;
249 bool _limitToDisplayFilter;
250 bool _nanoseconds;
251 bool _machineReadable;
252
253 QTreeView * createTree(int protoId);
254 TrafficDataFilterProxy * modelForTabIndex(int tabIdx = -1);
255 TrafficDataFilterProxy * modelForWidget(QWidget * widget);
256 ATapDataModel * dataModelForWidget(QWidget * widget);
257
258 void insertProtoTab(int protoId, bool emitSignals = true);
259 void removeProtoTab(int protoId, bool emitSignals = true);
260
261#ifdef HAVE_MAXMINDDB
262 bool writeGeoIPMapFile(QFile * fp, bool json_only, TrafficDataFilterProxy * model);
263#endif
264
265private slots:
266 void modelReset();
267
268 void doCurrentIndexChange(const QModelIndex & cur, const QModelIndex & prev);
269 void doSelectionChange(const QItemSelection &selected, const QItemSelection &deselected);
270};
271
272#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