]> git.meshlink.io Git - catta/blob - iface.h
add code for recieving packets
[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 #include "cache.h"
19 #include "llist.h"
20
21 struct _flxInterfaceMonitor {
22     flxServer *server;
23     flxNetlink *netlink;
24     GHashTable *hash_table;
25
26     FLX_LLIST_HEAD(flxInterface, interfaces);
27     
28     guint query_addr_seq, query_link_seq;
29     
30     enum { LIST_IFACE, LIST_ADDR, LIST_DONE } list;
31 };
32
33 struct _flxInterface {
34     flxInterfaceMonitor *monitor;
35     gchar *name;
36     gint index;
37     guint flags;
38
39     FLX_LLIST_HEAD(flxInterfaceAddress, addresses);
40     FLX_LLIST_FIELDS(flxInterface, interface);
41
42     guint n_ipv6_addrs, n_ipv4_addrs;
43     flxCache *ipv4_cache, *ipv6_cache;
44 };
45
46 struct _flxInterfaceAddress {
47     guchar flags;
48     guchar scope;
49     flxAddress address;
50     
51     flxInterface *interface;
52
53     FLX_LLIST_FIELDS(flxInterfaceAddress, address);
54
55     gint rr_id;
56 };
57
58 flxInterfaceMonitor *flx_interface_monitor_new(flxServer *server);
59 void flx_interface_monitor_free(flxInterfaceMonitor *m);
60
61 flxInterface* flx_interface_monitor_get_interface(flxInterfaceMonitor *m, gint index);
62 flxInterface* flx_interface_monitor_get_first(flxInterfaceMonitor *m);
63
64 int flx_interface_is_relevant(flxInterface *i);
65 int flx_address_is_relevant(flxInterfaceAddress *a);
66
67 void flx_interface_send_query(flxInterface *i, guchar protocol, flxKey *k);
68     
69 #endif