Fix filtering on IP heuristic subdissectors.
[metze/wireshark/wip.git] / caputils / 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  * 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.
12  *
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.
17  *
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.
21  */
22 #ifndef IFACE_MONITOR_H
23 #define IFACE_MONITOR_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 #ifdef HAVE_LIBPCAP
30
31 /*
32  * Callback for interface changes.
33  *
34  * iface is a pointer to the name of the interface.
35  *
36  * up is 1 if the interface is up, 0 if it's down.
37  *
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".
43  *
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.
46  */
47 typedef void (*iface_mon_cb)(const char *iface, int up);
48
49 /*
50  * Start watching for interface changes.
51  */
52 int
53 iface_mon_start(iface_mon_cb cb);
54
55 /*
56  * Stop watching for interface changes.
57  */
58 void
59 iface_mon_stop(void);
60
61 /*
62  * Get the socket on which interface changes are delivered, so that
63  * we can add it to the event loop.
64  *
65  * XXX - what if it's not a socket or other file descriptor?
66  */
67 int
68 iface_mon_get_sock(void);
69
70 /*
71  * Call this if something is readable from the interface change socket.
72  * It will call the callback as appropriate.
73  */
74 void
75 iface_mon_event(void);
76
77 #endif /* HAVE_LIBPCAP */
78
79 #ifdef __cplusplus
80 }
81 #endif /* __cplusplus */
82
83 #endif /* IFACE_MONITOR_H */