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 <stdio.h>
15 
16 #ifdef HAVE_UNISTD_H
17 #include <unistd.h>
18 #endif
19 
20 #include "file.h"
21 #include "wireshark_dialog.h"
22 
23 #include <QLineEdit>
24 #include <QPushButton>
25 #include <QTextEdit>
26 #include <QTextCodec>
27 
28 namespace Ui {
31 }
32 
34 {
35  Q_OBJECT
36 
37 public:
38  explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
40 
41  void addCodecs(const QMap<QString, QTextCodec *> &codecMap);
42 
43 protected:
44  bool eventFilter(QObject *obj, QEvent *event);
45  void keyPressEvent(QKeyEvent *event);
46  void captureFileClosing();
47  void captureFileClosed();
48 
49 private slots:
50  void on_sbStart_valueChanged(int value);
51  void on_sbEnd_valueChanged(int value);
52  void on_cbDecodeAs_currentIndexChanged(int idx);
53  void on_cbShowAs_currentIndexChanged(int idx);
54  void on_leFind_returnPressed();
55  void on_bFind_clicked();
56  void on_buttonBox_rejected();
57 
58  void showSelected(int start, int end);
59  void useRegexFind(bool use_regex);
60  void findText(bool go_back = true);
61  void helpButton();
62  void printBytes();
63  void copyBytes();
64  void saveAs();
65 
66 private:
67  void setStartAndEnd(int start, int end);
68  bool enableShowSelected();
69  void updateWidgets(); // Needed for WiresharkDialog?
70  void updateHintLabel();
71  void sanitizeBuffer(QByteArray &ba, bool handle_CR);
72  void symbolizeBuffer(QByteArray &ba);
73  QByteArray decodeQuotedPrintable(const uint8_t *bytes, int length);
74  void rot13(QByteArray &ba);
75  void updateFieldBytes(bool initialization = false);
76  void updatePacketBytes();
77 
78  Ui::ShowPacketBytesDialog *ui;
79 
80  const field_info *finfo_;
81  QByteArray field_bytes_;
82  QString hint_label_;
83  QPushButton *print_button_;
84  QPushButton *copy_button_;
85  QPushButton *save_as_button_;
86  bool use_regex_find_;
87  int start_;
88  int end_;
89  QImage image_;
90 };
91 
92 class ShowPacketBytesTextEdit : public QTextEdit
93 {
94  Q_OBJECT
95 
96 public:
97  explicit ShowPacketBytesTextEdit(QWidget *parent = 0) :
98  QTextEdit(parent), show_selected_enabled_(true), menus_enabled_(true) { }
100 
101  void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
102  void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
103 
104 signals:
105  void showSelected(int, int);
106 
107 private slots:
108  void contextMenuEvent(QContextMenuEvent *event);
109  void showSelected();
110  void showAll();
111 
112 private:
113  bool show_selected_enabled_;
114  bool menus_enabled_;
115 };
116 
117 #endif // SHOW_PACKET_BYTES_DIALOG_H
Definition: capture_file.h:21
Definition: show_packet_bytes_dialog.h:34
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:905
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:898
Definition: show_packet_bytes_dialog.h:93
Definition: wireshark_dialog.h:35
Definition: proto.h:816