diff options
author | Michael Tüxen <tuexen@fh-muenster.de> | 2011-07-05 20:34:03 +0000 |
---|---|---|
committer | Michael Tüxen <tuexen@fh-muenster.de> | 2011-07-05 20:34:03 +0000 |
commit | cb90aa79043d162d3a2955cc0c66fd714948f19f (patch) | |
tree | 8ff2ea83f9ec58cab18c991d440b80a01de4cfc7 /summary.c | |
parent | 4b8f5a1865053f7318467389df23fefa43d14148 (diff) |
Add initial support for multiple interfaces. More to come after
the capture options dialog box supports also multiple interfaces.
This patch has been developed by Irene Ruengeler.
svn path=/trunk/; revision=37904
Diffstat (limited to 'summary.c')
-rw-r--r-- | summary.c | 34 |
1 files changed, 25 insertions, 9 deletions
@@ -131,22 +131,38 @@ summary_fill_in(capture_file *cf, summary_tally *st) st->drops = cf->drops; st->dfilter = cf->dfilter; - /* capture related */ - st->cfilter = NULL; - st->iface = NULL; - st->iface_descr = NULL; + st->ifaces = g_array_new(FALSE, FALSE, sizeof(iface_options)); } #ifdef HAVE_LIBPCAP -/* FIXME: This needs additional functionality to support multiple interfaces */ void summary_fill_in_capture(capture_options *capture_opts, summary_tally *st) { + iface_options iface; + interface_options interface_opts; + guint i; + if (capture_opts->ifaces->len > 0) { - st->cfilter = g_array_index(capture_opts->ifaces, interface_options, 0).cfilter; - st->iface = g_array_index(capture_opts->ifaces, interface_options, 0).name; - st->iface_descr = get_iface_description_for_interface(capture_opts, 0); - } + while (st->ifaces->len > 0) { + iface = g_array_index(st->ifaces, iface_options, 0); + st->ifaces = g_array_remove_index(st->ifaces, 0); + g_free(iface.name); + g_free(iface.descr); + g_free(iface.cfilter); + } + for (i = 0; i < capture_opts->ifaces->len; i++) { + interface_opts = g_array_index(capture_opts->ifaces, interface_options, i); + iface.cfilter = g_strdup(interface_opts.cfilter); + iface.name = g_strdup(interface_opts.name); + iface.descr = g_strdup(interface_opts.descr); + iface.drops_known = FALSE; + iface.drops = 0; + iface.has_snap = interface_opts.has_snaplen; + iface.snap = interface_opts.snaplen; + iface.linktype = interface_opts.linktype; + g_array_append_val(st->ifaces, iface); + } + } } #endif |