Commit 297d4985 authored by Thomas Haller's avatar Thomas Haller

core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API

Previously, we used the generated GDBusInterfaceSkeleton types and glued
them via the NMExportedObject base class to our NM types. We also used
GDBusObjectManagerServer.

Don't do that anymore. The resulting code was more complicated despite (or
because?) using generated classes. It was hard to understand, complex, had
ordering-issues, and had a runtime and memory overhead.

This patch refactors this entirely and uses the lower layer API GDBusConnection
directly. It replaces the generated code, GDBusInterfaceSkeleton, and
GDBusObjectManagerServer. All this is now done by NMDbusObject and NMDBusManager
and static descriptor instances of type GDBusInterfaceInfo.

This adds a net plus of more then 1300 lines of hand written code. I claim
that this implementation is easier to understand. Note that previously we
also required extensive and complex glue code to bind our objects to the
generated skeleton objects. Instead, now glue our objects directly to
GDBusConnection. The result is more immediate and gets rid of layers of
code in between.
Now that the D-Bus glue us more under our control, we can address issus and
bottlenecks better, instead of adding code to bend the generated skeletons
to our needs.

Note that the current implementation now only supports one D-Bus connection.
That was effectively the case already, although there were places (and still are)
where the code pretends it could also support connections from a private socket.
We dropped private socket support mainly because it was unused, untested and
buggy, but also because GDBusObjectManagerServer could not export the same
objects on multiple connections. Now, it would be rather straight forward to
fix that and re-introduce ObjectManager on each private connection. But this
commit doesn't do that yet, and the new code intentionally supports only one
D-Bus connection.
Also, the D-Bus startup was simplified. There is no retry, either nm_dbus_manager_start()
succeeds, or it detects the initrd case. In the initrd case, bus manager never tries to
connect to D-Bus. Since the initrd scenario is not yet used/tested, this is good enough
for the moment. It could be easily extended later, for example with polling whether the
system bus appears (like was done previously). Also, restart of D-Bus daemon isn't
supported either -- just like before.

Note how NMDBusManager now implements the ObjectManager D-Bus interface
directly.

Also, this fixes race issues in the server, by no longer delaying
PropertiesChanged signals. NMExportedObject would collect changed
properties and send the signal out in idle_emit_properties_changed()
on idle. This messes up the ordering of change events w.r.t. other
signals and events on the bus. Note that not only NMExportedObject
messed up the ordering. Also the generated code would hook into
notify() and process change events in and idle handle, exhibiting the
same ordering issue too.
No longer do that. PropertiesChanged signals will be sent right away
by hooking into dispatch_properties_changed(). This means, changing
a property in quick succession will no longer be combined and is
guaranteed to emit signals for each individual state. Quite possibly
we emit now more PropertiesChanged signals then before.
However, we are now able to group a set of changes by using standard
g_object_freeze_notify()/g_object_thaw_notify(). We probably should
make more use of that.

Also, now that our signals are all handled in the right order, we
might find places where we still emit them in the wrong order. But that
is then due to the order in which our GObjects emit signals, not due
to an ill behavior of the D-Bus glue. Possibly we need to identify
such ordering issues and fix them.

Numbers (for contrib/rpm --without debug on x86_64):

- the patch changes the code size of NetworkManager by
  - 2809360 bytes
  + 2537528 bytes (-9.7%)

- Runtime measurements are harder because there is a large variance
  during testing. In other words, the numbers are not reproducible.
  Currently, the implementation performs no caching of GVariants at all,
  but it would be rather simple to add it, if that turns out to be
  useful.
  Anyway, without strong claim, it seems that the new form tends to
  perform slightly better. That would be no surprise.

  $ time (for i in {1..1000}; do nmcli >/dev/null || break; echo -n .;  done)
  - real    1m39.355s
  + real    1m37.432s

  $ time (for i in {1..2000}; do busctl call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects > /dev/null || break; echo -n .; done)
  - real    0m26.843s
  + real    0m25.281s

- Regarding RSS size, just looking at the processes in similar
  conditions, doesn't give a large difference. On my system they
  consume about 19MB RSS. It seems that the new version has a
  slightly smaller RSS size.
  - 19356 RSS
  + 18660 RSS
