Wireshark  4.3.0
The Wireshark network protocol analyzer
wireshark_dialog.h
Go to the documentation of this file.
1 
10 #ifndef WIRESHARK_DIALOG_H
11 #define WIRESHARK_DIALOG_H
12 
13 /*
14  * @file General dialog base class
15  *
16  * Base class which provides convenience methods for dialogs that handle
17  * capture files.
18  *
19  * This class attempts to destroy itself when closed. Doing this safely and
20  * properly can be a bit tricky while scanning and tapping packets since
21  */
22 
23 // "General" is a misnomer but we already have a class named
24 // "CaptureFileDialog". Suggestions for a better name from
25 // https://code.wireshark.org/review/#/c/9739/:
26 // BaseCaptureDialog, CaptureHelperDialog (or rename CaptureFileDialog to something else - WiresharkFileDialog).
27 // TapDialog might make sense as well.
28 
29 #include <epan/tap.h>
30 
31 #include "capture_file.h"
32 #include "geometry_state_dialog.h"
33 
35 {
36  Q_OBJECT
37 
38 public:
39  // XXX Unlike the entire QWidget API, parent is mandatory here.
40  explicit WiresharkDialog(QWidget &parent, CaptureFile &capture_file);
41 
45  bool fileClosed() const { return file_closed_; }
46 
47 protected:
48  virtual void keyPressEvent(QKeyEvent *event) { QDialog::keyPressEvent(event); }
49  virtual void accept();
50  virtual void reject();
51 
62  void beginRetapPackets();
71  virtual void endRetapPackets();
72 
79  void setWindowSubtitle(const QString &subtitle);
80  const QString &windowSubtitle() { return subtitle_; }
81  virtual void updateWidgets();
82 
83  // Capture file and tapping
84  CaptureFile &cap_file_;
100  bool registerTapListener(const char *tap_name, void *tap_data,
101  const char *filter, unsigned flags,
102  tap_reset_cb tap_reset,
103  tap_packet_cb tap_packet,
104  tap_draw_cb tap_draw);
105 
109  virtual void removeTapListeners();
110 
111  // XXX - Move this to private, have subclasses use the getter?
112  bool file_closed_;
113 
118  bool dialogClosed() const { return dialog_closed_; }
119 
125  int retapDepth() const { return retap_depth_; }
126 
133  virtual void captureFileClosing();
134 
141  virtual void captureFileClosed();
142 
143 protected slots:
144  void captureEvent(CaptureEvent);
145 
146 private:
147  void dialogCleanup(bool closeDialog = false);
148 
149  QString subtitle_;
150  QList<void *> tap_listeners_;
151  int retap_depth_;
152  bool dialog_closed_;
153 
154 private slots:
155 };
156 
157 #endif // WIRESHARK_DIALOG_H
Definition: capture_event.h:21
Definition: capture_file.h:21
Definition: geometry_state_dialog.h:17
Definition: wireshark_dialog.h:35
bool fileClosed() const
true if the file has been closed, false otherwise.
Definition: wireshark_dialog.h:45
bool dialogClosed() const
Check to see if the user has closed (and not minimized) the dialog.
Definition: wireshark_dialog.h:118
virtual void removeTapListeners()
Remove all tap listeners registered via registerTapListener.
Definition: wireshark_dialog.cpp:159
bool registerTapListener(const char *tap_name, void *tap_data, const char *filter, unsigned flags, tap_reset_cb tap_reset, tap_packet_cb tap_packet, tap_draw_cb tap_draw)
Convenience wrapper for register_tap_listener. Tap listeners registered via this function are automat...
Definition: wireshark_dialog.cpp:96
int retapDepth() const
Check to see if we're currently retapping. If this is positive, tapping will fail in process_specifie...
Definition: wireshark_dialog.h:125
virtual void captureFileClosed()
Called when the capture file was closed. This can be used to enable or disable widgets according to t...
Definition: wireshark_dialog.cpp:172
void setWindowSubtitle(const QString &subtitle)
Set the window subtitle, e.g. "Foo Timeouts". The subtitle and file name will be added to the dialog ...
Definition: wireshark_dialog.cpp:56
virtual void captureFileClosing()
Called when the capture file is about to close. This can be used to disconnect taps and similar actio...
Definition: wireshark_dialog.cpp:166
void beginRetapPackets()
Mark the start of a code block that retaps packets. If the user closes the dialog while tapping,...
Definition: wireshark_dialog.cpp:148
virtual void endRetapPackets()
Mark the end of a code block that retaps packets. If the user has closed the dialog it will be desroy...
Definition: wireshark_dialog.cpp:153
Definition: cfile.h:67