2006-01-06 Robert Love <rml@novell.com>
* src/NetworkManagerDevice.c, src/NetworkManagerDevice.h, src/NetworkManagerDevicePrivate.h, src/NetworkManagerWireless.c, src/NetworkManagerWireless.h: Remove, no longer used and they keep showing up in my greps. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1278 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2006-01-06 Robert Love <rml@novell.com>
|
||||||
|
|
||||||
|
* src/NetworkManagerDevice.c, src/NetworkManagerDevice.h,
|
||||||
|
src/NetworkManagerDevicePrivate.h, src/NetworkManagerWireless.c,
|
||||||
|
src/NetworkManagerWireless.h: Remove, no longer used and they keep
|
||||||
|
showing up in my greps.
|
||||||
|
|
||||||
2006-01-06 Robert Love <rml@novell.com>
|
2006-01-06 Robert Love <rml@novell.com>
|
||||||
|
|
||||||
* gnome/applet/applet-dbus-devices.c,
|
* gnome/applet/applet-dbus-devices.c,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,145 +0,0 @@
|
|||||||
/* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NETWORK_MANAGER_DEVICE_H
|
|
||||||
#define NETWORK_MANAGER_DEVICE_H
|
|
||||||
|
|
||||||
#include <net/ethernet.h>
|
|
||||||
#include <iwlib.h>
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "NetworkManagerMain.h"
|
|
||||||
#include "nm-ip4-config.h"
|
|
||||||
#include "nm-ap-security.h"
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define IOCTL_DEBUG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct NMDevice NMDevice;
|
|
||||||
|
|
||||||
typedef enum NMWirelessScanInterval
|
|
||||||
{
|
|
||||||
NM_WIRELESS_SCAN_INTERVAL_INIT = 0,
|
|
||||||
NM_WIRELESS_SCAN_INTERVAL_ACTIVE,
|
|
||||||
NM_WIRELESS_SCAN_INTERVAL_INACTIVE
|
|
||||||
} NMWirelessScanInterval;
|
|
||||||
|
|
||||||
NMDevice * nm_device_new (const char *iface, const char *udi, gboolean test_device,
|
|
||||||
NMDeviceType test_dev_type, NMData *app_data);
|
|
||||||
|
|
||||||
void nm_device_ref (NMDevice *dev);
|
|
||||||
gboolean nm_device_unref (NMDevice *dev);
|
|
||||||
void nm_device_worker_thread_stop (NMDevice *dev);
|
|
||||||
|
|
||||||
int nm_device_open_sock (void);
|
|
||||||
|
|
||||||
char * nm_device_get_udi (NMDevice *dev);
|
|
||||||
void nm_device_set_udi (NMDevice *dev, const char *udi);
|
|
||||||
|
|
||||||
const char * nm_device_get_iface (NMDevice *dev);
|
|
||||||
|
|
||||||
const char * nm_device_get_driver (NMDevice *dev);
|
|
||||||
|
|
||||||
NMDeviceType nm_device_get_type (NMDevice *dev);
|
|
||||||
guint32 nm_device_get_capabilities (NMDevice *dev);
|
|
||||||
guint32 nm_device_get_type_capabilities (NMDevice *dev);
|
|
||||||
|
|
||||||
gboolean nm_device_is_802_11_wireless (NMDevice *dev);
|
|
||||||
gboolean nm_device_is_802_3_ethernet (NMDevice *dev);
|
|
||||||
|
|
||||||
NMData * nm_device_get_app_data (const NMDevice *dev);
|
|
||||||
|
|
||||||
gboolean nm_device_get_removed (const NMDevice *dev);
|
|
||||||
void nm_device_set_removed (NMDevice *dev, const gboolean removed);
|
|
||||||
|
|
||||||
gboolean nm_device_has_active_link (NMDevice *dev);
|
|
||||||
void nm_device_set_link_active (NMDevice *dev, const gboolean active);
|
|
||||||
gboolean nm_device_probe_link_state (NMDevice *dev);
|
|
||||||
|
|
||||||
char * nm_device_get_essid (NMDevice *dev);
|
|
||||||
void nm_device_set_essid (NMDevice *dev, const char *essid);
|
|
||||||
|
|
||||||
void nm_device_get_ap_address (NMDevice *dev, struct ether_addr *addr);
|
|
||||||
|
|
||||||
int nm_device_get_mode (NMDevice *dev);
|
|
||||||
gboolean nm_device_set_mode (NMDevice *dev, const int mode);
|
|
||||||
|
|
||||||
guint32 nm_device_get_ip4_address (NMDevice *dev);
|
|
||||||
void nm_device_update_ip4_address (NMDevice *dev);
|
|
||||||
|
|
||||||
void nm_device_get_hw_address (NMDevice *dev, struct ether_addr *addr);
|
|
||||||
void nm_device_update_hw_address (NMDevice *dev);
|
|
||||||
|
|
||||||
void nm_device_get_ip6_address (NMDevice *dev);
|
|
||||||
|
|
||||||
gboolean nm_device_get_supports_wireless_scan (NMDevice *dev);
|
|
||||||
|
|
||||||
gboolean nm_device_get_supports_carrier_detect (NMDevice *dev);
|
|
||||||
|
|
||||||
gint8 nm_device_get_signal_strength (NMDevice *dev);
|
|
||||||
void nm_device_update_signal_strength (NMDevice *dev);
|
|
||||||
|
|
||||||
NMAccessPoint *nm_device_get_best_ap (NMDevice *dev);
|
|
||||||
|
|
||||||
void nm_device_set_wireless_scan_interval (NMDevice *dev, NMWirelessScanInterval interval);
|
|
||||||
|
|
||||||
void nm_device_set_wep_enc_key (NMDevice *dev, const char *key, int auth_method);
|
|
||||||
|
|
||||||
NMActRequest * nm_device_get_act_request (NMDevice *dev);
|
|
||||||
gboolean nm_device_activation_start (NMActRequest *req);
|
|
||||||
void nm_device_activate_schedule_stage1_device_prepare (NMActRequest *req);
|
|
||||||
void nm_device_activate_schedule_stage4_ip_config_get (NMActRequest *req);
|
|
||||||
void nm_device_activate_schedule_stage4_ip_config_timeout (NMActRequest *req);
|
|
||||||
void nm_device_activation_cancel (NMDevice *dev);
|
|
||||||
gboolean nm_device_activation_should_cancel (NMDevice *dev);
|
|
||||||
gboolean nm_device_is_activating (NMDevice *dev);
|
|
||||||
gboolean nm_device_deactivate_quickly (NMDevice *dev);
|
|
||||||
gboolean nm_device_deactivate (NMDevice *dev);
|
|
||||||
|
|
||||||
NMAccessPoint *nm_device_wireless_get_activation_ap (NMDevice *dev, const char *essid, NMAPSecurity *security);
|
|
||||||
|
|
||||||
void nm_device_bring_up (NMDevice *dev);
|
|
||||||
void nm_device_bring_down (NMDevice *dev);
|
|
||||||
gboolean nm_device_is_up (NMDevice *dev);
|
|
||||||
|
|
||||||
void nm_device_ap_list_clear (NMDevice *dev);
|
|
||||||
struct NMAccessPointList *nm_device_ap_list_get (NMDevice *dev);
|
|
||||||
NMAccessPoint *nm_device_ap_list_get_ap_by_essid (NMDevice *dev, const char *essid);
|
|
||||||
NMAccessPoint *nm_device_ap_list_get_ap_by_address (NMDevice *dev, const struct ether_addr *addr);
|
|
||||||
NMAccessPoint *nm_device_ap_list_get_ap_by_obj_path (NMDevice *dev, const char *obj_path);
|
|
||||||
void nm_device_copy_allowed_to_dev_list (NMDevice *dev, struct NMAccessPointList *allowed_list);
|
|
||||||
|
|
||||||
gboolean nm_device_get_use_dhcp (NMDevice *dev);
|
|
||||||
void nm_device_set_use_dhcp (NMDevice *dev, gboolean use_dhcp);
|
|
||||||
|
|
||||||
NMIP4Config * nm_device_get_ip4_config (NMDevice *dev);
|
|
||||||
void nm_device_set_ip4_config (NMDevice *dev, NMIP4Config *config);
|
|
||||||
|
|
||||||
void * nm_device_get_system_config_data (NMDevice *dev);
|
|
||||||
|
|
||||||
/* Utility routines */
|
|
||||||
NMDevice * nm_get_device_by_udi (NMData *data, const char *udi);
|
|
||||||
NMDevice * nm_get_device_by_iface (NMData *data, const char *iface);
|
|
||||||
|
|
||||||
/* Test device routines */
|
|
||||||
gboolean nm_device_is_test_device (NMDevice *dev);
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,111 +0,0 @@
|
|||||||
/* 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 2005 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include <libhal.h>
|
|
||||||
#include <iwlib.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "NetworkManagerMain.h"
|
|
||||||
#include "NetworkManagerDevice.h"
|
|
||||||
#include "NetworkManagerAPList.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Wireless device specific options */
|
|
||||||
typedef struct NMDevice80211WirelessOptions
|
|
||||||
{
|
|
||||||
char * cur_essid; /* Only for test devices */
|
|
||||||
gint8 strength;
|
|
||||||
gint8 invalid_strength_counter;
|
|
||||||
iwqual max_qual;
|
|
||||||
iwqual avg_qual;
|
|
||||||
|
|
||||||
guint failed_link_count;
|
|
||||||
|
|
||||||
gint8 num_freqs;
|
|
||||||
double freqs[IW_MAX_FREQUENCIES];
|
|
||||||
|
|
||||||
GMutex * scan_mutex;
|
|
||||||
NMAccessPointList * ap_list;
|
|
||||||
guint8 scan_interval; /* seconds */
|
|
||||||
guint32 last_scan;
|
|
||||||
|
|
||||||
/* Static options from driver */
|
|
||||||
guint8 we_version;
|
|
||||||
guint32 capabilities;
|
|
||||||
} NMDevice80211WirelessOptions;
|
|
||||||
|
|
||||||
/* Wired device specific options */
|
|
||||||
typedef struct NMDevice80211EthernetOptions
|
|
||||||
{
|
|
||||||
guint32 unused;
|
|
||||||
} NMDevice8023EthernetOptions;
|
|
||||||
|
|
||||||
/* General options structure */
|
|
||||||
typedef union NMDeviceOptions
|
|
||||||
{
|
|
||||||
NMDevice80211WirelessOptions wireless;
|
|
||||||
NMDevice8023EthernetOptions wired;
|
|
||||||
} NMDeviceOptions;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NetworkManager device structure
|
|
||||||
*/
|
|
||||||
struct NMDevice
|
|
||||||
{
|
|
||||||
guint refcount;
|
|
||||||
|
|
||||||
char * udi;
|
|
||||||
char * iface;
|
|
||||||
NMDeviceType type;
|
|
||||||
guint32 capabilities;
|
|
||||||
char * driver;
|
|
||||||
gboolean removed;
|
|
||||||
|
|
||||||
gboolean link_active;
|
|
||||||
guint32 ip4_address;
|
|
||||||
/* FIXME: ipv6 address too */
|
|
||||||
struct ether_addr hw_addr;
|
|
||||||
NMData * app_data;
|
|
||||||
NMDeviceOptions options;
|
|
||||||
|
|
||||||
/* IP configuration info */
|
|
||||||
void * system_config_data; /* Distro-specific config data (parsed config file, etc) */
|
|
||||||
gboolean use_dhcp;
|
|
||||||
NMIP4Config * ip4_config; /* Config from DHCP, PPP, or system config files */
|
|
||||||
|
|
||||||
GMainContext * context;
|
|
||||||
GMainLoop * loop;
|
|
||||||
GThread * worker;
|
|
||||||
gboolean worker_started;
|
|
||||||
|
|
||||||
NMActRequest * act_request;
|
|
||||||
gboolean quit_activation; /* Flag to signal activation thread to stop activating */
|
|
||||||
|
|
||||||
gboolean test_device;
|
|
||||||
gboolean test_device_up;
|
|
||||||
};
|
|
||||||
|
|
@@ -1,233 +0,0 @@
|
|||||||
/* 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 <stdio.h>
|
|
||||||
#include <iwlib.h>
|
|
||||||
#include "config.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "NetworkManagerDevice.h"
|
|
||||||
#include "NetworkManagerWireless.h"
|
|
||||||
#include "NetworkManagerPolicy.h"
|
|
||||||
#include "NetworkManagerUtils.h"
|
|
||||||
#include "utils/nm-utils.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nm_wireless_stats_to_percent
|
|
||||||
*
|
|
||||||
* Convert an iw_stats structure from a scan or the card into
|
|
||||||
* a magical signal strength percentage.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int nm_wireless_qual_to_percent (const struct iw_quality *qual, const struct iw_quality *max_qual, const struct iw_quality *avg_qual)
|
|
||||||
{
|
|
||||||
int percent = -1;
|
|
||||||
int level_percent = -1;
|
|
||||||
|
|
||||||
g_return_val_if_fail (qual != NULL, -1);
|
|
||||||
g_return_val_if_fail (max_qual != NULL, -1);
|
|
||||||
g_return_val_if_fail (avg_qual != NULL, -1);
|
|
||||||
|
|
||||||
#ifdef IW_QUAL_DEBUG
|
|
||||||
nm_debug ("QL: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X, updated: 0x%X ** MAX: qual %d/%u/0x%X, level %d/%u/0x%X, noise %d/%u/0x%X, updated: 0x%X",
|
|
||||||
(__s8)qual->qual, qual->qual, qual->qual,
|
|
||||||
(__s8)qual->level, qual->level, qual->level,
|
|
||||||
(__s8)qual->noise, qual->noise, qual->noise,
|
|
||||||
qual->updated,
|
|
||||||
(__s8)max_qual->qual, max_qual->qual, max_qual->qual,
|
|
||||||
(__s8)max_qual->level, max_qual->level, max_qual->level,
|
|
||||||
(__s8)max_qual->noise, max_qual->noise, max_qual->noise,
|
|
||||||
max_qual->updated);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Try using the card's idea of the signal quality first as long as it tells us what the max quality is.
|
|
||||||
* Drivers that fill in quality values MUST treat them as percentages, ie the "Link Quality" MUST be
|
|
||||||
* bounded by 0 and max_qual->qual, and MUST change in a linear fashion. Within those bounds, drivers
|
|
||||||
* are free to use whatever they want to calculate "Link Quality".
|
|
||||||
*/
|
|
||||||
if ((max_qual->qual != 0) && !(max_qual->updated & IW_QUAL_QUAL_INVALID) && !(qual->updated & IW_QUAL_QUAL_INVALID))
|
|
||||||
percent = (int)(100 * ((double)qual->qual / (double)max_qual->qual));
|
|
||||||
|
|
||||||
/* If the driver doesn't specify a complete and valid quality, we have two options:
|
|
||||||
*
|
|
||||||
* 1) dBm: driver must specify max_qual->level = 0, and have valid values for
|
|
||||||
* qual->level and (qual->noise OR max_qual->noise)
|
|
||||||
* 2) raw RSSI: driver must specify max_qual->level > 0, and have valid values for
|
|
||||||
* qual->level and max_qual->level
|
|
||||||
*
|
|
||||||
* This is the WEXT spec. If this interpretation is wrong, I'll fix it. Otherwise,
|
|
||||||
* If drivers don't conform to it, they are wrong and need to be fixed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( (max_qual->level == 0) && !(max_qual->updated & IW_QUAL_LEVEL_INVALID) /* Valid max_qual->level == 0 */
|
|
||||||
&& !(qual->updated & IW_QUAL_LEVEL_INVALID) /* Must have valid qual->level */
|
|
||||||
&& ( ((max_qual->noise > 0) && !(max_qual->updated & IW_QUAL_NOISE_INVALID)) /* Must have valid max_qual->noise */
|
|
||||||
|| ((qual->noise > 0) && !(qual->updated & IW_QUAL_NOISE_INVALID))) /* OR valid qual->noise */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
/* Absolute power values (dBm) */
|
|
||||||
|
|
||||||
/* Reasonable fallbacks for dumb drivers that don't specify either level. */
|
|
||||||
#define FALLBACK_NOISE_FLOOR_DBM -90
|
|
||||||
#define FALLBACK_SIGNAL_MAX_DBM -20
|
|
||||||
int max_level = FALLBACK_SIGNAL_MAX_DBM;
|
|
||||||
int noise = FALLBACK_NOISE_FLOOR_DBM;
|
|
||||||
int level = qual->level - 0x100;
|
|
||||||
|
|
||||||
level = CLAMP (level, FALLBACK_NOISE_FLOOR_DBM, FALLBACK_SIGNAL_MAX_DBM);
|
|
||||||
|
|
||||||
if ((qual->noise > 0) && (!qual->updated & IW_QUAL_NOISE_INVALID))
|
|
||||||
noise = qual->noise - 0x100;
|
|
||||||
else if ((max_qual->noise > 0) && !(max_qual->updated & IW_QUAL_NOISE_INVALID))
|
|
||||||
noise = max_qual->noise - 0x100;
|
|
||||||
noise = CLAMP (noise, FALLBACK_NOISE_FLOOR_DBM, FALLBACK_SIGNAL_MAX_DBM);
|
|
||||||
|
|
||||||
/* A sort of signal-to-noise ratio calculation */
|
|
||||||
level_percent = (int)(100 - 70 *(
|
|
||||||
((double)max_level - (double)level) /
|
|
||||||
((double)max_level - (double)noise)));
|
|
||||||
#ifdef IW_QUAL_DEBUG
|
|
||||||
nm_debug ("QL1: level_percent is %d. max_level %d, level %d, noise_floor %d.", level_percent, max_level, level, noise);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if ((max_qual->level != 0) && !(max_qual->updated & IW_QUAL_LEVEL_INVALID) /* Valid max_qual->level as upper bound */
|
|
||||||
&& !(qual->updated & IW_QUAL_LEVEL_INVALID))
|
|
||||||
{
|
|
||||||
/* Relative power values (RSSI) */
|
|
||||||
|
|
||||||
int level = qual->level;
|
|
||||||
|
|
||||||
/* Signal level is relavtive (0 -> max_qual->level) */
|
|
||||||
level = CLAMP (level, 0, max_qual->level);
|
|
||||||
level_percent = (int)(100 * ((double)level / (double)max_qual->level));
|
|
||||||
#ifdef IW_QUAL_DEBUG
|
|
||||||
nm_debug ("QL2: level_percent is %d. max_level %d, level %d.", level_percent, max_qual->level, level);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (percent == -1)
|
|
||||||
{
|
|
||||||
#ifdef IW_QUAL_DEBUG
|
|
||||||
nm_debug ("QL: Could not get quality %% value from driver. Driver is probably buggy.");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the quality percent was 0 or doesn't exist, then try to use signal levels instead */
|
|
||||||
if ((percent < 1) && (level_percent >= 0))
|
|
||||||
percent = level_percent;
|
|
||||||
|
|
||||||
#ifdef IW_QUAL_DEBUG
|
|
||||||
nm_debug ("QL: Final quality percent is %d (%d).", percent, CLAMP (percent, 0, 100));
|
|
||||||
#endif
|
|
||||||
return (CLAMP (percent, 0, 100));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean nm_wireless_set_scan_interval_cb (gpointer user_data)
|
|
||||||
{
|
|
||||||
NMData *data = (NMData*) user_data;
|
|
||||||
|
|
||||||
nm_wireless_set_scan_interval (data, NULL, NM_WIRELESS_SCAN_INTERVAL_INACTIVE);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nm_wireless_set_scan_interval (NMData *data, NMDevice *dev, NMWirelessScanInterval interval)
|
|
||||||
{
|
|
||||||
static guint source_id = 0;
|
|
||||||
GSource *source = NULL;
|
|
||||||
GSList *elt;
|
|
||||||
|
|
||||||
g_return_if_fail (data != NULL);
|
|
||||||
|
|
||||||
if (source_id != 0)
|
|
||||||
g_source_remove (source_id);
|
|
||||||
|
|
||||||
for (elt = data->dev_list; elt; elt = g_slist_next (elt))
|
|
||||||
{
|
|
||||||
NMDevice *d = (NMDevice *)(elt->data);
|
|
||||||
if (dev && dev != d)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (d && nm_device_is_802_11_wireless (d))
|
|
||||||
nm_device_set_wireless_scan_interval (d, interval);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (interval != NM_WIRELESS_SCAN_INTERVAL_INACTIVE)
|
|
||||||
{
|
|
||||||
source = g_timeout_source_new (120000);
|
|
||||||
g_source_set_callback (source, nm_wireless_set_scan_interval_cb, (gpointer) data, NULL);
|
|
||||||
source_id = g_source_attach (source, data->main_context);
|
|
||||||
g_source_unref (source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
guint32 nm_802_11_wireless_discover_capabilities (NMDevice *dev, iwrange * range, guint32 data_len)
|
|
||||||
{
|
|
||||||
int minlen;
|
|
||||||
guint32 caps = NM_802_11_CAP_NONE;
|
|
||||||
|
|
||||||
g_return_val_if_fail (dev != NULL, NM_802_11_CAP_NONE);
|
|
||||||
g_return_val_if_fail (range != NULL, NM_802_11_CAP_NONE);
|
|
||||||
|
|
||||||
minlen = ((char *) range->enc_capa) - (char *) range + sizeof (range->enc_capa);
|
|
||||||
|
|
||||||
/* A test wireless device is a pro at everything */
|
|
||||||
if (nm_device_is_test_device (dev))
|
|
||||||
{
|
|
||||||
caps |= NM_802_11_CAP_PROTO_WPA
|
|
||||||
| NM_802_11_CAP_PROTO_WPA2
|
|
||||||
| NM_802_11_CAP_KEY_MGMT_PSK
|
|
||||||
| NM_802_11_CAP_KEY_MGMT_802_1X
|
|
||||||
| NM_802_11_CAP_CIPHER_WEP40
|
|
||||||
| NM_802_11_CAP_CIPHER_WEP104
|
|
||||||
| NM_802_11_CAP_CIPHER_TKIP
|
|
||||||
| NM_802_11_CAP_CIPHER_CCMP;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* All drivers should support WEP by default */
|
|
||||||
caps |= NM_802_11_CAP_CIPHER_WEP40 | NM_802_11_CAP_CIPHER_WEP104;
|
|
||||||
|
|
||||||
if ((data_len >= minlen) && range->we_version_compiled >= 18)
|
|
||||||
{
|
|
||||||
if (range->enc_capa & IW_ENC_CAPA_WPA)
|
|
||||||
{
|
|
||||||
caps |= NM_802_11_CAP_PROTO_WPA
|
|
||||||
| NM_802_11_CAP_KEY_MGMT_PSK
|
|
||||||
| NM_802_11_CAP_KEY_MGMT_802_1X;
|
|
||||||
}
|
|
||||||
if (range->enc_capa & IW_ENC_CAPA_WPA2)
|
|
||||||
{
|
|
||||||
caps |= NM_802_11_CAP_PROTO_WPA2
|
|
||||||
| NM_802_11_CAP_KEY_MGMT_PSK
|
|
||||||
| NM_802_11_CAP_KEY_MGMT_802_1X;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (range->enc_capa & IW_ENC_CAPA_CIPHER_TKIP)
|
|
||||||
caps |= NM_802_11_CAP_CIPHER_TKIP;
|
|
||||||
if (range->enc_capa & IW_ENC_CAPA_CIPHER_CCMP)
|
|
||||||
caps |= NM_802_11_CAP_CIPHER_CCMP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@@ -1,39 +0,0 @@
|
|||||||
/* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NETWORK_MANAGER_WIRELESS_H
|
|
||||||
#define NETWORK_MANAGER_WIRELESS_H
|
|
||||||
|
|
||||||
#include <iwlib.h>
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "NetworkManagerDevice.h"
|
|
||||||
#include "NetworkManagerAPList.h"
|
|
||||||
|
|
||||||
|
|
||||||
int nm_wireless_qual_to_percent (const struct iw_quality *qual,
|
|
||||||
const struct iw_quality *max_qual,
|
|
||||||
const struct iw_quality *avg_qual);
|
|
||||||
void nm_wireless_set_scan_interval (NMData *data, NMDevice *dev, NMWirelessScanInterval interval);
|
|
||||||
|
|
||||||
guint32 nm_802_11_wireless_discover_capabilities (NMDevice *dev, iwrange * range, guint32 data_len);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
Reference in New Issue
Block a user