2016-02-07 21:15:12 +00:00
|
|
|
/* show_packet_bytes_dialog.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SHOW_PACKET_BYTES_DIALOG_H
|
|
|
|
#define SHOW_PACKET_BYTES_DIALOG_H
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "file.h"
|
|
|
|
#include "wireshark_dialog.h"
|
|
|
|
|
2016-02-14 22:01:09 +00:00
|
|
|
#include <QLineEdit>
|
2016-02-07 21:15:12 +00:00
|
|
|
#include <QPushButton>
|
2016-02-14 22:01:09 +00:00
|
|
|
#include <QTextEdit>
|
2016-02-07 21:15:12 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ShowPacketBytesDialog;
|
2016-02-14 22:01:09 +00:00
|
|
|
class ShowPacketBytesTextEdit;
|
2016-02-07 21:15:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class ShowPacketBytesDialog : public WiresharkDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ShowPacketBytesDialog(QWidget &parent, CaptureFile &cf);
|
|
|
|
~ShowPacketBytesDialog();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void captureFileClosing();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
|
|
void keyPressEvent(QKeyEvent *event);
|
|
|
|
|
|
|
|
private slots:
|
2016-02-14 22:01:09 +00:00
|
|
|
void on_sbStart_valueChanged(int value);
|
|
|
|
void on_sbEnd_valueChanged(int value);
|
|
|
|
void on_cbDecodeAs_currentIndexChanged(int idx);
|
2016-02-07 21:15:12 +00:00
|
|
|
void on_cbShowAs_currentIndexChanged(int idx);
|
|
|
|
void on_leFind_returnPressed();
|
|
|
|
void on_bFind_clicked();
|
|
|
|
void on_buttonBox_rejected();
|
|
|
|
|
2016-02-14 22:01:09 +00:00
|
|
|
void showSelected(int start, int end);
|
2016-02-14 18:34:11 +00:00
|
|
|
void useRegexFind(bool use_regex);
|
2016-02-07 21:15:12 +00:00
|
|
|
void findText(bool go_back = true);
|
|
|
|
void helpButton();
|
|
|
|
void printBytes();
|
|
|
|
void copyBytes();
|
|
|
|
void saveAs();
|
|
|
|
|
|
|
|
private:
|
2016-02-14 22:01:09 +00:00
|
|
|
enum DecodeAsType {
|
|
|
|
DecodeAsNone,
|
|
|
|
DecodeAsBASE64,
|
|
|
|
DecodeAsCompressed,
|
2016-05-19 10:09:33 +00:00
|
|
|
DecodeAsQuotedPrintable,
|
2016-02-14 22:01:09 +00:00
|
|
|
DecodeAsROT13
|
|
|
|
};
|
2016-02-07 21:15:12 +00:00
|
|
|
enum ShowAsType {
|
|
|
|
ShowAsASCII,
|
2016-02-28 12:38:08 +00:00
|
|
|
ShowAsASCIIandControl,
|
2016-02-11 20:08:51 +00:00
|
|
|
ShowAsCArray,
|
2016-02-07 21:15:12 +00:00
|
|
|
ShowAsEBCDIC,
|
2016-02-10 08:07:13 +00:00
|
|
|
ShowAsHexDump,
|
2016-02-07 21:15:12 +00:00
|
|
|
ShowAsHTML,
|
|
|
|
ShowAsImage,
|
|
|
|
ShowAsISO8859_1,
|
|
|
|
ShowAsRAW,
|
2016-02-11 20:08:51 +00:00
|
|
|
ShowAsUTF8,
|
|
|
|
ShowAsYAML
|
2016-02-07 21:15:12 +00:00
|
|
|
};
|
|
|
|
|
2016-02-14 22:01:09 +00:00
|
|
|
void setStartAndEnd(int start, int end);
|
|
|
|
bool enableShowSelected();
|
2016-02-07 21:15:12 +00:00
|
|
|
void updateWidgets(); // Needed for WiresharkDialog?
|
2016-02-14 22:01:09 +00:00
|
|
|
void updateHintLabel();
|
2016-02-28 12:38:08 +00:00
|
|
|
void sanitizeBuffer(QByteArray &ba, bool handle_CR);
|
|
|
|
void symbolizeBuffer(QByteArray &ba);
|
2016-05-19 10:09:33 +00:00
|
|
|
QByteArray decodeQuotedPrintable(const guint8 *bytes, int length);
|
2016-02-14 22:01:09 +00:00
|
|
|
void rot13(QByteArray &ba);
|
|
|
|
void updateFieldBytes(bool initialization = false);
|
|
|
|
void updatePacketBytes();
|
2016-02-07 21:15:12 +00:00
|
|
|
|
|
|
|
Ui::ShowPacketBytesDialog *ui;
|
|
|
|
|
2016-02-14 22:01:09 +00:00
|
|
|
const field_info *finfo_;
|
2016-02-07 21:15:12 +00:00
|
|
|
QByteArray field_bytes_;
|
2016-02-14 22:01:09 +00:00
|
|
|
QString hint_label_;
|
2016-02-07 21:15:12 +00:00
|
|
|
QPushButton *print_button_;
|
|
|
|
QPushButton *copy_button_;
|
|
|
|
QPushButton *save_as_button_;
|
2016-02-14 22:01:09 +00:00
|
|
|
DecodeAsType decode_as_;
|
2016-02-07 21:15:12 +00:00
|
|
|
ShowAsType show_as_;
|
2016-02-14 18:34:11 +00:00
|
|
|
bool use_regex_find_;
|
2016-02-14 22:01:09 +00:00
|
|
|
int start_;
|
|
|
|
int end_;
|
2016-02-07 21:15:12 +00:00
|
|
|
QImage image_;
|
|
|
|
};
|
|
|
|
|
2016-02-14 22:01:09 +00:00
|
|
|
class ShowPacketBytesTextEdit : public QTextEdit
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ShowPacketBytesTextEdit(QWidget *parent = 0) :
|
|
|
|
QTextEdit(parent), show_selected_enabled_(true), menus_enabled_(true) { }
|
|
|
|
~ShowPacketBytesTextEdit() { }
|
|
|
|
|
|
|
|
void setShowSelectedEnabled(bool enabled) { show_selected_enabled_ = enabled; }
|
|
|
|
void setMenusEnabled(bool enabled) { menus_enabled_ = enabled; }
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void showSelected(int, int);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
|
|
|
void showSelected();
|
|
|
|
void showAll();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool show_selected_enabled_;
|
|
|
|
bool menus_enabled_;
|
|
|
|
};
|
|
|
|
|
2016-02-07 21:15:12 +00:00
|
|
|
#endif // SHOW_PACKET_BYTES_DIALOG_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|