Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
wireshark_dialog.h
Go to the documentation of this file.
1
9
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"
33
38{
39 Q_OBJECT
40
41public:
42 // XXX Unlike the entire QWidget API, parent is mandatory here.
48 explicit WiresharkDialog(QWidget &parent, CaptureFile &capture_file);
49
54 bool fileClosed() const { return file_closed_; }
55
56protected:
61 virtual void keyPressEvent(QKeyEvent *event) override { QDialog::keyPressEvent(event); }
62
66 virtual void accept() override;
67
71 virtual void reject() override;
72
82 virtual void beginRetapPackets();
83
92 virtual void endRetapPackets();
93
100 void setWindowSubtitle(const QString &subtitle);
101
106 const QString &windowSubtitle() { return subtitle_; }
107
111 virtual void updateWidgets();
112
113 // Capture file and tapping
116
133 bool registerTapListener(const char *tap_name, void *tap_data,
134 const char *filter, unsigned flags,
135 tap_reset_cb tap_reset,
136 tap_packet_cb tap_packet,
137 tap_draw_cb tap_draw);
138
142 virtual void removeTapListeners();
143
144 // XXX - Move this to private, have subclasses use the getter?
147
148 bool listening() const { return !tap_listeners_.isEmpty(); }
149
154 bool dialogClosed() const { return dialog_closed_; }
155
161 int retapDepth() const { return retap_depth_; }
162
169 virtual void captureFileClosing();
170
177 virtual void captureFileClosed();
178
179protected slots:
185
186private:
191 void dialogCleanup(bool closeDialog = false);
192
194 QString subtitle_;
195
197 QList<void *> tap_listeners_;
198
200 int retap_depth_;
201
203 bool dialog_closed_;
204
205private slots:
206};
207
208#endif // WIRESHARK_DIALOG_H
struct _capture_file capture_file
Represents a capture file and its associated metadata.
Represents an event occurring during a capture or file operation.
Definition capture_event.h:24
Manages a capture file and its associated state and operations.
Definition capture_file.h:27
GeometryStateDialog(QWidget *parent, Qt::WindowFlags f=Qt::Window)
Constructs a new GeometryStateDialog with the specified parent and window flags.
Definition geometry_state_dialog.h:91
bool fileClosed() const
Checks if the capture file has been closed.
Definition wireshark_dialog.h:54
bool dialogClosed() const
Check to see if the user has closed (and not minimized) the dialog.
Definition wireshark_dialog.h:154
CaptureFile & cap_file_
Reference to the underlying capture file.
Definition wireshark_dialog.h:115
virtual void removeTapListeners()
Remove all tap listeners registered via registerTapListener.
Definition wireshark_dialog.cpp:160
virtual void updateWidgets()
Updates the state and contents of the dialog's widgets.
Definition wireshark_dialog.cpp:92
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:97
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:161
bool file_closed_
Flag indicating if the capture file has been closed.
Definition wireshark_dialog.h:146
WiresharkDialog(QWidget &parent, CaptureFile &capture_file)
Constructs a new WiresharkDialog object.
Definition wireshark_dialog.cpp:30
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:173
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:167
void captureEvent(CaptureEvent e)
Handles capture events.
Definition wireshark_dialog.cpp:112
const QString & windowSubtitle()
Retrieves the current window subtitle.
Definition wireshark_dialog.h:106
virtual void keyPressEvent(QKeyEvent *event) override
Handles key press events.
Definition wireshark_dialog.h:61
virtual void accept() override
Accepts the dialog.
Definition wireshark_dialog.cpp:43
virtual void beginRetapPackets()
Mark the start of a code block that retaps packets. If the user closes the dialog while tapping,...
Definition wireshark_dialog.cpp:149
virtual void reject() override
Rejects the dialog.
Definition wireshark_dialog.cpp:50
virtual void endRetapPackets()
Mark the end of a code block that retaps packets. If the user has closed the dialog it will be destro...
Definition wireshark_dialog.cpp:154