Wireshark  4.3.0
The Wireshark network protocol analyzer
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 <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 #include <QTextCodec>
28 
29 namespace Ui {
32 }
33 
35 {
36  Q_OBJECT
37 
38 public:
39  explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
41 
42  void addCodecs(const QMap<QString, QTextCodec *> &codecMap);
43 
44 protected:
45  bool eventFilter(QObject *obj, QEvent *event);
46  void keyPressEvent(QKeyEvent *event);
47  void captureFileClosing();
48  void captureFileClosed();
49 
50 private slots:
51  void on_sbStart_valueChanged(int value);
52  void on_sbEnd_valueChanged(int value);
53  void on_cbDecodeAs_currentIndexChanged(int idx);
54  void on_cbShowAs_currentIndexChanged(int idx);
55  void on_leFind_returnPressed();
56  void on_bFind_clicked();
57  void on_buttonBox_rejected();
58 
59  void showSelected(int start, int end);
60  void useRegexFind(bool use_regex);
61  void findText(bool go_back = true);
62  void helpButton();
63  void printBytes();
64  void copyBytes();
65  void saveAs();
66 
67 private:
68  void setStartAndEnd(int start, int end);
69  bool enableShowSelected();
70  void updateWidgets(); // Needed for WiresharkDialog?
71  void updateHintLabel();
72  void sanitizeBuffer(QByteArray &ba, bool handle_CR);
73  void symbolizeBuffer(QByteArray &ba);
74  QByteArray decodeQuotedPrintable(const guint8 *bytes, int length);
75  void rot13(QByteArray &ba);
76  void updateFieldBytes(bool initialization = false);
77  void updatePacketBytes();
78 
79  Ui::ShowPacketBytesDialog *ui;
80 
81  const field_info *finfo_;
82  QByteArray field_bytes_;
83  QString hint_label_;
84  QPushButton *print_button_;
85  QPushButton *copy_button_;
86  QPushButton *save_as_button_;
87  bool use_regex_find_;
88  int start_;
89  int end_;
90  QImage image_;
91 };
92 
93 class ShowPacketBytesTextEdit : public QTextEdit
94 {
95  Q_OBJECT
96 
97 public:
98  explicit ShowPacketBytesTextEdit(QWidget *parent = 0) :
99  QTextEdit(parent), show_selected_enabled_(true), menus_enabled_(true) { }
101 
102  void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
103  void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
104 
105 signals:
106  void showSelected(int, int);
107 
108 private slots:
109  void contextMenuEvent(QContextMenuEvent *event);
110  void showSelected();
111  void showAll();
112 
113 private:
114  bool show_selected_enabled_;
115  bool menus_enabled_;
116 };
117 
118 #endif // SHOW_PACKET_BYTES_DIALOG_H
Definition: capture_file.h:23
Definition: show_packet_bytes_dialog.h:35
void captureFileClosed()
Called when the capture file was closed. This can be used to enable or disable widgets according to t...
Definition: show_packet_bytes_dialog.cpp:885
void captureFileClosing()
Called when the capture file is about to close. This can be used to disconnect taps and similar actio...
Definition: show_packet_bytes_dialog.cpp:878
Definition: show_packet_bytes_dialog.h:94
Definition: wireshark_dialog.h:35
Definition: proto.h:809