]> git.meshlink.io Git - catta/blob - iface.h
add packet scheduler
[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 #include "psched.h"
21 #include "dns.h"
22
23 struct _flxInterfaceMonitor {
24     flxServer *server;
25     flxNetlink *netlink;
26     GHashTable *hash_table;
27
28     FLX_LLIST_HEAD(flxInterface, interfaces);
29     
30     guint query_addr_seq, query_link_seq;
31     
32     enum { LIST_IFACE, LIST_ADDR, LIST_DONE } list;
33 };
34
35 struct _flxInterface {
36     flxInterfaceMonitor *monitor;
37     gchar *name;
38     gint index;
39     guint flags;
40
41     FLX_LLIST_HEAD(flxInterfaceAddress, addresses);
42     FLX_LLIST_FIELDS(flxInterface, interface);
43
44     guint n_ipv6_addrs, n_ipv4_addrs;
45     flxCache *ipv4_cache, *ipv6_cache;
46
47     guint mtu;
48
49     flxPacketScheduler *ipv4_scheduler, *ipv6_scheduler;
50 };
51
52 struct _flxInterfaceAddress {
53     guchar flags;
54     guchar scope;
55     flxAddress address;
56     
57     flxInterface *interface;
58
59     FLX_LLIST_FIELDS(flxInterfaceAddress, address);
60
61     gint rr_id;
62 };
63
64 flxInterfaceMonitor *flx_interface_monitor_new(flxServer *server);
65 void flx_interface_monitor_free(flxInterfaceMonitor *m);
66
67 flxInterface* flx_interface_monitor_get_interface(flxInterfaceMonitor *m, gint index);
68 flxInterface* flx_interface_monitor_get_first(flxInterfaceMonitor *m);
69
70 int flx_interface_is_relevant(flxInterface *i);
71 int flx_address_is_relevant(flxInterfaceAddress *a);
72
73 void flx_interface_send_packet(flxInterface *i, guchar protocol, flxDnsPacket *p);
74
75 void flx_interface_post_query(flxInterface *i, guchar protocol, flxKey *k);
76 void flx_interface_post_response(flxInterface *i, guchar protocol, flxRecord *rr);
77
78 void flx_dump_caches(flxServer *s, FILE *f);
79
80 #endif