3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef TAP_PARAMETER_DIALOG_H
11 #define TAP_PARAMETER_DIALOG_H
14 * @file Base class for statistics and analysis dialogs.
15 * Provides convenience classes for command-line tap parameters ("-z ...")
16 * and general tapping.
21 #include <epan/stat_groups.h>
22 #include <epan/stat_tap_ui.h>
26 #include "filter_action.h"
27 #include "wireshark_dialog.h"
32 class QTreeWidgetItem
;
36 class TapParameterDialog
;
39 class TapParameterDialog
;
40 typedef TapParameterDialog
* (*tpdCreator
)(QWidget
&parent
, const QString cfg_str
, const QString arg
, CaptureFile
&cf
);
42 class TapParameterDialog
: public WiresharkDialog
47 explicit TapParameterDialog(QWidget
&parent
, CaptureFile
&cf
, int help_topic
= 0);
48 ~TapParameterDialog();
50 static const QString
&actionName() { return action_name_
; }
51 static void registerDialog(const QString title
, const char *cfg_abbr
, register_stat_group_t group
, stat_tap_init_cb tap_init_cb
, tpdCreator creator
);
53 static TapParameterDialog
*showTapParameterStatistics(QWidget
&parent
, CaptureFile
&cf
, const QString cfg_str
, const QString arg
, void *);
54 // Needed by static member functions in subclasses. Should we just make
55 // "ui" available instead?
56 QTreeWidget
*statsTreeWidget();
57 QLineEdit
*displayFilterLineEdit();
58 QPushButton
*applyFilterButton();
59 QVBoxLayout
*verticalLayout();
60 QHBoxLayout
*filterLayout();
65 void filterAction(QString filter
, FilterAction::Action action
, FilterAction::ActionType type
);
66 void updateFilter(QString filter
);
71 void contextMenuEvent(QContextMenuEvent
*event
);
72 void addFilterActions();
73 void addTreeCollapseAllActions();
74 QString
displayFilter();
75 void setDisplayFilter(const QString
&filter
);
76 void setHint(const QString
&hint
);
77 // Retap packets on first display. RPC stats need to disable this.
78 void setRetapOnShow(bool retap
);
81 void filterActionTriggered();
82 void collapseAllActionTriggered();
83 void expandAllActionTriggered();
87 Ui::TapParameterDialog
*ui
;
89 QList
<QAction
*> filter_actions_
;
91 static const QString action_name_
;
94 virtual const QString
filterExpression() { return QString(); }
95 QString
itemDataToPlain(QVariant var
, int width
= 0);
96 virtual QList
<QVariant
> treeItemData(QTreeWidgetItem
*) const;
97 virtual QByteArray
getTreeAsString(st_format_type format
);
100 // Called by the constructor. The subclass should tap packets here.
101 virtual void fillTree() = 0;
103 void on_applyFilterButton_clicked();
104 void on_actionCopyToClipboard_triggered();
105 void on_actionSaveAs_triggered();
106 void on_buttonBox_helpRequested();
109 #endif // TAP_PARAMETER_DIALOG_H