Wireshark 4.7.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
51{
52public:
56 TabData();
57
61 TabData(const TabData &) = default;
62
66 TabData &operator=(const TabData &) = default;
67
73 TabData(QString name, int proto);
74
79 QString name() const;
80
85 int protoId() const;
86
87private:
89 QString _name;
90
92 int _protoId;
93};
94
95Q_DECLARE_METATYPE(TabData)
96
97
106{
107 Q_OBJECT
108
109public:
114 TrafficTab(QWidget *parent = nullptr);
115
119 virtual ~TrafficTab();
120
135 void setProtocolInfo(QString tableName, TrafficTypesList * trafficList, GList ** recentList, GList ** recentColumnList, ATapModelCallback createModel);
136
145 void setDelegate(ATapCreateDelegate createDelegate);
146
159 void setFilter(QString filter = QString());
160
166 void setNameResolution(bool checked);
167
175 void disableTap();
176
186 QMenu * createCopyMenu(QWidget * parent = nullptr);
187
195 bool hasNameResolution(int tabIdx = -1);
196
197#ifdef HAVE_MAXMINDDB
205 bool hasGeoIPData(int tabIdx = -1);
206
214 QUrl createGeoIPMap(bool onlyJSON, int tabIdx = -1);
215#endif
216
224 QVariant currentItemData(int role = Qt::DisplayRole);
225
233 qlonglong countSelectedItems(int role = Qt::DisplayRole);
234
241 QList<QList<QVariant> > selectedItemsIOGData();
242
248 void useNanosecondTimestamps(bool useNSTime);
249
255 ATapDataModel * dataModelForTabIndex(int tabIdx = -1);
256
257public slots:
258
264 void useAbsoluteTime(bool absolute);
265
270 void limitToDisplayFilter(bool limit);
271
276 void setMachineReadable(bool machine);
277
282 void setOpenTabs(QList<int> protocols);
283
284signals:
292
298 void tabDataChanged(int idx, int selcounter);
299
304
309
314 void tabsChanged(QList<int> protocols);
315
320 void columnsHaveChanged(QList<int> columns);
321
322protected slots:
323
329 virtual void detachTab(int idx, QPoint pos) override;
330
336 virtual void attachTab(QWidget * content, QString name) override;
337
338private:
340 QList<int> _allProtocols;
341
343 QMap<int, int> _tabs;
344
346 ATapModelCallback _createModel;
347
349 ATapCreateDelegate _createDelegate;
350
352 GList ** _recentList;
353
355 GList ** _recentColumnList;
356
358 bool _disableTaps;
359
361 bool _nameResolution;
362
364 bool _absoluteTime;
365
367 bool _limitToDisplayFilter;
368
370 bool _nanoseconds;
371
373 bool _machineReadable;
374
380 QTreeView * createTree(int protoId);
381
387 TrafficDataFilterProxy * modelForTabIndex(int tabIdx = -1);
388
394 TrafficDataFilterProxy * modelForWidget(QWidget * widget);
395
401 ATapDataModel * dataModelForWidget(QWidget * widget);
402
408 void insertProtoTab(int protoId, bool emitSignals = true);
409
415 void removeProtoTab(int protoId, bool emitSignals = true);
416
417#ifdef HAVE_MAXMINDDB
425 bool writeGeoIPMapFile(QFile * fp, bool json_only, TrafficDataFilterProxy * model);
426#endif
427
428private slots:
432 void modelReset();
433
439 void doCurrentIndexChange(const QModelIndex & cur, const QModelIndex & prev);
440
446 void doSelectionChange(const QItemSelection &selected, const QItemSelection &deselected);
447};
448
449#endif // TRAFFIC_TAB_H
DataModel for tap user data.
Definition atap_data_model.h:33
A QTabWidget extension that allows tabs to be detached into separate windows.
Definition detachable_tabwidget.h:27
Action
Defines an action to be taken with a filter.
Definition filter_action.h:30
ActionType
Defines how the new filter should be combined with the existing one.
Definition filter_action.h:43
A simple class to store the data for a tab in the traffic tab widget.
Definition traffic_tab.h:51
TabData & operator=(const TabData &)=default
Copy assignment operator.
TabData()
Constructs a new empty TabData object.
Definition traffic_tab.cpp:48
int protoId() const
Retrieves the protocol ID.
Definition traffic_tab.cpp:63
TabData(const TabData &)=default
Copy constructor.
QString name() const
Retrieves the name of the tab.
Definition traffic_tab.cpp:58
Proxy model handling sorting, filtering, and column visibility for traffic data.
Definition traffic_tree.h:156
A QTabWidget class, providing tap information.
Definition traffic_tab.h:106
void tabDataChanged(int idx, int selcounter)
Signal emitted when the tab data has changed.
void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type)
Signal emitted to trigger a filter action.
void columnsHaveChanged(QList< int > columns)
Signal emitted when the column configuration has changed.
void tabsChanged(QList< int > protocols)
Signal emitted when the open tabs have changed.
void disablingTaps()
Signal emitted to notify that taps are being disabled.
void retapRequired()
Signal emitted when a retap operation is required.
Tree view widget that presents a filterable, sortable, checkable list of traffic-tap protocols and fo...
Definition traffic_types_list.h:229
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