<method name="GetDevices">
<tp:docstring>
- Get the list of network devices.
+ Get the list of realized network devices.
</tp:docstring>
<arg name="devices" type="ao" direction="out">
<tp:docstring>
- List of object paths of network devices known to the system.
+ List of object paths of network devices known to the system. This
+ list does not include device placeholders (see GetAllDevices()).
+ </tp:docstring>
+ </arg>
+ </method>
+
+ <method name="GetAllDevices">
+ <tp:docstring>
+ Get the list of all network devices.
+ </tp:docstring>
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_all_devices"/>
+ <arg name="devices" type="ao" direction="out">
+ <tp:docstring>
+ List of object paths of network devices and device placeholders
+ (eg, devices that do not yet exist but which can be automatically
+ created by NetworkManager if one of their AvailableConnections
+ was activated).
</tp:docstring>
</arg>
</method>
<property name="Devices" type="ao" access="read">
<tp:docstring>
- The list of network devices/interfaces NetworkManager knows about.
+ The list of realized network devices. Realized devices are those which
+ have backing resources (eg from the kernel or a management daemon like
+ ModemManager, teamd, etc).
+ </tp:docstring>
+ </property>
+
+ <property name="AllDevices" type="ao" access="read">
+ <tp:docstring>
+ The list of both realized and un-realized network devices. Un-realized
+ devices are software devices which do not yet have backing resources,
+ but for which backing resources can be created if the device is
+ activated.
</tp:docstring>
</property>
enum {
DEVICE_ADDED,
+ INTERNAL_DEVICE_ADDED,
DEVICE_REMOVED,
+ INTERNAL_DEVICE_REMOVED,
STATE_CHANGED,
CHECK_PERMISSIONS,
USER_PERMISSIONS_CHANGED,
PROP_DEVICES,
PROP_METERED,
PROP_GLOBAL_DNS_CONFIGURATION,
+ PROP_ALL_DEVICES,
/* Not exported */
PROP_HOSTNAME,
nm_settings_device_removed (priv->settings, device, quitting);
priv->devices = g_slist_remove (priv->devices, device);
- g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
- g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES);
- nm_device_removed (device);
+ if (nm_device_is_real (device)) {
+ g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
+ g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES);
+ nm_device_removed (device);
+ }
+ g_signal_emit (manager, signals[INTERNAL_DEVICE_REMOVED], 0, device);
+ g_object_notify (G_OBJECT (manager), NM_MANAGER_ALL_DEVICES);
nm_exported_object_clear_and_unexport (&device);
int ifindex;
gboolean assumed = FALSE;
+ /* Emit D-Bus signals */
+ g_signal_emit (self, signals[DEVICE_ADDED], 0, device);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_DEVICES);
+
/* Loopback device never gets managed */
ifindex = nm_device_get_ifindex (device);
if (ifindex > 0 && nm_platform_link_get_type (NM_PLATFORM_GET, ifindex) == NM_LINK_TYPE_LOOPBACK)
nm_device_finish_init (device);
nm_settings_device_added (priv->settings, device);
- g_signal_emit (self, signals[DEVICE_ADDED], 0, device);
- g_object_notify (G_OBJECT (self), NM_MANAGER_DEVICES);
+ g_signal_emit (self, signals[INTERNAL_DEVICE_ADDED], 0, device);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_ALL_DEVICES);
for (iter = priv->devices; iter; iter = iter->next) {
NMDevice *d = iter->data;
}
static void
-impl_manager_get_devices (NMManager *self,
- GDBusMethodInvocation *context)
+_get_devices (NMManager *self,
+ GDBusMethodInvocation *context,
+ gboolean all_devices)
{
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
gs_free const char **paths = NULL;
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (iter->data));
if ( path
- && nm_device_is_real (iter->data))
+ && (all_devices || nm_device_is_real (iter->data)))
paths[i++] = path;
}
paths[i++] = NULL;
g_variant_new ("(^ao)", (char **) paths));
}
+static void
+impl_manager_get_devices (NMManager *self,
+ GDBusMethodInvocation *context)
+{
+ _get_devices (self, context, FALSE);
+}
+
+static void
+impl_manager_get_all_devices (NMManager *self,
+ GDBusMethodInvocation *context)
+{
+ _get_devices (self, context, TRUE);
+}
+
static void
impl_manager_get_device_by_ip_iface (NMManager *self,
GDBusMethodInvocation *context,
dns_config = nm_config_data_get_global_dns_config (config_data);
nm_global_dns_config_to_dbus (dns_config, value);
break;
+ case PROP_ALL_DEVICES:
+ nm_utils_g_value_set_object_path_array (value, priv->devices, NULL, NULL);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * NMManager:all-devices:
+ *
+ * All devices, including those that are not realized.
+ *
+ * Since: 1.2
+ **/
+ g_object_class_install_property
+ (object_class, PROP_ALL_DEVICES,
+ g_param_spec_boxed (NM_MANAGER_ALL_DEVICES, "", "",
+ G_TYPE_STRV,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
/* signals */
+
+ /* D-Bus exported; emitted only for realized devices */
signals[DEVICE_ADDED] =
g_signal_new ("device-added",
G_OBJECT_CLASS_TYPE (object_class),
NULL, NULL, NULL,
G_TYPE_NONE, 1, NM_TYPE_DEVICE);
+ /* Emitted for both realized devices and placeholder devices */
+ signals[INTERNAL_DEVICE_ADDED] =
+ g_signal_new ("internal-device-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST, 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 1, G_TYPE_OBJECT);
+
+ /* D-Bus exported; emitted only for realized devices */
signals[DEVICE_REMOVED] =
g_signal_new ("device-removed",
G_OBJECT_CLASS_TYPE (object_class),
NULL, NULL, NULL,
G_TYPE_NONE, 1, NM_TYPE_DEVICE);
+ /* Emitted for both realized devices and placeholder devices */
+ signals[INTERNAL_DEVICE_REMOVED] =
+ g_signal_new ("internal-device-removed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST, 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 1, G_TYPE_OBJECT);
+
signals[STATE_CHANGED] =
g_signal_new ("state-changed",
G_OBJECT_CLASS_TYPE (object_class),
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (manager_class),
NMDBUS_TYPE_MANAGER_SKELETON,
"GetDevices", impl_manager_get_devices,
+ "GetAllDevices", impl_manager_get_all_devices,
"GetDeviceByIpIface", impl_manager_get_device_by_ip_iface,
"ActivateConnection", impl_manager_activate_connection,
"AddAndActivateConnection", impl_manager_add_and_activate_connection,