Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
show_packet_bytes_dialog.h
Go to the documentation of this file.
1
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#include <QTextCodec>
27
28namespace Ui {
31}
32
38 QString name;
39 tvbuff_t *(*function)(tvbuff_t *, unsigned, unsigned);
40};
41
42
49{
50 Q_OBJECT
51
52public:
58 explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
59
64
69 void addCodecs(const QMap<QString, QTextCodec *> &codecMap);
70
71protected:
79 bool eventFilter(QObject *obj, QEvent *event);
80
86 void keyPressEvent(QKeyEvent *event);
87
88private slots:
93 void on_sbStart_valueChanged(int value);
94
99 void on_sbEnd_valueChanged(int value);
100
106 void on_cbDecodeAs_currentIndexChanged(int idx);
107
113 void on_cbShowAs_currentIndexChanged(int idx);
114
118 void on_leFind_returnPressed();
119
124 void on_bFind_clicked();
125
129 void on_buttonBox_rejected();
130
137 void showSelected(int start, int end);
138
143 void useRegexFind(bool use_regex);
144
150 void findText(bool go_back = true);
151
153 void helpButton();
154
156 void printBytes();
157
159 void copyBytes();
160
162 void saveAs();
163
164private:
171 void setStartAndEnd(int start, int end);
172
178 bool enableShowSelected();
179
183 void updateWidgets();
184
189 void updateHintLabel();
190
196 void sanitizeBuffer(QByteArray &ba, bool handle_CR);
197
203 void symbolizeBuffer(QByteArray &ba);
204
211 QByteArray decodeQuotedPrintable(const uint8_t *bytes, int length);
212
217 void rot13(QByteArray &ba);
218
225 void updateFieldBytes(bool initialization = false);
226
231 void updatePacketBytes();
232
233 Ui::ShowPacketBytesDialog *ui;
235 tvbuff_t *tvb_;
236 QByteArray field_bytes_;
237 QString hint_label_;
238 QString decode_as_name_;
239 QPushButton *print_button_;
240 QPushButton *copy_button_;
241 QPushButton *save_as_button_;
242 bool use_regex_find_;
243 int start_;
244 int end_;
245 QImage image_;
246};
247
248
253class ShowPacketBytesTextEdit : public QTextEdit
254{
255 Q_OBJECT
256
257public:
262 explicit ShowPacketBytesTextEdit(QWidget *parent = nullptr);
263
268
273 void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
274
279 void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
280
281signals:
288 void showSelected(int start, int end);
289
290private slots:
296 void contextMenuEvent(QContextMenuEvent *event);
297
301 void showSelected();
302
307 void showAll();
308
309private:
310 bool show_selected_enabled_;
311 bool menus_enabled_;
312};
313
314#endif // SHOW_PACKET_BYTES_DIALOG_H
Manages a capture file and its associated state and operations.
Definition capture_file.h:27
Dialog that displays the raw bytes of a selected packet field, with configurable decode and display t...
Definition show_packet_bytes_dialog.h:49
void addCodecs(const QMap< QString, QTextCodec * > &codecMap)
Populates the character-encoding combo box with the supplied codecs.
Definition show_packet_bytes_dialog.cpp:128
bool eventFilter(QObject *obj, QEvent *event)
Intercepts events on watched objects; used to detect text selection changes in the display widget.
Definition show_packet_bytes_dialog.cpp:450
~ShowPacketBytesDialog()
Destroys the dialog and releases all associated resources.
Definition show_packet_bytes_dialog.cpp:122
void keyPressEvent(QKeyEvent *event)
Handles key press events; maps Ctrl+F to the find field and Enter/Return to findText().
Definition show_packet_bytes_dialog.cpp:470
QTextEdit subclass used inside ShowPacketBytesDialog that adds a context menu with "Show Selected Byt...
Definition show_packet_bytes_dialog.h:254
void showSelected(int start, int end)
Emitted when the user chooses "Show Selected Bytes", carrying the character positions of the selectio...
void setShowSelectedEnabled(bool enabled)
Enables or disables the "Show Selected Bytes" context menu action.
Definition show_packet_bytes_dialog.h:273
~ShowPacketBytesTextEdit()
Destroys the text edit widget.
Definition show_packet_bytes_dialog.h:267
void setMenusEnabled(bool enabled)
Enables or disables the entire context menu.
Definition show_packet_bytes_dialog.h:279
Base class for Wireshark specific dialogs that require interaction with a CaptureFile.
Definition wireshark_dialog.h:38
Core tvbuff (testy virtual buffer) structure representing a region of packet data,...
Definition tvbuff-int.h:95
Describes a single decompression algorithm available in the "Decode As" list of ShowPacketBytesDialog...
Definition show_packet_bytes_dialog.h:37
QString name
Definition show_packet_bytes_dialog.h:38