2 * interface monitor by Pontus Fuchs <pontus.fuchs@gmail.com>
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef IFACE_MONITOR_H
23 #define IFACE_MONITOR_H
27 #endif /* __cplusplus */
32 * Callback for interface changes.
34 * iface is a pointer to the name of the interface.
36 * up is 1 if the interface is up, 0 if it's down.
38 * XXX - we really want "gone", not "down", where "gone" may include
39 * "down" if the OS requires an interface to be up in order to start
40 * a capture on it (as is the case in Linux and in OS X prior to
41 * Lion), but should also include *gone*, as in "there is no longer
42 * an interface with this name, so it's neither down nor up".
44 * We also may want other events, such as address changes, so what
45 * we might want is "add", "remove", and "modify" as the events.
47 typedef void (*iface_mon_cb)(const char *iface, int up);
50 * Start watching for interface changes.
53 iface_mon_start(iface_mon_cb cb);
56 * Stop watching for interface changes.
62 * Get the socket on which interface changes are delivered, so that
63 * we can add it to the event loop.
65 * XXX - what if it's not a socket or other file descriptor?
68 iface_mon_get_sock(void);
71 * Call this if something is readable from the interface change socket.
72 * It will call the callback as appropriate.
75 iface_mon_event(void);
77 #endif /* HAVE_LIBPCAP */
81 #endif /* __cplusplus */
83 #endif /* IFACE_MONITOR_H */