| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
tap_parameter_dialog.h
Go to the documentation of this file.
1
9
10#ifndef TAP_PARAMETER_DIALOG_H
11#define TAP_PARAMETER_DIALOG_H
12
13/*
14 * @file Base class for statistics and analysis dialogs.
15 * Provides convenience classes for command-line tap parameters ("-z ...")
16 * and general tapping.
17 */
18
19#include "config.h"
20
21#include <epan/stat_groups.h>
22#include <epan/stat_tap_ui.h>
23
24#include <QMenu>
25
26#include "filter_action.h"
27#include "wireshark_dialog.h"
28
29 class QHBoxLayout;
30 class QLineEdit;
31 class QTreeWidget;
32 class QTreeWidgetItem;
33 class QVBoxLayout;
34
35 namespace Ui {
36 class TapParameterDialog;
37}
38
39 class TapParameterDialog;
48 typedef TapParameterDialog *(*tpdCreator)(QWidget &parent, const QString cfg_str,
49 const QString arg, CaptureFile &cf);
50
51
57 class TapParameterDialog : public WiresharkDialog
58{
59 Q_OBJECT
60
61 public:
68 explicit TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic = 0);
69
73 ~TapParameterDialog();
74
79 static const QString &actionName() { return action_name_; }
80
90 static void registerDialog(const QString title, const char *cfg_abbr,
91 register_stat_group_t group,
92 stat_tap_init_cb tap_init_cb,
93 tpdCreator creator);
94
103 static TapParameterDialog *showTapParameterStatistics(QWidget &parent, CaptureFile &cf,
104 const QString cfg_str,
105 const QString arg, void *);
106
107 // Needed by static member functions in subclasses. Should we just make
108 // "ui" available instead?
113 QTreeWidget *statsTreeWidget();
114
119 QLineEdit *displayFilterLineEdit();
120
125 QPushButton *applyFilterButton();
126
132 QVBoxLayout *verticalLayout();
133
138 QHBoxLayout *filterLayout();
139
144 void drawTreeItems();
145
146signals:
153 void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
154
159 void updateFilter(QString filter);
160
161 public slots:
162
163 protected:
168 void contextMenuEvent(QContextMenuEvent *event) override;
169
173 void addFilterActions();
174
178 void addTreeCollapseAllActions();
179
184 QString displayFilter();
185
190 void setDisplayFilter(const QString &filter);
191
196 void setHint(const QString &hint);
197
203 void setRetapOnShow(bool retap);
204
209 Ui::TapParameterDialog * getUI(void)
210 {
211 return (ui);
212 }
213
214 protected slots:
218 void filterActionTriggered();
219
221 void collapseAllActionTriggered();
222
224 void expandAllActionTriggered();
225
230 void updateWidgets() override;
231
232 private:
233 Ui::TapParameterDialog *ui;
234 QMenu ctx_menu_;
235 QList<QAction *> filter_actions_;
236 int help_topic_;
237 static const QString action_name_;
238 QTimer *show_timer_;
239
245 virtual const QString filterExpression() { return QString(); }
246
253 QString itemDataToPlain(QVariant var, int width = 0);
254
261 virtual QList<QVariant> treeItemData(QTreeWidgetItem *) const;
262
268 virtual QByteArray getTreeAsString(st_format_type format);
269
270 private slots:
275 virtual void fillTree() = 0;
276
280 void on_applyFilterButton_clicked();
281
285 void on_actionCopyToClipboard_triggered();
286
290 void on_actionSaveAs_triggered();
291
295 void on_buttonBox_helpRequested();
296};
297
298#endif // TAP_PARAMETER_DIALOG_H
CaptureFile
Manages a capture file and its associated state and operations.
Definition capture_file.h:27
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
TapParameterDialog
Base class for statistics dialogs driven by a tap and an optional display filter, presenting results ...
Definition tap_parameter_dialog.h:58
TapParameterDialog::actionName
static const QString & actionName()
Returns the action name string used to identify this dialog type in menus.
Definition tap_parameter_dialog.h:79
TapParameterDialog::contextMenuEvent
void contextMenuEvent(QContextMenuEvent *event) override
Shows the context menu with filter and tree collapse/expand actions.
Definition tap_parameter_dialog.cpp:434
TapParameterDialog::addFilterActions
void addFilterActions()
Populates the context menu with filter actions for the selected tree item.
Definition tap_parameter_dialog.cpp:445
TapParameterDialog::getUI
Ui::TapParameterDialog * getUI(void)
Retrieves the UI object.
Definition tap_parameter_dialog.h:209
TapParameterDialog::addTreeCollapseAllActions
void addTreeCollapseAllActions()
Adds "Collapse All" and "Expand All" actions to the context menu.
Definition tap_parameter_dialog.cpp:492
TapParameterDialog::registerDialog
static void registerDialog(const QString title, const char *cfg_abbr, register_stat_group_t group, stat_tap_init_cb tap_init_cb, tpdCreator creator)
Registers a TapParameterDialog subclass so it can be opened via the statistics menu or the "-z" comma...
Definition tap_parameter_dialog.cpp:114
TapParameterDialog::filterLayout
QHBoxLayout * filterLayout()
Returns the filter bar horizontal layout for use by subclasses.
Definition tap_parameter_dialog.cpp:164
TapParameterDialog::filterActionTriggered
void filterActionTriggered()
Applies the filter action associated with the triggered context menu action.
Definition tap_parameter_dialog.cpp:195
TapParameterDialog::collapseAllActionTriggered
void collapseAllActionTriggered()
Collapses all items in the statistics tree.
Definition tap_parameter_dialog.cpp:207
TapParameterDialog::drawTreeItems
void drawTreeItems()
Triggers a full redraw of all tree items, typically called after the tap has finished accumulating da...
Definition tap_parameter_dialog.cpp:415
TapParameterDialog::displayFilter
QString displayFilter()
Returns the current display filter string from the filter line edit.
Definition tap_parameter_dialog.cpp:169
TapParameterDialog::setDisplayFilter
void setDisplayFilter(const QString &filter)
Sets the display filter line edit to the given expression.
Definition tap_parameter_dialog.cpp:176
TapParameterDialog::displayFilterLineEdit
QLineEdit * displayFilterLineEdit()
Returns the display filter line edit widget for use by subclasses.
Definition tap_parameter_dialog.cpp:149
TapParameterDialog::updateFilter
void updateFilter(QString filter)
Emitted to push a new display filter to the main window filter bar.
TapParameterDialog::updateWidgets
void updateWidgets() override
Refreshes the enabled/disabled state of UI widgets based on current capture and filter state.
Definition tap_parameter_dialog.cpp:505
TapParameterDialog::setHint
void setHint(const QString &hint)
Sets the hint text shown below the tree widget.
Definition tap_parameter_dialog.cpp:181
TapParameterDialog::TapParameterDialog
TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic=0)
Constructs the tap parameter dialog and registers it for retapping.
Definition tap_parameter_dialog.cpp:69
TapParameterDialog::setRetapOnShow
void setRetapOnShow(bool retap)
Controls whether packets are retapped when the dialog is first shown. RPC statistics dialogs should d...
Definition tap_parameter_dialog.cpp:187
TapParameterDialog::~TapParameterDialog
~TapParameterDialog()
Destroys the dialog, deregisters the tap, and releases UI resources.
Definition tap_parameter_dialog.cpp:107
TapParameterDialog::filterAction
void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type)
Emitted when the user triggers a filter action from the context menu.
TapParameterDialog::expandAllActionTriggered
void expandAllActionTriggered()
Expands all items in the statistics tree.
Definition tap_parameter_dialog.cpp:210
TapParameterDialog::applyFilterButton
QPushButton * applyFilterButton()
Returns the Apply Filter button for use by subclasses.
Definition tap_parameter_dialog.cpp:154
TapParameterDialog::verticalLayout
QVBoxLayout * verticalLayout()
Returns the main vertical layout for use by subclasses that need to insert additional widgets.
Definition tap_parameter_dialog.cpp:159
TapParameterDialog::statsTreeWidget
QTreeWidget * statsTreeWidget()
Returns the statistics results tree widget for use by subclasses.
Definition tap_parameter_dialog.cpp:144
TapParameterDialog::showTapParameterStatistics
static TapParameterDialog * showTapParameterStatistics(QWidget &parent, CaptureFile &cf, const QString cfg_str, const QString arg, void *)
Finds or creates and shows the tap statistics dialog matching cfg_str.
Definition tap_parameter_dialog.cpp:135
WiresharkDialog::WiresharkDialog
WiresharkDialog(QWidget &parent, CaptureFile &capture_file)
Constructs a new WiresharkDialog object.
Definition wireshark_dialog.cpp:30
filter_action.h
stat_groups.h
st_format_type
enum _st_format_type st_format_type
Output format used when saving statistics tree data via "Save As...".
register_stat_group_t
enum register_stat_group_e register_stat_group_t
stat_tap_ui.h
stat_tap_init_cb
bool(* stat_tap_init_cb)(const char *opt_arg, void *userdata)
Callback invoked to initialize a tap statistic with its CLI argument string.
Definition stat_tap_ui.h:53
tpdCreator
TapParameterDialog *(* tpdCreator)(QWidget &parent, const QString cfg_str, const QString arg, CaptureFile &cf)
Factory function signature for creating TapParameterDialog subclass instances.
Definition tap_parameter_dialog.h:48
wireshark_dialog.h