Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

show_packet_bytes_dialog.h
1 /* show_packet_bytes_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 SHOW_PACKET_BYTES_DIALOG_H
11 #define SHOW_PACKET_BYTES_DIALOG_H
12
13 #include <config.h>
14 #include <glib.h>
15 #include <stdio.h>
16
17 #ifdef HAVE_UNISTD_H
18 #include <unistd.h>
19 #endif
20
21 #include "file.h"
22 #include "wireshark_dialog.h"
23
24 #include <QLineEdit>
25 #include <QPushButton>
26 #include <QTextEdit>
27
28 namespace Ui {
29 class ShowPacketBytesDialog;
30 class ShowPacketBytesTextEdit;
31 }
32
33 class ShowPacketBytesDialog : public WiresharkDialog
34 {
35 Q_OBJECT
36
37 public:
38 explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
39 ~ShowPacketBytesDialog();
40
41 public slots:
42 void captureFileClosing();
43
44 protected:
45 bool eventFilter(QObject *obj, QEvent *event);
46 void keyPressEvent(QKeyEvent *event);
47
48 private slots:
49 void on_sbStart_valueChanged(int value);
50 void on_sbEnd_valueChanged(int value);
51 void on_cbDecodeAs_currentIndexChanged(int idx);
52 void on_cbShowAs_currentIndexChanged(int idx);
53 void on_leFind_returnPressed();
54 void on_bFind_clicked();
55 void on_buttonBox_rejected();
56
57 void showSelected(int start, int end);
58 void useRegexFind(bool use_regex);
59 void findText(bool go_back = true);
60 void helpButton();
61 void printBytes();
62 void copyBytes();
63 void saveAs();
64
65 private:
66 enum DecodeAsType {
67 DecodeAsNone,
68 DecodeAsBASE64,
69 DecodeAsCompressed,
70 DecodeAsQuotedPrintable,
71 DecodeAsROT13
72 };
73 enum ShowAsType {
74 ShowAsASCII,
75 ShowAsASCIIandControl,
76 ShowAsCArray,
77 ShowAsEBCDIC,
78 ShowAsHexDump,
79 ShowAsHTML,
80 ShowAsImage,
81 ShowAsISO8859_1,
82 ShowAsRAW,
83 ShowAsUTF8,
84 ShowAsUTF16,
85 ShowAsYAML
86 };
87
88 void setStartAndEnd(int start, int end);
89 bool enableShowSelected();
90 void updateWidgets(); // Needed for WiresharkDialog?
91 void updateHintLabel();
92 void sanitizeBuffer(QByteArray &ba, bool handle_CR);
93 void symbolizeBuffer(QByteArray &ba);
94 QByteArray decodeQuotedPrintable(const guint8 *bytes, int length);
95 void rot13(QByteArray &ba);
96 void updateFieldBytes(bool initialization = false);
97 void updatePacketBytes();
98
99 Ui::ShowPacketBytesDialog *ui;
100
101 const field_info *finfo_;
102 QByteArray field_bytes_;
103 QString hint_label_;
104 QPushButton *print_button_;
105 QPushButton *copy_button_;
106 QPushButton *save_as_button_;
107 DecodeAsType decode_as_;
108 ShowAsType show_as_;
109 bool use_regex_find_;
110 int start_;
111 int end_;
112 QImage image_;
113 };
114
115 class ShowPacketBytesTextEdit : public QTextEdit
116 {
117 Q_OBJECT
118
119 public:
120 explicit ShowPacketBytesTextEdit(QWidget *parent = 0) :
121 QTextEdit(parent), show_selected_enabled_(true), menus_enabled_(true) { }
122 ~ShowPacketBytesTextEdit() { }
123
124 void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
125 void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
126
127 signals:
128 void showSelected(int, int);
129
130 private slots:
131 void contextMenuEvent(QContextMenuEvent *event);
132 void showSelected();
133 void showAll();
134
135 private:
136 bool show_selected_enabled_;
137 bool menus_enabled_;
138 };
139
140 #endif // SHOW_PACKET_BYTES_DIALOG_H
141
142 /*
143 * Editor modelines - http://www.wireshark.org/tools/modelines.html
144 *
145 * Local variables:
146 * c-basic-offset: 4
147 * tab-width: 8
148 * indent-tabs-mode: nil
149 * End:
150 *
151 * vi: set shiftwidth=4 tabstop=8 expandtab:
152 * :indentSize=4:tabSize=8:noTabs=true:
153 */
ShowPacketBytesTextEdit
Definition: show_packet_bytes_dialog.h:115
Ui
Definition: ui_about_dialog.h:291
ShowPacketBytesDialog
Definition: show_packet_bytes_dialog.h:33
field_info
Definition: proto.h:673
Ui::ShowPacketBytesDialog
Definition: ui_show_packet_bytes_dialog.h:179
WiresharkDialog
Definition: wireshark_dialog.h:32
CaptureFile
Definition: capture_file.h:22