1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef fooifacehfoo
#define fooifacehfoo
#include <glib.h>
#include "address.h"
struct _flxInterfaceMonitor;
typedef struct _flxInterfaceMonitor flxInterfaceMonitor;
struct _flxInterfaceAddress;
typedef struct _flxInterfaceAddress flxInterfaceAddress;
struct _flxInterface;
typedef struct _flxInterface flxInterface;
struct _flxInterface {
gchar *name;
gint index;
guint flags;
flxInterfaceAddress *addresses;
flxInterface *next, *prev;
};
struct _flxInterfaceAddress {
guchar flags;
guchar scope;
flxAddress address;
flxInterface *interface;
flxInterfaceAddress *next, *prev;
};
typedef enum { FLX_INTERFACE_NEW, FLX_INTERFACE_REMOVE, FLX_INTERFACE_CHANGE } flxInterfaceChange;
flxInterfaceMonitor *flx_interface_monitor_new(GMainContext *c);
void flx_interface_monitor_free(flxInterfaceMonitor *m);
const flxInterface* flx_interface_monitor_get_interface(flxInterfaceMonitor *m, gint index);
const flxInterface* flx_interface_monitor_get_first(flxInterfaceMonitor *m);
void flx_interface_monitor_add_interface_callback(
flxInterfaceMonitor *m,
void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterface *i, gpointer userdata),
gpointer userdata);
void flx_interface_monitor_remove_interface_callback(
flxInterfaceMonitor *m,
void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterface *i, gpointer userdata),
gpointer userdata);
void flx_interface_monitor_add_address_callback(
flxInterfaceMonitor *m,
void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterfaceAddress *a, gpointer userdata),
gpointer userdata);
void flx_interface_monitor_remove_address_callback(
flxInterfaceMonitor *m,
void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterfaceAddress *a, gpointer userdata),
gpointer userdata);
#endif
|