Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
tap_parameter_dialog.h
1 /* tap_parameter_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 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 <glib.h>
22 
23 #include <epan/stat_groups.h>
24 #include <epan/stat_tap_ui.h>
25 
26 #include <QMenu>
27 
28 #include "filter_action.h"
29 #include "wireshark_dialog.h"
30 
31 class QHBoxLayout;
32 class QLineEdit;
33 class QTreeWidget;
34 class QTreeWidgetItem;
35 class QVBoxLayout;
36 
37 namespace Ui {
38 class TapParameterDialog;
39 }
40 
41 class TapParameterDialog;
42 typedef TapParameterDialog* (*tpdCreator)(QWidget &parent, const QString cfg_str, const QString arg, CaptureFile &cf);
43 
45 {
46  Q_OBJECT
47 
48 public:
49  explicit TapParameterDialog(QWidget &parent, CaptureFile &cf, int help_topic = 0);
51 
52  static const QString &actionName() { return action_name_; }
53  static void registerDialog(const QString title, const char *cfg_abbr, register_stat_group_t group, stat_tap_init_cb tap_init_cb, tpdCreator creator);
54 
55  static TapParameterDialog *showTapParameterStatistics(QWidget &parent, CaptureFile &cf, const QString cfg_str, const QString arg, void *);
56  // Needed by static member functions in subclasses. Should we just make
57  // "ui" available instead?
58  QTreeWidget *statsTreeWidget();
59  QLineEdit *displayFilterLineEdit();
60  QPushButton *applyFilterButton();
61  QVBoxLayout *verticalLayout();
62  QHBoxLayout *filterLayout();
63 
64  void drawTreeItems();
65 
66 signals:
67  void filterAction(QString filter, FilterAction::Action action, FilterAction::ActionType type);
68  void updateFilter(QString filter);
69 
70 public slots:
71 
72 protected:
73  void contextMenuEvent(QContextMenuEvent *event);
74  void addFilterActions();
75  QString displayFilter();
76  void setDisplayFilter(const QString &filter);
77  void setHint(const QString &hint);
78  // Retap packets on first display. RPC stats need to disable this.
79  void setRetapOnShow(bool retap);
80 
81 protected slots:
82  void filterActionTriggered();
83  void updateWidgets();
84 
85 private:
87  QMenu ctx_menu_;
88  QList<QAction *> filter_actions_;
89  int help_topic_;
90  static const QString action_name_;
91  QTimer *show_timer_;
92 
93  virtual const QString filterExpression() { return QString(); }
94  QString itemDataToPlain(QVariant var, int width = 0);
95  virtual QList<QVariant> treeItemData(QTreeWidgetItem *) const;
96  virtual QByteArray getTreeAsString(st_format_type format);
97 
98 private slots:
99  // Called by the constructor. The subclass should tap packets here.
100  virtual void fillTree() = 0;
101 
102  void on_applyFilterButton_clicked();
103  void on_actionCopyToClipboard_triggered();
104  void on_actionSaveAs_triggered();
105  void on_buttonBox_helpRequested();
106 };
107 
108 #endif // TAP_PARAMETER_DIALOG_H
109 
110 /*
111  * Editor modelines
112  *
113  * Local Variables:
114  * c-basic-offset: 4
115  * tab-width: 8
116  * indent-tabs-mode: nil
117  * End:
118  *
119  * ex: set shiftwidth=4 tabstop=8 expandtab:
120  * :indentSize=4:tabSize=8:noTabs=true:
121  */
Definition: ui_about_dialog.h:291
enum _st_format_type st_format_type
Definition: tap_parameter_dialog.h:44
Definition: ui_tap_parameter_dialog.h:128
register_stat_group_t
Definition: stat_groups.h:45
Definition: wireshark_dialog.h:32
Definition: capture_file.h:22