+static void add_interface(struct network *network,
+ struct interface *interface)
+{
+ char *uuid = mac_bytes_to_string(interface, interface->hwaddr,
+ sizeof(interface->hwaddr));
+
+ list_add(&network->interfaces, &interface->list);
+ interface->dev = discover_device_create(network->handler, uuid,
+ interface->name);
+ interface->dev->device->type = DEVICE_TYPE_NETWORK;
+ device_handler_add_device(network->handler, interface->dev);
+ talloc_free(uuid);
+}
+
+static void remove_interface(struct network *network,
+ struct interface *interface)
+{
+ if (interface->dev)
+ device_handler_remove(network->handler, interface->dev);
+ list_remove(&interface->list);
+ talloc_free(interface);
+}
+
+void network_register_device(struct network *network,
+ struct discover_device *dev)
+{
+ struct interface *iface;
+
+ iface = find_interface_by_uuid(network, dev->uuid);
+ if (!iface)
+ return;
+
+ iface->dev = dev;
+ dev->uuid = mac_bytes_to_string(iface->dev, iface->hwaddr,
+ sizeof(iface->hwaddr));
+}
+
+void network_unregister_device(struct network *network,
+ struct discover_device *dev)
+{
+ struct interface *iface;
+
+ iface = find_interface_by_uuid(network, dev->uuid);
+ if (!iface)
+ return;
+
+ iface->dev = NULL;
+}
+