2021-11-30 13:01:36 +00:00
|
|
|
/** @file
|
2012-09-17 23:40:53 +00:00
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2012-09-17 23:40:53 +00:00
|
|
|
|
|
|
|
#ifndef IMPORT_TEXT_DIALOG_H
|
|
|
|
#define IMPORT_TEXT_DIALOG_H
|
|
|
|
|
2015-04-26 17:21:09 +00:00
|
|
|
#include <config.h>
|
2012-09-17 23:40:53 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include "ui/text_import.h"
|
|
|
|
|
2017-07-05 14:56:45 +00:00
|
|
|
#include <ui/qt/widgets/syntax_line_edit.h>
|
2012-10-08 20:01:59 +00:00
|
|
|
|
2012-09-17 23:40:53 +00:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QRadioButton>
|
2022-01-10 04:55:14 +00:00
|
|
|
#include <QButtonGroup>
|
2012-09-17 23:40:53 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ImportTextDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ImportTextDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2014-02-25 20:42:35 +00:00
|
|
|
|
2012-09-17 23:40:53 +00:00
|
|
|
public:
|
|
|
|
explicit ImportTextDialog(QWidget *parent = 0);
|
|
|
|
~ImportTextDialog();
|
|
|
|
QString &capfileName();
|
2014-02-25 20:42:35 +00:00
|
|
|
|
2012-09-17 23:40:53 +00:00
|
|
|
private:
|
2022-01-09 12:16:26 +00:00
|
|
|
void enableHeaderWidgets(uint encapsulation = WTAP_ENCAP_ETHERNET);
|
2021-02-15 18:38:23 +00:00
|
|
|
|
|
|
|
/* regex fields */
|
|
|
|
void enableFieldWidgets(bool enable_direction_input = true, bool enable_time_input = true);
|
|
|
|
|
2015-12-11 16:43:35 +00:00
|
|
|
void check_line_edit(SyntaxLineEdit *le, bool &ok_enable, const QString &num_str, int base, guint max_val, bool is_short, guint *val_ptr);
|
2021-12-26 21:53:24 +00:00
|
|
|
void checkAddress(SyntaxLineEdit *le, bool &ok_enable, const QString &addr_str, ws_in4_addr *val_ptr);
|
2021-12-26 21:53:24 +00:00
|
|
|
void checkIPv6Address(SyntaxLineEdit *le, bool &ok_enable, const QString &addr_str, ws_in6_addr *val_ptr);
|
2015-12-11 16:43:35 +00:00
|
|
|
bool checkDateTimeFormat(const QString &time_format);
|
2021-02-15 18:38:23 +00:00
|
|
|
|
2021-09-17 10:02:54 +00:00
|
|
|
void loadSettingsFile();
|
|
|
|
void saveSettingsFile();
|
|
|
|
void applyDialogSettings();
|
|
|
|
void storeDialogSettings();
|
|
|
|
|
2015-12-11 16:43:35 +00:00
|
|
|
void updateImportButtonState();
|
2012-09-17 23:40:53 +00:00
|
|
|
|
2012-10-08 20:01:59 +00:00
|
|
|
Ui::ImportTextDialog *ti_ui_;
|
2021-09-17 10:02:54 +00:00
|
|
|
QVariantMap settings;
|
2012-09-17 23:40:53 +00:00
|
|
|
|
2015-12-11 16:43:35 +00:00
|
|
|
QPushButton *import_button_;
|
2022-01-10 04:55:14 +00:00
|
|
|
QButtonGroup *encap_buttons;
|
2012-09-17 23:40:53 +00:00
|
|
|
text_import_info_t import_info_;
|
|
|
|
QString capfile_name_;
|
2015-12-11 16:43:35 +00:00
|
|
|
bool file_ok_;
|
2021-02-15 18:38:23 +00:00
|
|
|
bool timestamp_format_ok_;
|
|
|
|
|
|
|
|
/* Regex input */
|
|
|
|
bool regex_ok_;
|
|
|
|
bool re_has_dir_;
|
|
|
|
bool in_indication_ok_;
|
|
|
|
bool out_indication_ok_;
|
|
|
|
bool re_has_time_;
|
|
|
|
|
2015-12-11 16:43:35 +00:00
|
|
|
bool ether_type_ok_;
|
|
|
|
bool proto_ok_;
|
2021-12-26 21:53:24 +00:00
|
|
|
bool source_addr_ok_;
|
|
|
|
bool dest_addr_ok_;
|
2015-12-11 16:43:35 +00:00
|
|
|
bool source_port_ok_;
|
|
|
|
bool dest_port_ok_;
|
|
|
|
bool tag_ok_;
|
|
|
|
bool ppi_ok_;
|
2018-10-28 22:04:23 +00:00
|
|
|
bool payload_ok_;
|
2015-12-11 16:43:35 +00:00
|
|
|
bool max_len_ok_;
|
2012-09-17 23:40:53 +00:00
|
|
|
|
|
|
|
public slots:
|
2012-12-05 19:04:59 +00:00
|
|
|
int exec();
|
2012-09-17 23:40:53 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_textFileBrowseButton_clicked();
|
|
|
|
void on_textFileLineEdit_textChanged(const QString &arg1);
|
2021-02-15 18:38:23 +00:00
|
|
|
void on_modeTabWidget_currentChanged(int index);
|
|
|
|
void on_timestampFormatLineEdit_textChanged(const QString &arg1);
|
|
|
|
|
|
|
|
/* Hex Dump input */
|
2016-06-05 19:06:51 +00:00
|
|
|
void on_noOffsetButton_toggled(bool checked);
|
2013-04-05 06:43:38 +00:00
|
|
|
void on_directionIndicationCheckBox_toggled(bool checked);
|
2021-12-26 22:40:59 +00:00
|
|
|
void on_asciiIdentificationCheckBox_toggled(bool checked);
|
2021-02-15 18:38:23 +00:00
|
|
|
|
|
|
|
/* Regex input */
|
|
|
|
void on_regexTextEdit_textChanged();
|
|
|
|
void on_dataEncodingComboBox_currentIndexChanged(int index);
|
|
|
|
void on_dirInIndicationLineEdit_textChanged(const QString &arg1);
|
|
|
|
void on_dirOutIndicationLineEdit_textChanged(const QString &arg1);
|
|
|
|
|
|
|
|
/* Encapsulation input */
|
|
|
|
void on_encapComboBox_currentIndexChanged(int index);
|
2022-01-10 04:55:14 +00:00
|
|
|
void encap_buttonsToggled(QAbstractButton *button, bool checked);
|
2021-12-28 20:34:46 +00:00
|
|
|
void on_ipVersionComboBox_currentIndexChanged(int index);
|
2012-09-17 23:40:53 +00:00
|
|
|
void on_ethertypeLineEdit_textChanged(const QString ðertype_str);
|
|
|
|
void on_protocolLineEdit_textChanged(const QString &protocol_str);
|
2021-12-26 21:53:24 +00:00
|
|
|
void on_sourceAddressLineEdit_textChanged(const QString &source_addr_str);
|
|
|
|
void on_destinationAddressLineEdit_textChanged(const QString &destination_addr_str);
|
2012-09-17 23:40:53 +00:00
|
|
|
void on_sourcePortLineEdit_textChanged(const QString &source_port_str);
|
|
|
|
void on_destinationPortLineEdit_textChanged(const QString &destination_port_str);
|
|
|
|
void on_tagLineEdit_textChanged(const QString &tag_str);
|
|
|
|
void on_ppiLineEdit_textChanged(const QString &ppi_str);
|
2021-02-15 18:38:23 +00:00
|
|
|
|
2021-12-30 18:57:45 +00:00
|
|
|
/* Footer input */
|
2012-09-17 23:40:53 +00:00
|
|
|
void on_maxLengthLineEdit_textChanged(const QString &max_frame_len_str);
|
2012-09-18 00:17:04 +00:00
|
|
|
void on_buttonBox_helpRequested();
|
2012-09-17 23:40:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // IMPORT_TEXT_DIALOG_H
|