The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / iface_monitor.h @ master

History | View | Annotate | Download (2.21 KB)

1
/* iface_monitor.h
2
 * interface monitor by Pontus Fuchs <pontus.fuchs@gmail.com>
3
 *
4
 * $Id$
5
 *
6
 * Wireshark - Network traffic analyzer
7
 * By Gerald Combs <gerald@wireshark.org>
8
 * Copyright 1998 Gerald Combs
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
 */
24
#ifndef IFACE_MONITOR_H
25
#define IFACE_MONITOR_H
26

    
27
#ifdef HAVE_LIBPCAP
28

    
29
/*
30
 * Callback for interface changes.
31
 *
32
 * iface is a pointer to the name of the interface.
33
 *
34
 * up is 1 if the interface is up, 0 if it's down.
35
 *
36
 * XXX - we really want "gone", not "down", where "gone" may include
37
 * "down" if the OS requires an interface to be up in order to start
38
 * a capture on it (as is the case in Linux and in OS X prior to
39
 * Lion), but should also include *gone*, as in "there is no longer
40
 * an interface with this name, so it's neither down nor up".
41
 *
42
 * We also may want other events, such as address changes, so what
43
 * we might want is "add", "remove", and "modify" as the events.
44
 */
45
typedef void (*iface_mon_cb)(const char *iface, int up);
46

    
47
/*
48
 * Start watching for interface changes.
49
 */
50
int
51
iface_mon_start(iface_mon_cb cb);
52

    
53
/*
54
 * Stop watching for interface changes.
55
 */
56
void
57
iface_mon_stop(void);
58

    
59
/*
60
 * Get the socket on which interface changes are delivered, so that
61
 * we can add it to the event loop.
62
 *
63
 * XXX - what if it's not a socket or other file descriptor?
64
 */
65
int
66
iface_mon_get_sock(void);
67

    
68
/*
69
 * Call this if something is readable from the interface change socket.
70
 * It will call the callback as appropriate.
71
 */
72
void
73
iface_mon_event(void);
74

    
75
#endif /* HAVE_LIBPCAP */
76

    
77
#endif /* IFACE_MONITOR_H */