1. 26 Mar, 2018 1 commit
  2. 10 Nov, 2016 1 commit
    • Lubomir Rintel's avatar
      libnm: use the o.fd.DBus.ObjectManager API for object management · 1f5b48a5
      Lubomir Rintel authored
      This speeds up the initial object tree load significantly. Also, it
      reduces the object management complexity by shifting the duties to
      GDBusObjectManager.
      
      The lifetime of all NMObjects is now managed by the NMClient via the
      object manager. The NMClient creates the NMObjects for GDBus objects,
      triggers the initialization and serves as an object registry (replaces
      the nm-cache).
      
      The ObjectManager uses the o.fd.DBus.ObjectManager API to learn of the
      object creation, removal and property changes. It takes care of the
      property changes so that we don't have to and lets us always see a
      consistent object state.  Thus at the time we learn of a new object we
      already know its properties.
      
      The NMObject unfortunately can't be made synchronously initializable as
      the NMRemoteConnection's settings are not managed with standard
      o.fd.DBus Properties and ObjectManager APIs and thus are not known to
      the ObjectManager.  Thus most of the asynchronous object property
      changing code in nm-object.c is preserved. The objects notify the
      properties that reference them of their initialization in from their
      init_finish() methods, thus the asynchronously created objects are not
      allowed to fail creation (or the dependees would wait forever). Not a
      problem -- if a connection can't get its Settings, it's either invisible
      or being removed (presumably we'd learn of the removal from the object
      manager soon).
      
      The NMObjects can't be created by the object manager itself, since we
      can't determine the resulting object type in proxy_type() yet (we can't
      tell from the name and can't access the interface list). Therefore the
      GDBusObject is coupled with a NMObject later on.
      
      Lastly, now that all the objects are managed by the object manager, the
      NMRemoteSettings and NMManager go away when the daemon is stopped. The
      complexity of dealing with calls to NMClient that would require any of
      the resources that these objects manage (connection or device lists,
      etc.) had to be moved to NMClient. The bright side is that his allows
      for removal all of the daemon presence tracking from NMObject.
      1f5b48a5
  3. 24 Oct, 2016 1 commit
    • Thomas Haller's avatar
      libnm: coerce empty strings to NULL for D-Bus properties · 95ab69b7
      Thomas Haller authored
      On D-Bus level, string (s) or object paths (o) cannot be NULL.
      Thus, whenver server exposes such an object, it gets automatically
      coerced to "" or "/", respectively.
      
      On client side, libnm should coerce certain properties back, for which
      "" is just not a sensible value.
      
      For example, an empty NM_DEVICE_ETHERNET_HW_ADDRESS should be instead
      exposed as NULL.
      
      Technically, this is an API change. However, all users were well advised
      to expect both NULL and "" as possible return values and handle them
      accordingly.
      95ab69b7
  4. 03 Oct, 2016 1 commit
  5. 26 May, 2016 1 commit
  6. 19 Feb, 2016 1 commit
    • Thomas Haller's avatar
      all: cleanup includes and let "nm-default.h" include "config.h" · 8bace23b
      Thomas Haller authored
      - All internal source files (except "examples", which are not internal)
        should include "config.h" first. As also all internal source
        files should include "nm-default.h", let "config.h" be included
        by "nm-default.h" and include "nm-default.h" as first in every
        source file.
        We already wanted to include "nm-default.h" before other headers
        because it might contains some fixes (like "nm-glib.h" compatibility)
        that is required first.
      
      - After including "nm-default.h", we optinally allow for including the
        corresponding header file for the source file at hand. The idea
        is to ensure that each header file is self contained.
      
      - Don't include "config.h" or "nm-default.h" in any header file
        (except "nm-sd-adapt.h"). Public headers anyway must not include
        these headers, and internal headers are never included after
        "nm-default.h", as of the first previous point.
      
      - Include all internal headers with quotes instead of angle brackets.
        In practice it doesn't matter, because in our public headers we must
        include other headers with angle brackets. As we use our public
        headers also to compile our interal source files, effectively the
        result must be the same. Still do it for consistency.
      
      - Except for <config.h> itself. Include it with angle brackets as suggested by
        https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
      8bace23b
  7. 05 Aug, 2015 2 commits
  8. 24 Jul, 2015 1 commit
    • Dan Winship's avatar
      all: rename nm-glib-compat.h to nm-glib.h, use everywhere · 3452ee2a
      Dan Winship authored
      Rather than randomly including one or more of <glib.h>,
      <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
      "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
      nm-glib.h, include <gio/gio.h> from there, and then change all .c
      files in NM to include "nm-glib.h" rather than including the glib
      headers directly.
      
      (Public headers files still have to include the real glib headers,
      since nm-glib.h isn't installed...)
      
      Also, remove glib includes from header files that are already
      including a base object header file (which must itself already include
      the glib headers).
      3452ee2a
  9. 13 Nov, 2014 2 commits
    • Dan Winship's avatar
      libnm*: fix library gettext usage · 53f5e9af
      Dan Winship authored
      Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _()
      will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than
      "gettext (string)" (which will use the program's default domain, which
      works fine for programs in the NetworkManager tree, but not for
      external users). Likewise, we need to call bindtextdomain() so that
      gettext can find the translations if the library is installed in a
      different prefix from the program using it (and
      bind_textdomain_codeset(), so it will know the translations are in
      UTF-8 even if the locale isn't).
      
      (The fact that no one noticed this was broken before is because the
      libraries didn't really start returning useful translated strings much
      until 0.9.10, and none of the out-of-tree clients have been updated to
      actually show those strings to users yet.)
      53f5e9af
    • Dan Winship's avatar
      all: consistently include config.h · 3bfb163a
      Dan Winship authored
      config.h should be included from every .c file, and it should be
      included before any other include. Fix that.
      
      (As a side effect of how I did this, this also changes us to
      consistently use "config.h" rather than <config.h>. To the extent that
      it matters [which is not much], quotes are more correct anyway, since
      we're talking about a file in our own build tree, not a system
      include.)
      3bfb163a
  10. 22 Oct, 2014 1 commit
    • Dan Winship's avatar
      libnm: merge device-type-specific errors into NMDeviceError · 69099f3e
      Dan Winship authored
      As with the settings, each device type was defining its own error
      type, containing either redundant or non-useful error codes. Drop all
      of the subtype-specific errors, and reduce things to just
      NM_DEVICE_ERROR_FAILED, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, and
      NM_DEVICE_ERROR_INVALID_CONNECTION.
      
      The device-type-specific errors were only returned from their
      nm_device_connection_compatible() implementations, so this is also a
      good opportunity to simplify those, by moving duplicated functionality
      into the base NMDevice implementation, and then allowing the
      subclasses to assume that the connection has already been validated in
      their own code. Most of the implementations now just check that the
      connection has the correct type for the device (which can't be done at
      the NMDevice level since some device types (eg, Ethernet) support
      multiple connection types.)
      
      Also, make sure that all of the error messages are localized.
      69099f3e
  11. 19 Oct, 2014 1 commit
    • Dan Winship's avatar
      libnm: further NULL-vs-empty-array fixes · ab878f74
      Dan Winship authored
      In some cases, code may look at the value of an array-valued property
      during object initialization, before NMObject has set it to its actual
      initial value. So ensure that we initialize all such properties to an
      empty array, rather than leaving them NULL.
      
      Also fix another bug in NMClient that could result in
      priv->active_connections being NULL during certain signal emissions,
      and fix nm_client_get_active_connections() to not return NULL when NM
      was not running.
      ab878f74
  12. 18 Sep, 2014 1 commit
    • Dan Winship's avatar
      libnm: let NMObject create all D-Bus proxies · b728d1fb
      Dan Winship authored
      Add _nm_object_class_add_interface(), for declaring that a class
      implements a particular interface, and then have NMObject create the
      corresponding proxies itself. (The subclass can get a copy with
      _nm_object_get_proxy() if it needs it for something).
      
      (In GDBus, creating a proxy is a heavier operation than in dbus-glib,
      so we'll need to create the proxies asynchronously. Moving the
      creation to NMObject makes that easier since we can do it as part
      of the existing init/init_async.)
      b728d1fb
  13. 04 Sep, 2014 3 commits
    • Dan Winship's avatar
      libnm: change empty-GPtrArray-return semantics · 3e5b3833
      Dan Winship authored
      libnm functions that return GPtrArrays of objects had a rule that if
      the array was empty, they would return NULL rather than a 0-length
      array. As it turns out, this is just a nuisance to clients, since in
      most places the code for the non-empty case would end up doing the
      right thing for the empty case as well (and where it doesn't, we can
      check "array->len == 0" just as easily as "array == NULL"). So just
      return the 0-length array instead.
      3e5b3833
    • Dan Winship's avatar
      libnm: drop NM_TYPE_OBJECT_ARRAY, use G_TYPE_PTR_ARRAY · 074c2093
      Dan Winship authored
      Use G_TYPE_PTR_ARRAY for GPtrArray-of-NMObject-valued properties,
      because it has better introspection/bindings support.
      
      As with the strdict change in libnm-core, we need to manually copy the
      array in get_property() implementations, to preserve the standard
      semantics that get_property() returns a copy, not the internal array.
      
      (This patch also changes those properties so that they are always
      non-NULL until dispose(); previously some of them could be either NULL
      or 0-length at different times.)
      074c2093
    • Dan Winship's avatar
      all: stop using virtual interface-name properties · ab26964c
      Dan Winship authored
      The virtual :interface-name properties (eg,
      NMDeviceBond:interface-name) are deprecated in favor of
      NMSettingConnection:interface-name, and nm_connection_verify() ensures
      that their values are kept in sync. So (a) there is no need to set
      those properties when we can just set
      NMSettingConnection:interface-name instead, and (b) we can replace any
      calls to the setting-specific get_interface_name() methods with
      nm_connection_get_interface_name() or
      nm_setting_connection_get_interface_name().
      ab26964c
  14. 18 Aug, 2014 1 commit
  15. 07 Aug, 2014 1 commit
    • Dan Winship's avatar
      libnm-core: include ETH_ALEN/INFINIBAND_ALEN defines in nm-utils.h · 357efd26
      Dan Winship authored
      Include <linux/if_ether.h> and <linux/if_infiniband.h> from
      nm-utils.h, to get ETH_ALEN and INFINIBAND_ALEN, and remove those
      includes (as well as <net/ethernet.h> and <netinet/ether.h>, and
      various headers that had been included to get the ARPHRD_* constants)
      from other files where they're not needed now.
      357efd26
  16. 01 Aug, 2014 5 commits
    • Dan Winship's avatar
      libnm: make the the use of GInitable mandatory · 258e74eb
      Dan Winship authored
      Remove _nm_object_ensure_inited(), etc; objects that implement
      GInitable are now mandatory-to-init().
      
      Remove constructor() implementations that sometimes return NULL; do
      all the relevant checking in init() instead.
      
      Make nm_client_new() and nm_remote_settings_new() take a GCancellable
      and a GError**.
      258e74eb
    • Dan Winship's avatar
      libnm: add init_dbus() virtual method to NMObject · 8ca2998d
      Dan Winship authored
      Rather than having each object type override constructed() to call
      _nm_object_register_properties(), have NMObject call a virtual method
      on the subclass to ask it to register them.
      
      Move some code around in nm-client.c and nm-object.c so that all
      D-Bus-related initialization happens in init_dbus(), and
      non-D-Bus-related stuff stays in construct().
      
      (This simplifies the next commit.)
      8ca2998d
    • Dan Winship's avatar
      libnm: remove _new functions from NMObject subclasses · a0e9a4bd
      Dan Winship authored
      Most NMObjects should not be manually created, they should only be
      received from NMClient or NMRemoteSettings.
      a0e9a4bd
    • Dan Winship's avatar
      libnm: remove Since tags and NM_AVAILABLE_IN_* attributes · b4ae6eae
      Dan Winship authored
      Everything currently in libnm has always been there.
      b4ae6eae
    • Dan Winship's avatar
      libnm: add libnm/libnm-core (part 1) · d595f784
      Dan Winship authored
      This commit begins creating the new "libnm", which will replace
      libnm-util and libnm-glib.
      
      The main reason for the libnm-util/libnm-glib split is that the daemon
      needs to link to libnm-util (to get NMSettings, NMConnection, etc),
      but can't link to libnm-glib (because it uses many of the same type
      names as the NetworkManager daemon. eg, NMDevice). So the daemon links
      to only libnm-util, but basically all clients link to both.
      
      With libnm, there will be only a single client-visible library, and
      NetworkManager will internally link against a private "libnm-core"
      containing the parts that used to be in libnm-util.
      
      (The "libnm-core" parts still need to be in their own directory so
      that the daemon can see those header files without also seeing the
      ones in libnm/ that conflict with its own headers.)
      
      [This commit just copies the source code from libnm-util/ to
      libnm-core/, and libnm-glib/ to libnm/:
      
        mkdir -p libnm-core/tests/
        mkdir -p libnm/tests/
        cp libnm-util/*.[ch] libnm-util/nm-version.h.in libnm-core/
        rm -f libnm-core/nm-version.h libnm-core/nm-setting-template.[ch] libnm-core/nm-utils-enum-types.[ch]
        cp libnm-util/tests/*.[ch] libnm-core/tests/
        cp libnm-glib/*.[ch] libnm/
        rm -f libnm/libnm_glib.[ch] libnm/libnm-glib-test.c libnm/nm-glib-enum-types.[ch]
        cp libnm-glib/tests/*.[ch] libnm/tests/
      
      ]
      d595f784
  17. 15 Jul, 2014 3 commits
    • Dan Winship's avatar
      libnm-util, libnm-glib: whitespace fixes · 2570c5a1
      Dan Winship authored
      Fix indentation, kill trailing whitespace, split some long lines.
      2570c5a1
    • Dan Winship's avatar
      libnm-util, libnm-glib: standardize copyright/license headers · cb7e1893
      Dan Winship authored
      - Remove list of authors from files that had them; these serve no
        purpose except to quickly get out of date (and were only used in
        libnm-util and not libnm-glib anyway).
      
      - Just say "Copyright", not "(C) Copyright" or "Copyright (C)"
      
      - Put copyright statement after the license, not before
      
      - Remove "NetworkManager - Network link manager" from the few files
        that contained it, and "libnm_glib -- Access network status &
        information from glib applications" from the many files that
        contained it.
      
      - Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
        to files that were missing it.
      cb7e1893
    • Dan Winship's avatar
      libnm-util, libnm-glib: tweak (element-type) annotations in docs · 4223fa47
      Dan Winship authored
      g-i allows you to specify types in annotations using either their
      fully-qualified introspected names (eg, "NMClient.Device") or their
      plain C names ("NMDevice"). Switch from the former to the latter (so
      that they'll still be correct when migrated to libnm later).
      4223fa47
  18. 19 Jun, 2014 1 commit
  19. 06 Mar, 2014 1 commit
  20. 13 Feb, 2014 1 commit
  21. 23 Jan, 2014 1 commit
  22. 20 Dec, 2013 1 commit
  23. 22 Oct, 2013 1 commit
    • Thomas Haller's avatar
      core: cleanup freeing of glib collections of pointers · 3eb1d5e9
      Thomas Haller authored
      When freeing one of the collections such as GArray, GPtrArray, GSList,
      etc. it is common that the items inside the connections must be
      freed/unrefed too.
      
      The previous code often iterated over the collection first with
      e.g. g_ptr_array_foreach and passing e.g. g_free as GFunc argument.
      For one, this has the problem, that g_free has a different signature
      GDestroyNotify then the expected GFunc. Moreover, this can be
      simplified either by setting a clear function
      (g_ptr_array_set_clear_func) or by passing the destroy function to the
      free function (g_slist_free_full).
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      3eb1d5e9
  24. 11 Oct, 2013 1 commit
    • Dan Winship's avatar
      libnm-util, libnm-glib: fix up some gtk-doc comments · 76cc2bd9
      Dan Winship authored
      gtk-doc recognizes that #NMFoos is the plural of #NMFoo now, so you
      don't need to put an empty comment between the type name and the "s"
      to make it work. (Unfortunately, it's not smart enough to realize that
      "NMIP4Addresses" is the plural of "NMIP4Address".)
      
      Also, add some missing "#"s noticed along the way.
      76cc2bd9
  25. 15 Aug, 2013 1 commit
  26. 08 Apr, 2013 1 commit
    • Dan Williams's avatar
      libnm-glib: use helpers to create dbus proxies · 661d0985
      Dan Williams authored
      When using a private connection, we need to use dbus_g_proxy_new_for_peer()
      because the bus isn't involved.  Since many parts of libnm-glib create a
      proxy for their corresponding remote object, consolidate the proxy creation
      logic.
      
      A later patch will add logic to use a private connection versus a bus-based
      one.
      661d0985
  27. 13 Mar, 2013 1 commit
  28. 22 Feb, 2013 1 commit
  29. 26 Oct, 2012 1 commit
  30. 19 Oct, 2012 1 commit