parent a1f37964
......@@ -366,8 +366,6 @@ CLEANFILES += $(DBUS_INTERFACE_DOCS)
$(dispatcher_libnm_dispatcher_core_la_OBJECTS): $(introspection_sources)
$(dispatcher_nm_dispatcher_OBJECTS): $(introspection_sources)
$(libnm_libnm_la_OBJECTS): $(introspection_sources)
$(src_libNetworkManager_la_OBJECTS): $(introspection_sources)
$(src_libNetworkManagerBase_la_OBJECTS): $(introspection_sources)
EXTRA_DIST += \
$(dbusinterfaces_DATA) \
......@@ -1423,8 +1421,10 @@ src_libNetworkManagerBase_la_SOURCES = \
src/ndisc/nm-ndisc.h \
src/ndisc/nm-ndisc-private.h \
\
src/nm-exported-object.c \
src/nm-exported-object.h \
src/nm-dbus-utils.c \
src/nm-dbus-utils.h \
src/nm-dbus-object.c \
src/nm-dbus-object.h \
src/nm-ip4-config.c \
src/nm-ip4-config.h \
src/nm-ip6-config.c \
......@@ -1452,7 +1452,6 @@ endif
src_libNetworkManagerBase_la_LIBADD = \
libnm-core/libnm-core.la \
introspection/libnmdbus.la \
$(GLIB_LIBS) \
$(SYSTEMD_JOURNAL_LIBS) \
$(LIBUDEV_LIBS) \
......@@ -1860,7 +1859,6 @@ src_ppp_libnm_ppp_plugin_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/src/ppp/nm-ppp-plugin.ver"
src_ppp_libnm_ppp_plugin_la_LIBADD = \
introspection/libnmdbus.la \
$(GLIB_LIBS)
$(src_ppp_libnm_ppp_plugin_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
......@@ -2515,7 +2513,6 @@ src_devices_adsl_libnm_device_plugin_adsl_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_adsl_libnm_device_plugin_adsl_la_LIBADD = \
introspection/libnmdbus.la \
$(LIBUDEV_LIBS)
check-local-devices-adsl: src/devices/adsl/libnm-device-plugin-adsl.la
......@@ -2591,7 +2588,6 @@ src_devices_wwan_libnm_device_plugin_wwan_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_wwan_libnm_device_plugin_wwan_la_LIBADD = \
introspection/libnmdbus.la \
src/devices/wwan/libnm-wwan.la \
$(GLIB_LIBS)
......@@ -2649,7 +2645,6 @@ src_devices_bluetooth_libnm_device_plugin_bluetooth_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_bluetooth_libnm_device_plugin_bluetooth_la_LIBADD = \
introspection/libnmdbus.la \
src/devices/wwan/libnm-wwan.la \
$(GLIB_LIBS)
......@@ -2690,6 +2685,8 @@ src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \
src/devices/wifi/nm-wifi-ap.h \
src/devices/wifi/nm-wifi-utils.c \
src/devices/wifi/nm-wifi-utils.h \
src/devices/wifi/nm-wifi-common.c \
src/devices/wifi/nm-wifi-common.h \
src/devices/wifi/nm-device-olpc-mesh.c \
src/devices/wifi/nm-device-olpc-mesh.h
......@@ -2716,7 +2713,6 @@ src_devices_wifi_libnm_device_plugin_wifi_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_wifi_libnm_device_plugin_wifi_la_LIBADD = \
introspection/libnmdbus.la \
$(GLIB_LIBS)
check-local-devices-wifi: src/devices/wifi/libnm-device-plugin-wifi.la
......@@ -2786,7 +2782,6 @@ src_devices_team_libnm_device_plugin_team_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_team_libnm_device_plugin_team_la_LIBADD = \
introspection/libnmdbus.la \
$(LIBTEAMDCTL_LIBS) \
$(JANSSON_LIBS) \
$(GLIB_LIBS)
......@@ -2848,7 +2843,6 @@ src_devices_ovs_libnm_device_plugin_ovs_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_ovs_libnm_device_plugin_ovs_la_LIBADD = \
introspection/libnmdbus.la \
$(JANSSON_LIBS) \
$(GLIB_LIBS)
......
......@@ -31,7 +31,6 @@
#include "nm-core-internal.h"
#include "platform/nm-platform.h"
#include "nm-exported-object.h"
#include "nm-auth-utils.h"
/*****************************************************************************/
......@@ -880,62 +879,6 @@ nm_utils_match_connection (NMConnection *const*connections,
/*****************************************************************************/
/**
* nm_utils_g_value_set_object_path:
* @value: a #GValue, initialized to store an object path
* @object: (allow-none): an #NMExportedObject
*
* Sets @value to @object's object path. If @object is %NULL, or not
* exported, @value is set to "/".
*/
void
nm_utils_g_value_set_object_path (GValue *value, gpointer object)
{
g_return_if_fail (!object || NM_IS_EXPORTED_OBJECT (object));
if (object && nm_exported_object_is_exported (object))
g_value_set_string (value, nm_exported_object_get_path (object));
else
g_value_set_string (value, "/");
}
/**
* nm_utils_g_value_set_object_path_array:
* @value: a #GValue, initialized to store an object path
* @objects: a #GSList of #NMExportedObjects
* @filter_func: (allow-none): function to call on each object in @objects
* @user_data: data to pass to @filter_func
*
* Sets @value to an array of object paths of the objects in @objects.
*/
void
nm_utils_g_value_set_object_path_array (GValue *value,
GSList *objects,
NMUtilsObjectFunc filter_func,
gpointer user_data)
{
char **paths;
guint i;
GSList *iter;
paths = g_new (char *, g_slist_length (objects) + 1);
for (i = 0, iter = objects; iter; iter = iter->next) {
NMExportedObject *object = iter->data;
const char *path;
path = nm_exported_object_get_path (object);
if (!path)
continue;
if (filter_func && !filter_func ((GObject *) object, user_data))
continue;
paths[i++] = g_strdup (path);
}
paths[i] = NULL;
g_value_take_boxed (value, paths);
}
/*****************************************************************************/
int
nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
const char *match_device_type,
......
......@@ -48,22 +48,6 @@ NMConnection *nm_utils_match_connection (NMConnection *const*connections,
NMUtilsMatchFilterFunc match_filter_func,
gpointer match_filter_data);
void nm_utils_g_value_set_object_path (GValue *value, gpointer object);
/**
* NMUtilsObjectFunc:
* @object: the object to filter on
* @user_data: data passed to the function from the caller
*
* Returns: %TRUE if the object should be used, %FALSE if not
*/
typedef gboolean (*NMUtilsObjectFunc) (GObject *object, gpointer user_data);
void nm_utils_g_value_set_object_path_array (GValue *value,
GSList *objects,
NMUtilsObjectFunc filter_func,
gpointer user_data);
int nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
const char *match_device_type,
const GSList *specs,
......
......@@ -4,7 +4,6 @@ sources = files(
)
deps = [
libnmdbus_dep,
libudev_dep,
nm_dep
]
......
......@@ -39,8 +39,6 @@
#include "nm-setting-adsl.h"
#include "nm-utils.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Adsl.h"
#include "devices/nm-device-logging.h"
_LOG_DECLARE_SELF (NMDeviceAdsl);
......@@ -655,10 +653,24 @@ dispose (GObject *object)
G_OBJECT_CLASS (nm_device_adsl_parent_class)->dispose (object);
}
static const NMDBusInterfaceInfoExtended interface_info_device_adsl = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_ADSL,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_adsl_class_init (NMDeviceAdslClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
object_class->constructed = constructed;
......@@ -666,6 +678,8 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
object_class->get_property = get_property;
object_class->set_property = set_property;
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_adsl);
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->check_connection_compatible = check_connection_compatible;
......@@ -682,8 +696,4 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_ADSL_SKELETON,
NULL);
}
......@@ -9,7 +9,6 @@ sources = files(
)
deps = [
libnmdbus_dep,
libnm_wwan_dep,
nm_dep
]
......
......@@ -43,8 +43,6 @@
#include "devices/wwan/nm-modem-manager.h"
#include "devices/wwan/nm-modem.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Bluetooth.h"
#include "devices/nm-device-logging.h"
_LOG_DECLARE_SELF(NMDeviceBt);
......@@ -1152,10 +1150,26 @@ finalize (GObject *object)
G_OBJECT_CLASS (nm_device_bt_parent_class)->finalize (object);
}
static const NMDBusInterfaceInfoExtended interface_info_device_bluetooth = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_BLUETOOTH,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Name", "s", NM_DEVICE_BT_NAME),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("BtCapabilities", "u", NM_DEVICE_BT_CAPABILITIES),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_bt_class_init (NMDeviceBtClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
object_class->constructed = constructed;
......@@ -1164,6 +1178,8 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
object_class->dispose = dispose;
object_class->finalize = finalize;
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bluetooth);
device_class->get_generic_capabilities = get_generic_capabilities;
device_class->can_auto_connect = can_auto_connect;
device_class->deactivate = deactivate;
......@@ -1207,8 +1223,4 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
G_TYPE_NONE, 2,
G_TYPE_UINT /*guint32 in_bytes*/,
G_TYPE_UINT /*guint32 out_bytes*/);
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_BLUETOOTH_SKELETON,
NULL);
}
......@@ -32,8 +32,6 @@
#include "nm-core-internal.h"
#include "nm-ip4-config.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Bond.h"
#include "nm-device-logging.h"
_LOG_DECLARE_SELF(NMDeviceBond);
......@@ -607,13 +605,31 @@ nm_device_bond_init (NMDeviceBond * self)
nm_assert (nm_device_is_master (NM_DEVICE (self)));
}
static const NMDBusInterfaceInfoExtended interface_info_device_bond = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_BOND,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Slaves", "ao", NM_DEVICE_SLAVES),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_bond_class_init (NMDeviceBondClass *klass)
{
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BOND_SETTING_NAME, NM_LINK_TYPE_BOND)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bond);
parent_class->is_master = TRUE;
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->check_connection_compatible = check_connection_compatible;
......@@ -629,10 +645,6 @@ nm_device_bond_class_init (NMDeviceBondClass *klass)
parent_class->release_slave = release_slave;
parent_class->can_reapply_change = can_reapply_change;
parent_class->reapply_connection = reapply_connection;
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_BOND_SKELETON,
NULL);
}
/*****************************************************************************/
......
......@@ -30,8 +30,6 @@
#include "nm-device-factory.h"
#include "nm-core-internal.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Bridge.h"
#include "nm-device-logging.h"
_LOG_DECLARE_SELF(NMDeviceBridge);
......@@ -488,13 +486,31 @@ nm_device_bridge_init (NMDeviceBridge * self)
nm_assert (nm_device_is_master (NM_DEVICE (self)));
}
static const NMDBusInterfaceInfoExtended interface_info_device_bridge = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_BRIDGE,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Slaves", "ao", NM_DEVICE_SLAVES),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
{
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BRIDGE_SETTING_NAME, NM_LINK_TYPE_BRIDGE)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bridge);
parent_class->is_master = TRUE;
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->check_connection_compatible = check_connection_compatible;
......@@ -511,10 +527,6 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
parent_class->enslave_slave = enslave_slave;
parent_class->release_slave = release_slave;
parent_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_BRIDGE_SKELETON,
NULL);
}
/*****************************************************************************/
......
......@@ -28,8 +28,6 @@
#include "nm-setting-dummy.h"
#include "nm-core-internal.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Dummy.h"
#include "nm-device-logging.h"
_LOG_DECLARE_SELF(NMDeviceDummy);
......@@ -156,13 +154,29 @@ nm_device_dummy_init (NMDeviceDummy *self)
{
}
static const NMDBusInterfaceInfoExtended interface_info_device_dummy = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_DUMMY,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_dummy_class_init (NMDeviceDummyClass *klass)
{
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_DUMMY)
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_dummy);
device_class->connection_type = NM_SETTING_DUMMY_SETTING_NAME;
device_class->complete_connection = complete_connection;
device_class->check_connection_compatible = check_connection_compatible;
......@@ -171,10 +185,6 @@ nm_device_dummy_class_init (NMDeviceDummyClass *klass)
device_class->update_connection = update_connection;
device_class->act_stage1_prepare = act_stage1_prepare;
device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_DUMMY_SKELETON,
NULL);
}
......
......@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <libudev.h>
#include "nm-device-private.h"
......@@ -52,8 +51,6 @@
#include "nm-core-internal.h"
#include "NetworkManagerUtils.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Wired.h"
#include "nm-device-logging.h"
_LOG_DECLARE_SELF(NMDeviceEthernet);
......@@ -1714,10 +1711,28 @@ set_property (GObject *object, guint prop_id,
}
}
static const NMDBusInterfaceInfoExtended interface_info_device_wired = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_WIRED,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("PermHwAddress", "s", NM_DEVICE_PERM_HW_ADDRESS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Speed", "u", NM_DEVICE_ETHERNET_SPEED),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("S390Subchannels", "as", NM_DEVICE_ETHERNET_S390_SUBCHANNELS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
g_type_class_add_private (object_class, sizeof (NMDeviceEthernetPrivate));
......@@ -1729,6 +1744,8 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
object_class->get_property = get_property;
object_class->set_property = set_property;
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_wired);
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->check_connection_compatible = check_connection_compatible;
parent_class->complete_connection = complete_connection;
......@@ -1762,10 +1779,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_ETHERNET_SKELETON,
NULL);
}
/*****************************************************************************/
......
......@@ -26,8 +26,6 @@
#include "platform/nm-platform.h"
#include "nm-core-internal.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Generic.h"
/*****************************************************************************/
NM_GOBJECT_PROPERTIES_DEFINE_BASE (
......@@ -203,10 +201,25 @@ dispose (GObject *object)
G_OBJECT_CLASS (nm_device_generic_parent_class)->dispose (object);
}
static const NMDBusInterfaceInfoExtended interface_info_device_generic = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_GENERIC,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("TypeDescription", "s", NM_DEVICE_GENERIC_TYPE_DESCRIPTION),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_generic_class_init (NMDeviceGenericClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_GENERIC_SETTING_NAME, NM_LINK_TYPE_ANY)
......@@ -216,6 +229,8 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
object_class->get_property = get_property;
object_class->set_property = set_property;
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_generic);
parent_class->realize_start_notify = realize_start_notify;
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->get_type_description = get_type_description;
......@@ -229,8 +244,4 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_GENERIC_SKELETON,
NULL);
}
......@@ -32,8 +32,6 @@
#include "nm-device-factory.h"
#include "nm-core-internal.h"
#include "introspection/org.freedesktop.NetworkManager.Device.Infiniband.h"
#define NM_DEVICE_INFINIBAND_IS_PARTITION "is-partition"
/*****************************************************************************/
......@@ -368,10 +366,25 @@ nm_device_infiniband_init (NMDeviceInfiniband * self)
{
}
static const NMDBusInterfaceInfoExtended interface_info_device_infiniband = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_INFINIBAND,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_INFINIBAND_SETTING_NAME, NM_LINK_TYPE_INFINIBAND)
......@@ -379,6 +392,8 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
object_class->get_property = get_property;
object_class->set_property = set_property;
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_infiniband);
parent_class->create_and_realize = create_and_realize;
parent_class->unrealize = unrealize;
parent_class->get_generic_capabilities = get_generic_capabilities;
......@@ -396,10 +411,6 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_INFINIBAND_SKELETON,
NULL);
}
/*****************************************************************************/
......
......@@ -37,8 +37,6 @@
#include "nm-act-request.h"
#include "nm-ip4-config.h"
#include "introspection/org.freedesktop.NetworkManager.Device.IPTunnel.h"
#include "nm-device-logging.h"
_LOG_DECLARE_SELF(NMDeviceIPTunnel);
......@@ -907,10 +905,35 @@ dispose (GObject *object)
G_OBJECT_CLASS (nm_device_ip_tunnel_parent_class)->dispose (object);
}
static const NMDBusInterfaceInfoExtended interface_info_device_ip_tunnel = {
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL,
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
&nm_signal_info_property_changed_legacy,
),
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mode", "u", NM_DEVICE_IP_TUNNEL_MODE),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Parent", "o", NM_DEVICE_PARENT),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Local", "s", NM_DEVICE_IP_TUNNEL_LOCAL),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Remote", "s", NM_DEVICE_IP_TUNNEL_REMOTE),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ttl", "y", NM_DEVICE_IP_TUNNEL_TTL),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Tos", "y", NM_DEVICE_IP_TUNNEL_TOS),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("PathMtuDiscovery", "b", NM_DEVICE_IP_TUNNEL_PATH_MTU_DISCOVERY),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("InputKey", "s", NM_DEVICE_IP_TUNNEL_INPUT_KEY),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("OutputKey", "s", NM_DEVICE_IP_TUNNEL_OUTPUT_KEY),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("EncapsulationLimit", "y", NM_DEVICE_IP_TUNNEL_ENCAPSULATION_LIMIT),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("FlowLabel", "u", NM_DEVICE_IP_TUNNEL_FLOW_LABEL),
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Flags", "u", NM_DEVICE_IP_TUNNEL_FLAGS),
),
),
.legacy_property_changed = TRUE,
};
static void
nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
object_class->constructed = constructed;
......@@ -918,6 +941,8 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
object_class->get_property = get_property;
object_class->set_property = set_property;
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_ip_tunnel);
device_class->link_changed = link_changed;
device_class->can_reapply_change = can_reapply_change;
device_class->complete_connection = complete_connection;
......@@ -1003,10 +1028,6 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_IPTUNNEL_SKELETON,
NULL);
}
/*****************************************************************************/
......
......@@ -43,9 +43,6 @@
#define NM_DEVICE_IP_TUNNEL_FLOW_LABEL "flow-label"
#define NM_DEVICE_IP_TUNNEL_FLAGS "flags"
/* defined in the parent class, but exposed on D-Bus by the subclass. */
#define NM_DEVICE_IP_TUNNEL_PARENT NM_DEVICE_PARENT
typedef struct _NMDeviceIPTunnel NMDeviceIPTunnel;
typedef struct _NMDeviceIPTunnelClass NMDeviceIPTunnelClass;
......
......@@ -33,8 +33,6 @@
#include "supplicant/nm-supplicant-interface.h"
#include "supplicant/nm-supplicant-config.h"