Wireshark  4.3.0
The Wireshark network protocol analyzer
tap_parameter_dialog.h
Go to the documentation of this file.
1 
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;
40 typedef TapParameterDialog* (*tpdCreator)(QWidget &parent, const QString cfg_str, const QString arg, CaptureFile &cf);
41 
43 {
44  Q_OBJECT
45 
46 public:
47  explicit TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic = 0);
49 
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);
52 
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();
61 
62  void drawTreeItems();
63 
64 signals:
65  void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
66  void updateFilter(QString filter);
67 
68 public slots:
69 
70 protected:
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);
79 
80 protected slots:
81  void filterActionTriggered();
82  void collapseAllActionTriggered();
83  void expandAllActionTriggered();
84  void updateWidgets();
85 
86 private:
87  Ui::TapParameterDialog *ui;
88  QMenu ctx_menu_;
89  QList<QAction *> filter_actions_;
90  int help_topic_;
91  static const QString action_name_;
92  QTimer *show_timer_;
93 
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);
98 
99 private slots:
100  // Called by the constructor. The subclass should tap packets here.
101  virtual void fillTree() = 0;
102 
103  void on_applyFilterButton_clicked();
104  void on_actionCopyToClipboard_triggered();
105  void on_actionSaveAs_triggered();
106  void on_buttonBox_helpRequested();
107 };
108 
109 #endif // TAP_PARAMETER_DIALOG_H
Definition: capture_file.h:21
Definition: tap_parameter_dialog.h:43
Definition: wireshark_dialog.h:35
enum _st_format_type st_format_type
enum register_stat_group_e register_stat_group_t