aboutsummaryrefslogtreecommitdiffstats
path: root/capture.c
diff options
context:
space:
mode:
authorMichael Tüxen <tuexen@fh-muenster.de>2011-10-20 18:17:54 +0000
committerMichael Tüxen <tuexen@fh-muenster.de>2011-10-20 18:17:54 +0000
commit95ae2fe13a49c6f8bdf95554b9488f4a5160ebcd (patch)
tree4718ae8b79401b6e6fb6ab785d2061eee56c6520 /capture.c
parent151acb8fa16d9d8bec74a581e77abefd6fc99e00 (diff)
Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI. Do not misuse the list of interfaces specified on the command line anymore. This patch does not provide any new functionality, it just provides the base for future extensions like removing remote interface, mulitple airpcap devices and multiple pipes. This patch was provided by Irene Ruengeler. svn path=/trunk/; revision=39495
Diffstat (limited to 'capture.c')
-rw-r--r--capture.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/capture.c b/capture.c
index 22bab8dd94..911a6c8a44 100644
--- a/capture.c
+++ b/capture.c
@@ -143,6 +143,7 @@ capture_start(capture_options *capture_opts)
/* close the currently loaded capture file */
cf_close(capture_opts->cf);
+ collect_ifaces(capture_opts);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Start ...");
#ifdef _WIN32
@@ -651,6 +652,9 @@ capture_input_closed(capture_options *capture_opts, gchar *msg)
}
/* ... and start the capture again */
+ if (capture_opts->ifaces->len == 0) {
+ collect_ifaces(capture_opts);
+ }
capture_start(capture_opts);
} else {
/* We're not doing a capture any more, so we don't have a save file. */
@@ -660,13 +664,13 @@ capture_input_closed(capture_options *capture_opts, gchar *msg)
}
if_stat_cache_t *
-capture_stat_start(GList *if_list) {
+capture_stat_start(capture_options *capture_opts) {
int stat_fd, fork_child;
gchar *msg;
if_stat_cache_t *sc = NULL;
- GList *if_entry;
- if_info_t *if_info;
if_stat_cache_item_t *sc_item;
+ guint i;
+ interface_t device;
/* Fire up dumpcap. */
/*
@@ -694,11 +698,11 @@ capture_stat_start(GList *if_list) {
sc->cache_list = NULL;
/* Initialize the cache */
- for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) {
- if_info = if_entry->data;
- if (if_info) {
+ for (i = 0; i < capture_opts->all_ifaces->len; i++) {
+ device = g_array_index(capture_opts->all_ifaces, interface_t, i);
+ if (&(device.if_info)) {
sc_item = g_malloc0(sizeof(if_stat_cache_item_t));
- sc_item->name = g_strdup(if_info->name);
+ sc_item->name = g_strdup(device.if_info.name);
sc->cache_list = g_list_append(sc->cache_list, sc_item);
}
}