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 * SPDX-License-Identifier: GPL-2.0-or-later*/
9 #ifndef IFACE_MONITOR_H
10 #define IFACE_MONITOR_H
14 #endif /* __cplusplus */
19 * Callback for interface changes.
21 * iface is a pointer to the name of the interface.
23 * up is 1 if the interface is up, 0 if it's down.
25 * XXX - we really want "gone", not "down", where "gone" may include
26 * "down" if the OS requires an interface to be up in order to start
27 * a capture on it (as is the case in Linux and in macOS prior to
28 * Lion), but should also include *gone*, as in "there is no longer
29 * an interface with this name, so it's neither down nor up".
31 * We also may want other events, such as address changes, so what
32 * we might want is "add", "remove", and "modify" as the events.
34 typedef void (*iface_mon_cb)(const char *iface, int up);
37 * Start watching for interface changes.
40 iface_mon_start(iface_mon_cb cb);
43 * Stop watching for interface changes.
49 * Get the socket on which interface changes are delivered, so that
50 * we can add it to the event loop.
52 * XXX - what if it's not a socket or other file descriptor?
55 iface_mon_get_sock(void);
58 * Call this if something is readable from the interface change socket.
59 * It will call the callback as appropriate.
62 iface_mon_event(void);
64 #endif /* HAVE_LIBPCAP */
68 #endif /* __cplusplus */
70 #endif /* IFACE_MONITOR_H */