summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-access-point.c
Commit message (Collapse)AuthorAgeFilesLines
* libnm: handle errors gracefully in nm_access_point_connection_valid()Thomas Haller2017-03-241-17/+22
| | | | | | | Suppress warnings and avoid assertions in nm_access_point_connection_valid(). https://bugzilla.gnome.org/show_bug.cgi?id=773675
* include: use double-quotes to include our own headersThomas Haller2017-03-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practice, this should only matter when there are multiple header files with the same name. That is something we try to avoid already, by giving headers a distinct name. When building NetworkManager itself, we clearly want to use double-quotes for including our own headers. But we also want to do that in our public headers. For example: ./a.c #include <stdio.h> #include <nm-1.h> void main() { printf ("INCLUDED %s/nm-2.h\n", SYMB); } ./1/nm-1.h #include <nm-2.h> ./1/nm-2.h #define SYMB "1" ./2/nm-2.h #define SYMB "2" $ cc -I./2 -I./1 ./a.c $ ./a.out INCLUDED 2/nm-2.h Exceptions to this are - headers in "shared/nm-utils" that include <NetworkManager.h>. These headers are copied into projects and hence used like headers owned by those projects. - examples/C
* 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
* 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).
* wifi: expose the last_seen property for a NMAccessPointMathieu Trudel-Lapierre2015-04-291-0/+44
| | | | https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00053.html
* 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-util, libnm-glib: whitespace fixesDan Winship2014-07-151-3/+3
| | | | Fix indentation, kill trailing whitespace, split some long lines.
* libnm-util, libnm-glib: standardize copyright/license headersDan Winship2014-07-151-4/+2
| | | | | | | | | | | | | | | | | | - 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.
* libnm-util, libnm-glib: tweak (element-type) annotations in docsDan Winship2014-07-151-2/+2
| | | | | | | 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).
* all: remove remaining GParamSpec name/blurb stringsDan Winship2014-06-191-47/+37
| | | | | | Remove all remaining GParamSpec name and blurb strings (and fix indentation while we're there), and add G_PARAM_STATIC_STRINGS to all paramspecs that were lacking it.
* libnm-util, libnm-glib: be consistent about "Wi-Fi", "Ethernet", ↵Dan Winship2014-06-191-3/+3
| | | | | | | | | "InfiniBand" in docs We made the UIs consistent last year, but missed the documentation. Fix the docs to also consistently use "Wi-Fi" rather than "WiFi", "Wifi", "wifi", or "WiFI"; "Ethernet" rather than "ethernet"; and "InfiniBand" rather than "Infiniband".
* trivial: make clear the maximum bitrate is in kbit/sJiří Klimeš2014-04-011-3/+3
|
* trivial: remove unused #definesDan Williams2014-01-231-10/+0
| | | | | These are no longer used by anything, but are determined automatically from the GObject property names.
* libnm-glib: remove bogus warningDan Williams2013-10-151-1/+0
| | | | | | | When connecting to a hidden SSID, the Access Point object that NetworkManager creates will have no frequency, because the frequency is unknown until the connection succeeds. The warning has no use; if the AP doesn't have a frequency then it even match a connection with a specified frequency.
* libnm-glib: use helpers to create dbus proxiesDan Williams2013-04-081-6/+1
| | | | | | | | | | 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.
* wifi: support ap-mode with wpa_supplicantJan Luebbe2012-10-171-1/+6
| | | | | | | | | | A new value for NM80211Mode is introduced (NM_802_11_MODE_AP) and the new mode is passed to wpa_supplicant analogous to adhoc-mode. The places which need to know the interface mode have been extended to handle the new mode. If the configuration does not contain a fixed frequency, a channel is selected the same way as with adhoc-mode before.
* libnm-glib: fix build on older glib without g_clear_object()Dan Williams2012-04-271-0/+2
|
* libnm-glib: NULL out priv fields on dispose()Dan Winship2012-04-231-9/+1
| | | | | | | | In some situations, objects might get used after being disposed, so clear out their various priv fields so we don't try to access unreffed objects, freed strings, etc. https://bugzilla.gnome.org/show_bug.cgi?id=674473
* libnm-glib: more ensure_inited() fixingDan Winship2012-03-281-0/+2
| | | | | | | | | We need to do _nm_object_ensure_inited() / _nm_remote_settings_ensure_inited() from the get_property() implementations; in most cases, get_property() just calls another accessor method (which will call _nm_object_ensure_inited()), but in a few places, it reads priv->whatever directly, so we need to make sure that it's valid.
* libnm-glib: implement GInitable/GAsyncInitable in NMObjectDan Winship2012-02-031-15/+6
| | | | | | | | | | | | | | | | | | | | | | Implement GInitable and GAsyncInitable in NMObject, with implementations that synchronously or asynchonously load all properties, and change _nm_object_ensure_inited() to run g_initable_init(). Update the object/object-array property handling to initialize the objects after creating them (synchronously or asynchronously, according to the situation), so that they will have all of their properties preloaded before they are ever visible to the caller. Move the non-blocking/non-failable parts of various objects' constructor() methods to constructed(), and move the blocking/failable parts to init(), and implement init_async() methods with non-blocking versions of the blocking methods. Make nm_device_new() and nm_client_new() call _nm_object_ensure_inited(), to preserve the behaviour formerly enforced by their construct() methods, that properties are guaranteed to be initialized before any signals involving them are emitted.
* libnm-glib: simplify property getter methodsDan Winship2012-02-031-99/+18
| | | | | | | | | | | | | | Rather than having every property getter method have code to fetch that specific property's value, just call the new _nm_object_ensure_inited() (which makes sure that we've read all the property values on the object at least once), and then return the cached value. (After we've read the initial property values, the PropertiesChanged signal handler will ensure that the values are kept up to date, so we can always just return cached property values after that point.) This then lets us get rid of _nm_object_get_property() and its wrappers.
* libnm-glib: simplify and genericize property declarationDan Winship2012-02-031-15/+15
| | | | | | | | | | | | | | | Rename _nm_object_handle_properties_changed(), etc, to be about properties in general, rather than just property changes. Interpret func==NULL in NMPropertiesInfo as meaning "use _nm_object_demarshal_generic", and then reorder the fields so that you can just leave that field out in the declarations when it's NULL. Add a way to register properties that exist in D-Bus but aren't tracked by the NMObjects, and use that for NMDevice's D-Bus Ip4Address property, replacing the existing hack. Also add a few other missing properties noticed along the way.
* libnm-glib: don't use client-side generated dbus-glib bindingsDan Winship2012-02-021-2/+0
| | | | | | | Most of the code was using dbus_g_proxy_call() directly, but there were some leftover uses of the generated bindings. Make things more consistent by using dbus_g_proxy_call() everywhere, and stop building the -bindings.h files.
* docs: fix 'connection' parameter name for nm_access_point_connection_valid()Jiří Klimeš2012-01-261-1/+1
|
* docs: fix section header name for nm_access_point_connection_valid()Alberto Ruiz2012-01-131-6/+6
| | | | | nm_access_point_connection_valid documentation had nm_access_point_filter_connection as the section string, probably a typo after copy pasting
* docs: Update NMAccessPoint documentationAlberto Ruiz2012-01-131-0/+5
| | | | | Further explanation on how to get the connection list to filter against an access point. Also noting that filtering by device is recommended.
* libnm-glib: add *_connection_valid() utility functionsDan Williams2011-04-251-89/+110
| | | | | | | | | Like the *_filter_connections() functions, but for just one connection, and now the *_filter_connections() functions call these new ones so it's really just moving code around and not anything new. These new functions more closely match the usage I've seen from gnome-shell's network.js and elsewhere.
* trivial: let g_free and g_strdup handle NULL (bgo #644763)Kjartan Maraas2011-03-151-2/+1
|
* build: fix return types (bgo #644665)Kjartan Maraas2011-03-141-2/+2
| | | | Some functions were returning FALSE or 0 instead of NULL.
* libnm-glib: add nm_access_point_filter_connections()Dan Williams2011-03-111-17/+177
|
* libnm-glib: documentation fixesDan Williams2011-03-101-1/+1
|
* libnm-glib: return enums for NMAccessPoint flags accessorsDan Williams2011-02-181-9/+10
|
* libnm-glib: add GError parameter to _nm_object_get_... functionsJiří Klimeš2011-02-151-10/+19
| | | | | It allows us to get the error back and have control over printing the error.
* libnm-glib: trivial documentation fixesDan Williams2009-11-231-1/+1
|
* 2008-11-14 Dan Williams <dcbw@redhat.com>Dan Williams2008-11-141-1/+22
| | | | | | | | Relicense libnm-glib to LGPLv2+ with agreement from contributors git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4285 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* Rename private nm_* functions to _nm_*Michael Biebl2008-08-261-20/+20
| | | | git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4012 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2008-08-12 Tambet Ingo <tambet@gmail.com>Tambet Ingo2008-08-121-0/+129
| | | | | | | * libnm-glib/*.c. Document some more. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3934 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2008-04-15 Dan Williams <dcbw@redhat.com>Dan Williams2008-04-151-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove exposure of wireless-tools mode types in the API. * include/NetworkManager.h - Define NM80211Mode enum * introspection/generic-types.xml - Describe NM_802_11_MODE enum - Remove IW_MODE_* enum * introspection/nm-access-point.xml libnm-glib/nm-access-point.c libnm-glib/nm-access-point.h - 'mode' is now of type NM80211Mode, a DBUS_TYPE_UINT * introspection/nm-device-802-11-wireless.xml libnm-glib/nm-device-802-11-wireless.c libnm-glib/nm-device-802-11-wireless.h - 'mode' is now of type NM80211Mode, a DBUS_TYPE_UINT * libnm-util/nm-setting-wireless.c src/NetworkManagerAP.c src/NetworkManagerAP.h src/nm-device-802-11-wireless.c src/nm-device-802-11-wireless.h test/nm-tool.c - Use NM80211Mode not IW_MODE_* git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3562 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2008-03-25 Dan Williams <dcbw@redhat.com>Dan Williams2008-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libnm-glib/nm-ip4-config.c libnm-glib/nm-active-connection.c libnm-glib/nm-access-point.c - Use nm_object_queue_notify() instead of g_object_notify() * libnm-glib/nm-device.c - (demarshal_ip4_config): distinguish between successful but missing ip4-config request, and unsuccessful and missing ip4-config request - (nm_device_get_ip4_config): don't try to demarshal a NULL ip4-config path - Use nm_object_queue_notify() instead of g_object_notify() * libnm-glib/nm-device-802-11-wireless.c - (demarshal_active_ap): distinguish between successfull but missing active-ap request, and unsuccessful and missing active-ap request - (dispose, clean_up_aps): consolidate AP list and active AP clearing code - (nm_device_802_11_wireless_set_wireless_enabled): add a private hook for the NMClient to notify the device that wireless is disabled, and therefore to clear the AP list and active AP - Use nm_object_queue_notify() instead of g_object_notify() * libnm-glib/nm-client.c - (poke_wireless_devices_with_rf_status): new function - (update_wireless_status): notify wireless devices of the rfkill status so they can clean up if needed - Use nm_object_queue_notify() instead of g_object_notify() git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3502 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2008-03-24 Dan Williams <dcbw@redhat.com>Dan Williams2008-03-241-172/+69
| | | | | | | | | | | | | | | | | Massive fixup of libnm-glib to: a) have all objects (with the exception of VPN) cache their properties and update them asynchronously on PropertiesChanged signals from NM b) return internal const data for most attributes/properties instead of allocated values that the caller must free c) cache wrapped objects such that a given D-Bus path will always map to the same GObject returned by libnm-glib d) remove a few signals and move them to GObject property notifications e) match recent NM D-Bus API changes for activation/deactivation f) remove some private functions from libnm-glib headers git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3491 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2008-03-14 Dan Williams <dcbw@redhat.com>Dan Williams2008-03-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/wireless-helper.h include/Makefile.am - One place for all the junk needed for #including wireless.h * test/nm-tool.c src/NetworkManagerAP.c src/wpa.c src/Makefile.am libnm-util/nm-utils.c libnm-util/nm-setting-wireless.c libnm-glib/nm-device-802-11-wireless.c libnm-glib/nm-access-point.c libnm-glib/libnm-glib-test.c - include wireless-helper.h, not iwlib.h * configure.in - Don't need libiw really, just need to check for wireless.h * src/kernel-types.h - Remove; used types moved into wpa.c * src/nm-device-802-11-wireless.c - (nm_device_802_11_wireless_update_signal_strength, real_get_generic_capabilities, nm_device_802_11_wireless_get_mode, nm_device_802_11_wireless_set_mode, nm_device_802_11_wireless_get_frequency, nm_device_802_11_wireless_get_ssid, nm_device_802_11_wireless_set_ssid, nm_device_802_11_wireless_get_bitrate, nm_device_802_11_wireless_get_bssid, nm_device_802_11_wireless_disable_encryption): use ioctl() directly instead of iwlib functions git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3462 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2008-03-12 Dan Williams <dcbw@redhat.com>Dan Williams2008-03-121-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Harmonize the 802.11 bitrate API * introspection/nm-access-point.xml - 'Rate' -> 'MaxBitrate'; clarify units * introspection/nm-device-802-11-wireless.xml - Clarify units of 'Bitrate' * src/NetworkManagerAP.c src/NetworkManagerAP.h - (set_property, get_property, nm_ap_class_init): rename 'rate' property to 'max-bitrate' - (foreach_property_cb): convert rate to Kb/s * src/nm-device-802-11-wireless.c - (nm_device_802_11_wireless_get_bitrate): return rate in Kb/s * libnm-glib/nm-access-point.c libnm-glib/nm-access-point.h - 'rate' -> 'max-bitrate' * test/nm-tool.c libnm-glib/libnm-glib-test.c - Fix up for these changes git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3432 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2007-12-07 Dan Williams <dcbw@redhat.com>Dan Williams2007-12-071-1/+4
| | | | | | | | | | | Noticed by Christian Persch <chpe@gnome.org> Always chain up to parent object in dispose and finalize handlers. (gnome.org #433112) git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3154 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2007-10-26 Dan Williams <dcbw@redhat.com>Dan Williams2007-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch from Helmut Schaa <hschaa@suse.de> (and more bits from me) * src/NetworkManagerAP.c src/NetworkManagerAP.h libnm-glib/nm-access-point.c libnm-glib/nm-access-point.h - Make 'rate' property a guint32 to better match with WEXT and wpa_supplicant and to allow representation of higher bitrates * src/nm-device-802-11-wireless.c introspection/nm-device-802-11-wireless.xml libnm-glib/nm-device-802-11-wireless.c libnm-glib/nm-device-802-11-wireless.h - Make 'bitrate' property a guint32 to match AP 'rate' property type * src/nm-device-802-3-ethernet.c src/nm-device-802-3-ethernet.h introspection/nm-device-802-3-ethernet.xml libnm-glib/nm-device-802-3-ethernet.c libnm-glib/nm-device-802-3-ethernet.h - Make 'speed' property a guint32 to match other speed/rate types - Make nm_device_802_3_ethernet_get_speed() static * test/nm-tool.c - Update for the changes above git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3030 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2007-10-12 Tambet Ingo <tambet@gmail.com>Tambet Ingo2007-10-121-302/+333
| | | | | | | | | | | | | | | | | | | | | | | | | | Rework the "properties-changed" signal listening implementation. Add a generic implementation to NMObject class that listens for the signal and calls property setters of the target NMObject. * libnm-glib/nm-object.c (nm_object_handle_properties_changed): * Implement. * libnm-glib/nm-device-802-11-wireless.c: Move the GObject * consturction code to the end of file so that all the static functions are available without extra declarations. Remove the "properties-changed" signal handling and use the framework from NMObject. Implement property setters for properties that change with "properties-changed" signal. * libnm-glib/nm-access-point.c: Ditto. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2972 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2007-10-05 Dan Williams <dcbw@redhat.com>Dan Williams2007-10-051-1/+11
| | | | | | | | | | | | | | | | | * libnm-glib/nm-access-point.c libnm-glib/nm-access-point.h - (nm_access_point_get_hw_address): return 'const char *', not 'char *' because the value is cached internally now. Callers should not free the internal value. - Make signal name defines private * test/nm-tool.c libnm-glib/libnm-glib-test.c - Don't free value returned from nm_access_point_get_hw_address() git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2935 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* 2007-09-20 Dan Williams <dcbw@redhat.com>Dan Williams2007-09-211-2/+2
| | | | | | | | | * libnm-glib/nm-access-point.c - (handle_property_changed): strength is a UCHAR git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2837 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
* Warning fixesDan Williams2007-09-201-1/+0
| | | | git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2833 4912f4e0-d625-0410-9fb7-b9a5a253dbdc