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
10 #ifndef IFACE_MONITOR_H
11 #define IFACE_MONITOR_H
15 #endif /* __cplusplus */
20 * Callback for interface changes.
22 * iface is a pointer to the name of the interface.
24 * up is 1 if the interface is up, 0 if it's down.
26 * XXX - we really want "gone", not "down", where "gone" may include
27 * "down" if the OS requires an interface to be up in order to start
28 * a capture on it (as is the case in Linux and in macOS prior to
29 * Lion), but should also include *gone*, as in "there is no longer
30 * an interface with this name, so it's neither down nor up".
32 * We also may want other events, such as address changes, so what
33 * we might want is "add", "remove", and "modify" as the events.
35 typedef void (*iface_mon_cb)(const char *iface, int up);
38 * Start watching for interface changes.
41 iface_mon_start(iface_mon_cb cb);
44 * Stop watching for interface changes.
50 * Get the socket on which interface changes are delivered, so that
51 * we can add it to the event loop.
53 * XXX - what if it's not a socket or other file descriptor?
56 iface_mon_get_sock(void);
59 * Call this if something is readable from the interface change socket.
60 * It will call the callback as appropriate.
63 iface_mon_event(void);
65 #endif /* HAVE_LIBPCAP */
69 #endif /* __cplusplus */
71 #endif /* IFACE_MONITOR_H */