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 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"
|
2006-10-13 19:41:47 +00:00
|
|
|
#include "nm-dbus-manager.h"
|
2004-07-27 16:15:36 +00:00
|
|
|
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
struct NMAccessPointList
|
|
|
|
|
{
|
2007-01-04 12:06:26 +00:00
|
|
|
guint refcount;
|
|
|
|
|
NMNetworkType type;
|
|
|
|
|
GSList * ap_list;
|
2004-08-05 18:54:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2004-08-02 21:12:40 +00:00
|
|
|
/*
|
2004-08-05 18:54:29 +00:00
|
|
|
* nm_ap_list_new
|
2004-08-02 21:12:40 +00:00
|
|
|
*
|
2004-08-05 18:54:29 +00:00
|
|
|
* Creates a new empty access point list
|
2004-08-02 21:12:40 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2004-08-05 18:54:29 +00:00
|
|
|
NMAccessPointList *nm_ap_list_new (NMNetworkType type)
|
2004-08-02 21:12:40 +00:00
|
|
|
{
|
2006-08-04 15:46:06 +00:00
|
|
|
NMAccessPointList *list = g_slice_new0 (NMAccessPointList);
|
2004-08-02 21:12:40 +00:00
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
nm_ap_list_ref (list);
|
|
|
|
|
list->type = type;
|
2007-01-04 12:06:26 +00:00
|
|
|
return list;
|
2004-08-05 18:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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)
|
|
|
|
|
{
|
2005-02-07 22:35:07 +00:00
|
|
|
if (!list)
|
|
|
|
|
return;
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
list->refcount--;
|
2007-01-04 12:06:26 +00:00
|
|
|
if (list->refcount <= 0) {
|
2007-02-16 11:23:49 +00:00
|
|
|
g_slist_foreach (list->ap_list, (GFunc) g_object_unref, NULL);
|
2004-08-05 18:54:29 +00:00
|
|
|
g_slist_free (list->ap_list);
|
2006-08-04 15:46:06 +00:00
|
|
|
g_slice_free (NMAccessPointList, list);
|
2004-08-02 21:12:40 +00:00
|
|
|
}
|
2004-08-05 18:54:29 +00:00
|
|
|
}
|
2004-08-02 21:12:40 +00:00
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
|
2005-04-27 18:05:16 +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);
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
return g_slist_length (list->ap_list);
|
2005-04-27 18:05:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-10-11 21:32:19 +00:00
|
|
|
/*
|
|
|
|
|
* 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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
/*
|
|
|
|
|
* 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);
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
list->ap_list = g_slist_append (list->ap_list, g_object_ref (ap));
|
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)
|
|
|
|
|
{
|
2005-02-10 04:39:40 +00:00
|
|
|
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);
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
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
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
if (list_ap == ap) {
|
2005-02-10 04:39:40 +00:00
|
|
|
list->ap_list = g_slist_remove_link (list->ap_list, elt);
|
2007-02-16 11:23:49 +00:00
|
|
|
g_object_unref (list_ap);
|
2005-02-10 04:39:40 +00:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
|
2005-04-04 21:24:58 +00:00
|
|
|
/*
|
2007-06-27 16:18:52 +00:00
|
|
|
* nm_ap_list_remove_ap_by_ssid
|
2005-04-04 21:24:58 +00:00
|
|
|
*
|
2007-06-27 16:18:52 +00:00
|
|
|
* Helper to remove an AP from an AP list by the AP's SSID.
|
2005-04-04 21:24:58 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2007-06-27 16:18:52 +00:00
|
|
|
void
|
|
|
|
|
nm_ap_list_remove_ap_by_ssid (NMAccessPointList *list, const GByteArray * ssid)
|
2005-04-04 21:24:58 +00:00
|
|
|
{
|
2007-06-27 16:18:52 +00:00
|
|
|
GSList * elt = NULL;
|
2005-04-04 21:24:58 +00:00
|
|
|
|
|
|
|
|
g_return_if_fail (list != NULL);
|
2007-06-27 16:18:52 +00:00
|
|
|
g_return_if_fail (ssid != NULL);
|
2005-04-04 21:24:58 +00:00
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
for (elt = list->ap_list; elt; elt = g_slist_next (elt)) {
|
|
|
|
|
NMAccessPoint * list_ap = (NMAccessPoint *) elt->data;
|
2005-04-04 21:24:58 +00:00
|
|
|
|
2007-08-15 01:56:02 +00:00
|
|
|
if (nm_utils_same_ssid (nm_ap_get_ssid (list_ap), ssid, TRUE)) {
|
2005-04-04 21:24:58 +00:00
|
|
|
list->ap_list = g_slist_remove_link (list->ap_list, elt);
|
2007-02-16 11:23:49 +00:00
|
|
|
g_object_unref (list_ap);
|
2005-04-04 21:24:58 +00:00
|
|
|
g_slist_free (elt);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
/* nm_ap_list_remove_duplicate_ssids
|
2005-04-15 20:00:28 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2007-06-27 16:18:52 +00:00
|
|
|
void nm_ap_list_remove_duplicate_ssids (NMAccessPointList *list)
|
2005-04-15 20:00:28 +00:00
|
|
|
{
|
|
|
|
|
NMAccessPoint *removal_ap;
|
|
|
|
|
NMAccessPoint *list_ap_max;
|
|
|
|
|
GSList *elt_i = NULL;
|
|
|
|
|
GSList *elt_j = NULL;
|
2005-06-26 02:53:59 +00:00
|
|
|
GSList *elt_max = NULL;
|
2005-04-15 20:00:28 +00:00
|
|
|
GSList *removal_list = NULL;
|
|
|
|
|
GSList *elt;
|
|
|
|
|
gint8 max_strength = 0;
|
|
|
|
|
gint8 strengthj = 0;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (list != NULL);
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
for (elt_i = list->ap_list; elt_i; elt_i = g_slist_next (elt_i)) {
|
|
|
|
|
NMAccessPoint * list_ap_i = (NMAccessPoint *) elt_i->data;
|
2007-06-27 16:18:52 +00:00
|
|
|
const GByteArray * list_ap_i_ssid = nm_ap_get_ssid (list_ap_i);
|
2007-01-04 12:06:26 +00:00
|
|
|
gboolean found = FALSE;
|
2005-04-15 20:00:28 +00:00
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
for (elt_j = list->ap_list; elt_j < elt_i; elt_j = g_slist_next (elt_j)) {
|
2007-06-27 16:18:52 +00:00
|
|
|
NMAccessPoint * list_ap_j = (NMAccessPoint *) elt_j->data;
|
|
|
|
|
const GByteArray * list_ap_j_ssid = nm_ap_get_ssid (list_ap_j);
|
2005-04-15 20:00:28 +00:00
|
|
|
|
2007-08-15 01:56:02 +00:00
|
|
|
if ((found = nm_utils_same_ssid (list_ap_i_ssid, list_ap_j_ssid, TRUE)))
|
2005-04-15 20:00:28 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
elt_max = elt_i;
|
|
|
|
|
list_ap_max = (NMAccessPoint *)(elt_i->data);
|
|
|
|
|
max_strength = nm_ap_get_strength (list_ap_i);
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
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;
|
2007-06-27 16:18:52 +00:00
|
|
|
const GByteArray * list_ap_j_ssid = nm_ap_get_ssid (list_ap_j);
|
2005-04-15 20:00:28 +00:00
|
|
|
|
|
|
|
|
strengthj = nm_ap_get_strength (list_ap_j);
|
2007-08-15 01:56:02 +00:00
|
|
|
if (nm_utils_same_ssid (list_ap_i_ssid, list_ap_j_ssid, TRUE)) {
|
2007-01-04 12:06:26 +00:00
|
|
|
if (strengthj > max_strength) {
|
2005-04-15 20:00:28 +00:00
|
|
|
removal_list = g_slist_append (removal_list, list_ap_max);
|
|
|
|
|
list_ap_max = list_ap_j;
|
|
|
|
|
max_strength = strengthj;
|
2007-01-04 12:06:26 +00:00
|
|
|
} else {
|
2005-04-15 20:00:28 +00:00
|
|
|
removal_list = g_slist_append (removal_list, list_ap_j);
|
2007-01-04 12:06:26 +00:00
|
|
|
}
|
2005-04-15 20:00:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
for (elt = removal_list; elt; elt = g_slist_next (elt)) {
|
2005-04-15 20:00:28 +00:00
|
|
|
if ((removal_ap = (NMAccessPoint *)(elt->data)))
|
|
|
|
|
nm_ap_list_remove_ap (list, removal_ap);
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (removal_list);
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-04 21:24:58 +00:00
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
/*
|
2007-06-27 16:18:52 +00:00
|
|
|
* nm_ap_list_get_ap_by_ssid
|
2004-07-27 16:15:36 +00:00
|
|
|
*
|
2004-08-05 18:54:29 +00:00
|
|
|
* Search through an access point list and return the access point
|
2007-06-27 16:18:52 +00:00
|
|
|
* that has a given SSID.
|
2004-07-27 16:15:36 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2007-06-27 16:18:52 +00:00
|
|
|
NMAccessPoint *
|
|
|
|
|
nm_ap_list_get_ap_by_ssid (NMAccessPointList *list, const GByteArray * ssid)
|
2004-07-27 16:15:36 +00:00
|
|
|
{
|
2004-08-06 18:19:06 +00:00
|
|
|
NMAccessPoint *ap;
|
2004-07-27 16:15:36 +00:00
|
|
|
NMAccessPoint *found_ap = NULL;
|
2004-08-06 18:19:06 +00:00
|
|
|
NMAPListIter *iter;
|
2004-07-27 16:15:36 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
if (!ssid || !list)
|
|
|
|
|
return NULL;
|
2004-08-05 18:54:29 +00:00
|
|
|
|
2004-08-06 18:19:06 +00:00
|
|
|
if (!(iter = nm_ap_list_iter_new (list)))
|
2007-06-27 16:18:52 +00:00
|
|
|
return NULL;
|
2004-08-05 18:54:29 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
while ((ap = nm_ap_list_iter_next (iter))) {
|
|
|
|
|
const GByteArray * ap_ssid = nm_ap_get_ssid (ap);
|
2007-08-15 01:56:02 +00:00
|
|
|
if (ap_ssid && nm_utils_same_ssid (ap_ssid, ssid, TRUE)) {
|
2004-08-05 18:54:29 +00:00
|
|
|
found_ap = ap;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-10-13 20:57:23 +00:00
|
|
|
nm_ap_list_iter_free (iter);
|
|
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
return found_ap;
|
2004-10-13 20:57:23 +00:00
|
|
|
}
|
2004-08-05 18:54:29 +00:00
|
|
|
|
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 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];
|
2005-02-10 04:39:40 +00:00
|
|
|
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);
|
2005-11-09 01:56:03 +00:00
|
|
|
iw_ether_ntop (addr, &char_addr[0]);
|
2005-02-10 04:39:40 +00:00
|
|
|
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
|
|
|
{
|
2005-02-10 04:39:40 +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 20:57:23 +00:00
|
|
|
{
|
|
|
|
|
found_ap = ap;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-08-06 18:19:06 +00:00
|
|
|
nm_ap_list_iter_free (iter);
|
2004-10-13 20:57:23 +00:00
|
|
|
|
2004-07-27 16:15:36 +00:00
|
|
|
return (found_ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-10-11 21:32:19 +00:00
|
|
|
/*
|
2004-10-13 20:57:23 +00:00
|
|
|
* nm_ap_list_copy_properties
|
2004-10-11 21:32:19 +00:00
|
|
|
*
|
2004-10-13 20:57:23 +00:00
|
|
|
* Update properties (like encryption keys or timestamps) in one access point list from
|
2004-10-11 21:32:19 +00:00
|
|
|
* access points in another list, if the APs in the first list are present
|
|
|
|
|
* in the second.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-10-13 20:57:23 +00:00
|
|
|
void nm_ap_list_copy_properties (NMAccessPointList *dest, NMAccessPointList *source)
|
2004-10-11 21:32:19 +00:00
|
|
|
{
|
|
|
|
|
NMAPListIter *iter;
|
|
|
|
|
NMAccessPoint *dest_ap;
|
|
|
|
|
|
2004-12-17 17:16:22 +00:00
|
|
|
if (!dest || !source)
|
|
|
|
|
return;
|
2004-10-11 21:32:19 +00:00
|
|
|
|
2006-10-13 19:41:47 +00:00
|
|
|
if (!(iter = nm_ap_list_iter_new (dest)))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
while ((dest_ap = nm_ap_list_iter_next (iter)))
|
2004-10-11 21:32:19 +00:00
|
|
|
{
|
2006-10-13 19:41:47 +00:00
|
|
|
NMAccessPoint *src_ap = NULL;
|
2004-10-11 21:32:19 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
if ((src_ap = nm_ap_list_get_ap_by_ssid (source, nm_ap_get_ssid (dest_ap))))
|
2006-10-13 19:41:47 +00:00
|
|
|
{
|
|
|
|
|
nm_ap_set_invalid (dest_ap, nm_ap_get_invalid (src_ap));
|
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));
|
2006-10-13 19:41:47 +00:00
|
|
|
nm_ap_set_timestamp_via_timestamp (dest_ap, nm_ap_get_timestamp (src_ap));
|
2004-10-13 20:57:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-10-13 19:41:47 +00:00
|
|
|
nm_ap_list_iter_free (iter);
|
2004-10-13 20:57:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-02-27 06:11:16 +00:00
|
|
|
/*
|
2007-06-27 16:18:52 +00:00
|
|
|
* nm_ap_list_copy_one_ssid_by_address
|
2005-02-27 06:11:16 +00:00
|
|
|
*
|
2007-06-27 16:18:52 +00:00
|
|
|
* If the access point doesn't have an SSID, search through a list of access points
|
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.
|
2007-06-27 16:18:52 +00:00
|
|
|
* If one is found, copy the SSID over to the original access point.
|
2005-02-27 06:11:16 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2006-10-13 19:41:47 +00:00
|
|
|
void
|
2007-06-27 16:18:52 +00:00
|
|
|
nm_ap_list_copy_one_ssid_by_address (NMAccessPoint *ap,
|
|
|
|
|
NMAccessPointList *search_list)
|
2005-02-27 06:11:16 +00:00
|
|
|
{
|
2007-06-27 16:18:52 +00:00
|
|
|
NMAccessPoint * found_ap;
|
|
|
|
|
const GByteArray * ssid;
|
2005-02-27 06:11:16 +00:00
|
|
|
|
2006-11-10 02:51:02 +00:00
|
|
|
g_return_if_fail (ap != NULL);
|
|
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
/* Ignore APs that already have an SSID */
|
|
|
|
|
if (!search_list || nm_ap_get_ssid (ap))
|
2006-10-13 19:41:47 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
found_ap = nm_ap_list_get_ap_by_address (search_list, nm_ap_get_address (ap));
|
2007-06-27 16:18:52 +00:00
|
|
|
ssid = found_ap ? nm_ap_get_ssid (found_ap) : NULL;
|
2006-10-13 19:41:47 +00:00
|
|
|
|
2007-06-27 16:18:52 +00:00
|
|
|
if (ssid)
|
|
|
|
|
nm_ap_set_ssid (ap, ssid);
|
2005-02-27 06:11:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-10-13 20:57:23 +00:00
|
|
|
/*
|
2007-06-27 16:18:52 +00:00
|
|
|
* nm_ap_list_copy_ssids_by_address
|
2004-10-13 20:57:23 +00:00
|
|
|
*
|
2007-06-27 16:18:52 +00:00
|
|
|
* For each blank-SSID access point in the destination list, try to find
|
2004-10-13 20:57:23 +00:00
|
|
|
* an access point in the source list that has the same MAC address, and if
|
2007-06-27 16:18:52 +00:00
|
|
|
* its found, copy the source access point's SSID to the dest access point.
|
2004-10-13 20:57:23 +00:00
|
|
|
*
|
|
|
|
|
*/
|
2006-10-13 19:41:47 +00:00
|
|
|
void
|
2007-06-27 16:18:52 +00:00
|
|
|
nm_ap_list_copy_ssids_by_address (NMAccessPointList *dest,
|
|
|
|
|
NMAccessPointList *source)
|
2004-10-13 20:57:23 +00:00
|
|
|
{
|
|
|
|
|
NMAPListIter *iter;
|
|
|
|
|
NMAccessPoint *dest_ap;
|
|
|
|
|
|
2004-12-17 17:16:22 +00:00
|
|
|
if (!dest || !source)
|
|
|
|
|
return;
|
2004-10-13 20:57:23 +00:00
|
|
|
|
2006-10-13 19:41:47 +00:00
|
|
|
if (!(iter = nm_ap_list_iter_new (dest)))
|
|
|
|
|
return;
|
2004-10-13 20:57:23 +00:00
|
|
|
|
2006-10-13 19:41:47 +00:00
|
|
|
while ((dest_ap = nm_ap_list_iter_next (iter)))
|
2007-06-27 16:18:52 +00:00
|
|
|
nm_ap_list_copy_one_ssid_by_address (dest_ap, source);
|
2006-10-13 19:41:47 +00:00
|
|
|
nm_ap_list_iter_free (iter);
|
2004-10-11 21:32:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-04-27 18:05:16 +00:00
|
|
|
/*
|
|
|
|
|
* 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
|
|
|
|
|
{
|
2007-01-04 12:06:26 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2004-08-05 18:54:29 +00:00
|
|
|
NMAPListIter * nm_ap_list_iter_new (NMAccessPointList *list)
|
|
|
|
|
{
|
|
|
|
|
NMAPListIter *iter;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (list != NULL, NULL);
|
|
|
|
|
|
2006-08-04 15:46:06 +00:00
|
|
|
iter = g_slice_new (NMAPListIter);
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
iter->list = list;
|
|
|
|
|
iter->cur_pos = list->ap_list;
|
|
|
|
|
iter->valid = FALSE;
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
return iter;
|
2004-08-05 18:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2004-08-06 18:19:06 +00:00
|
|
|
|
|
|
|
|
if (!iter->cur_pos)
|
|
|
|
|
return (NULL);
|
2004-08-05 18:54:29 +00:00
|
|
|
|
|
|
|
|
return ((NMAccessPoint *)(iter->cur_pos->data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NMAccessPoint * nm_ap_list_iter_next (NMAPListIter *iter)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (iter != NULL, NULL);
|
|
|
|
|
|
2007-01-04 12:06:26 +00:00
|
|
|
if (iter->valid) {
|
2004-08-05 18:54:29 +00:00
|
|
|
iter->cur_pos = g_slist_next (iter->cur_pos);
|
2007-01-04 12:06:26 +00:00
|
|
|
} else {
|
2004-08-05 18:54:29 +00:00
|
|
|
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));
|
2006-08-04 15:46:06 +00:00
|
|
|
g_slice_free (NMAPListIter, iter);
|
2004-08-05 18:54:29 +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_print_members
|
|
|
|
|
*
|
|
|
|
|
* Print the information about each access point in an AP list
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void nm_ap_list_print_members (NMAccessPointList *list, const char *name)
|
|
|
|
|
{
|
2006-11-26 19:47:29 +00:00
|
|
|
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;
|
|
|
|
|
|
2006-11-26 19:47:29 +00:00
|
|
|
nm_info ("AP_LIST_PRINT: printing members of '%s'", name);
|
2007-08-21 01:41:04 +00:00
|
|
|
while ((ap = nm_ap_list_iter_next (iter)))
|
|
|
|
|
nm_ap_print_self (ap, "::\t");
|
2006-11-26 19:47:29 +00:00
|
|
|
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);
|
|
|
|
|
}
|
2007-08-15 01:59:19 +00:00
|
|
|
|