Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

traffic_table_dialog.h
1 /* traffic_table_dialog.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10 #ifndef TRAFFIC_TABLE_DIALOG_H
11 #define TRAFFIC_TABLE_DIALOG_H
12
13 #include <config.h>
14
15 #include "file.h"
16
17 #include "epan/conversation_table.h"
18
19 #include "epan/follow.h"
20
21 #include "capture_file.h"
22 #include "filter_action.h"
23 #include "wireshark_dialog.h"
24
25 #include <QMenu>
26 #include <QTreeWidgetItem>
27
28 class QCheckBox;
29 class QDialogButtonBox;
30 class QPushButton;
31 class QTabWidget;
32 class QTreeWidget;
33
34 namespace Ui {
35 class TrafficTableDialog;
36 }
37
38 class TrafficTableTreeWidgetItem : public QTreeWidgetItem
39 {
40 public:
41 TrafficTableTreeWidgetItem(QTreeWidget *tree) : QTreeWidgetItem(tree) {}
42 TrafficTableTreeWidgetItem(QTreeWidget *parent, const QStringList &strings)
43 : QTreeWidgetItem (parent, strings) {}
44 virtual QVariant colData(int col, bool resolve_names) const = 0;
45 };
46
47 class TrafficTableTreeWidget : public QTreeWidget
48 {
49 Q_OBJECT
50 public:
51 explicit TrafficTableTreeWidget(QWidget *parent, register_ct_t* table);
52 ~TrafficTableTreeWidget();
53
54 // String, int, or double data for each column in a row.
55 // Passing -1 returns titles.
56 QList<QVariant> rowData(int row) const;
57
58 bool hasNameResolution() const;
59
60 public slots:
61 void setNameResolutionEnabled(bool enable);
62
63 // Title string plus optional count
64 const QString &trafficTreeTitle() { return title_; }
65 conv_hash_t* trafficTreeHash() {return &hash_;}
66
67 protected:
68 register_ct_t* table_;
69 QString title_;
70 conv_hash_t hash_;
71 bool resolve_names_;
72 QMenu ctx_menu_;
73
74 // When adding rows, resize to contents up to this number.
75 int resizeThreshold() const { return 200; }
76 void contextMenuEvent(QContextMenuEvent *event);
77
78 private:
79 virtual void updateItems() {}
80
81 private slots:
82 // Updates all items
83 void updateItemsForSettingChange();
84
85 signals:
86 void titleChanged(QWidget *tree, const QString &text);
87 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
88 };
89
90 class TrafficTableDialog : public WiresharkDialog
91 {
92 Q_OBJECT
93 Q_PROPERTY(bool absolute_start_time READ absoluteStartTime)
94 Q_PROPERTY(bool nanosecond_timestamps READ nanosecondTimestamps)
95
96 public:
104 explicit TrafficTableDialog(QWidget &parent, CaptureFile &cf, const char *filter = NULL, const QString &table_name = tr("Unknown"));
105 ~TrafficTableDialog();
106
110 bool absoluteStartTime();
111
115 bool nanosecondTimestamps() { return nanosecond_timestamps_; }
116
117 public slots:
118
119 signals:
120 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
121 void openFollowStreamDialog(follow_type_t type);
122 void openTcpStreamGraph(int graph_type);
123
124 protected:
125 Ui::TrafficTableDialog *ui;
126
127 CaptureFile &cap_file_;
128 bool file_closed_;
129 QString filter_;
130 QMenu traffic_type_menu_;
131 QPushButton *copy_bt_;
132 QMap<int, TrafficTableTreeWidget *> proto_id_to_tree_;
133
134 const QList<int> defaultProtos() const;
135 static gboolean fillTypeMenuFunc(const void *key, void *value, void *userdata);
136 void fillTypeMenu(QList<int> &enabled_protos);
137 // Adds a conversation tree. Returns true if the tree was freshly created, false if it was cached.
138 virtual bool addTrafficTable(register_ct_t*) { return false; }
139 void addProgressFrame(QObject *parent);
140
141 // UI getters
142 QDialogButtonBox *buttonBox() const;
143 QTabWidget *trafficTableTabWidget() const;
144 QCheckBox *displayFilterCheckBox() const;
145 QCheckBox *nameResolutionCheckBox() const;
146 QCheckBox *absoluteTimeCheckBox() const;
147 QPushButton *enabledTypesPushButton() const;
148
149 protected slots:
150 virtual void currentTabChanged();
151 void updateWidgets();
152
153 private:
154 QString window_name_;
155 bool nanosecond_timestamps_;
156
157 QList<QVariant> curTreeRowData(int row) const;
158
159
160 private slots:
161 void on_nameResolutionCheckBox_toggled(bool checked);
162 void on_displayFilterCheckBox_toggled(bool checked);
163 void setTabText(QWidget *tree, const QString &text);
164 void toggleTable();
165 void captureEvent(CaptureEvent e);
166
167 void copyAsCsv();
168 void copyAsYaml();
169 virtual void on_buttonBox_helpRequested() = 0;
170 };
171
172 #endif // TRAFFIC_TABLE_DIALOG_H
173
174 /*
175 * Editor modelines
176 *
177 * Local Variables:
178 * c-basic-offset: 4
179 * tab-width: 8
180 * indent-tabs-mode: nil
181 * End:
182 *
183 * ex: set shiftwidth=4 tabstop=8 expandtab:
184 * :indentSize=4:tabSize=8:noTabs=true:
185 */
TrafficTableTreeWidget
Definition: traffic_table_dialog.h:47
_conversation_hash_t
Definition: conversation_table.h:53
Ui
Definition: ui_about_dialog.h:291
register_ct
Definition: conversation_table.c:24
Ui::TrafficTableDialog
Definition: ui_traffic_table_dialog.h:131
conversation_table.h
TrafficTableTreeWidgetItem
Definition: traffic_table_dialog.h:38
CaptureEvent
Definition: capture_event.h:19
TrafficTableDialog::nanosecondTimestamps
bool nanosecondTimestamps()
Definition: traffic_table_dialog.h:115
WiresharkDialog
Definition: wireshark_dialog.h:32
TrafficTableDialog
Definition: traffic_table_dialog.h:90
CaptureFile
Definition: capture_file.h:22