libnm

libnm is the new API for NetworkManager 1.0, replacing libnm-util and libnm-glib (which will still be available, but deprecated).

Changes between libnm-util/libnm-glib and libnm

  • There is only a single library, libnm (with pkg-config file "libnm" and introspection namespace "NM"), which covers the equivalent of libnm-util, libnm-glib, and libnm-glib-vpn.
    • For technical reasons, the library is still split into two pieces in the source tree, with the "libnm-util-like" parts in libnm-core/ and the "libnm-glib-like" parts in libnm/. This is because the daemon can only link to libnm-core, because the client-side and server-side libnm objects have the same names (eg, "NMDevice").

  • libnm uses GDBus and no longer links to dbus-glib. (Note that the daemon still links to dbus-glib however, and of course the package as a whole will continue to require dbus-glib as long as you want to build libnm-util and libnm-glib.)
    • The object properties that used to use dbus-glib's "specialized types" now use ordinary types. In some cases, this involves a loss of type precision at the GType level, but we have tried to give complete type information in the introspection annotations. (Not that this matters much, since neither pygi nor gjs reads annotations on properties. At any rate, there are getter functions for all the properties as well, which do work fine from bindings.)

    • Many NMSetting properties now have types that don't match their corresponding D-Bus types. Eg, all MAC address properties are now strings, not byte arrays

      • NMSettingIP4Config and NMSettingIP6Config have seen the most changes. First, they are now subclasses of a common NMSettingIPConfig, with most of the methods and properties being on the parent class. The :addresses property is now an array of NMIPAddress structs, and the :routes property is an array of NMIPRoute structs. These data types are the same for IPv4 and IPv6, and represent IP addresses as strings rather than in binary form (as do all other IP-address-related properties on the IP config setting objects).

  • All functions and properties that were marked deprecated in libnm-util and libnm-glib have been removed in libnm. As well as a few others...
    • nm_utils_init() no longer exists; everything is either initialized via constructors, or else initialized on demand.
    • The type-based nm_utils_hwaddr* functions have been removed in favor of the length-based ones

    • The setting-type-specific interface-name properties have all been dropped since they are now fully redundant with NMSettingConnection:interface-name.

    • NMSecretAgent and NMVpnPlugin have been "pre-deprecated" by renaming them to NMSecretAgentOld and NMVpnPluginOld, respectively. The plan is to introduce new-and-improved NMSecretAgent and NMVpnPlugin types in NetworkManager 1.2, and then mark the old ones deprecated.

  • Type names now consistently use the GLib/Gtk capitalization rules. This means that "DHCP", "PPP", "PPPOE", and "VPN" are now "Dhcp", "Ppp", "Pppoe", and "Vpn".
  • NetworkManager.h (the file containing macros and types related to NetworkManager's D-Bus interface) is now called nm-dbus-interface.h, and NetworkManagerVPN.h is now nm-vpn-dbus-interface.h.

    • A few D-Bus-interface-name macros in nm-dbus-interface.h that used to have "IFACE" in their names (eg, NM_DBUS_IFACE_SETTINGS) now have "INTERFACE", to match the other macros.

    • All of the enum/flags types in nm-dbus-interface.h and nm-vpn-dbus-interface.h now have corresponding GTypes.

  • There is a new header NetworkManager.h which acts as a top-level header for libnm, including all of the other headers, and it is now illegal to directly include any header except NetworkManager.h, nm-dbus-interface.h, nm-vpn-dbus-interface.h, or nm-version.h.

  • NMRemoteSettings no longer exists; its API has been merged into NMClient (along with the addition of a connections property and associated signals, and a few other small changes).

  • NMClient no longer lazy-initializes itself; you must initialize it with g_initable_init() or g_async_initable_init_async(). (Note that its public constructors do this automatically.) (This is also true of all other NMObjects. However, creating random NMObjects by hand [rather than receiving them from NMClient] is discouraged anyway.)

  • NMSecretAgentOld also requires initable-style intialization, and it registers itself with the agent manager during this step, rather than registering itself after construction and then emitting a signal.

  • All APIs that wrap D-Bus operations now use "gio" calling conventions (GCancellables, GAsyncReadyCallback/GAsyncResult, etc). Most of them are now available in both synchronous and asynchronous versions, though a few are not. All asynchronous methods now have names ending in "_async".

  • All APIs and properties that return an array of objects/structs now use GPtrArray, not GSList (and the APIs are all (transfer none).)

Projects/NetworkManager/libnm (last edited 2014-12-16 18:35:55 by DanWinship)