aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/capture.c10
-rw-r--r--ui/capture_ui_utils.c22
-rw-r--r--ui/iface_lists.c60
-rw-r--r--ui/qt/interface_toolbar.cpp12
-rw-r--r--ui/qt/main_window_slots.cpp12
-rw-r--r--ui/qt/wireshark_application.cpp6
6 files changed, 60 insertions, 62 deletions
diff --git a/ui/capture.c b/ui/capture.c
index 0612d3cba6..518a716687 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -464,19 +464,19 @@ capture_input_cfilter_error_message(capture_session *cap_session, guint i,
gchar *safe_cfilter;
gchar *safe_descr;
gchar *safe_cfilter_error_msg;
- interface_options interface_opts;
+ interface_options *interface_opts;
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture filter error message from child: \"%s\"", error_message);
g_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
g_assert(i < capture_opts->ifaces->len);
- interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
- safe_cfilter = simple_dialog_format_message(interface_opts.cfilter);
- safe_descr = simple_dialog_format_message(interface_opts.descr);
+ interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
+ safe_cfilter = simple_dialog_format_message(interface_opts->cfilter);
+ safe_descr = simple_dialog_format_message(interface_opts->descr);
safe_cfilter_error_msg = simple_dialog_format_message(error_message);
/* Did the user try a display filter? */
- if (dfilter_compile(interface_opts.cfilter, &rfcode, NULL) && rfcode != NULL) {
+ if (dfilter_compile(interface_opts->cfilter, &rfcode, NULL) && rfcode != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"%sInvalid capture filter \"%s\" for interface %s.%s\n"
"\n"
diff --git a/ui/capture_ui_utils.c b/ui/capture_ui_utils.c
index 5655632d91..88ce9a34d2 100644
--- a/ui/capture_ui_utils.c
+++ b/ui/capture_ui_utils.c
@@ -484,16 +484,14 @@ get_if_name(const char *if_text)
const char *
get_iface_description_for_interface(capture_options *capture_opts, guint i)
{
- interface_options interface_opts;
+ interface_options *interface_opts;
if (i < capture_opts->ifaces->len) {
- interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
- if (!interface_opts.descr && interface_opts.name) {
- interface_opts.descr = get_interface_descriptive_name(interface_opts.name);
- capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i);
- g_array_insert_val(capture_opts->ifaces, i, interface_opts);
+ interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
+ if (!interface_opts->descr && interface_opts->name) {
+ interface_opts->descr = get_interface_descriptive_name(interface_opts->name);
}
- return (interface_opts.descr);
+ return (interface_opts->descr);
} else {
return (NULL);
}
@@ -584,12 +582,12 @@ get_iface_list_string(capture_options *capture_opts, guint32 style)
if (style & IFLIST_QUOTE_IF_DESCRIPTION)
g_string_append_printf(iface_list_string, "'");
if (style & IFLIST_SHOW_FILTER) {
- interface_options interface_opts;
+ interface_options *interface_opts;
- interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
- if (interface_opts.cfilter != NULL &&
- strlen(interface_opts.cfilter) > 0) {
- g_string_append_printf(iface_list_string, " (%s)", interface_opts.cfilter);
+ interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
+ if (interface_opts->cfilter != NULL &&
+ strlen(interface_opts->cfilter) > 0) {
+ g_string_append_printf(iface_list_string, " (%s)", interface_opts->cfilter);
}
}
}
diff --git a/ui/iface_lists.c b/ui/iface_lists.c
index 103dd8d25a..97ecb24462 100644
--- a/ui/iface_lists.c
+++ b/ui/iface_lists.c
@@ -62,27 +62,27 @@ if_list_comparator_alph(const void *first_arg, const void *second_arg)
static gboolean
fill_from_ifaces (interface_t *device)
{
- interface_options interface_opts;
+ interface_options *interface_opts;
guint i;
for (i = 0; i < global_capture_opts.ifaces->len; i++) {
- interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, i);
- if (strcmp(interface_opts.name, device->name) != 0) {
+ interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, i);
+ if (strcmp(interface_opts->name, device->name) != 0) {
continue;
}
#if defined(HAVE_PCAP_CREATE)
- device->buffer = interface_opts.buffer_size;
- device->monitor_mode_enabled = interface_opts.monitor_mode;
+ device->buffer = interface_opts->buffer_size;
+ device->monitor_mode_enabled = interface_opts->monitor_mode;
#endif
- device->pmode = interface_opts.promisc_mode;
- device->has_snaplen = interface_opts.has_snaplen;
- device->snaplen = interface_opts.snaplen;
+ device->pmode = interface_opts->promisc_mode;
+ device->has_snaplen = interface_opts->has_snaplen;
+ device->snaplen = interface_opts->snaplen;
g_free(device->cfilter);
- device->cfilter = g_strdup(interface_opts.cfilter);
- device->timestamp_type = g_strdup(interface_opts.timestamp_type);
- if (interface_opts.linktype != -1) {
- device->active_dlt = interface_opts.linktype;
+ device->cfilter = g_strdup(interface_opts->cfilter);
+ device->timestamp_type = g_strdup(interface_opts->timestamp_type);
+ if (interface_opts->linktype != -1) {
+ device->active_dlt = interface_opts->linktype;
}
return TRUE;
}
@@ -111,7 +111,7 @@ scan_local_interfaces(void (*update_cb)(void))
data_link_info_t *data_link_info;
interface_t device;
GString *ip_str;
- interface_options interface_opts;
+ interface_options *interface_opts;
gboolean found = FALSE;
static gboolean running = FALSE;
GHashTable *selected_devices;
@@ -344,51 +344,51 @@ scan_local_interfaces(void (*update_cb)(void))
* the list of all interfaces (all_ifaces).
*/
for (j = 0; j < global_capture_opts.ifaces->len; j++) {
- interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j);
+ interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, j);
found = FALSE;
for (i = 0; i < (int)global_capture_opts.all_ifaces->len; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
- if (strcmp(device.name, interface_opts.name) == 0) {
+ if (strcmp(device.name, interface_opts->name) == 0) {
found = TRUE;
break;
}
}
if (!found) { /* new interface, maybe a pipe */
memset(&device, 0, sizeof(device));
- device.name = g_strdup(interface_opts.name);
- device.display_name = interface_opts.descr ?
- g_strdup_printf("%s: %s", device.name, interface_opts.descr) :
+ device.name = g_strdup(interface_opts->name);
+ device.display_name = interface_opts->descr ?
+ g_strdup_printf("%s: %s", device.name, interface_opts->descr) :
g_strdup(device.name);
device.hidden = FALSE;
device.selected = TRUE;
- device.type = interface_opts.if_type;
+ device.type = interface_opts->if_type;
#ifdef CAN_SET_CAPTURE_BUFFER_SIZE
- device.buffer = interface_opts.buffer_size;
+ device.buffer = interface_opts->buffer_size;
#endif
#if defined(HAVE_PCAP_CREATE)
- device.monitor_mode_enabled = interface_opts.monitor_mode;
+ device.monitor_mode_enabled = interface_opts->monitor_mode;
device.monitor_mode_supported = FALSE;
#endif
- device.pmode = interface_opts.promisc_mode;
- device.has_snaplen = interface_opts.has_snaplen;
- device.snaplen = interface_opts.snaplen;
- device.cfilter = g_strdup(interface_opts.cfilter);
- device.timestamp_type = g_strdup(interface_opts.timestamp_type);
- device.active_dlt = interface_opts.linktype;
+ device.pmode = interface_opts->promisc_mode;
+ device.has_snaplen = interface_opts->has_snaplen;
+ device.snaplen = interface_opts->snaplen;
+ device.cfilter = g_strdup(interface_opts->cfilter);
+ device.timestamp_type = g_strdup(interface_opts->timestamp_type);
+ device.active_dlt = interface_opts->linktype;
device.addresses = NULL;
device.no_addresses = 0;
device.last_packets = 0;
device.links = NULL;
device.local = TRUE;
device.locked = FALSE;
- device.if_info.name = g_strdup(interface_opts.name);
+ device.if_info.name = g_strdup(interface_opts->name);
device.if_info.friendly_name = NULL;
- device.if_info.vendor_description = g_strdup(interface_opts.descr);
+ device.if_info.vendor_description = g_strdup(interface_opts->descr);
device.if_info.addrs = NULL;
device.if_info.loopback = FALSE;
#ifdef HAVE_EXTCAP
- device.if_info.extcap = g_strdup(interface_opts.extcap);
+ device.if_info.extcap = g_strdup(interface_opts->extcap);
#endif
g_array_append_val(global_capture_opts.all_ifaces, device);
diff --git a/ui/qt/interface_toolbar.cpp b/ui/qt/interface_toolbar.cpp
index fed9cb919b..f5a3f6a95b 100644
--- a/ui/qt/interface_toolbar.cpp
+++ b/ui/qt/interface_toolbar.cpp
@@ -741,8 +741,8 @@ void InterfaceToolbar::startCapture(GArray *ifaces)
for (guint i = 0; i < ifaces->len; i++)
{
- interface_options interface_opts = g_array_index(ifaces, interface_options, i);
- QString ifname(interface_opts.name);
+ interface_options *interface_opts = &g_array_index(ifaces, interface_options, i);
+ QString ifname(interface_opts->name);
if (!interface_.contains(ifname))
// This interface is not for us
@@ -760,11 +760,11 @@ void InterfaceToolbar::startCapture(GArray *ifaces)
// Open control out channel
#ifdef _WIN32
- startReaderThread(ifname, interface_opts.extcap_control_in_h);
- interface_[ifname].out_fd = _open_osfhandle((intptr_t)interface_opts.extcap_control_out_h, O_APPEND | O_BINARY);
+ startReaderThread(ifname, interface_opts->extcap_control_in_h);
+ interface_[ifname].out_fd = _open_osfhandle((intptr_t)interface_opts->extcap_control_out_h, O_APPEND | O_BINARY);
#else
- startReaderThread(ifname, interface_opts.extcap_control_in);
- interface_[ifname].out_fd = ws_open(interface_opts.extcap_control_out, O_WRONLY | O_BINARY, 0);
+ startReaderThread(ifname, interface_opts->extcap_control_in);
+ interface_[ifname].out_fd = ws_open(interface_opts->extcap_control_out, O_WRONLY | O_BINARY, 0);
#endif
sendChangedValues(ifname);
controlSend(ifname, 0, commandControlInitialized);
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index a662a0be8e..d88f0bdb5e 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -951,7 +951,7 @@ void MainWindow::filterExpressionsChanged()
void MainWindow::startCapture() {
#ifdef HAVE_LIBPCAP
- interface_options interface_opts;
+ interface_options *interface_opts;
guint i;
/* did the user ever select a capture interface before? */
@@ -1009,16 +1009,16 @@ void MainWindow::startCapture() {
valid; add this capture filter to the recent capture filter list. */
QByteArray filter_ba;
for (i = 0; i < global_capture_opts.ifaces->len; i++) {
- interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, i);
- if (interface_opts.cfilter) {
- recent_add_cfilter(interface_opts.name, interface_opts.cfilter);
+ interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, i);
+ if (interface_opts->cfilter) {
+ recent_add_cfilter(interface_opts->name, interface_opts->cfilter);
if (filter_ba.isEmpty()) {
- filter_ba = interface_opts.cfilter;
+ filter_ba = interface_opts->cfilter;
} else {
/* Not the first selected interface; is its capture filter
the same as the one the other interfaces we've looked
at have? */
- if (strcmp(interface_opts.cfilter, filter_ba.constData()) != 0) {
+ if (strcmp(interface_opts->cfilter, filter_ba.constData()) != 0) {
/* No, so not all selected interfaces have the same capture
filter. */
filter_ba.clear();
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index d6d46f38d5..a9340438ea 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -1027,7 +1027,7 @@ iface_mon_event_cb(const char *iface, int up)
int present = 0;
guint ifs, j;
interface_t *device;
- interface_options interface_opts;
+ interface_options *interface_opts;
for (ifs = 0; ifs < global_capture_opts.all_ifaces->len; ifs++) {
device = &g_array_index(global_capture_opts.all_ifaces, interface_t, ifs);
@@ -1040,8 +1040,8 @@ iface_mon_event_cb(const char *iface, int up)
* for capturing.
*/
for (j = 0; j < global_capture_opts.ifaces->len; j++) {
- interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j);
- if (strcmp(interface_opts.name, device->name) == 0) {
+ interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, j);
+ if (strcmp(interface_opts->name, device->name) == 0) {
g_array_remove_index(global_capture_opts.ifaces, j);
}
}