Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

iface_monitor.h
1 /* iface_monitor.h
2 * interface monitor by Pontus Fuchs <pontus.fuchs@gmail.com>
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10 #ifndef IFACE_MONITOR_H
11 #define IFACE_MONITOR_H
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif /* __cplusplus */
16
17 #ifdef HAVE_LIBPCAP
18
19 /*
20 * Callback for interface changes.
21 *
22 * iface is a pointer to the name of the interface.
23 *
24 * up is 1 if the interface is up, 0 if it's down.
25 *
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".
31 *
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.
34 */
35 typedef void (*iface_mon_cb)(const char *iface, int up);
36
37 /*
38 * Start watching for interface changes.
39 */
40 int
41 iface_mon_start(iface_mon_cb cb);
42
43 /*
44 * Stop watching for interface changes.
45 */
46 void
47 iface_mon_stop(void);
48
49 /*
50 * Get the socket on which interface changes are delivered, so that
51 * we can add it to the event loop.
52 *
53 * XXX - what if it's not a socket or other file descriptor?
54 */
55 int
56 iface_mon_get_sock(void);
57
58 /*
59 * Call this if something is readable from the interface change socket.
60 * It will call the callback as appropriate.
61 */
62 void
63 iface_mon_event(void);
64
65 #endif /* HAVE_LIBPCAP */
66
67 #ifdef __cplusplus
68 }
69 #endif /* __cplusplus */
70
71 #endif /* IFACE_MONITOR_H */