#include <glib.h>
-#include "address.h"
-
-struct _flxInterfaceMonitor;
typedef struct _flxInterfaceMonitor flxInterfaceMonitor;
-
-struct _flxInterfaceAddress;
typedef struct _flxInterfaceAddress flxInterfaceAddress;
-
-struct _flxInterface;
typedef struct _flxInterface flxInterface;
+typedef struct _flxHwInterface flxHwInterface;
+
+#include "address.h"
+#include "server.h"
+#include "netlink.h"
+#include "cache.h"
+#include "llist.h"
+#include "psched.h"
+#include "dns.h"
+#include "announce.h"
+
+struct _flxInterfaceMonitor {
+ flxServer *server;
+ flxNetlink *netlink;
+ GHashTable *hash_table;
+
+ FLX_LLIST_HEAD(flxInterface, interfaces);
+ FLX_LLIST_HEAD(flxHwInterface, hw_interfaces);
+
+ guint query_addr_seq, query_link_seq;
+
+ enum {
+ LIST_IFACE,
+ LIST_ADDR,
+ LIST_DONE
+ } list;
+};
+
+struct _flxHwInterface {
+ FLX_LLIST_FIELDS(flxHwInterface, hardware);
+ flxInterfaceMonitor *monitor;
-struct _flxInterface {
gchar *name;
gint index;
guint flags;
+ guint mtu;
- guint n_ipv6_addrs, n_ipv4_addrs;
+ FLX_LLIST_HEAD(flxInterface, interfaces);
+};
+
+struct _flxInterface {
+ FLX_LLIST_FIELDS(flxInterface, interface);
+ FLX_LLIST_FIELDS(flxInterface, by_hardware);
+ flxInterfaceMonitor *monitor;
- flxInterfaceAddress *addresses;
- flxInterface *next, *prev;
+ flxHwInterface *hardware;
+ guchar protocol;
+ gboolean announcing;
+
+ flxCache *cache;
+ flxPacketScheduler *scheduler;
+
+ FLX_LLIST_HEAD(flxInterfaceAddress, addresses);
+ FLX_LLIST_HEAD(flxAnnouncement, announcements);
};
struct _flxInterfaceAddress {
+ FLX_LLIST_FIELDS(flxInterfaceAddress, address);
+ flxInterfaceMonitor *monitor;
+
guchar flags;
guchar scope;
flxAddress address;
+ flxEntryGroup *entry_group;
flxInterface *interface;
- flxInterfaceAddress *next, *prev;
};
-typedef enum { FLX_INTERFACE_NEW, FLX_INTERFACE_REMOVE, FLX_INTERFACE_CHANGE } flxInterfaceChange;
-
-flxInterfaceMonitor *flx_interface_monitor_new(GMainContext *c);
+flxInterfaceMonitor *flx_interface_monitor_new(flxServer *server);
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_sync(flxInterfaceMonitor *m);
+
+flxInterface* flx_interface_monitor_get_interface(flxInterfaceMonitor *m, gint index, guchar protocol);
+flxHwInterface* flx_interface_monitor_get_hw_interface(flxInterfaceMonitor *m, gint index);
+
+void flx_interface_send_packet(flxInterface *i, flxDnsPacket *p);
-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_post_query(flxInterface *i, flxKey *k, gboolean immediately);
+void flx_interface_post_probe(flxInterface *i, flxRecord *p, gboolean immediately);
+void flx_interface_post_response(flxInterface *i, const flxAddress *a, flxRecord *record, gboolean flush_cache, gboolean immediately);
-void flx_interface_monitor_remove_interface_callback(
- flxInterfaceMonitor *m,
- void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterface *i, gpointer userdata),
- gpointer userdata);
+void flx_dump_caches(flxInterfaceMonitor *m, FILE *f);
-void flx_interface_monitor_add_address_callback(
- flxInterfaceMonitor *m,
- void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterfaceAddress *a, gpointer userdata),
- gpointer userdata);
+gboolean flx_interface_relevant(flxInterface *i);
+gboolean flx_interface_address_relevant(flxInterfaceAddress *a);
-void flx_interface_monitor_remove_address_callback(
- flxInterfaceMonitor *m,
- void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterfaceAddress *a, gpointer userdata),
- gpointer userdata);
+gboolean flx_interface_match(flxInterface *i, gint index, guchar protocol);
+
+typedef void (*flxInterfaceMonitorWalkCallback)(flxInterfaceMonitor *m, flxInterface *i, gpointer userdata);
+
+void flx_interface_monitor_walk(flxInterfaceMonitor *m, gint index, guchar protocol, flxInterfaceMonitorWalkCallback callback, gpointer userdata);
#endif