Initialize rq_hdr.session
[metze/wireshark/wip.git] / 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 HAVE_LIBPCAP
26
27 /*
28  * Callback for interface changes.
29  *
30  * iface is a pointer to the name of the interface.
31  *
32  * up is 1 if the interface is up, 0 if it's down.
33  *
34  * XXX - we really want "gone", not "down", where "gone" may include
35  * "down" if the OS requires an interface to be up in order to start
36  * a capture on it (as is the case in Linux and in OS X prior to
37  * Lion), but should also include *gone*, as in "there is no longer
38  * an interface with this name, so it's neither down nor up".
39  *
40  * We also may want other events, such as address changes, so what
41  * we might want is "add", "remove", and "modify" as the events.
42  */
43 typedef void (*iface_mon_cb)(const char *iface, int up);
44
45 /*
46  * Start watching for interface changes.
47  */
48 int
49 iface_mon_start(iface_mon_cb cb);
50
51 /*
52  * Stop watching for interface changes.
53  */
54 void
55 iface_mon_stop(void);
56
57 /*
58  * Get the socket on which interface changes are delivered, so that
59  * we can add it to the event loop.
60  *
61  * XXX - what if it's not a socket or other file descriptor?
62  */
63 int
64 iface_mon_get_sock(void);
65
66 /*
67  * Call this if something is readable from the interface change socket.
68  * It will call the callback as appropriate.
69  */
70 void
71 iface_mon_event(void);
72
73 #endif /* HAVE_LIBPCAP */
74
75 #endif /* IFACE_MONITOR_H */