| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
show_packet_bytes_dialog.h
Go to the documentation of this file.
1
9
10#ifndef SHOW_PACKET_BYTES_DIALOG_H
11#define SHOW_PACKET_BYTES_DIALOG_H
12
13#include <config.h>
14#include <stdio.h>
15
16#ifdef HAVE_UNISTD_H
17#include <unistd.h>
18#endif
19
20#include <epan/tvbuff.h>
21#include "wireshark_dialog.h"
22
23#include <QLineEdit>
24#include <QPushButton>
25#include <QTextEdit>
26
27 namespace Ui {
28 class ShowPacketBytesDialog;
29 class ShowPacketBytesTextEdit;
30}
31
36 struct uncompress_list_t {
37 QString name;
38 tvbuff_t *(*function)(tvbuff_t *, unsigned, unsigned);
39};
40
41
47 class ShowPacketBytesDialog : public WiresharkDialog
48{
49 Q_OBJECT
50
51 public:
57 explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
58
62 ~ShowPacketBytesDialog();
63
68 void addCodecs(const QMap<QString, const char *> &codecMap);
69
70 protected:
78 bool eventFilter(QObject *obj, QEvent *event) override;
79
85 void keyPressEvent(QKeyEvent *event) override;
86
87 private slots:
92 void on_sbStart_valueChanged(int value);
93
98 void on_sbEnd_valueChanged(int value);
99
105 void on_cbDecodeAs_currentIndexChanged(int idx);
106
112 void on_cbShowAs_currentIndexChanged(int idx);
113
117 void on_leFind_returnPressed();
118
123 void on_bFind_clicked();
124
128 void on_buttonBox_rejected();
129
136 void showSelected(int start, int end);
137
142 void useRegexFind(bool use_regex);
143
149 void findText(bool go_back = true);
150
152 void helpButton();
153
155 void printBytes();
156
158 void copyBytes();
159
161 void saveAs();
162
163 private:
170 void setStartAndEnd(int start, int end);
171
177 bool enableShowSelected();
178
182 void updateWidgets() override;
183
188 void updateHintLabel();
189
195 void sanitizeBuffer(QByteArray &ba, bool handle_CR);
196
202 void symbolizeBuffer(QByteArray &ba);
203
210 QByteArray decodeQuotedPrintable(const uint8_t *bytes, int length);
211
216 void rot13(QByteArray &ba);
217
224 void updateFieldBytes(bool initialization = false);
225
230 void updatePacketBytes();
231
232 Ui::ShowPacketBytesDialog *ui;
233
234 tvbuff_t *tvb_;
235 QByteArray field_bytes_;
236 QString hint_label_;
237 QString decode_as_name_;
238 QPushButton *print_button_;
239 QPushButton *copy_button_;
240 QPushButton *save_as_button_;
241 bool use_regex_find_;
242 int start_;
243 int end_;
244 QImage image_;
245};
246
247
252 class ShowPacketBytesTextEdit : public QTextEdit
253{
254 Q_OBJECT
255
256 public:
261 explicit ShowPacketBytesTextEdit(QWidget *parent = nullptr);
262
266 ~ShowPacketBytesTextEdit() { }
267
272 void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
273
278 void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
279
280signals:
287 void showSelected(int start, int end);
288
289 private slots:
295 void contextMenuEvent(QContextMenuEvent *event) override;
296
300 void showSelected();
301
306 void showAll();
307
308 private:
309 bool show_selected_enabled_;
310 bool menus_enabled_;
311};
312
313#endif // SHOW_PACKET_BYTES_DIALOG_H
CaptureFile
Manages a capture file and its associated state and operations.
Definition capture_file.h:27
ShowPacketBytesDialog::addCodecs
void addCodecs(const QMap< QString, const char * > &codecMap)
Populates the character-encoding combo box with the supplied codecs.
Definition show_packet_bytes_dialog.cpp:128
ShowPacketBytesDialog::ShowPacketBytesDialog
ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf)
Constructs a ShowPacketBytesDialog for the currently selected field.
Definition show_packet_bytes_dialog.cpp:42
ShowPacketBytesDialog::eventFilter
bool eventFilter(QObject *obj, QEvent *event) override
Intercepts events on watched objects; used to detect text selection changes in the display widget.
Definition show_packet_bytes_dialog.cpp:450
ShowPacketBytesDialog::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Handles key press events; maps Ctrl+F to the find field and Enter/Return to findText().
Definition show_packet_bytes_dialog.cpp:470
ShowPacketBytesDialog::~ShowPacketBytesDialog
~ShowPacketBytesDialog()
Destroys the dialog and releases all associated resources.
Definition show_packet_bytes_dialog.cpp:122
ShowPacketBytesTextEdit::showSelected
void showSelected(int start, int end)
Emitted when the user chooses "Show Selected Bytes", carrying the character positions of the selectio...
ShowPacketBytesTextEdit::ShowPacketBytesTextEdit
ShowPacketBytesTextEdit(QWidget *parent=nullptr)
Constructs a ShowPacketBytesTextEdit.
Definition show_packet_bytes_dialog.cpp:932
ShowPacketBytesTextEdit::setShowSelectedEnabled
void setShowSelectedEnabled(bool enabled)
Enables or disables the "Show Selected Bytes" context menu action.
Definition show_packet_bytes_dialog.h:272
ShowPacketBytesTextEdit::~ShowPacketBytesTextEdit
~ShowPacketBytesTextEdit()
Destroys the text edit widget.
Definition show_packet_bytes_dialog.h:266
ShowPacketBytesTextEdit::setMenusEnabled
void setMenusEnabled(bool enabled)
Enables or disables the entire context menu.
Definition show_packet_bytes_dialog.h:278
WiresharkDialog::updateWidgets
virtual void updateWidgets()
Updates the state and contents of the dialog's widgets.
Definition wireshark_dialog.cpp:92
WiresharkDialog::WiresharkDialog
WiresharkDialog(QWidget &parent, CaptureFile &capture_file)
Constructs a new WiresharkDialog object.
Definition wireshark_dialog.cpp:30
uncompress_list_t
Describes a single decompression algorithm available in the "Decode As" list of ShowPacketBytesDialog...
Definition show_packet_bytes_dialog.h:36
uncompress_list_t::name
QString name
Definition show_packet_bytes_dialog.h:37
tvbuff.h
wireshark_dialog.h