+static void new_interface(flxInterfaceMonitor *m, flxHwInterface *hw, guchar protocol) {
+ flxInterface *i;
+
+ g_assert(m);
+ g_assert(hw);
+ g_assert(protocol != AF_UNSPEC);
+
+ i = g_new(flxInterface, 1);
+ i->monitor = m;
+ i->hardware = hw;
+ i->protocol = protocol;
+ i->announcing = FALSE;
+
+ FLX_LLIST_HEAD_INIT(flxInterfaceAddress, i->addresses);
+ FLX_LLIST_HEAD_INIT(flxAnnouncement, i->announcements);
+
+ i->cache = flx_cache_new(m->server, i);
+ i->scheduler = flx_packet_scheduler_new(m->server, i);
+
+ FLX_LLIST_PREPEND(flxInterface, by_hardware, hw->interfaces, i);
+ FLX_LLIST_PREPEND(flxInterface, interface, m->interfaces, i);
+}
+
+static void check_interface_relevant(flxInterfaceMonitor *m, flxInterface *i) {
+ gboolean b;
+ g_assert(m);
+ g_assert(i);
+
+ b = flx_interface_relevant(i);
+
+ if (b && !i->announcing) {
+ g_message("New relevant interface %s.%i", i->hardware->name, i->protocol);
+
+ i->announcing = TRUE;
+ flx_announce_interface(m->server, i);
+ } else if (!b && i->announcing) {
+ g_message("Interface %s.%i no longer relevant", i->hardware->name, i->protocol);
+
+ i->announcing = FALSE;
+ flx_goodbye_interface(m->server, i, FALSE);
+ }
+}
+
+static void check_hw_interface_relevant(flxInterfaceMonitor *m, flxHwInterface *hw) {
+ flxInterface *i;
+
+ g_assert(m);
+ g_assert(hw);
+
+ for (i = hw->interfaces; i; i = i->by_hardware_next)
+ check_interface_relevant(m, i);
+}
+