summaryrefslogtreecommitdiff
path: root/libnm/nm-device-wifi.c
Commit message (Collapse)AuthorAgeFilesLines
* all: rename the introspection data to use the interface paths in namesLubomir Rintel2016-11-231-1/+1
| | | | | | | | This makes it easier to install the files with proper names. Also, it makes the makefile rules slightly simpler. Lastly, the documentation is now generated into docs/api, which makes it possible to get rid of the awkward relative file names in docbook.
* libnm: avoid leaking the interface proxiesLubomir Rintel2016-11-141-0/+2
| | | | | _nm_object_get_proxy()'s semantics changed with the object-manager branch merge: it now takes a reference.
* libnm: use the o.fd.DBus.ObjectManager API for object managementlr/object-managerLubomir Rintel2016-11-101-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | | 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.
* libnm: minor refactoring by using g_clear_object() and nm_str_not_empty()Thomas Haller2016-10-241-10/+3
|
* all: modify line separator comments to be 80 chars wideThomas Haller2016-10-031-1/+1
| | | | sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
* 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
* build: cleanup default includesThomas Haller2016-02-121-7/+7
| | | | | | | | | | | | | | | | | | | - "gsystem-local-alloc.h" and <gio/gio.h> are already included via "nm-default.h". No need to include them separately. - include "nm-macros-internal.h" via "nm-default.h" and drop all explict includes. - in the modified files, ensure that we always include "config.h" and "nm-default.h" first. As second, include the header file for the current source file (if applicable). Then follow external includes and finally internal nm includes. - include nm headers inside source code files with quotes - internal header files don't need to include default headers. They can savely assume that "nm-default.h" is already included and with it glib, nm-glib.h, nm-macros-internal.h, etc.
* Revert "all: change "Since: 1.2" to "Since: 1.0.4"/"Since: 1.0.6" for ↵Thomas Haller2015-08-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | backported API" API should be added with "Since:" of the next release on the same branch. That means, new API on 1.1 branch (development), should be "Since: 1.2" and new API on 1.0 branch (stable) will be "Since: 1.0.x". Similarly, new API on master is NM_AVAILABLE_IN_1_2 and will be added with the linker version libnl_1_2 -- never the versions of minor releases. It is also strongly advised that for the 1.0 branch, we only add API that was previously formerly added on master. IOW, that we only do true backports of API that already exists on master. API that gets backported, must also be added to master via NM_BACKPORT_SYMBOL(). That gives ABI compatibility and an application that was build against 1.0.x will work with 1.y.z version (y > 0) without need for recompiling -- provided that 1.y.z also contains that API. There is one important caveat: if a major branch (e.g. current master) has a linker section of backported APIs (e.g. libnm_1_0_6), we must do the minor release (1.0.6) before the next major release (1.2). The reason is that after the major release, the linker section (libnm_1_0_6) must not be extended and thus the minor release (1.0.6) must be already released at that point. In general, users should avoid using backported API because it limits the ability to upgrade to arbitrary later versions. But together with the previous point (that we only backport API to minor releases), a user that uses backported API can be sure that a 1.y.z version is ABI compatible with 1.0.x, if the 1.y.z release date was after the release date of 1.0.x. This reverts commit 02a136682c749a0fd27853c0152d36c44635151f.
* all: change "Since: 1.2" to "Since: 1.0.4"/"Since: 1.0.6" for backported APIJiří Klimeš2015-08-211-2/+2
|
* libnm: symbols for request scanning backported to 1.0.6Jiří Klimeš2015-08-141-0/+9
| | | | | | | | Backport to 1.0.6 the following symbols: - nm_device_wifi_request_scan_options - nm_device_wifi_request_scan_options_async Backported by commit 91c0555afaac57234744f42024d95bde46ba170e
* libnm: add new functions allowing passing options to RequestScan() D-Bus callJiří Klimeš2015-08-141-24/+130
| | | | | nm_device_wifi_request_scan_options() nm_device_wifi_request_scan_options_async()
* all: drop includes to <glib/gi18n.h> for "nm-default.h"Dan Winship2015-08-051-1/+0
| | | | | | | The localization headers are now included via "nm-default.h". Also fixes several places, where we wrongly included <glib/gi18n-lib.h> instead of <glib/gi18n.h>. For example under "clients/" directory.
* 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-2/+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).
* libnm*: fix library gettext usageDan Winship2014-11-131-1/+1
| | | | | | | | | | | | | | | | | 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.)
* all: consistently include config.hDan Winship2014-11-131-1/+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: strip GDBus gunk from GErrorsDan Winship2014-10-221-5/+12
| | | | | Call g_dbus_error_strip_remote_error() on all errors returned from gdbus calls. (Blah!)
* libnm: merge device-type-specific errors into NMDeviceErrorDan Winship2014-10-221-41/+17
| | | | | | | | | | | | | | | | | | | | 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.
* libnm: further NULL-vs-empty-array fixesDan Winship2014-10-191-0/+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: add nm-types.h, to avoid include loopsDan Winship2014-10-101-0/+1
| | | | | 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-8/+10
| | | | | | | | | | 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: fix argument type passed to RequestScan() D-Bus callJiří Klimeš2014-10-011-3/+3
| | | | GLib-ERROR **: g_variant_new: expected GVariant of type `a{sv}' but received value has type `aa{sv}'
* libnm: add some missing sync/async method variantsDan Winship2014-09-251-0/+26
| | | | | | | | | | | | | Add the missing variant in most places in the API where previously there was either only a synchronous version or only an asynchronous version. There is not yet a synchronous nm_client_activate_connection(), nm_client_add_and_activate_connection(), or nm_remote_settings_add_connection(), because the existing async code depends on waiting for other asynchronous events, so making them run synchronously is slightly more complicated. But these APIs can be added later.
* libnm: make sync/async APIs more GLib-likeDan Winship2014-09-251-50/+61
| | | | | | | | | | | | Make synchronous APIs take GCancellables, and make asynchronous APIs use GAsyncReadyCallbacks and have names ending in "_async", with "_finish" functions to retrieve the results. Also, make nm_client_activate_connection_finish(), nm_client_add_and_activate_finish(), and nm_remote_settings_add_connection_finish() be (transfer full) rather than (transfer none), because the refcounting semantics become slightly confusing in some edge cases otherwise.
* libnm: port to GDBusDan Winship2014-09-181-35/+41
| | | | | | | | | 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: let NMObject create all D-Bus proxiesDan Winship2014-09-181-3/+4
| | | | | | | | | | | | 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: 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-15/+23
| | | | | | | | | | | | | 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-core: change all mac-address properties to G_TYPE_STRINGDan Winship2014-09-041-7/+6
| | | | | | | | | | Make all mac-address properties (including NMSettingBluetooth:bdaddr, NMSettingOlpcMesh:dhcp-anycast-addr, and NMSettingWireless:bssid) be strings, using _nm_setting_class_transform_property() to handle translating to/from binary form when dealing with D-Bus. Update everything accordingly for the change, and also add a test for transformed setting properties to test-general.
* libnm-core, etc: add nm_utils_hwaddr_matches()Dan Winship2014-08-071-6/+5
| | | | | | | Add nm_utils_hwaddr_matches(), for comparing hardware addresses for equality, allowing either binary or ASCII hardware addresses to be passed, and handling the special rules for InfiniBand hardware addresses automatically. Update code to use it.
* libnm-core: include ETH_ALEN/INFINIBAND_ALEN defines in nm-utils.hDan Winship2014-08-071-1/+0
| | | | | | | | 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.
* all: remove use of struct ether_addr / ether_aton()Dan Winship2014-08-071-4/+4
| | | | | | | | | | | | | Lots of old code used struct ether_addr to store hardware addresses, and ether_aton() to parse them, but more recent code generally uses guint8 arrays, and the nm_utils_hwaddr_* methods, to be able to share code between ETH_ALEN and INFINIBAND_ALEN cases. So update the old code to match the new. (In many places, this ends up getting rid of casts between struct ether_addr and guint8* anyway.) (Also, in some places, variables were switched from struct ether_addr to guint8[] a while back, but some code still used "&" when referring to them even though that's unnecessary now. Clean that up.)
* libnm: make the the use of GInitable mandatoryDan Winship2014-08-011-9/+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-20/+17
| | | | | | | | | | | | 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-25/+0
| | | | | Most NMObjects should not be manually created, they should only be received from NMClient or NMRemoteSettings.
* libnm: remove Since tags and NM_AVAILABLE_IN_* attributesDan Winship2014-08-011-4/+0
| | | | Everything currently in libnm has always been there.
* libnm: add libnm/libnm-core (part 1)Dan Winship2014-08-011-0/+838
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/ ]