forked from osmocom/wireshark
Windows: Manage remote interfaces
Add remote interfaces to capture from a remote host. Change-Id: I34e31d865304f3c6dd972ab9ab1c23829d564665 Reviewed-on: https://code.wireshark.org/review/3405 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
3b91474af5
commit
f080b43933
|
@ -79,6 +79,8 @@ set(WIRESHARK_QT_HEADERS
|
|||
proto_tree.h
|
||||
qcustomplot.h
|
||||
recent_file_status.h
|
||||
remote_capture_dialog.h
|
||||
remote_settings_dialog.h
|
||||
sctp_all_assocs_dialog.h
|
||||
sctp_assoc_analyse_dialog.h
|
||||
sctp_chunk_statistics_dialog.h
|
||||
|
@ -166,6 +168,8 @@ set(WIRESHARK_QT_SRC
|
|||
qt_ui_utils.cpp
|
||||
recent_file_status.cpp
|
||||
related_packet_delegate.cpp
|
||||
remote_capture_dialog.cpp
|
||||
remote_settings_dialog.cpp
|
||||
sctp_all_assocs_dialog.cpp
|
||||
sctp_assoc_analyse_dialog.cpp
|
||||
sctp_chunk_statistics_dialog.cpp
|
||||
|
@ -233,6 +237,8 @@ set(WIRESHARK_QT_UI
|
|||
preferences_dialog.ui
|
||||
print_dialog.ui
|
||||
profile_dialog.ui
|
||||
remote_capture_dialog.ui
|
||||
remote_settings_dialog.ui
|
||||
sctp_all_assocs_dialog.ui
|
||||
sctp_assoc_analyse_dialog.ui
|
||||
sctp_chunk_statistics_dialog.ui
|
||||
|
|
|
@ -187,6 +187,10 @@ print_dialog.cpp print_dialog.h: ui_print_dialog.h
|
|||
|
||||
profile_dialog.cpp profile_dialog.h: ui_profile_dialog.h
|
||||
|
||||
remote_capture_dialog.cpp remote_capture_dialog.h: ui_remote_capture_dialog.h
|
||||
|
||||
remote_settings_dialog.cpp remote_settings_dialog.h: ui_remote_settings_dialog.h
|
||||
|
||||
search_frame.cpp search_frame.h: ui_search_frame.h
|
||||
|
||||
sequence_dialog.cpp sequence_dialog.h: ui_sequence_dialog.h
|
||||
|
|
|
@ -60,6 +60,8 @@ NODIST_GENERATED_HEADER_FILES = \
|
|||
ui_preferences_dialog.h \
|
||||
ui_print_dialog.h \
|
||||
ui_profile_dialog.h \
|
||||
ui_remote_capture_dialog.h \
|
||||
ui_remote_settings_dialog.h \
|
||||
ui_sctp_all_assocs_dialog.h \
|
||||
ui_sctp_assoc_analyse_dialog.h \
|
||||
ui_sctp_chunk_statistics_dialog.h \
|
||||
|
@ -167,6 +169,8 @@ MOC_HDRS = \
|
|||
qcustomplot.h \
|
||||
recent_file_status.h \
|
||||
related_packet_delegate.h \
|
||||
remote_capture_dialog.h \
|
||||
remote_settings_dialog.h \
|
||||
search_frame.h \
|
||||
sctp_all_assocs_dialog.h \
|
||||
sctp_assoc_analyse_dialog.h \
|
||||
|
@ -223,6 +227,8 @@ UI_FILES = \
|
|||
preferences_dialog.ui \
|
||||
print_dialog.ui \
|
||||
profile_dialog.ui \
|
||||
remote_capture_dialog.ui \
|
||||
remote_settings_dialog.ui \
|
||||
sctp_all_assocs_dialog.ui \
|
||||
sctp_assoc_analyse_dialog.ui \
|
||||
sctp_chunk_statistics_dialog.ui \
|
||||
|
@ -354,6 +360,8 @@ WIRESHARK_QT_SRC = \
|
|||
qt_ui_utils.cpp \
|
||||
recent_file_status.cpp \
|
||||
related_packet_delegate.cpp \
|
||||
remote_capture_dialog.cpp \
|
||||
remote_settings_dialog.cpp \
|
||||
sctp_all_assocs_dialog.cpp \
|
||||
sctp_assoc_analyse_dialog.cpp \
|
||||
sctp_chunk_statistics_dialog.cpp \
|
||||
|
|
|
@ -236,6 +236,8 @@ FORMS += \
|
|||
preferences_dialog.ui \
|
||||
print_dialog.ui \
|
||||
profile_dialog.ui \
|
||||
remote_capture_dialog.ui \
|
||||
remote_settings_dialog.ui \
|
||||
sctp_all_assocs_dialog.ui \
|
||||
sctp_assoc_analyse_dialog.ui \
|
||||
sctp_chunk_statistics_dialog.ui \
|
||||
|
@ -284,6 +286,8 @@ HEADERS += $$HEADERS_WS_C \
|
|||
preferences_dialog.h \
|
||||
print_dialog.h \
|
||||
profile_dialog.h \
|
||||
remote_capture_dialog.h \
|
||||
remote_settings_dialog.h \
|
||||
sctp_all_assocs_dialog.h \
|
||||
sctp_assoc_analyse_dialog.h \
|
||||
sctp_chunk_statistics_dialog.h \
|
||||
|
@ -392,6 +396,8 @@ macx {
|
|||
}
|
||||
|
||||
win32 {
|
||||
DEFINES+=HAVE_PCAP_REMOTE
|
||||
DEFINES+=HAVE_PCAP_SETSAMPLING
|
||||
# Add the wireshark objects to LIBS
|
||||
LIBS += $$OBJECTS_WS_C
|
||||
LIBS += $$PA_OBJECTS
|
||||
|
@ -635,6 +641,8 @@ SOURCES += \
|
|||
qt_ui_utils.cpp \
|
||||
recent_file_status.cpp \
|
||||
related_packet_delegate.cpp \
|
||||
remote_capture_dialog.cpp \
|
||||
remote_settings_dialog.cpp \
|
||||
sctp_all_assocs_dialog.cpp \
|
||||
sctp_assoc_analyse_dialog.cpp \
|
||||
sctp_chunk_statistics_dialog.cpp \
|
||||
|
|
|
@ -24,12 +24,18 @@
|
|||
#include "manage_interfaces_dialog.h"
|
||||
#include "ui_manage_interfaces_dialog.h"
|
||||
#include "epan/prefs.h"
|
||||
#include "epan/to_str.h"
|
||||
#include "ui/last_open_dir.h"
|
||||
#include "capture_opts.h"
|
||||
#include "ui/capture_globals.h"
|
||||
#include "ui/qt/capture_interfaces_dialog.h"
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
#include "ui/qt/remote_capture_dialog.h"
|
||||
#include "ui/qt/remote_settings_dialog.h"
|
||||
#endif
|
||||
#include "ui/iface_lists.h"
|
||||
#include "ui/preference_utils.h"
|
||||
#include "ui/ui_util.h"
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
#include <QFileDialog>
|
||||
|
@ -51,11 +57,21 @@ ManageInterfacesDialog::ManageInterfacesDialog(QWidget *parent) :
|
|||
new_pipe_item_delegate_.setTable(ui->pipeList);
|
||||
showPipes();
|
||||
connect(this, SIGNAL(ifsChanged()), parent, SIGNAL(ifsChanged()));
|
||||
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
connect(this, SIGNAL(remoteAdded(GList*, remote_options*)), this, SLOT(addRemoteInterfaces(GList*, remote_options*)));
|
||||
connect(this, SIGNAL(remoteSettingsChanged(interface_t *)), this, SLOT(setRemoteSettings(interface_t *)));
|
||||
#endif
|
||||
showLocalInterfaces();
|
||||
|
||||
#if !defined(HAVE_PCAP_REMOTE)
|
||||
ui->tabWidget->removeTab(2);
|
||||
#else
|
||||
ui->remoteList->setHeaderLabels(QStringList() << "Host" << "Hide" << "Name");
|
||||
ui->remoteList->header()->setDefaultAlignment(Qt::AlignCenter);
|
||||
ui->remoteList->setColumnWidth(HIDDEN, 50);
|
||||
ui->remoteSettings->setEnabled(false);
|
||||
showRemoteInterfaces();
|
||||
connect(ui->remoteList, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(remoteSelectionChanged(QTreeWidgetItem*, int)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -324,7 +340,7 @@ void ManageInterfacesDialog::checkBoxChanged(QTableWidgetItem* item)
|
|||
|
||||
void ManageInterfacesDialog::on_localButtonBox_accepted()
|
||||
{
|
||||
gchar *new_hide;
|
||||
gchar *new_hide = g_strdup("");
|
||||
gchar *new_comment = NULL;
|
||||
QString name;
|
||||
gchar *tmp_descr = NULL;
|
||||
|
@ -371,6 +387,291 @@ void ManageInterfacesDialog::on_localButtonBox_accepted()
|
|||
emit ifsChanged();
|
||||
}
|
||||
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
void ManageInterfacesDialog::remoteSelectionChanged(QTreeWidgetItem* item, int col)
|
||||
{
|
||||
Q_UNUSED(item);
|
||||
|
||||
if (col != 0 && item->isSelected()) {
|
||||
ui->remoteSettings->setEnabled(true);
|
||||
} else if (col == 0) {
|
||||
ui->remoteSettings->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *roptions)
|
||||
{
|
||||
GList *if_entry, *lt_entry;
|
||||
if_info_t *if_info;
|
||||
char *if_string = NULL;
|
||||
gchar *descr, *str = NULL, *link_type_name = NULL;;
|
||||
if_capabilities_t *caps;
|
||||
gint linktype_count;
|
||||
bool monitor_mode, found = false;
|
||||
GSList *curr_addr;
|
||||
int ips = 0;
|
||||
guint i;
|
||||
if_addr_t *addr;
|
||||
data_link_info_t *data_link_info;
|
||||
GString *ip_str;
|
||||
link_row *linkr = NULL;
|
||||
interface_t device;
|
||||
|
||||
guint num_interfaces = global_capture_opts.all_ifaces->len;
|
||||
for (if_entry = g_list_first(rlist); if_entry != NULL; if_entry = g_list_next(if_entry)) {
|
||||
if_info = (if_info_t *)if_entry->data;
|
||||
for (i = 0; i < num_interfaces; i++) {
|
||||
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
||||
if (device.hidden)
|
||||
continue;
|
||||
if (strcmp(device.name, if_info->name) == 0) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
found = FALSE;
|
||||
continue;
|
||||
}
|
||||
ip_str = g_string_new("");
|
||||
str = "";
|
||||
ips = 0;
|
||||
device.name = g_strdup(if_info->name);
|
||||
/* Is this interface hidden and, if so, should we include it
|
||||
anyway? */
|
||||
descr = capture_dev_user_descr_find(if_info->name);
|
||||
if (descr != NULL) {
|
||||
/* Yes, we have a user-supplied description; use it. */
|
||||
if_string = g_strdup_printf("%s: %s", descr, if_info->name);
|
||||
g_free(descr);
|
||||
} else {
|
||||
/* No, we don't have a user-supplied description; did we get
|
||||
one from the OS or libpcap? */
|
||||
if (if_info->vendor_description != NULL) {
|
||||
/* Yes - use it. */
|
||||
if_string = g_strdup_printf("%s: %s", if_info->vendor_description, if_info->name);
|
||||
} else {
|
||||
/* No. */
|
||||
if_string = g_strdup(if_info->name);
|
||||
}
|
||||
} /* else descr != NULL */
|
||||
if (if_info->loopback) {
|
||||
device.display_name = g_strdup_printf("%s (loopback)", if_string);
|
||||
} else {
|
||||
device.display_name = g_strdup(if_string);
|
||||
}
|
||||
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
|
||||
if ((device.buffer = capture_dev_user_buffersize_find(if_string)) == -1) {
|
||||
device.buffer = global_capture_opts.default_options.buffer_size;
|
||||
}
|
||||
#endif
|
||||
if ((device.pmode = capture_dev_user_pmode_find(if_string)) == -1) {
|
||||
device.pmode = global_capture_opts.default_options.promisc_mode;
|
||||
}
|
||||
device.has_snaplen = global_capture_opts.default_options.has_snaplen;
|
||||
if ((device.snaplen = capture_dev_user_snaplen_find(if_string)) == -1) {
|
||||
device.snaplen = global_capture_opts.default_options.snaplen;
|
||||
}
|
||||
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
|
||||
monitor_mode = prefs_capture_device_monitor_mode(if_string);
|
||||
caps = capture_get_if_capabilities(if_string, monitor_mode, NULL, main_window_update);
|
||||
for (; (curr_addr = g_slist_nth(if_info->addrs, ips)) != NULL; ips++) {
|
||||
if (ips != 0) {
|
||||
g_string_append(ip_str, "\n");
|
||||
}
|
||||
addr = (if_addr_t *)curr_addr->data;
|
||||
switch (addr->ifat_type) {
|
||||
case IF_AT_IPv4:
|
||||
g_string_append(ip_str, ip_to_str((guint8 *)&addr->addr.ip4_addr));
|
||||
break;
|
||||
case IF_AT_IPv6:
|
||||
g_string_append(ip_str, ip6_to_str((struct e_in6_addr *)&addr->addr.ip6_addr));
|
||||
break;
|
||||
default:
|
||||
/* In case we add non-IP addresses */
|
||||
break;
|
||||
}
|
||||
} /* for curr_addr */
|
||||
linktype_count = 0;
|
||||
device.links = NULL;
|
||||
if (caps != NULL) {
|
||||
#ifdef HAVE_PCAP_CREATE
|
||||
device.monitor_mode_enabled = monitor_mode;
|
||||
device.monitor_mode_supported = caps->can_set_rfmon;
|
||||
#endif
|
||||
for (lt_entry = caps->data_link_types; lt_entry != NULL; lt_entry = g_list_next(lt_entry)) {
|
||||
data_link_info = (data_link_info_t *)lt_entry->data;
|
||||
linkr = (link_row *)g_malloc(sizeof(link_row));
|
||||
/*
|
||||
* For link-layer types libpcap/WinPcap doesn't know about, the
|
||||
* name will be "DLT n", and the description will be null.
|
||||
* We mark those as unsupported, and don't allow them to be
|
||||
* used.
|
||||
*/
|
||||
if (data_link_info->description != NULL) {
|
||||
str = g_strdup_printf("%s", data_link_info->description);
|
||||
linkr->dlt = data_link_info->dlt;
|
||||
} else {
|
||||
str = g_strdup_printf("%s (not supported)", data_link_info->name);
|
||||
linkr->dlt = -1;
|
||||
}
|
||||
if (linktype_count == 0) {
|
||||
link_type_name = g_strdup(str);
|
||||
device.active_dlt = data_link_info->dlt;
|
||||
}
|
||||
linkr->name = g_strdup(str);
|
||||
g_free(str);
|
||||
device.links = g_list_append(device.links, linkr);
|
||||
linktype_count++;
|
||||
} /* for link_types */
|
||||
} else {
|
||||
#if defined(HAVE_PCAP_CREATE)
|
||||
device.monitor_mode_enabled = FALSE;
|
||||
device.monitor_mode_supported = FALSE;
|
||||
#endif
|
||||
device.active_dlt = -1;
|
||||
link_type_name = g_strdup("default");
|
||||
}
|
||||
device.addresses = g_strdup(ip_str->str);
|
||||
device.no_addresses = ips;
|
||||
device.remote_opts.src_type= roptions->src_type;
|
||||
if (device.remote_opts.src_type == CAPTURE_IFREMOTE) {
|
||||
device.local = FALSE;
|
||||
}
|
||||
device.remote_opts.remote_host_opts.remote_host = g_strdup(roptions->remote_host_opts.remote_host);
|
||||
device.remote_opts.remote_host_opts.remote_port = g_strdup(roptions->remote_host_opts.remote_port);
|
||||
device.remote_opts.remote_host_opts.auth_type = roptions->remote_host_opts.auth_type;
|
||||
device.remote_opts.remote_host_opts.auth_username = g_strdup(roptions->remote_host_opts.auth_username);
|
||||
device.remote_opts.remote_host_opts.auth_password = g_strdup(roptions->remote_host_opts.auth_password);
|
||||
device.remote_opts.remote_host_opts.datatx_udp = roptions->remote_host_opts.datatx_udp;
|
||||
device.remote_opts.remote_host_opts.nocap_rpcap = roptions->remote_host_opts.nocap_rpcap;
|
||||
device.remote_opts.remote_host_opts.nocap_local = roptions->remote_host_opts.nocap_local;
|
||||
#ifdef HAVE_PCAP_SETSAMPLING
|
||||
device.remote_opts.sampling_method = roptions->sampling_method;
|
||||
device.remote_opts.sampling_param = roptions->sampling_param;
|
||||
#endif
|
||||
device.selected = TRUE;
|
||||
global_capture_opts.num_selected++;
|
||||
g_array_append_val(global_capture_opts.all_ifaces, device);
|
||||
g_string_free(ip_str, TRUE);
|
||||
} /*for*/
|
||||
showRemoteInterfaces();
|
||||
}
|
||||
|
||||
void ManageInterfacesDialog::on_remoteButtonBox_accepted()
|
||||
{
|
||||
QTreeWidgetItemIterator it(ui->remoteList);
|
||||
|
||||
while(*it) {
|
||||
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
||||
interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
||||
if ((*it)->text(2).compare(device.name))
|
||||
continue;
|
||||
device.hidden = ((*it)->checkState(1)==Qt::Checked?true:false);
|
||||
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
|
||||
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
emit ifsChanged();
|
||||
}
|
||||
|
||||
void ManageInterfacesDialog::on_delRemote_clicked()
|
||||
{
|
||||
QList<QTreeWidgetItem*> selected = ui->remoteList->selectedItems();
|
||||
if (selected.length() == 0) {
|
||||
QMessageBox::warning(this, tr("Error"),
|
||||
tr("No host selected. Select the host to be removed."));
|
||||
return;
|
||||
}
|
||||
QString host = selected[0]->text(0);
|
||||
int index = ui->remoteList->indexOfTopLevelItem(selected[0]);
|
||||
QTreeWidgetItem *top = ui->remoteList->takeTopLevelItem(index);
|
||||
int numChildren = top->childCount();
|
||||
for (int i = 0; i < numChildren; i++) {
|
||||
QTreeWidgetItem *child = top->child(i);
|
||||
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
||||
interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
||||
if (child->text(2).compare(device.name))
|
||||
continue;
|
||||
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
|
||||
}
|
||||
}
|
||||
ui->remoteList->removeItemWidget(top, 0);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void ManageInterfacesDialog::on_addRemote_clicked()
|
||||
{
|
||||
RemoteCaptureDialog *dlg = new RemoteCaptureDialog(this);
|
||||
dlg->show();
|
||||
}
|
||||
|
||||
void ManageInterfacesDialog::showRemoteInterfaces()
|
||||
{
|
||||
guint i;
|
||||
interface_t device;
|
||||
gchar *host = g_strdup("");
|
||||
QTreeWidgetItem *child;
|
||||
|
||||
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
||||
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
||||
if (!device.local) {
|
||||
QTreeWidgetItem *itm;
|
||||
if (strcmp(host, device.remote_opts.remote_host_opts.remote_host)) {
|
||||
host = g_strdup(device.remote_opts.remote_host_opts.remote_host);
|
||||
itm = new QTreeWidgetItem(ui->remoteList);
|
||||
itm->setText(HOST, host);
|
||||
child = new QTreeWidgetItem(itm);
|
||||
child->setCheckState(HIDDEN, device.hidden?Qt::Checked:Qt::Unchecked);
|
||||
child->setText(REMOTE_NAME, QString(device.name));
|
||||
} else {
|
||||
child = new QTreeWidgetItem(itm);
|
||||
child->setCheckState(HIDDEN, device.hidden?Qt::Checked:Qt::Unchecked);
|
||||
child->setText(REMOTE_NAME, QString(device.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ManageInterfacesDialog::on_remoteSettings_clicked()
|
||||
{
|
||||
guint i = 0;
|
||||
interface_t device;
|
||||
|
||||
QList<QTreeWidgetItem*> selected = ui->remoteList->selectedItems();
|
||||
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
||||
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
||||
if (!device.local) {
|
||||
if (selected[0]->text(2).compare(device.name)) {
|
||||
continue;
|
||||
} else {
|
||||
RemoteSettingsDialog *dlg = new RemoteSettingsDialog(this, &device);
|
||||
dlg->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ManageInterfacesDialog::setRemoteSettings(interface_t *iface)
|
||||
{
|
||||
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
||||
interface_t device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
||||
if (!device.local) {
|
||||
if (strcmp(iface->name, device.name)) {
|
||||
continue;
|
||||
}
|
||||
device.remote_opts.remote_host_opts.nocap_rpcap = iface->remote_opts.remote_host_opts.nocap_rpcap;
|
||||
device.remote_opts.remote_host_opts.datatx_udp = iface->remote_opts.remote_host_opts.datatx_udp;
|
||||
device.remote_opts.sampling_method = iface->remote_opts.sampling_method;
|
||||
device.remote_opts.sampling_param = iface->remote_opts.sampling_param;
|
||||
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
|
||||
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
NewFileDelegate::NewFileDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
#include <QLineEdit>
|
||||
#include <QTableWidget>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <glib.h>
|
||||
#include "capture_opts.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -36,6 +41,14 @@ enum
|
|||
NUM_LOCAL_COLUMNS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HOST = 0,
|
||||
HIDDEN,
|
||||
REMOTE_NAME,
|
||||
NUM_REMOTE_COLUMNS
|
||||
};
|
||||
|
||||
|
||||
class NewFileDelegate : public QStyledItemDelegate
|
||||
{
|
||||
|
@ -73,21 +86,36 @@ public:
|
|||
private:
|
||||
Ui::ManageInterfacesDialog *ui;
|
||||
NewFileDelegate new_pipe_item_delegate_;
|
||||
QStandardItemModel *remoteModel;
|
||||
|
||||
void showPipes();
|
||||
void showLocalInterfaces();
|
||||
void showRemoteInterfaces();
|
||||
void saveLocalHideChanges(QTableWidgetItem *item);
|
||||
void saveLocalCommentChanges(QTableWidgetItem *item);
|
||||
void checkBoxChanged(QTableWidgetItem *item);
|
||||
void checkBoxChanged(QTableWidgetItem *item);
|
||||
|
||||
signals:
|
||||
void ifsChanged();
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
void remoteAdded(GList *rlist, remote_options *roptions);
|
||||
void remoteSettingsChanged(interface_t *iface);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void on_addButton_clicked();
|
||||
void on_buttonBox_accepted();
|
||||
void on_delButton_clicked();
|
||||
void on_localButtonBox_accepted();
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
void on_addRemote_clicked();
|
||||
void on_remoteButtonBox_accepted();
|
||||
void addRemoteInterfaces(GList *rlist, remote_options *roptions);
|
||||
void setRemoteSettings(interface_t *iface);
|
||||
void on_delRemote_clicked();
|
||||
void remoteSelectionChanged(QTreeWidgetItem* item, int col);
|
||||
void on_remoteSettings_clicked();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // MANAGE_INTERFACES_DIALOG_H
|
||||
|
|
|
@ -1,327 +1,457 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ManageInterfacesDialog</class>
|
||||
<widget class="QDialog" name="ManageInterfacesDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>574</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Manage Interfaces</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="Pipes">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Add a pipe to capture from or remove an existing pipe from the list.</p></body></html></string>
|
||||
<class>ManageInterfacesDialog</class>
|
||||
<widget class="QDialog" name="ManageInterfacesDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>574</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Manage Interfaces</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Pipes</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="pipeList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="rowCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<row/>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Pipe</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Add a new pipe using default settings.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../image/toolbar.qrc">
|
||||
<normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="delButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remove the selected pipe from the list.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../image/toolbar.qrc">
|
||||
<normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Local">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Click the checkbox to hide or show a hidden interface.</p></body></html></string>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Local Interfaces</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="localList">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Hide</string>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Friendly Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Interface Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
<widget class="QWidget" name="Pipes">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Add a pipe to capture from or remove an existing pipe from the list.</p></body></html></string>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Pipes</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="pipeList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="rowCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<row/>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Pipe</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Add a new pipe using default settings.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../image/toolbar.qrc">
|
||||
<normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="delButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remove the selected pipe from the list.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../image/toolbar.qrc">
|
||||
<normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Local">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Click the checkbox to hide or show a hidden interface.</p></body></html></string>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Local Interfaces</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="localList">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Hide</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Friendly Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Interface Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="localButtonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Remote">
|
||||
<attribute name="title">
|
||||
<string>Remote Interfaces</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="remoteList">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragDropOverwriteMode">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addRemote">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Add a remote host and its interfaces</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../image/toolbar.qrc">
|
||||
<normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="delRemote">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remove the selected host from the list.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../image/toolbar.qrc">
|
||||
<normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>328</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remoteSettings">
|
||||
<property name="text">
|
||||
<string>Remote Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="remoteButtonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="localButtonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Remote">
|
||||
<attribute name="title">
|
||||
<string>Remote Interfaces</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../image/toolbar.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>localButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>localButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../image/toolbar.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>localButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>localButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>469</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>164</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>remoteButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>482</x>
|
||||
<y>312</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>168</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>remoteButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ManageInterfacesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>482</x>
|
||||
<y>312</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>168</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
/* remote_capture_dialog.cpp
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
#include <glib.h>
|
||||
#include "ui/capture_globals.h"
|
||||
#include "remote_capture_dialog.h"
|
||||
#include "ui_remote_capture_dialog.h"
|
||||
#include "capture_opts.h"
|
||||
#include "caputils/capture-pcap-util.h"
|
||||
#include "ui/capture_ui_utils.h"
|
||||
#include "epan/prefs.h"
|
||||
#include "epan/to_str.h"
|
||||
#include "ui/ui_util.h"
|
||||
#include "ui/recent.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
static guint num_selected = 0;
|
||||
|
||||
RemoteCaptureDialog::RemoteCaptureDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RemoteCaptureDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
fillComboBox();
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(apply_remote()));
|
||||
connect(this, SIGNAL(remoteAdded(GList *, remote_options*)), parent, SIGNAL(remoteAdded(GList *, remote_options*)));
|
||||
connect(ui->hostCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(hostChanged(QString)));
|
||||
}
|
||||
|
||||
RemoteCaptureDialog::~RemoteCaptureDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RemoteCaptureDialog::hostChanged(QString host)
|
||||
{
|
||||
if (!host.compare(tr("Clear list"))) {
|
||||
free_remote_host_list();
|
||||
ui->hostCombo->clear();
|
||||
} else {
|
||||
struct remote_host *rh = recent_get_remote_host(host.toUtf8().constData());
|
||||
if (rh) {
|
||||
ui->portText->setText(QString(rh->remote_port));
|
||||
if (rh->auth_type == CAPTURE_AUTH_NULL) {
|
||||
ui->nullAuth->setChecked(true);
|
||||
} else {
|
||||
ui->pwAuth->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void fillBox(gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
Q_UNUSED(value);
|
||||
Q_UNUSED(user_data);
|
||||
|
||||
QComboBox *cb = (QComboBox *)user_data;
|
||||
cb->addItem(QString((gchar*)key));
|
||||
}
|
||||
|
||||
void RemoteCaptureDialog::fillComboBox()
|
||||
{
|
||||
GHashTable *ht = get_remote_host_list();
|
||||
ui->hostCombo->addItem(QString(""));
|
||||
if (g_hash_table_size(ht) > 0) {
|
||||
g_hash_table_foreach(ht, fillBox, ui->hostCombo);
|
||||
ui->hostCombo->insertSeparator(g_hash_table_size(ht)+1);
|
||||
ui->hostCombo->addItem(QString(tr("Clear list")));
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteCaptureDialog::apply_remote()
|
||||
{
|
||||
int err;
|
||||
gchar *err_str;
|
||||
remote_options global_remote_opts;
|
||||
|
||||
QString host = ui->hostCombo->currentText();
|
||||
global_remote_opts.src_type = CAPTURE_IFREMOTE;
|
||||
global_remote_opts.remote_host_opts.remote_host = g_strdup((gchar *)host.toUtf8().constData());
|
||||
QString port = ui->portText->text();
|
||||
global_remote_opts.remote_host_opts.remote_port = g_strdup((gchar *)port.toUtf8().constData());
|
||||
if (ui->pwAuth->isChecked()) {
|
||||
global_remote_opts.remote_host_opts.auth_type = CAPTURE_AUTH_PWD;
|
||||
} else {
|
||||
global_remote_opts.remote_host_opts.auth_type = CAPTURE_AUTH_NULL;
|
||||
}
|
||||
QString user = ui->userText->text();
|
||||
global_remote_opts.remote_host_opts.auth_username = g_strdup((gchar *)user.toUtf8().constData());
|
||||
QString pw = ui->pwText->text();
|
||||
global_remote_opts.remote_host_opts.auth_password = g_strdup((gchar *)pw.toUtf8().constData());
|
||||
GList *rlist = get_remote_interface_list(global_remote_opts.remote_host_opts.remote_host,
|
||||
global_remote_opts.remote_host_opts.remote_port,
|
||||
global_remote_opts.remote_host_opts.auth_type,
|
||||
global_remote_opts.remote_host_opts.auth_username,
|
||||
global_remote_opts.remote_host_opts.auth_password,
|
||||
&err, &err_str);
|
||||
if (rlist == NULL &&
|
||||
(err == CANT_GET_INTERFACE_LIST || err == DONT_HAVE_PCAP)) {
|
||||
QMessageBox::warning(this, tr("Error"),
|
||||
(err == CANT_GET_INTERFACE_LIST?tr("No remote interfaces found."):tr("PCAP not found")));
|
||||
return;
|
||||
}
|
||||
if (ui->hostCombo->count() == 0) {
|
||||
ui->hostCombo->addItem("");
|
||||
ui->hostCombo->addItem(host);
|
||||
ui->hostCombo->insertSeparator(2);
|
||||
ui->hostCombo->addItem(QString(tr("Clear list")));
|
||||
} else {
|
||||
ui->hostCombo->insertItem(0, host);
|
||||
}
|
||||
struct remote_host *rh = recent_get_remote_host(host.toUtf8().constData());
|
||||
if (!rh) {
|
||||
rh = (struct remote_host *)g_malloc (sizeof (*rh));
|
||||
rh->r_host = g_strdup((gchar *)host.toUtf8().constData());
|
||||
rh->remote_port = g_strdup((gchar *)port.toUtf8().constData());
|
||||
rh->auth_type = global_remote_opts.remote_host_opts.auth_type;
|
||||
rh->auth_password = g_strdup("");
|
||||
rh->auth_username = g_strdup("");
|
||||
recent_add_remote_host(global_remote_opts.remote_host_opts.remote_host, rh);
|
||||
}
|
||||
emit remoteAdded(rlist, &global_remote_opts);
|
||||
}
|
||||
|
||||
void RemoteCaptureDialog::on_pwAuth_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->userLabel->setEnabled(true);
|
||||
ui->userText->setEnabled(true);
|
||||
ui->pwLabel->setEnabled(true);
|
||||
ui->pwText->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteCaptureDialog::on_nullAuth_toggled(bool checked)
|
||||
{
|
||||
if (checked) {
|
||||
ui->userLabel->setEnabled(false);
|
||||
ui->userText->setEnabled(false);
|
||||
ui->pwLabel->setEnabled(false);
|
||||
ui->pwText->setEnabled(false);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_PCAP_REMOTE */
|
||||
//
|
||||
// Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
//
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// tab-width: 4
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vi: set shiftwidth=4 tabstop=4 expandtab:
|
||||
// :indentSize=4:tabSize=4:noTabs=true:
|
||||
//
|
|
@ -0,0 +1,71 @@
|
|||
/* remote_capture_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 REMOTE_CAPTURE_DIALOG_H
|
||||
#define REMOTE_CAPTURE_DIALOG_H
|
||||
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
#include <QDialog>
|
||||
#include <glib.h>
|
||||
#include "capture_opts.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class RemoteCaptureDialog;
|
||||
}
|
||||
|
||||
class RemoteCaptureDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RemoteCaptureDialog(QWidget *parent = 0);
|
||||
~RemoteCaptureDialog();
|
||||
|
||||
signals:
|
||||
void remoteAdded(GList *rlist, remote_options *roptions);
|
||||
|
||||
private slots:
|
||||
void on_pwAuth_toggled(bool checked);
|
||||
void on_nullAuth_toggled(bool checked);
|
||||
void apply_remote();
|
||||
void hostChanged(QString host);
|
||||
|
||||
private:
|
||||
Ui::RemoteCaptureDialog *ui;
|
||||
|
||||
void fillComboBox();
|
||||
};
|
||||
#endif
|
||||
#endif // REMOTE_CAPTURE_DIALOG_H
|
||||
|
||||
//
|
||||
// Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
//
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// tab-width: 4
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vi: set shiftwidth=4 tabstop=4 expandtab:
|
||||
// :indentSize=4:tabSize=4:noTabs=true:
|
||||
//
|
|
@ -0,0 +1,180 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RemoteCaptureDialog</class>
|
||||
<widget class="QDialog" name="RemoteCaptureDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>233</width>
|
||||
<height>256</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Remote Interface</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="hostCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="portText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="nullAuth">
|
||||
<property name="text">
|
||||
<string>Null authentication</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="pwAuth">
|
||||
<property name="text">
|
||||
<string>Password authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="userLabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="userText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="pwLabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="pwText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>RemoteCaptureDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>RemoteCaptureDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -0,0 +1,100 @@
|
|||
/* remote_settings_dialog.cpp
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
#include "remote_settings_dialog.h"
|
||||
#include "ui_remote_settings_dialog.h"
|
||||
|
||||
RemoteSettingsDialog::RemoteSettingsDialog(QWidget *parent, interface_t *iface) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RemoteSettingsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
mydevice.name = g_strdup(iface->name);
|
||||
ui->rpcapBox->setCheckState(iface->remote_opts.remote_host_opts.nocap_rpcap?Qt::Checked:Qt::Unchecked);
|
||||
ui->udpBox->setCheckState(iface->remote_opts.remote_host_opts.datatx_udp?Qt::Checked:Qt::Unchecked);
|
||||
#ifdef HAVE_PCAP_SETSAMPLING
|
||||
switch (iface->remote_opts.sampling_method)
|
||||
{
|
||||
case CAPTURE_SAMP_NONE:
|
||||
ui->sampleNone->setChecked(true);
|
||||
break;
|
||||
case CAPTURE_SAMP_BY_COUNT:
|
||||
ui->samplePkt->setChecked(true);
|
||||
ui->spinPkt->setValue(iface->remote_opts.sampling_param);
|
||||
break;
|
||||
case CAPTURE_SAMP_BY_TIMER:
|
||||
ui->sampleTime->setChecked(true);
|
||||
ui->spinTime->setValue(iface->remote_opts.sampling_param);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
ui->sampleLabel->setVisible(false);
|
||||
ui->sampleNone->setVisible(false);
|
||||
ui->samplePkt->setVisible(false);
|
||||
ui->sampleTime->setVisible(false);
|
||||
ui->spinPkt->setVisible(false);
|
||||
ui->spinTime->setVisible(false);
|
||||
ui->pktLabel->setVisible(false);
|
||||
ui->timeLabel->setVisible(false);
|
||||
resize(width(), height() - ui->sampleLabel->height() - 3 * ui->sampleNone->height());
|
||||
#endif
|
||||
connect(this, SIGNAL(remoteSettingsChanged(interface_t *)), parent, SIGNAL(remoteSettingsChanged(interface_t *)));
|
||||
}
|
||||
|
||||
RemoteSettingsDialog::~RemoteSettingsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RemoteSettingsDialog::on_buttonBox_accepted()
|
||||
{
|
||||
mydevice.remote_opts.remote_host_opts.nocap_rpcap = (ui->rpcapBox->checkState()==Qt::Checked)?true:false;
|
||||
mydevice.remote_opts.remote_host_opts.datatx_udp = (ui->udpBox->checkState()==Qt::Checked)?true:false;
|
||||
#ifdef HAVE_PCAP_SETSAMPLING
|
||||
if (ui->sampleNone->isChecked()) {
|
||||
mydevice.remote_opts.sampling_method = CAPTURE_SAMP_NONE;
|
||||
mydevice.remote_opts.sampling_param = 0;
|
||||
} else if (ui->samplePkt->isChecked()) {
|
||||
mydevice.remote_opts.sampling_method = CAPTURE_SAMP_BY_COUNT;
|
||||
mydevice.remote_opts.sampling_param = ui->spinPkt->value();
|
||||
} else {
|
||||
mydevice.remote_opts.sampling_method = CAPTURE_SAMP_BY_TIMER;
|
||||
mydevice.remote_opts.sampling_param = ui->spinTime->value();
|
||||
}
|
||||
#endif
|
||||
emit remoteSettingsChanged(&mydevice);
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
//
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// tab-width: 4
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vi: set shiftwidth=4 tabstop=4 expandtab:
|
||||
// :indentSize=4:tabSize=4:noTabs=true:
|
||||
//
|
|
@ -0,0 +1,65 @@
|
|||
/* remote_settings_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 REMOTE_SETTINGS_DIALOG_H
|
||||
#define REMOTE_SETTINGS_DIALOG_H
|
||||
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
#include <QDialog>
|
||||
#include "capture_opts.h"
|
||||
|
||||
namespace Ui {
|
||||
class RemoteSettingsDialog;
|
||||
}
|
||||
|
||||
class RemoteSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RemoteSettingsDialog(QWidget *parent = 0, interface_t *iface = NULL);
|
||||
~RemoteSettingsDialog();
|
||||
|
||||
signals:
|
||||
void remoteSettingsChanged(interface_t *iface);
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
|
||||
private:
|
||||
Ui::RemoteSettingsDialog *ui;
|
||||
interface_t mydevice;
|
||||
};
|
||||
#endif
|
||||
#endif // REMOTE_SETTINGS_DIALOG_H
|
||||
|
||||
//
|
||||
// Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
//
|
||||
// Local variables:
|
||||
// c-basic-offset: 4
|
||||
// tab-width: 4
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
//
|
||||
// vi: set shiftwidth=4 tabstop=4 expandtab:
|
||||
// :indentSize=4:tabSize=4:noTabs=true:
|
||||
//
|
|
@ -0,0 +1,165 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RemoteSettingsDialog</class>
|
||||
<widget class="QDialog" name="RemoteSettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>231</width>
|
||||
<height>229</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Remote Capture Settings</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Capture Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="rpcapBox">
|
||||
<property name="text">
|
||||
<string>Do not capture own RPCAP traffic</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="udpBox">
|
||||
<property name="text">
|
||||
<string>Use UDP for data transfer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleLabel">
|
||||
<property name="text">
|
||||
<string>Sampling Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="sampleNone">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="samplePkt">
|
||||
<property name="text">
|
||||
<string>1 of</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinPkt">
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="pktLabel">
|
||||
<property name="text">
|
||||
<string>packets</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="sampleTime">
|
||||
<property name="text">
|
||||
<string>1 every </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinTime">
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="timeLabel">
|
||||
<property name="text">
|
||||
<string>milliseconds</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>RemoteSettingsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>RemoteSettingsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue