| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
iface_monitor.h
Go to the documentation of this file.
1
11#ifndef IFACE_MONITOR_H
12#define IFACE_MONITOR_H
13
14#include <wireshark.h>
15
16#ifdef __cplusplus
17 extern "C" {
18#endif /* __cplusplus */
19
20#ifdef HAVE_LIBPCAP
21
22/*
23 * Callback for interface changes.
24 *
25 * iface is a pointer to the name of the interface.
26 *
27 * up is 1 if the interface is up, 0 if it's down.
28 *
29 * XXX - we really want "gone", not "down", where "gone" may include
30 * "down" if the OS requires an interface to be up in order to start
31 * a capture on it (as is the case in Linux and in macOS prior to
32 * Lion), but should also include *gone*, as in "there is no longer
33 * an interface with this name, so it's neither down nor up".
34 *
35 * We also may want other events, such as address changes, so what
36 * we might want is "add", "remove", and "modify" as the events.
37 */
38 typedef void (*iface_mon_cb)(const char *iface, int added, int up);
39
40/*
41 * Start watching for interface changes.
42 */
43 int
44iface_mon_start(iface_mon_cb cb);
45
46/*
47 * Stop watching for interface changes.
48 */
49 void
50iface_mon_stop(void);
51
52/*
53 * Get the socket on which interface changes are delivered, so that
54 * we can add it to the event loop.
55 *
56 * XXX - what if it's not a socket or other file descriptor?
57 */
58 int
59iface_mon_get_sock(void);
60
61/*
62 * Call this if something is readable from the interface change socket.
63 * It will call the callback as appropriate.
64 */
65 void
66iface_mon_event(void);
67
68/*
69 * Temporarily enable or disable watching for interface changes. This has
70 * no effect if interface monitoring has not been started.
71 *
72 * This is for Linux, where setting rfmon mode on an interface can create
73 * or destroy another (virtual) interface on the same wiphy, to avoid infinite
74 * loops. It is a no-op on other platforms.
75 */
76 void
77iface_mon_enable(bool enable);
78
79#endif /* HAVE_LIBPCAP */
80
81#ifdef __cplusplus
82}
83#endif /* __cplusplus */
84
85#endif /* IFACE_MONITOR_H */