]> git.meshlink.io Git - catta/blob - iface.h
fold local.c into iface.c
[catta] / iface.h
1 #ifndef fooifacehfoo
2 #define fooifacehfoo
3
4 #include <glib.h>
5
6 struct _flxInterfaceMonitor;
7 typedef struct _flxInterfaceMonitor flxInterfaceMonitor;
8
9 struct _flxInterfaceAddress;
10 typedef struct _flxInterfaceAddress flxInterfaceAddress;
11
12 struct _flxInterface;
13 typedef struct _flxInterface flxInterface;
14
15 #include "address.h"
16 #include "server.h"
17 #include "netlink.h"
18
19 struct _flxInterfaceMonitor {
20     flxServer *server;
21     flxNetlink *netlink;
22     GHashTable *hash_table;
23
24     flxInterface *interfaces;
25     
26     guint query_addr_seq, query_link_seq;
27     
28     enum { LIST_IFACE, LIST_ADDR, LIST_DONE } list;
29 };
30
31 struct _flxInterface {
32     gchar *name;
33     gint index;
34     guint flags;
35
36     guint n_ipv6_addrs, n_ipv4_addrs;
37     
38     flxInterfaceAddress *addresses;
39     flxInterface *next, *prev;
40 };
41
42 struct _flxInterfaceAddress {
43     guchar flags;
44     guchar scope;
45     flxAddress address;
46     
47     flxInterface *interface;
48     flxInterfaceAddress *next, *prev;
49
50     gint rr_id;
51 };
52
53 flxInterfaceMonitor *flx_interface_monitor_new(flxServer *server);
54 void flx_interface_monitor_free(flxInterfaceMonitor *m);
55
56 const flxInterface* flx_interface_monitor_get_interface(flxInterfaceMonitor *m, gint index);
57 const flxInterface* flx_interface_monitor_get_first(flxInterfaceMonitor *m);
58
59 int flx_interface_is_relevant(flxInterface *i);
60 int flx_address_is_relevant(flxInterfaceAddress *a);
61     
62 #endif