| 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
15#include <ui/qt/models/atap_data_model.h>
16#include <ui/qt/filter_action.h>
17#include <ui/qt/widgets/traffic_tree.h>
18#include <ui/qt/widgets/detachable_tabwidget.h>
19#include <ui/qt/widgets/traffic_types_list.h>
20
21#include <QTabWidget>
22#include <QTreeView>
23#include <QFile>
24#include <QUrl>
25#include <QAbstractItemDelegate>
26#include <QSortFilterProxyModel>
27
36 typedef ATapDataModel * (*ATapModelCallback)(int protoId, QString filter);
37
45 typedef QAbstractItemDelegate * (*ATapCreateDelegate)(QWidget * parent);
46
50 class TabData
51{
52 public:
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
87 private:
89 QString _name;
90
92 int _protoId;
93};
94
95Q_DECLARE_METATYPE(TabData)
96
97
105class TrafficTab : public DetachableTabWidget
106{
107 Q_OBJECT
108
109 public:
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
257 public 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:
291 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
292
298 void tabDataChanged(int idx, int selcounter);
299
303 void retapRequired();
304
308 void disablingTaps();
309
314 void tabsChanged(QList<int> protocols);
315
320 void columnsHaveChanged(QList<int> columns);
321
322 protected slots:
323
329 virtual void detachTab(int idx, QPoint pos) override;
330
336 virtual void attachTab(QWidget * content, QString name) override;
337
338 private:
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
428 private 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
atap_data_model.h
ATapDataModel
DataModel for tap user data.
Definition atap_data_model.h:33
DetachableTabWidget::DetachableTabWidget
DetachableTabWidget(QWidget *parent=nullptr)
Constructs a new DetachableTabWidget.
Definition detachable_tabwidget.cpp:26
FilterAction::Action
Action
Defines an action to be taken with a filter.
Definition filter_action.h:30
FilterAction::ActionType
ActionType
Defines how the new filter should be combined with the existing one.
Definition filter_action.h:43
TabData
A simple class to store the data for a tab in the traffic tab widget.
Definition traffic_tab.h:51
TabData::operator=
TabData & operator=(const TabData &)=default
Copy assignment operator.
TabData::TabData
TabData()
Constructs a new empty TabData object.
Definition traffic_tab.cpp:48
TabData::protoId
int protoId() const
Retrieves the protocol ID.
Definition traffic_tab.cpp:63
TabData::TabData
TabData(const TabData &)=default
Copy constructor.
TabData::name
QString name() const
Retrieves the name of the tab.
Definition traffic_tab.cpp:58
TrafficDataFilterProxy
Proxy model handling sorting, filtering, and column visibility for traffic data.
Definition traffic_tree.h:157
TrafficTab::TrafficTab
TrafficTab(QWidget *parent=nullptr)
Constructs a new TrafficTab widget.
Definition traffic_tab.cpp:69
TrafficTab::createCopyMenu
QMenu * createCopyMenu(QWidget *parent=nullptr)
Create a menu containing clipboard copy entries for this tab.
Definition traffic_tab.cpp:653
TrafficTab::tabDataChanged
void tabDataChanged(int idx, int selcounter)
Signal emitted when the tab data has changed.
TrafficTab::setDelegate
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
TrafficTab::filterAction
void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type)
Signal emitted to trigger a filter action.
TrafficTab::setMachineReadable
void setMachineReadable(bool machine)
Configures output presentation to be machine readable.
Definition traffic_tab.cpp:239
TrafficTab::disableTap
void disableTap()
Disables the taps for this traffic tab.
Definition traffic_tab.cpp:253
TrafficTab::columnsHaveChanged
void columnsHaveChanged(QList< int > columns)
Signal emitted when the column configuration has changed.
TrafficTab::setOpenTabs
void setOpenTabs(QList< int > protocols)
Opens specific protocol tabs based on a list.
Definition traffic_tab.cpp:266
TrafficTab::tabsChanged
void tabsChanged(QList< int > protocols)
Signal emitted when the open tabs have changed.
TrafficTab::useNanosecondTimestamps
void useNanosecondTimestamps(bool useNSTime)
Use nanosecond timestamps if requested.
Definition traffic_tab.cpp:211
TrafficTab::hasNameResolution
bool hasNameResolution(int tabIdx=-1)
Checks, wether the given tabpage support name resolution on the address column.
Definition traffic_tab.cpp:643
TrafficTab::setNameResolution
void setNameResolution(bool checked)
Enable/Disable name resolution for the address column.
Definition traffic_tab.cpp:623
TrafficTab::selectedItemsIOGData
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
TrafficTab::disablingTaps
void disablingTaps()
Signal emitted to notify that taps are being disabled.
TrafficTab::setFilter
void setFilter(QString filter=QString())
Set the filter or remove it by providing an empty filter.
Definition traffic_tab.cpp:612
TrafficTab::attachTab
virtual void attachTab(QWidget *content, QString name) override
Slot called to reattach a previously detached tab.
Definition traffic_tab.cpp:829
TrafficTab::countSelectedItems
qlonglong countSelectedItems(int role=Qt::DisplayRole)
Return the number of currently selected items in the currently displayed treeview.
Definition traffic_tab.cpp:449
TrafficTab::dataModelForTabIndex
ATapDataModel * dataModelForTabIndex(int tabIdx=-1)
Retrieves the tap data model for a specific tab index.
Definition traffic_tab.cpp:595
TrafficTab::detachTab
virtual void detachTab(int idx, QPoint pos) override
Slot called to detach a tab into its own window.
Definition traffic_tab.cpp:814
TrafficTab::useAbsoluteTime
void useAbsoluteTime(bool absolute)
Use absolute time for the time columns.
Definition traffic_tab.cpp:197
TrafficTab::currentItemData
QVariant currentItemData(int role=Qt::DisplayRole)
Return the itemData for the currently selected index in the currently displayed treeview.
Definition traffic_tab.cpp:431
TrafficTab::limitToDisplayFilter
void limitToDisplayFilter(bool limit)
Limits the displayed data to the active display filter.
Definition traffic_tab.cpp:225
TrafficTab::setProtocolInfo
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
TrafficTab::retapRequired
void retapRequired()
Signal emitted when a retap operation is required.
TrafficTypesList
Tree view widget that presents a filterable, sortable, checkable list of traffic-tap protocols and fo...
Definition traffic_types_list.h:229
filter_action.h
ATapModelCallback
ATapDataModel *(* ATapModelCallback)(int protoId, QString filter)
Callback for creating an ATapDataModel.
Definition traffic_tab.h:36
ATapCreateDelegate
QAbstractItemDelegate *(* ATapCreateDelegate)(QWidget *parent)
Callback for creating an item delegate.
Definition traffic_tab.h:45
traffic_tree.h
traffic_types_list.h