summaryrefslogtreecommitdiff
path: root/libnm/nm-active-connection.c
Commit message (Collapse)AuthorAgeFilesLines
* libnm: add NMActivationStateFlagsThomas Haller2017-10-051-0/+39
| | | | | | No flags yet implemented. https://bugzilla.redhat.com/show_bug.cgi?id=1454883
* libnm: fix emission of NMActiveConnection::state notify signalBeniamino Galvani2017-03-211-0/+1
| | | | | | | | | | | | | | state_changed_proxy() updates the value of @state and must also emit the notify signal for it. Without this, when the PropertiesChanged signal carrying the change of 'state' arrives after StateChanged, we notice that the value of @state doesn't change and don't emit the notify, causing a loss of the state change event. Fixes: 40ffb962bec3700e447254d4a1cc93f21b8a25dd https://bugzilla.redhat.com/show_bug.cgi?id=1433883
* libnm: fix chaining up NMActiveConnection::constructed()Thomas Haller2017-03-171-0/+2
| | | | Fixes: 40ffb962bec3700e447254d4a1cc93f21b8a25dd
* fixup! libnm/active-connection: track reason for state changesLubomir Rintel2017-03-171-0/+7
|
* libnm/active-connection: track reason for state changesLubomir Rintel2017-03-171-0/+64
| | | | | | | | | Note that the reason tracking starts as soon as the object exists (which is immediately after GDBusObject is created), not when the asynchronous NMObject initialization finishes. That is so that we the reason changes in between are not lost. The vpn-connection should probably be doing the same.
* libnm: use the o.fd.DBus.ObjectManager API for object managementlr/object-managerLubomir Rintel2016-11-101-21/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* libnm: coerce empty strings to NULL for D-Bus propertiesThomas Haller2016-10-241-4/+7
| | | | | | | | | | | | | | | | 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.
* all: cleanup includes and let "nm-default.h" include "config.h"Thomas Haller2016-02-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* all: make use of new header file "nm-default.h"Thomas Haller2015-08-051-1/+1
|
* all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship2015-07-241-1/+1
| | | | | | | | | | | | | | | | 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).
* all: consistently include config.hDan Winship2014-11-131-0/+2
| | | | | | | | | | | 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.)
* libnm: create NMDhcpConfig as parent of NMDhcp4Config and NMDhcp6ConfigDan Winship2014-11-071-16/+16
| | | | | As with NMIP4Config and NMIP6Config, merge the two DHCP config classes into one in the public API.
* libnm: create NMIPConfig as parent of NMIP4Config and NMIP6ConfigDan Winship2014-11-071-16/+14
| | | | | | | Create NMIPConfig as the parent of NMIP4Config and NMIP6Config, and remove the two subclasses from the public API; while it's convenient to still have both internally, they are now identical to the outside world.
* libnm: fix NMActiveConnection:specific-object-pathDan Winship2014-10-211-1/+19
| | | | | | NMActiveConnection:specific-object was renamed to NMActiveConnection:specific-object-path in 677314c5, but it didn't actually work, because of assumptions NMObject makes. Fix that.
* libnm: further NULL-vs-empty-array fixesDan Winship2014-10-191-1/+4
| | | | | | | | | | | | 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.
* libnm: fix NMActiveConnection object-path-valued propertiesDan Winship2014-10-101-53/+57
| | | | | | | | | | | | | | | NMActiveConnection:connection was an object path rather than an NMRemoteConnection because in the past the NMObject property system wasn't capable of handling NMRemoteConnection-valued properties. NMActiveConnection:master was an object path rather than an NMDevice entirely by accident. Fix both. NMActiveConnection:specific-object can't currently be converted to an object, because we don't know ahead of time what object type it is, and NMObject can't deal with that. Instead, we rename it to :specific-object-path (and likewise for its get function), both to emphasize that it doesn't behave like other properties, and to leave the old name open for an actual object-valued property later on.
* libnm: add nm-types.h, to avoid include loopsDan Winship2014-10-101-0/+4
| | | | | Add nm-types.h defining all the type structs, to avoid future include loops. Clean up the includes in all of the installed headers.
* libnm: make use of GParamSpecFlags and GParamSpecEnumDan Winship2014-10-031-4/+3
| | | | | | | | | | Make enum- and flags-valued properties use GParamSpecEnum and GParamSpecFlags, for better introspectability/bindability. This requires no changes outside libnm-core/libnm since the expected data size is still the same with g_object_get()/g_object_set(), and GLib will internally convert between int/uint and enum/flags GValues when using g_object_get_property()/g_object_set_property().
* libnm: port to GDBusDan Winship2014-09-181-3/+3
| | | | | | | | | Port libnm-core/libnm to GDBus. The NetworkManager daemon continues to use dbus-glib; the previously-added connection hash/variant conversion methods are now moved to NetworkManagerUtils (along with a few other utilities that are now only needed by the daemon code).
* libnm: rename nm-dbus-helpers-private.h to nm-dbus-helpers.hDan Winship2014-09-181-1/+1
| | | | The .h file should have the same name as the .c file.
* libnm: move most of the subclass-type-deciding code into NMObjectDan Winship2014-09-181-98/+10
| | | | | | | | | | NMObject has a system that lets devices and active connections get created as the correct subtypes (NMDeviceFoo / NMActiveConnection vs NMVpnConnection). But it was much more generic than it needed to be, because NMDevice and NMActiveConnection both did the same thing (fetch a D-Bus property and then look at its value). So move the property-fetching part into NMObject, and only use the callback for converting the property value to a GType.
* libnm: let NMObject create all D-Bus proxiesDan Winship2014-09-181-6/+3
| | | | | | | | | | | | 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.)
* libnm: don't hardcode things like "org.freedesktop.DBus.Properties"Dan Winship2014-09-181-2/+2
| | | | Use the #defines provided by libdbus instead.
* libnm: change empty-GPtrArray-return semanticsDan Winship2014-09-041-1/+1
| | | | | | | | | | 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.
* libnm: drop NM_TYPE_OBJECT_ARRAY, use G_TYPE_PTR_ARRAYDan Winship2014-09-041-10/+8
| | | | | | | | | | | | | 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.)
* libnm: rename NetworkManager.h and NetworkManagerVPN.hDan Winship2014-08-011-1/+1
| | | | | | | "NetworkManager.h"'s name (and non-standard capitalization) suggest that it's some sort of high-level super-important header, but it's really just low-level D-Bus stuff. Rename it to "nm-dbus-interface.h" and likewise "NetworkManagerVPN.h" to "nm-vpn-dbus-interface.h"
* libnm: make the the use of GInitable mandatoryDan Winship2014-08-011-17/+0
| | | | | | | | | | | 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**.
* libnm: add init_dbus() virtual method to NMObjectDan Winship2014-08-011-15/+9
| | | | | | | | | | | | 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.)
* libnm: remove _new functions from NMObject subclassesDan Winship2014-08-011-21/+0
| | | | | Most NMObjects should not be manually created, they should only be received from NMClient or NMRemoteSettings.
* libnm, core, cli, tui: fix the capitalization of various typesDan Winship2014-08-011-11/+11
| | | | | | | | | | | | GLib/Gtk have mostly settled on the convention that two-letter acronyms in type names remain all-caps (eg, "IO"), but longer acronyms become initial-caps-only (eg, "Tcp"). NM was inconsistent, with most long acronyms using initial caps only (Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP, PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all three-or-more-letter-long acronyms (and update nmcli and nmtui for the libnm changes).
* libnm: remove Since tags and NM_AVAILABLE_IN_* attributesDan Winship2014-08-011-28/+0
| | | | Everything currently in libnm has always been there.
* libnm: add libnm/libnm-core (part 1)Dan Winship2014-08-011-0/+851
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/ ]