2 * interface monitor by Pontus Fuchs <pontus.fuchs@gmail.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include "../../iface_monitor.h"
35 #include "capture_opts.h"
37 #include "ui/capture_globals.h"
38 #include "ui/iface_lists.h"
40 #include "ui/gtk/capture_dlg.h"
41 #include "ui/gtk/gtk_iface_monitor.h"
43 GIOChannel *iface_mon_channel;
46 gtk_iface_mon_event_cb(const char *iface, int up)
51 interface_options interface_opts;
53 for (ifs = 0; ifs < global_capture_opts.all_ifaces->len; ifs++) {
54 device = g_array_index(global_capture_opts.all_ifaces, interface_t, ifs);
55 if (strcmp(device.name, iface) == 0) {
59 * Interface went down or disappeared; remove all instances
60 * of it from the current list of interfaces selected
63 for (j = 0; j < global_capture_opts.ifaces->len; j++) {
64 interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j);
65 if (strcmp(interface_opts.name, device.name) == 0) {
66 g_array_remove_index(global_capture_opts.ifaces, j);
77 * We've been told that there's a new interface or that an old
78 * interface is gone; reload the list and refresh all places
79 * that are displaying the list.
81 refresh_local_interface_lists();
85 gtk_iface_mon_event(GIOChannel *source _U_, GIOCondition condition _U_, gpointer data _U_)
92 gtk_iface_mon_start(void)
95 err = iface_mon_start(>k_iface_mon_event_cb);
98 sock = iface_mon_get_sock();
100 iface_mon_channel = g_io_channel_unix_new(sock);
101 g_io_channel_set_encoding(iface_mon_channel, NULL, NULL);
102 g_io_add_watch(iface_mon_channel,
103 (GIOCondition)(G_IO_IN|G_IO_ERR|G_IO_HUP),
104 >k_iface_mon_event,
110 gtk_iface_mon_stop(void)
116 #endif /* HAVE_LIBPCAP */