patchpanel: Add support for getting all managed devices.
Adds a new dbus method - GetDevices - and the supporting implementation
in the arc and crostini services to acquire the list of devices
currently managed by patchpanel. This currently includes only the
virtual devices it creates for guests and excludes physical and virtual
(like VPN) devices tracked by shill.
BUG=b:174432555
TEST=units
Change-Id: I3e62c89836bf7bfbc0fade5260ea27eb1f60df9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2566852
Tested-by: Garrick Evans <garrick@chromium.org>
Commit-Queue: Garrick Evans <garrick@chromium.org>
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
diff --git a/patchpanel/arc_service.h b/patchpanel/arc_service.h
index 0e81a76..0e40bde 100644
--- a/patchpanel/arc_service.h
+++ b/patchpanel/arc_service.h
@@ -52,6 +52,10 @@
// configurations, if any, are currently associated to TAP devices.
std::vector<const Device::Config*> GetDeviceConfigs() const;
+ // Walks the current list of devices managed by the service invoking the
+ // callback for each, allowing for safe inspection/evaluation.
+ void ScanDevices(base::RepeatingCallback<void(const Device&)> callback) const;
+
// Callback from ShillClient, invoked whenever the device list changes.
// |shill_devices_| will contain all devices currently connected to shill
// (e.g. "eth0", "wlan0", etc).