Wireshark 4.5.0
The Wireshark network protocol analyzer
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
34 QString name;
35 tvbuff_t *(*function)(tvbuff_t *, int, int);
36};
37
39{
40 Q_OBJECT
41
42public:
43 explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
45
46 void addCodecs(const QMap<QString, QTextCodec *> &codecMap);
47
48protected:
49 bool eventFilter(QObject *obj, QEvent *event);
50 void keyPressEvent(QKeyEvent *event);
51
52private slots:
53 void on_sbStart_valueChanged(int value);
54 void on_sbEnd_valueChanged(int value);
55 void on_cbDecodeAs_currentIndexChanged(int idx);
56 void on_cbShowAs_currentIndexChanged(int idx);
57 void on_leFind_returnPressed();
58 void on_bFind_clicked();
59 void on_buttonBox_rejected();
60
61 void showSelected(int start, int end);
62 void useRegexFind(bool use_regex);
63 void findText(bool go_back = true);
64 void helpButton();
65 void printBytes();
66 void copyBytes();
67 void saveAs();
68
69private:
70 void setStartAndEnd(int start, int end);
71 bool enableShowSelected();
72 void updateWidgets(); // Needed for WiresharkDialog?
73 void updateHintLabel();
74 void sanitizeBuffer(QByteArray &ba, bool handle_CR);
75 void symbolizeBuffer(QByteArray &ba);
76 QByteArray decodeQuotedPrintable(const uint8_t *bytes, int length);
77 void rot13(QByteArray &ba);
78 void updateFieldBytes(bool initialization = false);
79 void updatePacketBytes();
80
81 Ui::ShowPacketBytesDialog *ui;
82
83 tvbuff_t *tvb_;
84 QByteArray field_bytes_;
85 QString hint_label_;
86 QString decode_as_name_;
87 QPushButton *print_button_;
88 QPushButton *copy_button_;
89 QPushButton *save_as_button_;
90 bool use_regex_find_;
91 int start_;
92 int end_;
93 QImage image_;
94};
95
96class ShowPacketBytesTextEdit : public QTextEdit
97{
98 Q_OBJECT
99
100public:
101 explicit ShowPacketBytesTextEdit(QWidget *parent = 0) :
102 QTextEdit(parent), show_selected_enabled_(true), menus_enabled_(true) { }
104
105 void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
106 void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
107
108signals:
109 void showSelected(int, int);
110
111private slots:
112 void contextMenuEvent(QContextMenuEvent *event);
113 void showSelected();
114 void showAll();
115
116private:
117 bool show_selected_enabled_;
118 bool menus_enabled_;
119};
120
121#endif // SHOW_PACKET_BYTES_DIALOG_H
Definition capture_file.h:21
Definition show_packet_bytes_dialog.h:39
Definition show_packet_bytes_dialog.h:97
Definition wireshark_dialog.h:35
Definition tvbuff-int.h:35
Definition show_packet_bytes_dialog.h:33