NetworkManager/src/NetworkManagerAPList.c

533 lines
12 KiB
C
Raw Normal View History

2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
/* NetworkManager -- Network link manager
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Red Hat, Inc.
*/
#include <glib.h>
#include <dbus/dbus-glib.h>
2004-11-17 Dan Williams <dcbw@redhat.com> * Cache access point MAC addresses in NetworkManagerInfo after you've explicitly connected to them. Then, after a scan, match up non-ESSID-broadcasting access points with any cached MAC addresses from NetworkManagerInfo. Allows us to show known access points that don't broadcast their ESSID in the menus without any user intervention whatsoever. * info-daemon/NetworkManagerInfoDbus.c - (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions for dbus method calls "getNetworkAddresses" and "addNetworkAddress" * src/NetworkManagerAP.[ch] - Add a "user_addresses" data member to the NMAccessPoint structure - (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing the user_addresses data member * src/NetworkManagerAPList.c - (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just the AP's reported address - (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo * src/NetworkManagerDHCP.c - Increase DHCP timeout from 25s -> 30s * src/NetworkManagerDbus.[ch] - (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set user addresses * src/NetworkManagerDevice.c - (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up, wait 2s, then configure it. Sometimes Prism54 cards will freeze up with "mgnt tx queue full", seemingly in response to NM controlling the card too much. So, we take the card down to clear it out. - (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list too, since that's where the user_addresses are * src/NetworkManagerPolicy.c - (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to that wireless networks' user_addresses list upon successful activation git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
#include <netinet/ether.h>
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
#include "NetworkManagerAP.h"
#include "NetworkManagerAPList.h"
#include "NetworkManagerUtils.h"
#include "NetworkManagerDbus.h"
2005-03-14 Ray Strode <rstrode@redhat.com> Fourth (probably working) cut at porting to dbus 0.30 api and new hal. This cut adds some new logging macros to make debugging easier. * dispatcher-daemon/NetworkManagerDispatcher.c: * info-daemon/NetworkmanagerInfo.c: * info-daemon/NetworkManagerInfoPassphraseDialog.c: * info-daemon/NetworkManagerInfoVPN.c: * src/NetworkManager.c: * src/NetworkManagerAP.c: * src/NetworkManagerAPList.c: * src/NetworkManagerDHCP.c: * src/NetworkManagerDbus.c: * src/NetworkManagerDevice.c: * src/NetworkManagerPolicy.c: * src/NetworkManagerSystem.c: * src/NetworkManagerUtils.c: * src/NetworkManagerWireless.c: * src/autoip.c: * src/nm-dbus-nm.c: * src/backends/NetworkManagerDebian.c: * src/backends/NetworkManagerGentoo.c: * src/backends/NetworkManagerRedHat.c: * src/backends/NetworkManagerSlackware.c: use new logging macros. * dispatcher-daemon/NetworkManagerDispatcher.c: (nmd_dbus_filter): s/dbus_free/g_free/ * info-daemon/Makefile.am: link in utils library. * info-daemon/NetworkmanagerInfo.c: use new logging macros. (nmi_dbus_get_network): don't assume enumerations are 32-bit. (nmi_dbus_nmi_message_handler): don't free what doesn't belong to us. * libnm_glib/libnm_glib.c: (libnm_glib_get_nm_status): (libnm_glib_init): don't free what doesn't belong to us. (libnm_glib_dbus): strdup result, so it doesn't get lost when message is unref'd. * panel-applet/NMWirelessAppletDbus.c: (nmwa_dbus_update_devices): s/dbus_free/g_free/ * src/NetworkManager.c: (nm_monitor_wired_link_state): request initial status dump of all cards when we start up, instead of relying on /sys/.../carrier. (nm_info_handler), (nm_set_up_log_handlers): log handlers to specify what syslog priorites the logging macros default to. * src/NetworkManagerAPList.c: (nm_ap_list_populate_from_nmi): s/dbus_free_string_array/g_strfreev/ * src/NetworkManagerDbus.c: (nm_dbus_get_network_object): validate d-bus message argument types. Advance message iterator after reading argument, prepend instead of append to GSList. * src/NetworkManagerDevice.c: (nm_device_probe_wired_link_status): remove redundant /sys in /sys path. remove wrong contents == NULL means has carrier assumption. * src/nm-netlink-monitor.c (nm_netlink_monitor_request_status): implement function to ask kernel to dump interface link status over netlink socket. * test/*.c: s/dbus_free/g_free/ * utils/nm-utils.h: (nm_print_backtrace): new macro to print backtrace. (nm_get_timestamp): new macro to get sub-second precise unix timestamp. (nm_info), (nm_debug), (nm_warning), (nm_error): new logging functions. nm_info just prints, nm_debug includes timestamp and function, nm_warning includes function, nm_error includes backtrace and sigtrap. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@497 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-03-15 05:30:15 +00:00
#include "nm-utils.h"
#include "nm-dbus-manager.h"
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
struct NMAccessPointList
{
guint refcount;
NMNetworkType type;
GSList * ap_list;
};
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
/*
* nm_ap_list_new
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
*
* Creates a new empty access point list
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
*
*/
NMAccessPointList *nm_ap_list_new (NMNetworkType type)
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
{
NMAccessPointList *list = g_slice_new0 (NMAccessPointList);
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
nm_ap_list_ref (list);
list->type = type;
return list;
}
/*
* nm_ap_list_ref
*
* Increases the refcount of the ap list
*
*/
void nm_ap_list_ref (NMAccessPointList *list)
{
g_return_if_fail (list != NULL);
list->refcount++;
}
/*
* nm_ap_list_unref
*
* Decreases the refcount of the ap list, and if it reaches
* 0 frees the structure.
*
*/
void nm_ap_list_unref (NMAccessPointList *list)
{
if (!list)
return;
list->refcount--;
if (list->refcount <= 0) {
g_slist_foreach (list->ap_list, (GFunc) g_object_unref, NULL);
g_slist_free (list->ap_list);
g_slice_free (NMAccessPointList, list);
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
}
}
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
/*
* nm_ap_list_size
*
* Return size of the access point list
*
*/
guint nm_ap_list_size (NMAccessPointList *list)
{
g_return_val_if_fail (list != NULL, 0);
return g_slist_length (list->ap_list);
}
/*
* nm_ap_list_is_empty
*
* Returns whether or not the access point list has any access points
* in it.
*
*/
gboolean nm_ap_list_is_empty (NMAccessPointList *list)
{
return ((list->ap_list == NULL));
}
/*
* nm_ap_list_append_ap
*
* Helper to append an AP to an ap list of a certain type.
*
*/
void nm_ap_list_append_ap (NMAccessPointList *list, NMAccessPoint *ap)
{
g_return_if_fail (list != NULL);
g_return_if_fail (ap != NULL);
list->ap_list = g_slist_append (list->ap_list, g_object_ref (ap));
2004-08-02 Dan Williams <dcbw@redhat.com> * TODO - new task: proper logging support * info-daemon/NetworkManagerInfo.c - Correct spelling of "canceled" - Correct casting of objects for g_signal_connect() * info-daemon/NetworkManagerInfoDbus.c - Add defines for NetworkManager namespace and object path, and use them - Add filter function to trap new signals from NetworkManager: WirelessNetworkAppeared, WirelessNetworkDisappeared * info-daemon/passphrase.glade - Change name of "ok" button to "Login to Network..." - Mark invisible * src/NetworkManager.c - Code and debug message cleanups - Rename "nm_add_current_devices"->"nm_add_initial_devices" - (nm_add_initial_devices) Check returned string array of devices and don't try to add devices if array is NULL - (main) Initialize libhal a bit later, make code a bit clearer * src/NetworkManagerAP.[ch] - New accessor and data member "matched": used to speed up AP list diffing - New accessor and data member "enc_method": will be used during key fallback to cache which passphrase->key conversion actually works so we don't have to do it every time * src/NetworkManagerAPList.[ch] - (nm_ap_list_find_ap_in_list) New: find an AP by essid in an AP list - (nm_ap_list_diff) New: given two lists of access points, find the differences between them, and send WirelessNetworkAppeared/Disappeared signals over dbus in response to those differences * src/NetworkManagerDbus.[ch] - (nm_dbus_get_object_path_from_ap) New: given a device and an access point, make an object path for that access point (NOTE that we don't yet check to make sure that access point is actually in the device's AP list yet) - (nm_dbus_get_ap_from_object_path) Renamed from nm_dbus_get_network_from_object_path - (nm_dbus_signal_wireless_network_appeared, nm_dbus_signal_wireless_network_disappeared) New: signal appearance/disappearance of wireless networks - (nm_dbus_set_user_key_for_network) Mark the network/ap as invalid if the user cancelled key entry * src/NetworkManagerDevice.[ch] - (nm_device_ap_list_clear) Use nm_ap_list_free rather than doing it ourselves - (nm_device_ap_list_get) New: return the AP list (static function) - (nm_device_do_normal_scan) Destroy old AP list later, so that we can diff the new one resulting from the scan with the old one * src/NetworkManagerWireless.c - (nm_wireless_is_most_prefered_ap) "invalid" access points cannot be "best" access points * test/nminfotest.c - #define object paths and namespaces and use the #defines rather than static strings - Test out user-key functionality of NetworkManagerInfo too git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@33 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-02 21:12:40 +00:00
}
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
/*
* nm_ap_list_remove_ap
*
* Helper to remove an AP to an ap list of a certain type.
*
*/
void nm_ap_list_remove_ap (NMAccessPointList *list, NMAccessPoint *ap)
{
GSList *elt = NULL;
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
g_return_if_fail (list != NULL);
g_return_if_fail (ap != NULL);
for (elt = list->ap_list; elt; elt = g_slist_next (elt)) {
NMAccessPoint * list_ap = (NMAccessPoint *) elt->data;
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
if (list_ap == ap) {
list->ap_list = g_slist_remove_link (list->ap_list, elt);
g_object_unref (list_ap);
g_slist_free (elt);
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
break;
}
}
}
/*
* nm_ap_list_remove_ap_by_ssid
*
* Helper to remove an AP from an AP list by the AP's SSID.
*
*/
void
nm_ap_list_remove_ap_by_ssid (NMAccessPointList *list, const GByteArray * ssid)
{
GSList * elt = NULL;
g_return_if_fail (list != NULL);
g_return_if_fail (ssid != NULL);
for (elt = list->ap_list; elt; elt = g_slist_next (elt)) {
NMAccessPoint * list_ap = (NMAccessPoint *) elt->data;
if (nm_utils_same_ssid (nm_ap_get_ssid (list_ap), ssid, TRUE)) {
list->ap_list = g_slist_remove_link (list->ap_list, elt);
g_object_unref (list_ap);
g_slist_free (elt);
break;
}
}
}
/* nm_ap_list_remove_duplicate_ssids
*
*/
void nm_ap_list_remove_duplicate_ssids (NMAccessPointList *list)
{
NMAccessPoint *removal_ap;
NMAccessPoint *list_ap_max;
GSList *elt_i = NULL;
GSList *elt_j = NULL;
GSList *elt_max = NULL;
GSList *removal_list = NULL;
GSList *elt;
gint8 max_strength = 0;
gint8 strengthj = 0;
g_return_if_fail (list != NULL);
for (elt_i = list->ap_list; elt_i; elt_i = g_slist_next (elt_i)) {
NMAccessPoint * list_ap_i = (NMAccessPoint *) elt_i->data;
const GByteArray * list_ap_i_ssid = nm_ap_get_ssid (list_ap_i);
gboolean found = FALSE;
for (elt_j = list->ap_list; elt_j < elt_i; elt_j = g_slist_next (elt_j)) {
NMAccessPoint * list_ap_j = (NMAccessPoint *) elt_j->data;
const GByteArray * list_ap_j_ssid = nm_ap_get_ssid (list_ap_j);
if ((found = nm_utils_same_ssid (list_ap_i_ssid, list_ap_j_ssid, TRUE)))
break;
}
if (found)
continue;
elt_max = elt_i;
list_ap_max = (NMAccessPoint *)(elt_i->data);
max_strength = nm_ap_get_strength (list_ap_i);
for (elt_j = g_slist_next (elt_i); elt_j; elt_j = g_slist_next (elt_j)) {
NMAccessPoint *list_ap_j = (NMAccessPoint *) elt_j->data;
const GByteArray * list_ap_j_ssid = nm_ap_get_ssid (list_ap_j);
strengthj = nm_ap_get_strength (list_ap_j);
if (nm_utils_same_ssid (list_ap_i_ssid, list_ap_j_ssid, TRUE)) {
if (strengthj > max_strength) {
removal_list = g_slist_append (removal_list, list_ap_max);
list_ap_max = list_ap_j;
max_strength = strengthj;
} else {
removal_list = g_slist_append (removal_list, list_ap_j);
}
}
}
}
for (elt = removal_list; elt; elt = g_slist_next (elt)) {
if ((removal_ap = (NMAccessPoint *)(elt->data)))
nm_ap_list_remove_ap (list, removal_ap);
}
g_slist_free (removal_list);
}
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
/*
* nm_ap_list_get_ap_by_ssid
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
*
* Search through an access point list and return the access point
* that has a given SSID.
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
*
*/
NMAccessPoint *
nm_ap_list_get_ap_by_ssid (NMAccessPointList *list, const GByteArray * ssid)
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
{
NMAccessPoint *ap;
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
NMAccessPoint *found_ap = NULL;
NMAPListIter *iter;
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
if (!ssid || !list)
return NULL;
if (!(iter = nm_ap_list_iter_new (list)))
return NULL;
while ((ap = nm_ap_list_iter_next (iter))) {
const GByteArray * ap_ssid = nm_ap_get_ssid (ap);
if (ap_ssid && nm_utils_same_ssid (ap_ssid, ssid, TRUE)) {
found_ap = ap;
break;
}
}
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
nm_ap_list_iter_free (iter);
return found_ap;
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
}
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
/*
* nm_ap_list_get_ap_by_address
*
* Search through an access point list and return the access point
* that has a given AP address.
*
*/
NMAccessPoint *nm_ap_list_get_ap_by_address (NMAccessPointList *list, const struct ether_addr *addr)
{
NMAccessPoint *ap;
NMAccessPoint *found_ap = NULL;
NMAPListIter *iter;
if (!addr)
return (NULL);
if (!list)
return (NULL);
if (!(iter = nm_ap_list_iter_new (list)))
return (NULL);
while ((ap = nm_ap_list_iter_next (iter)))
{
2004-11-17 Dan Williams <dcbw@redhat.com> * Cache access point MAC addresses in NetworkManagerInfo after you've explicitly connected to them. Then, after a scan, match up non-ESSID-broadcasting access points with any cached MAC addresses from NetworkManagerInfo. Allows us to show known access points that don't broadcast their ESSID in the menus without any user intervention whatsoever. * info-daemon/NetworkManagerInfoDbus.c - (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions for dbus method calls "getNetworkAddresses" and "addNetworkAddress" * src/NetworkManagerAP.[ch] - Add a "user_addresses" data member to the NMAccessPoint structure - (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing the user_addresses data member * src/NetworkManagerAPList.c - (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just the AP's reported address - (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo * src/NetworkManagerDHCP.c - Increase DHCP timeout from 25s -> 30s * src/NetworkManagerDbus.[ch] - (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set user addresses * src/NetworkManagerDevice.c - (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up, wait 2s, then configure it. Sometimes Prism54 cards will freeze up with "mgnt tx queue full", seemingly in response to NM controlling the card too much. So, we take the card down to clear it out. - (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list too, since that's where the user_addresses are * src/NetworkManagerPolicy.c - (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to that wireless networks' user_addresses list upon successful activation git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
GSList *user_addrs;
gboolean success = FALSE;
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
if (nm_ap_get_address (ap) && (memcmp (addr, nm_ap_get_address (ap), sizeof (struct ether_addr)) == 0))
2004-11-17 Dan Williams <dcbw@redhat.com> * Cache access point MAC addresses in NetworkManagerInfo after you've explicitly connected to them. Then, after a scan, match up non-ESSID-broadcasting access points with any cached MAC addresses from NetworkManagerInfo. Allows us to show known access points that don't broadcast their ESSID in the menus without any user intervention whatsoever. * info-daemon/NetworkManagerInfoDbus.c - (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions for dbus method calls "getNetworkAddresses" and "addNetworkAddress" * src/NetworkManagerAP.[ch] - Add a "user_addresses" data member to the NMAccessPoint structure - (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing the user_addresses data member * src/NetworkManagerAPList.c - (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just the AP's reported address - (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo * src/NetworkManagerDHCP.c - Increase DHCP timeout from 25s -> 30s * src/NetworkManagerDbus.[ch] - (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set user addresses * src/NetworkManagerDevice.c - (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up, wait 2s, then configure it. Sometimes Prism54 cards will freeze up with "mgnt tx queue full", seemingly in response to NM controlling the card too much. So, we take the card down to clear it out. - (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list too, since that's where the user_addresses are * src/NetworkManagerPolicy.c - (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to that wireless networks' user_addresses list upon successful activation git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
success = TRUE;
if (!success && (user_addrs = nm_ap_get_user_addresses (ap)))
{
char char_addr[20];
GSList *elt;
2004-11-17 Dan Williams <dcbw@redhat.com> * Cache access point MAC addresses in NetworkManagerInfo after you've explicitly connected to them. Then, after a scan, match up non-ESSID-broadcasting access points with any cached MAC addresses from NetworkManagerInfo. Allows us to show known access points that don't broadcast their ESSID in the menus without any user intervention whatsoever. * info-daemon/NetworkManagerInfoDbus.c - (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions for dbus method calls "getNetworkAddresses" and "addNetworkAddress" * src/NetworkManagerAP.[ch] - Add a "user_addresses" data member to the NMAccessPoint structure - (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing the user_addresses data member * src/NetworkManagerAPList.c - (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just the AP's reported address - (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo * src/NetworkManagerDHCP.c - Increase DHCP timeout from 25s -> 30s * src/NetworkManagerDbus.[ch] - (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set user addresses * src/NetworkManagerDevice.c - (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up, wait 2s, then configure it. Sometimes Prism54 cards will freeze up with "mgnt tx queue full", seemingly in response to NM controlling the card too much. So, we take the card down to clear it out. - (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list too, since that's where the user_addresses are * src/NetworkManagerPolicy.c - (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to that wireless networks' user_addresses list upon successful activation git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
memset (&char_addr[0], 0, 20);
iw_ether_ntop (addr, &char_addr[0]);
for (elt = user_addrs; elt; elt = g_slist_next (elt))
2004-11-17 Dan Williams <dcbw@redhat.com> * Cache access point MAC addresses in NetworkManagerInfo after you've explicitly connected to them. Then, after a scan, match up non-ESSID-broadcasting access points with any cached MAC addresses from NetworkManagerInfo. Allows us to show known access points that don't broadcast their ESSID in the menus without any user intervention whatsoever. * info-daemon/NetworkManagerInfoDbus.c - (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions for dbus method calls "getNetworkAddresses" and "addNetworkAddress" * src/NetworkManagerAP.[ch] - Add a "user_addresses" data member to the NMAccessPoint structure - (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing the user_addresses data member * src/NetworkManagerAPList.c - (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just the AP's reported address - (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo * src/NetworkManagerDHCP.c - Increase DHCP timeout from 25s -> 30s * src/NetworkManagerDbus.[ch] - (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set user addresses * src/NetworkManagerDevice.c - (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up, wait 2s, then configure it. Sometimes Prism54 cards will freeze up with "mgnt tx queue full", seemingly in response to NM controlling the card too much. So, we take the card down to clear it out. - (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list too, since that's where the user_addresses are * src/NetworkManagerPolicy.c - (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to that wireless networks' user_addresses list upon successful activation git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
{
if (elt->data && !strcmp (elt->data, &char_addr[0]))
2004-11-17 Dan Williams <dcbw@redhat.com> * Cache access point MAC addresses in NetworkManagerInfo after you've explicitly connected to them. Then, after a scan, match up non-ESSID-broadcasting access points with any cached MAC addresses from NetworkManagerInfo. Allows us to show known access points that don't broadcast their ESSID in the menus without any user intervention whatsoever. * info-daemon/NetworkManagerInfoDbus.c - (nmi_dbus_get_network_addresses, nmi_dbus_add_network_address): new functions for dbus method calls "getNetworkAddresses" and "addNetworkAddress" * src/NetworkManagerAP.[ch] - Add a "user_addresses" data member to the NMAccessPoint structure - (nm_ap_get_user_addresses, nm_ap_set_user_addresses): new functions for accessing the user_addresses data member * src/NetworkManagerAPList.c - (nm_ap_list_get_ap_by_address): check user_addresses list too, instead of just the AP's reported address - (nm_ap_list_update_network): grab the user_addresses list from NetworkManagerInfo * src/NetworkManagerDHCP.c - Increase DHCP timeout from 25s -> 30s * src/NetworkManagerDbus.[ch] - (nm_dbus_get_network_addresses, nm_dbus_add_network_address): have NMI get/set user addresses * src/NetworkManagerDevice.c - (nm_device_set_wireless_config): bring down the interface, wait 4s, bring it up, wait 2s, then configure it. Sometimes Prism54 cards will freeze up with "mgnt tx queue full", seemingly in response to NM controlling the card too much. So, we take the card down to clear it out. - (nm_device_do_normal_scan): Copy over AP ESSIDs from the allowed access point list too, since that's where the user_addresses are * src/NetworkManagerPolicy.c - (nm_state_modification_monitor): Tell NMI to add an AP's hardware address to that wireless networks' user_addresses list upon successful activation git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@319 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-11-17 17:51:36 +00:00
{
success = TRUE;
break;
}
}
g_slist_foreach (user_addrs, (GFunc)g_free, NULL);
g_slist_free (user_addrs);
}
if (success)
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
{
found_ap = ap;
break;
}
}
nm_ap_list_iter_free (iter);
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
2004-07-27 Dan Williams <dcbw@redhat.com> * src/NetworkManagerAPList.[ch] src/Makefile.am - Add. Deal with allowed network list additions, deletions, and updates * dispatcher-daemon/NetworkManagerDispatcher.c - Add missing <dbus/dbus.h> header * info-daemon/NetworkManagerInfo.[ch] - Add missing <dbus/dbus.h> header - Implement the GConf notify callback to signal NetworkManager of an allowed network change - Better error checking * info-daemon/NetworkManagerInfoDbus.[ch] - Add missing <dbus/dbus.h> header - Convert to using dbus_message_append_args/dbus_message_get_args - Implement nmi_dbus_signal_update_allowed_network() to signal NetworkManager that an allowed network changed. We don't want to signal on individual keys _inside_ an allowed network really, just want NM to query the info daemon for updated info on all keys. - Better error checking * src/NetworkManager.[ch] - Add missing <dbus/dbus.h> header - Move allowed_ap_list free functions to NetworkManagerAPList.[ch] - Zero out NMData structure on free - No longer use a thread for allowed_ap_list updating, instead its now done through dbus queries against NetworkManagerInfo - Populate allowed_ap_list initially before adding existing network devices to the device list, so wireless devices can get their "best" AP * src/NetworkManagerDbus.[ch] - Convert to using dbus_message_append_args/dbus_message_get_args - Better error checking - Implement Allowed Network info functions to request allowed network info from NetworkManagerInfo - Implement the filter function to process signals from NetworkManagerInfo about changing allowed networks * src/NetworkManagerDevice.c - Fix file descriptor leak in nm_device_update_ip4_address() `CVS: Modified Files: git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@22 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-07-27 16:15:36 +00:00
return (found_ap);
}
/*
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
* nm_ap_list_copy_properties
*
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
* Update properties (like encryption keys or timestamps) in one access point list from
* access points in another list, if the APs in the first list are present
* in the second.
*
*/
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
void nm_ap_list_copy_properties (NMAccessPointList *dest, NMAccessPointList *source)
{
NMAPListIter *iter;
NMAccessPoint *dest_ap;
if (!dest || !source)
return;
if (!(iter = nm_ap_list_iter_new (dest)))
return;
while ((dest_ap = nm_ap_list_iter_next (iter)))
{
NMAccessPoint *src_ap = NULL;
if ((src_ap = nm_ap_list_get_ap_by_ssid (source, nm_ap_get_ssid (dest_ap))))
{
nm_ap_set_invalid (dest_ap, nm_ap_get_invalid (src_ap));
2007-08-28 Dan Williams <dcbw@redhat.com> Remove NMAPSecurity objects, they are replaced with flags on the APs for each AP's capabilities, and by NMConnection/NMSettings objects for user defined connections. * include/NetworkManager.h - Redefine 802.11 security properties. There are now device capabilities and AP flags and AP security flags. It was way to unclear before. * src/Makefile.am src/nm-ap-security-leap.h src/nm-ap-security-leap.c src/nm-ap-security-wpa-eap.c src/nm-ap-security-wpa-eap.h src/nm-ap-security-private.h src/nm-ap-security-wpa-psk.c src/nm-ap-security-wpa-psk.h src/nm-ap-security-wep.c src/nm-ap-security-wep.h src/nm-ap-security.c src/nm-ap-security.h - Removed, to be replaced with NMConnection/NMSettings objects * src/nm-dbus-nmi.c src/nm-dbus-nmi.h - Removed, to be replaced by code that talks to the new info daemon interface and gets NMConnection/NMSettings objects * src/backends/NetworkManagerSuSE.c - Remove usage of NMAPSecurity; should be replaced by a system-level info-daemon that does the same thing but talks the new info-daemon D-Bus interface * src/NetworkManagerAP.h src/NetworkManagerAP.c src/NetworkManagerAPList.c libnm-glib/libnm-glib-test.c - Remove usage of NMAPSecurity objects and adjust to new flags for WPA/RSN * libnm-glib/nm-access-point.c libnm-glib/nm-access-point.h introspection/nm-access-point.xml test/nm-tool.c - Adjust to new flags for AP security * utils/nm-utils.c utils/nm-utils.h src/vpn-manager/nm-dbus-vpn.c - Remove D-Bus pending call stuff from nm-utils and put it in the VPN stuff which is the only place it's used * src/nm-device-interface.c src/nm-device-interface.h introspection/nm-device.xml src/nm-activation-request.c src/nm-activation-request.h src/nm-device.c - Add a new 'specific_object' argument that hints to NM what actual AP or other device-specific thing the connection should apply to. NMConnection objects can apply to more than one actual device/AP. * libnm-util/nm-connection.c * libnm-util/nm-connection.h - Add 'have_secrets" call stubs * libnm-util/cipher.h - Move NM_AUTH_TYPE_* defines here for now * src/nm-device-802-11-wireless.c - Remove usage of NMAPSecurity, to be replaced with NMConnection/ NMSettings objects * src/NetworkManagerDbus.c * src/NetworkManagerPolicy.c - Remove usage of update_allowed_networks, should be pushing data in a different manner git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2738 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-08-28 14:47:31 +00:00
nm_ap_set_flags (dest_ap, nm_ap_get_flags (src_ap));
nm_ap_set_wpa_flags (dest_ap, nm_ap_get_wpa_flags (src_ap));
nm_ap_set_rsn_flags (dest_ap, nm_ap_get_rsn_flags (src_ap));
nm_ap_set_timestamp_via_timestamp (dest_ap, nm_ap_get_timestamp (src_ap));
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
}
}
nm_ap_list_iter_free (iter);
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
}
2005-02-27 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.[ch] panel-applet/NMWirelessAppletDbus.[ch] - Move to incremental network updates. Instead of blowing away our list of devices every time we get a signal from NetworkManager, we now incrementally add/remove networks when NetworkManager notifies us that a new network has appeared or disappered. Strength updates now happen on-the-fly for each access point as well. There are now two copies of data from NetworkManager: one for the dbus side, and one for the gui side. When the dbus side data is modified, it is copied over to the gui side so we don't have to hold the data_mutex for long periods of time (and therefore block animation of the applet's icon). - Clean up some memleaks too * panel-applet/NMWirelessAppletOtherNetworkDialog.c - Minor code beautification * src/NetworkManagerAPList.c - (nm_ap_list_merge_scanned_ap): return whether or not the access point is completely new and whether or not an existing one's strength was updated. Try to fix multiple access points and signal strength by using the highest signal strength in each scan for any given ESSID. * src/NetworkManagerDbus.[ch] - (nm_dbus_signal_wireless_network_change): consolidate signals that deal with wireless networks; now we have only WirelessNetworkUpdate which includes a UINT32 for Appeared, Disappeared, or StrengthChanged (see NetworkManager.h). - Kill usage of DbusMessageIter * src/NetworkManagerDevice.c - (nm_device_wireless_process_scan_results): Use the same timestamp for all APs in the same scan result list. Copy ESSIDs-by-address earlier on, for each AP rather than all-at-once. Also don't ever remove the AP a card is currently associated with from the network list. - Update for new signals during scan, send out Appeared, Disappeared, or StrengthChanged when necessary. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@477 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-02-27 06:11:16 +00:00
/*
* nm_ap_list_copy_one_ssid_by_address
2005-02-27 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.[ch] panel-applet/NMWirelessAppletDbus.[ch] - Move to incremental network updates. Instead of blowing away our list of devices every time we get a signal from NetworkManager, we now incrementally add/remove networks when NetworkManager notifies us that a new network has appeared or disappered. Strength updates now happen on-the-fly for each access point as well. There are now two copies of data from NetworkManager: one for the dbus side, and one for the gui side. When the dbus side data is modified, it is copied over to the gui side so we don't have to hold the data_mutex for long periods of time (and therefore block animation of the applet's icon). - Clean up some memleaks too * panel-applet/NMWirelessAppletOtherNetworkDialog.c - Minor code beautification * src/NetworkManagerAPList.c - (nm_ap_list_merge_scanned_ap): return whether or not the access point is completely new and whether or not an existing one's strength was updated. Try to fix multiple access points and signal strength by using the highest signal strength in each scan for any given ESSID. * src/NetworkManagerDbus.[ch] - (nm_dbus_signal_wireless_network_change): consolidate signals that deal with wireless networks; now we have only WirelessNetworkUpdate which includes a UINT32 for Appeared, Disappeared, or StrengthChanged (see NetworkManager.h). - Kill usage of DbusMessageIter * src/NetworkManagerDevice.c - (nm_device_wireless_process_scan_results): Use the same timestamp for all APs in the same scan result list. Copy ESSIDs-by-address earlier on, for each AP rather than all-at-once. Also don't ever remove the AP a card is currently associated with from the network list. - Update for new signals during scan, send out Appeared, Disappeared, or StrengthChanged when necessary. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@477 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-02-27 06:11:16 +00:00
*
* If the access point doesn't have an SSID, search through a list of access points
2005-02-27 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.[ch] panel-applet/NMWirelessAppletDbus.[ch] - Move to incremental network updates. Instead of blowing away our list of devices every time we get a signal from NetworkManager, we now incrementally add/remove networks when NetworkManager notifies us that a new network has appeared or disappered. Strength updates now happen on-the-fly for each access point as well. There are now two copies of data from NetworkManager: one for the dbus side, and one for the gui side. When the dbus side data is modified, it is copied over to the gui side so we don't have to hold the data_mutex for long periods of time (and therefore block animation of the applet's icon). - Clean up some memleaks too * panel-applet/NMWirelessAppletOtherNetworkDialog.c - Minor code beautification * src/NetworkManagerAPList.c - (nm_ap_list_merge_scanned_ap): return whether or not the access point is completely new and whether or not an existing one's strength was updated. Try to fix multiple access points and signal strength by using the highest signal strength in each scan for any given ESSID. * src/NetworkManagerDbus.[ch] - (nm_dbus_signal_wireless_network_change): consolidate signals that deal with wireless networks; now we have only WirelessNetworkUpdate which includes a UINT32 for Appeared, Disappeared, or StrengthChanged (see NetworkManager.h). - Kill usage of DbusMessageIter * src/NetworkManagerDevice.c - (nm_device_wireless_process_scan_results): Use the same timestamp for all APs in the same scan result list. Copy ESSIDs-by-address earlier on, for each AP rather than all-at-once. Also don't ever remove the AP a card is currently associated with from the network list. - Update for new signals during scan, send out Appeared, Disappeared, or StrengthChanged when necessary. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@477 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-02-27 06:11:16 +00:00
* and find one (if any) that has the MAC address of the access point we're looking for.
* If one is found, copy the SSID over to the original access point.
2005-02-27 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.[ch] panel-applet/NMWirelessAppletDbus.[ch] - Move to incremental network updates. Instead of blowing away our list of devices every time we get a signal from NetworkManager, we now incrementally add/remove networks when NetworkManager notifies us that a new network has appeared or disappered. Strength updates now happen on-the-fly for each access point as well. There are now two copies of data from NetworkManager: one for the dbus side, and one for the gui side. When the dbus side data is modified, it is copied over to the gui side so we don't have to hold the data_mutex for long periods of time (and therefore block animation of the applet's icon). - Clean up some memleaks too * panel-applet/NMWirelessAppletOtherNetworkDialog.c - Minor code beautification * src/NetworkManagerAPList.c - (nm_ap_list_merge_scanned_ap): return whether or not the access point is completely new and whether or not an existing one's strength was updated. Try to fix multiple access points and signal strength by using the highest signal strength in each scan for any given ESSID. * src/NetworkManagerDbus.[ch] - (nm_dbus_signal_wireless_network_change): consolidate signals that deal with wireless networks; now we have only WirelessNetworkUpdate which includes a UINT32 for Appeared, Disappeared, or StrengthChanged (see NetworkManager.h). - Kill usage of DbusMessageIter * src/NetworkManagerDevice.c - (nm_device_wireless_process_scan_results): Use the same timestamp for all APs in the same scan result list. Copy ESSIDs-by-address earlier on, for each AP rather than all-at-once. Also don't ever remove the AP a card is currently associated with from the network list. - Update for new signals during scan, send out Appeared, Disappeared, or StrengthChanged when necessary. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@477 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-02-27 06:11:16 +00:00
*
*/
void
nm_ap_list_copy_one_ssid_by_address (NMAccessPoint *ap,
NMAccessPointList *search_list)
2005-02-27 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.[ch] panel-applet/NMWirelessAppletDbus.[ch] - Move to incremental network updates. Instead of blowing away our list of devices every time we get a signal from NetworkManager, we now incrementally add/remove networks when NetworkManager notifies us that a new network has appeared or disappered. Strength updates now happen on-the-fly for each access point as well. There are now two copies of data from NetworkManager: one for the dbus side, and one for the gui side. When the dbus side data is modified, it is copied over to the gui side so we don't have to hold the data_mutex for long periods of time (and therefore block animation of the applet's icon). - Clean up some memleaks too * panel-applet/NMWirelessAppletOtherNetworkDialog.c - Minor code beautification * src/NetworkManagerAPList.c - (nm_ap_list_merge_scanned_ap): return whether or not the access point is completely new and whether or not an existing one's strength was updated. Try to fix multiple access points and signal strength by using the highest signal strength in each scan for any given ESSID. * src/NetworkManagerDbus.[ch] - (nm_dbus_signal_wireless_network_change): consolidate signals that deal with wireless networks; now we have only WirelessNetworkUpdate which includes a UINT32 for Appeared, Disappeared, or StrengthChanged (see NetworkManager.h). - Kill usage of DbusMessageIter * src/NetworkManagerDevice.c - (nm_device_wireless_process_scan_results): Use the same timestamp for all APs in the same scan result list. Copy ESSIDs-by-address earlier on, for each AP rather than all-at-once. Also don't ever remove the AP a card is currently associated with from the network list. - Update for new signals during scan, send out Appeared, Disappeared, or StrengthChanged when necessary. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@477 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-02-27 06:11:16 +00:00
{
NMAccessPoint * found_ap;
const GByteArray * ssid;
2005-02-27 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.[ch] panel-applet/NMWirelessAppletDbus.[ch] - Move to incremental network updates. Instead of blowing away our list of devices every time we get a signal from NetworkManager, we now incrementally add/remove networks when NetworkManager notifies us that a new network has appeared or disappered. Strength updates now happen on-the-fly for each access point as well. There are now two copies of data from NetworkManager: one for the dbus side, and one for the gui side. When the dbus side data is modified, it is copied over to the gui side so we don't have to hold the data_mutex for long periods of time (and therefore block animation of the applet's icon). - Clean up some memleaks too * panel-applet/NMWirelessAppletOtherNetworkDialog.c - Minor code beautification * src/NetworkManagerAPList.c - (nm_ap_list_merge_scanned_ap): return whether or not the access point is completely new and whether or not an existing one's strength was updated. Try to fix multiple access points and signal strength by using the highest signal strength in each scan for any given ESSID. * src/NetworkManagerDbus.[ch] - (nm_dbus_signal_wireless_network_change): consolidate signals that deal with wireless networks; now we have only WirelessNetworkUpdate which includes a UINT32 for Appeared, Disappeared, or StrengthChanged (see NetworkManager.h). - Kill usage of DbusMessageIter * src/NetworkManagerDevice.c - (nm_device_wireless_process_scan_results): Use the same timestamp for all APs in the same scan result list. Copy ESSIDs-by-address earlier on, for each AP rather than all-at-once. Also don't ever remove the AP a card is currently associated with from the network list. - Update for new signals during scan, send out Appeared, Disappeared, or StrengthChanged when necessary. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@477 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-02-27 06:11:16 +00:00
g_return_if_fail (ap != NULL);
/* Ignore APs that already have an SSID */
if (!search_list || nm_ap_get_ssid (ap))
return;
found_ap = nm_ap_list_get_ap_by_address (search_list, nm_ap_get_address (ap));
ssid = found_ap ? nm_ap_get_ssid (found_ap) : NULL;
if (ssid)
nm_ap_set_ssid (ap, ssid);
2005-02-27 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.[ch] panel-applet/NMWirelessAppletDbus.[ch] - Move to incremental network updates. Instead of blowing away our list of devices every time we get a signal from NetworkManager, we now incrementally add/remove networks when NetworkManager notifies us that a new network has appeared or disappered. Strength updates now happen on-the-fly for each access point as well. There are now two copies of data from NetworkManager: one for the dbus side, and one for the gui side. When the dbus side data is modified, it is copied over to the gui side so we don't have to hold the data_mutex for long periods of time (and therefore block animation of the applet's icon). - Clean up some memleaks too * panel-applet/NMWirelessAppletOtherNetworkDialog.c - Minor code beautification * src/NetworkManagerAPList.c - (nm_ap_list_merge_scanned_ap): return whether or not the access point is completely new and whether or not an existing one's strength was updated. Try to fix multiple access points and signal strength by using the highest signal strength in each scan for any given ESSID. * src/NetworkManagerDbus.[ch] - (nm_dbus_signal_wireless_network_change): consolidate signals that deal with wireless networks; now we have only WirelessNetworkUpdate which includes a UINT32 for Appeared, Disappeared, or StrengthChanged (see NetworkManager.h). - Kill usage of DbusMessageIter * src/NetworkManagerDevice.c - (nm_device_wireless_process_scan_results): Use the same timestamp for all APs in the same scan result list. Copy ESSIDs-by-address earlier on, for each AP rather than all-at-once. Also don't ever remove the AP a card is currently associated with from the network list. - Update for new signals during scan, send out Appeared, Disappeared, or StrengthChanged when necessary. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@477 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2005-02-27 06:11:16 +00:00
}
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
/*
* nm_ap_list_copy_ssids_by_address
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
*
* For each blank-SSID access point in the destination list, try to find
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
* an access point in the source list that has the same MAC address, and if
* its found, copy the source access point's SSID to the dest access point.
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
*
*/
void
nm_ap_list_copy_ssids_by_address (NMAccessPointList *dest,
NMAccessPointList *source)
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
{
NMAPListIter *iter;
NMAccessPoint *dest_ap;
if (!dest || !source)
return;
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
if (!(iter = nm_ap_list_iter_new (dest)))
return;
2004-10-13 Dan Williams <dcbw@redhat.com> * panel-applet/NMWirelessApplet.c - Add function to print out applet_state in a readable manner * src/NetworkManager.c - (main): Don't segfault when nm_dbus_init() fails, we had a left-over call to hal_shutdown() into which we passed NULL * src/NetworkManagerAP.c - (nm_ap_set_essid): Allow NULL essids * src/NetworkManagerAPList.[ch] - More use of nm_ap_list_[un]lock () - (nm_ap_list_get_ap_by_essid): don't warn when looking for a NULL network/essid, just return nothing. Also skip over NULL essid access points in the list when searching - (nm_ap_list_get_ap_by_address): new function - (nm_ap_list_update_network): set the access point's key source to NULL when the key returned from NetworkManagerInfo is NULL or of 0 length - nm_ap_list_update_keys() -> nm_ap_list_update_properties(), and copy timestamp over too - (nm_ap_list_copy_essids_by_address): new function, attempt to find the correct ESSID for a blank-essid access point by searching through another list and matching access point MAC addresses - (nm_ap_list_diff): exclude blank-essid access points from the diffs * src/NetworkManagerDbus.c - (nm_dbus_nm_set_active_device): deal with random networks the user may specify. This is mainly for access points that don't broadcast their essid. So if the user tells us to associate with some random ESSID that's not in our access point list, we find out if the access point does in fact exist (by attempting association and then matching that access point's MAC address with the essid the user gave us) and then we switch to it. - (nm_dbus_devices_handle_request): don't add blank-essid access points to the returned list of networks for the "getNetworks" method * src/NetworkManagerDevice.[ch] - Extra debugging info for link detection - (nm_device_ap_list_get_ap_by_address): new function, return an AP based on MAC address - (nm_device_get_path_for_ap): ignore blank-essid access points - (nm_device_wireless_network_exists): new function, find out whether a random ESSID exists by attempting to associate with it - (nm_device_do_normal_scan): allow blank-essid access points in our device list as long as they have an AP MAC address we can use. Also send WirelessNetwork[Dis]Appeared signals for non-active devices too. Lets the applet update more frequently. * src/backends/NetworkManagerGentoo.c - Patch from: Robert Paskowitz - Update backend code for Gentoo - Implement nm_system_device_update_config_info () * test/nmclienttest.c - (set_network_device): new function, takes a command-line argument and tells NetworkManager to use that wireless network git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@222 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-10-13 20:57:23 +00:00
while ((dest_ap = nm_ap_list_iter_next (iter)))
nm_ap_list_copy_one_ssid_by_address (dest_ap, source);
nm_ap_list_iter_free (iter);
}
/*
* nm_ap_list_get_type
*
* Return the type of an AP list
*
*/
NMNetworkType nm_ap_list_get_type (NMAccessPointList *list)
{
g_return_val_if_fail (list != NULL, NETWORK_TYPE_UNKNOWN);
return (list->type);
}
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
struct NMAPListIter
{
NMAccessPointList * list;
GSList * cur_pos;
gboolean valid;
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
};
NMAPListIter * nm_ap_list_iter_new (NMAccessPointList *list)
{
NMAPListIter *iter;
g_return_val_if_fail (list != NULL, NULL);
iter = g_slice_new (NMAPListIter);
iter->list = list;
iter->cur_pos = list->ap_list;
iter->valid = FALSE;
return iter;
}
NMAccessPoint * nm_ap_list_iter_get_ap (NMAPListIter *iter)
{
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (iter->valid, NULL);
if (!iter->cur_pos)
return (NULL);
return ((NMAccessPoint *)(iter->cur_pos->data));
}
NMAccessPoint * nm_ap_list_iter_next (NMAPListIter *iter)
{
g_return_val_if_fail (iter != NULL, NULL);
if (iter->valid) {
iter->cur_pos = g_slist_next (iter->cur_pos);
} else {
iter->valid = TRUE;
iter->cur_pos = iter->list->ap_list;
}
return (nm_ap_list_iter_get_ap (iter));
}
void nm_ap_list_iter_free (NMAPListIter *iter)
{
g_return_if_fail (iter != NULL);
2004-08-12 Dan Williams <dcbw@redhat.com> * info-daemon/passphrase.glade - Set window title to " " * panel-applet/Makefile.am panel-applet/keyring.png - Deliver to correct place * panel-applet/NMWirelessApplet.[ch] - Add comments - Remove applet->have_active_device as its no longer used - (nmwa_load_theme): load keyring.png too - (error_dialog): remove - (show_warning_dialog): subsume functionality of error dialog too - (nmwa_destroy, nmwa_new): create and dispose of an application-wide GConfClient - (nmwa_handle_network_choice): add to deal with user clicking on an item from the networks menu - (nmwa_menu_item_activated): GtkMenuItem "activate" signal handler - (nmwa_button_clicked, nmwa_setup_widgets): create and populate the menu on startup and when we get broadcasts of changed wireless access points only, not when the user clicks on the button to display the menu (too long of a wait) - (nmwa_add_menu_item): Make active network bold, and place a keyring icon beside networks that are encrypted - (nmwa_dispose_menu, nmwa_menu_item_data_free): dispose of the data we place on each menu item with g_object_set_data() * panel-applet/NMWirelessAppletDbus.[ch] - (nmwa_dbus_get_bool): add method to return boolean value from dbus message - (nmwa_dbus_get_active_network): add (nmwa_dbus_get_string() wrapper to get active network) - (nmwa_dbus_add_networks_to_menu): clean up, only show one instance of each ESSID in the menu - (nmwa_dbus_set_network): force NetworkManager to use a particular network for wireless cards - (nmwa_dbus_init, nmwa_dbus_filter): Trap network appear/disappear and device activation/deactivation signals and rebuild the menu when they happen * src/NetworkManager.c - (main): use new nm_spawn_process() rather than system() * src/NetworkManagerDbus.c - (nm_dbus_devices_handle_request): don't compare AP structure addresses directly, but essids instead. Since we can now force best_aps to stick around, the AP structure to which dev->options.wireless.best_ap points to won't necessarily be in the device's device list if a scan has happened since the best_ap was frozen. Also add "setNetwork" method to freeze the best_ap. * src/NetworkManagerDevice.[ch] - (nm_device_activation_worker): Use new nm_spawn_process() call rather than system() - (nm_device_*_best_ap): add freeze/unfreeze/get_frozen functions, and don't really update the best_ap in nm_device_update_best_ap() if the best_ap is frozen AND in the device's ap list * src/NetworkManagerUtils.[ch] - (nm_spawn_process): add replacement for system() usage git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@48 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-12 19:58:01 +00:00
memset (iter, 0, sizeof (struct NMAPListIter));
g_slice_free (NMAPListIter, iter);
}
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
/*
* nm_ap_list_print_members
*
* Print the information about each access point in an AP list
*
*/
void nm_ap_list_print_members (NMAccessPointList *list, const char *name)
{
NMAccessPoint * ap;
NMAPListIter * iter;
int i = 0;
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
g_return_if_fail (list != NULL);
g_return_if_fail (name != NULL);
if (!(iter = nm_ap_list_iter_new (list)))
return;
nm_info ("AP_LIST_PRINT: printing members of '%s'", name);
while ((ap = nm_ap_list_iter_next (iter)))
nm_ap_print_self (ap, "::\t");
nm_info ("AP_LIST_PRINT: done");
2004-08-11 Dan Williams <dcbw@redhat.com> * info-daemon/NetworkManagerInfo.c: - (main): clean up Seth's code style * info-daemon/NetworkManagerInfoDbus.c: - Use the more aptly-named path/service/interface constants from NetworkManager - Don't return empty strings ("") as object paths ever, instead return errors * panel-applet/NMWirelessApplet.c: - Clean up Seth's code style * src/NetworkManager.[ch] - (nm_remove_device_from_list): remove anything having to do with pending_device - (main, nm_print_usage): change --daemon=[yes|no] -> --no-daemon * src/NetworkManagerAPList.[ch] - Move Iter struct right above the iter functions to preserve opacity - (nm_ap_list_remove_ap): implement - (nm_ap_list_update_network): deal with errors returned from nm_dbus_get_network_priority(), remove AP if NetworkManagerInfo doesn't know anything about it - (nm_ap_list_diff): user NMAPList iterators - (nm_ap_list_print_members): implement debugging function * src/NetworkManagerDbus.[ch] - (nm_dbus_nm_get_active_device): remove anything to do with pending_device - (nm_dbus_get_user_key_for_network): remove DBusPendingCall stuff (unused), and move the actual key setting stuff into NetworkManagerDevice.c - (nm_dbus_get_network_priority): return -1 now on errors - (nm_dbus_nmi_filter): fix strcmp() error that caused PreferredNetworkUpdate signals to get lost, and force the active device to update its "best" ap when AP lists change - (nm_dbus_nm_message_handler): Update conditions for returning "connecting" for a "status" method call due to pending_device member removal * src/NetworkManagerDevice.[ch] - Move NMDevice structure to the top - Add a wireless scan mutex and a best_ap mutex to the Wireless Options structure - Remove Pending Action stuff from everywhere - (nm_device_activation_*): We now "begin" activation and start a thread to do the activation for us. This thread blocks until all conditions for activation have been met (ie for wireless devices, we need a valid WEP key and a "best" ap), and then setup up the interface and runs dhclient. We have to do this because there is no guaruntee how long dhclient takes, and while we are blocking on it, we cannot run our main loop and respond to dbus method calls or HAL device removals/inserts - (nm_device_set_user_key_for_network): Move logic here from NetworkManagerDbus.c so we can tell nm_device_activation_worker() that we've got a key - (nm_device_*_best_ap): lock access to best_ap member of Wireless Options structure - (nm_device_get_path_for_ap): dumb it down so the list doesn't lock against itself when diffing (AP appear/disappear signal functions make sure the AP is actually in the device's list) - (nm_device_update_best_ap): move logic from nm_wireless_is_ap_better() here * src/NetworkManagerPolicy.c - Remove anything to do with pending_device - Adjust device activation to deal with activation-in-worker-thread * src/NetworkManagerUtils.c - Clean up locking debugging a bit * src/NetworkManagerWireless.[ch] - (nm_wireless_is_ap_better): remove, stick logic in nm_device_update_best_ap(). This function was badly named and is better as a device function * panel-applet/.cvsignore: add git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@46 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2004-08-11 18:14:02 +00:00
nm_ap_list_iter_free (iter);
}