TODO netlogon_user_flags_ntlmv2_enabled
[wireshark-sm.git] / ui / qt / show_packet_bytes_dialog.h
blob1f6183faea40d38ec1489ec500af9a93142cfb20
1 /** @file
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #ifndef SHOW_PACKET_BYTES_DIALOG_H
11 #define SHOW_PACKET_BYTES_DIALOG_H
13 #include <config.h>
14 #include <stdio.h>
16 #ifdef HAVE_UNISTD_H
17 #include <unistd.h>
18 #endif
20 #include "file.h"
21 #include "wireshark_dialog.h"
23 #include <QLineEdit>
24 #include <QPushButton>
25 #include <QTextEdit>
26 #include <QTextCodec>
28 namespace Ui {
29 class ShowPacketBytesDialog;
30 class ShowPacketBytesTextEdit;
33 struct uncompress_list_t {
34 QString name;
35 tvbuff_t *(*function)(tvbuff_t *, int, int);
38 class ShowPacketBytesDialog : public WiresharkDialog
40 Q_OBJECT
42 public:
43 explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
44 ~ShowPacketBytesDialog();
46 void addCodecs(const QMap<QString, QTextCodec *> &codecMap);
48 protected:
49 bool eventFilter(QObject *obj, QEvent *event);
50 void keyPressEvent(QKeyEvent *event);
51 void captureFileClosing();
52 void captureFileClosed();
54 private slots:
55 void on_sbStart_valueChanged(int value);
56 void on_sbEnd_valueChanged(int value);
57 void on_cbDecodeAs_currentIndexChanged(int idx);
58 void on_cbShowAs_currentIndexChanged(int idx);
59 void on_leFind_returnPressed();
60 void on_bFind_clicked();
61 void on_buttonBox_rejected();
63 void showSelected(int start, int end);
64 void useRegexFind(bool use_regex);
65 void findText(bool go_back = true);
66 void helpButton();
67 void printBytes();
68 void copyBytes();
69 void saveAs();
71 private:
72 void setStartAndEnd(int start, int end);
73 bool enableShowSelected();
74 void updateWidgets(); // Needed for WiresharkDialog?
75 void updateHintLabel();
76 void sanitizeBuffer(QByteArray &ba, bool handle_CR);
77 void symbolizeBuffer(QByteArray &ba);
78 QByteArray decodeQuotedPrintable(const uint8_t *bytes, int length);
79 void rot13(QByteArray &ba);
80 void updateFieldBytes(bool initialization = false);
81 void updatePacketBytes();
83 Ui::ShowPacketBytesDialog *ui;
85 const field_info *finfo_;
86 QByteArray field_bytes_;
87 QString hint_label_;
88 QString decode_as_name_;
89 QPushButton *print_button_;
90 QPushButton *copy_button_;
91 QPushButton *save_as_button_;
92 bool use_regex_find_;
93 int start_;
94 int end_;
95 QImage image_;
98 class ShowPacketBytesTextEdit : public QTextEdit
100 Q_OBJECT
102 public:
103 explicit ShowPacketBytesTextEdit(QWidget *parent = 0) :
104 QTextEdit(parent), show_selected_enabled_(true), menus_enabled_(true) { }
105 ~ShowPacketBytesTextEdit() { }
107 void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
108 void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
110 signals:
111 void showSelected(int, int);
113 private slots:
114 void contextMenuEvent(QContextMenuEvent *event);
115 void showSelected();
116 void showAll();
118 private:
119 bool show_selected_enabled_;
120 bool menus_enabled_;
123 #endif // SHOW_PACKET_BYTES_DIALOG_H