libnm-core, libnm, core: make NMConnection an interface

System Internals / NetworkManager - Dan Winship [gnome.org] - 16 August 2014 09:17 UTC

The fact that NMRemoteConnection has to be an NMConnection and therefore can't be an NMObject means that it needs to reimplement bits of NMObject functionality (and likewise NMObject needs some special magic to deal with it). Likewise, we will need a daemon-side equivalent of NMObject as part of the gdbus port, and we would want NMSettingsConnection to be able to inherit from this as well.

Solve this problem by making NMConnection into an interface, and having NMRemoteConnection and NMSettingsConnection implement it. (We use some hacks to keep the GHashTable of NMSettings objects inside nm-connection.c rather than having to be implemented by the implementations.)

Since NMConnection is no longer an instantiable type, this adds NMSimpleConnection to replace the various non-D-Bus-based uses of NMConnection throughout the code. nm_connection_new() becomes nm_simple_connection_new(), nm_connection_new_from_hash() becomes nm_simple_connection_new_from_hash(), and nm_connection_duplicate() becomes nm_simple_connection_new_clone().

e1ba13a libnm-core, libnm, core: make NMConnection an interface
callouts/tests/test-dispatcher-envp.c | 2 +-
clients/cli/connections.c | 6 +-
clients/cli/devices.c | 4 +-
clients/tui/nm-editor-utils.c | 2 +-
clients/tui/nmt-editor.c | 2 +-
examples/C/glib/add-connection-dbus-glib.c | 2 +-
examples/C/glib/add-connection-libnm.c | 2 +-
examples/C/glib/get-active-connections-dbus-glib.c | 2 +-
include/nm-test-utils.h | 4 +-
libnm-core/Makefile.libnm-core | 2 +
libnm-core/nm-connection.c | 194 +++-----------------
libnm-core/nm-connection.h | 33 +---
libnm-core/nm-simple-connection.c | 110 +++++++++++
libnm-core/nm-simple-connection.h | 61 ++++++
libnm-core/nm-utils.h | 1 +
libnm-core/tests/test-general.c | 76 ++++----
libnm-core/tests/test-secrets.c | 6 +-
libnm/NetworkManager.h | 1 +
libnm/libnm.ver | 7 +-
libnm/nm-remote-connection.c | 30 ++-
libnm/nm-remote-connection.h | 5 +-
libnm/nm-remote-settings.c | 2 +-
libnm/nm-secret-agent.c | 3 +-
libnm/nm-vpn-plugin.c | 7 +-
libnm/tests/test-nm-client.c | 6 +-
libnm/tests/test-remote-settings-client.c | 6 +-
src/devices/bluetooth/nm-bluez-device.c | 2 +-
src/devices/nm-device.c | 2 +-
src/devices/wifi/tests/test-wifi-ap-utils.c | 44 ++---
src/nm-manager.c | 2 +-
src/settings/nm-agent-manager.c | 5 +-
src/settings/nm-secret-agent.c | 1 +
src/settings/nm-settings-connection.c | 24 ++-
src/settings/nm-settings-connection.h | 4 +-
src/settings/nm-settings.c | 18 +-
src/settings/plugins/ifcfg-rh/reader.c | 16 +-
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 90 ++++-----
src/settings/plugins/ifnet/connection_parser.c | 2 +-
.../plugins/ifupdown/tests/test-ifupdown.c | 6 +-
src/settings/plugins/keyfile/reader.c | 2 +-
src/settings/plugins/keyfile/tests/test-keyfile.c | 30 +--
src/settings/tests/test-wired-defname.c | 4 +-
.../tests/test-supplicant-config.c | 6 +-
src/tests/test-general.c | 18 +-
src/vpn-manager/nm-vpn-connection.c | 2 +-
45 files changed, 454 insertions(+), 400 deletions(-)

Upstream: cgit.freedesktop.org


  • Share