Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
traffic_tab.h
Go to the documentation of this file.
1
9
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
DetachableTabWidget(QWidget *parent=nullptr)
Constructs a new DetachableTabWidget.
Definition detachable_tabwidget.cpp:26
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:157
TrafficTab(QWidget *parent=nullptr)
Constructs a new TrafficTab widget.
Definition traffic_tab.cpp:69
QMenu * createCopyMenu(QWidget *parent=nullptr)
Create a menu containing clipboard copy entries for this tab.
Definition traffic_tab.cpp:653
void tabDataChanged(int idx, int selcounter)
Signal emitted when the tab data has changed.
void setDelegate(ATapCreateDelegate createDelegate)
Set the Delegate object for the tab. It will apply for all models residing in this tab object.
Definition traffic_tab.cpp:102
void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type)
Signal emitted to trigger a filter action.
void setMachineReadable(bool machine)
Configures output presentation to be machine readable.
Definition traffic_tab.cpp:239
void disableTap()
Disables the taps for this traffic tab.
Definition traffic_tab.cpp:253
void columnsHaveChanged(QList< int > columns)
Signal emitted when the column configuration has changed.
void setOpenTabs(QList< int > protocols)
Opens specific protocol tabs based on a list.
Definition traffic_tab.cpp:266
void tabsChanged(QList< int > protocols)
Signal emitted when the open tabs have changed.
void useNanosecondTimestamps(bool useNSTime)
Use nanosecond timestamps if requested.
Definition traffic_tab.cpp:211
bool hasNameResolution(int tabIdx=-1)
Checks, wether the given tabpage support name resolution on the address column.
Definition traffic_tab.cpp:643
void setNameResolution(bool checked)
Enable/Disable name resolution for the address column.
Definition traffic_tab.cpp:623
QList< QList< QVariant > > selectedItemsIOGData()
Return a list of IOGraph related data, for the currently selected index or indexes in the currently d...
Definition traffic_tab.cpp:472
void disablingTaps()
Signal emitted to notify that taps are being disabled.
void setFilter(QString filter=QString())
Set the filter or remove it by providing an empty filter.
Definition traffic_tab.cpp:612
virtual void attachTab(QWidget *content, QString name) override
Slot called to reattach a previously detached tab.
Definition traffic_tab.cpp:829
qlonglong countSelectedItems(int role=Qt::DisplayRole)
Return the number of currently selected items in the currently displayed treeview.
Definition traffic_tab.cpp:449
ATapDataModel * dataModelForTabIndex(int tabIdx=-1)
Retrieves the tap data model for a specific tab index.
Definition traffic_tab.cpp:595
virtual void detachTab(int idx, QPoint pos) override
Slot called to detach a tab into its own window.
Definition traffic_tab.cpp:814
void useAbsoluteTime(bool absolute)
Use absolute time for the time columns.
Definition traffic_tab.cpp:197
QVariant currentItemData(int role=Qt::DisplayRole)
Return the itemData for the currently selected index in the currently displayed treeview.
Definition traffic_tab.cpp:431
void limitToDisplayFilter(bool limit)
Limits the displayed data to the active display filter.
Definition traffic_tab.cpp:225
void setProtocolInfo(QString tableName, TrafficTypesList *trafficList, GList **recentList, GList **recentColumnList, ATapModelCallback createModel)
Set the Protocol Info for the traffic tab.
Definition traffic_tab.cpp:88
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