2007-10-12 10:18:46 +00:00
|
|
|
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
2007-10-05 20:54:13 +00:00
|
|
|
#include <iwlib.h>
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
#include "nm-device-802-11-wireless.h"
|
|
|
|
|
#include "nm-device-private.h"
|
|
|
|
|
|
|
|
|
|
#include "nm-device-802-11-wireless-bindings.h"
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (NMDevice80211Wireless, nm_device_802_11_wireless, NM_TYPE_DEVICE)
|
|
|
|
|
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
#define NM_DEVICE_802_11_WIRELESS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_802_11_WIRELESS, NMDevice80211WirelessPrivate))
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2007-03-16 09:37:53 +00:00
|
|
|
DBusGProxy *wireless_proxy;
|
2007-10-03 18:20:35 +00:00
|
|
|
gboolean have_ap_list;
|
|
|
|
|
GHashTable *aps;
|
2007-03-16 09:37:53 +00:00
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
char * hw_address;
|
|
|
|
|
int mode;
|
2007-10-27 02:58:32 +00:00
|
|
|
guint32 rate;
|
2007-10-05 20:54:13 +00:00
|
|
|
NMAccessPoint *current_ap;
|
|
|
|
|
guint32 wireless_caps;
|
|
|
|
|
|
2007-03-16 09:37:53 +00:00
|
|
|
gboolean disposed;
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
} NMDevice80211WirelessPrivate;
|
|
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_HW_ADDRESS,
|
|
|
|
|
PROP_MODE,
|
|
|
|
|
PROP_BITRATE,
|
|
|
|
|
PROP_ACTIVE_ACCESS_POINT,
|
|
|
|
|
PROP_WIRELESS_CAPABILITIES,
|
|
|
|
|
|
|
|
|
|
LAST_PROP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define DBUS_PROP_HW_ADDRESS "HwAddress"
|
|
|
|
|
#define DBUS_PROP_MODE "Mode"
|
|
|
|
|
#define DBUS_PROP_BITRATE "Bitrate"
|
|
|
|
|
#define DBUS_PROP_ACTIVE_ACCESS_POINT "ActiveAccessPoint"
|
|
|
|
|
#define DBUS_PROP_WIRELESS_CAPABILITIES "WirelessCapabilities"
|
|
|
|
|
|
2007-02-20 15:24:42 +00:00
|
|
|
enum {
|
2007-10-03 18:20:35 +00:00
|
|
|
ACCESS_POINT_ADDED,
|
|
|
|
|
ACCESS_POINT_REMOVED,
|
2007-02-20 15:24:42 +00:00
|
|
|
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
NMDevice80211Wireless *
|
|
|
|
|
nm_device_802_11_wireless_new (DBusGConnection *connection, const char *path)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (connection != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
|
|
|
|
|
2007-03-16 09:37:53 +00:00
|
|
|
return (NMDevice80211Wireless *) g_object_new (NM_TYPE_DEVICE_802_11_WIRELESS,
|
2007-10-12 10:18:46 +00:00
|
|
|
NM_OBJECT_CONNECTION, connection,
|
|
|
|
|
NM_OBJECT_PATH, path,
|
|
|
|
|
NULL);
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
static void
|
2007-10-12 10:18:46 +00:00
|
|
|
nm_device_802_11_wireless_set_hw_address (NMDevice80211Wireless *self,
|
|
|
|
|
const char *address)
|
2007-10-05 20:54:13 +00:00
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
|
|
|
|
|
|
2007-10-12 10:18:46 +00:00
|
|
|
g_free (priv->hw_address);
|
|
|
|
|
priv->hw_address = g_strdup (address);
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_DEVICE_802_11_WIRELESS_HW_ADDRESS);
|
2007-10-05 20:54:13 +00:00
|
|
|
}
|
|
|
|
|
|
2007-11-13 20:03:31 +00:00
|
|
|
const char *
|
2007-02-16 11:23:49 +00:00
|
|
|
nm_device_802_11_wireless_get_hw_address (NMDevice80211Wireless *device)
|
2007-02-12 09:23:43 +00:00
|
|
|
{
|
2007-10-05 20:54:13 +00:00
|
|
|
NMDevice80211WirelessPrivate *priv;
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device), NULL);
|
|
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
if (!priv->hw_address) {
|
|
|
|
|
priv->hw_address = nm_object_get_string_property (NM_OBJECT (device),
|
|
|
|
|
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
|
|
|
|
DBUS_PROP_HW_ADDRESS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return priv->hw_address;
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-12 10:18:46 +00:00
|
|
|
static void
|
|
|
|
|
nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self, int mode)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
priv->mode = mode;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_DEVICE_802_11_WIRELESS_MODE);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
int
|
|
|
|
|
nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *device)
|
|
|
|
|
{
|
2007-10-05 20:54:13 +00:00
|
|
|
NMDevice80211WirelessPrivate *priv;
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device), 0);
|
|
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
if (!priv->mode) {
|
|
|
|
|
priv->mode = nm_object_get_int_property (NM_OBJECT (device),
|
|
|
|
|
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
|
|
|
|
DBUS_PROP_MODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return priv->mode;
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-12 10:18:46 +00:00
|
|
|
static void
|
2007-10-27 02:58:32 +00:00
|
|
|
nm_device_802_11_wireless_set_bitrate (NMDevice80211Wireless *self, guint32 bitrate)
|
2007-10-12 10:18:46 +00:00
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
if (priv->rate != bitrate) {
|
|
|
|
|
priv->rate = bitrate;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_DEVICE_802_11_WIRELESS_BITRATE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-27 02:58:32 +00:00
|
|
|
guint32
|
2007-02-16 11:23:49 +00:00
|
|
|
nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *device)
|
|
|
|
|
{
|
2007-10-05 20:54:13 +00:00
|
|
|
NMDevice80211WirelessPrivate *priv;
|
|
|
|
|
NMDeviceState state;
|
|
|
|
|
|
2007-02-16 11:23:49 +00:00
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device), 0);
|
|
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
state = nm_device_get_state (NM_DEVICE (device));
|
|
|
|
|
switch (state) {
|
|
|
|
|
case NM_DEVICE_STATE_PREPARE:
|
|
|
|
|
case NM_DEVICE_STATE_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_NEED_AUTH:
|
|
|
|
|
case NM_DEVICE_STATE_IP_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_ACTIVATED:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
if (!priv->rate) {
|
2007-10-27 02:58:32 +00:00
|
|
|
priv->rate = nm_object_get_uint_property (NM_OBJECT (device),
|
2007-10-05 20:54:13 +00:00
|
|
|
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
|
|
|
|
DBUS_PROP_BITRATE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return priv->rate;
|
2007-02-16 11:23:49 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-12 10:18:46 +00:00
|
|
|
static void
|
|
|
|
|
nm_device_802_11_wireless_set_capabilities (NMDevice80211Wireless *self, guint caps)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
priv->wireless_caps = caps;
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_DEVICE_802_11_WIRELESS_CAPABILITIES);
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-05 08:49:30 +00:00
|
|
|
guint32
|
|
|
|
|
nm_device_802_11_wireless_get_capabilities (NMDevice80211Wireless *device)
|
|
|
|
|
{
|
2007-10-05 20:54:13 +00:00
|
|
|
NMDevice80211WirelessPrivate *priv;
|
|
|
|
|
|
2007-03-16 09:37:53 +00:00
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device), 0);
|
2007-03-05 08:49:30 +00:00
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
if (!priv->wireless_caps) {
|
|
|
|
|
priv->wireless_caps = nm_object_get_uint_property (NM_OBJECT (device),
|
|
|
|
|
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
|
|
|
|
DBUS_PROP_WIRELESS_CAPABILITIES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return priv->wireless_caps;
|
2007-03-05 08:49:30 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
static NMAccessPoint *
|
2007-10-03 18:20:35 +00:00
|
|
|
get_access_point (NMDevice80211Wireless *device, const char *path, gboolean create_if_not_found)
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
NMAccessPoint *ap;
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
ap = g_hash_table_lookup (priv->aps, path);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
if (!ap && create_if_not_found) {
|
2007-06-22 15:09:02 +00:00
|
|
|
ap = nm_access_point_new (nm_object_get_connection (NM_OBJECT (device)), path);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
if (ap)
|
2007-10-03 18:20:35 +00:00
|
|
|
g_hash_table_insert (priv->aps, g_strdup (path), ap);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ap;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-12 10:18:46 +00:00
|
|
|
static void
|
|
|
|
|
nm_device_802_11_wireless_set_active_ap (NMDevice80211Wireless *self,
|
|
|
|
|
const char *ap_path)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
|
|
|
|
|
|
|
|
|
|
if (!priv->current_ap && !ap_path)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (priv->current_ap) {
|
|
|
|
|
g_object_unref (priv->current_ap);
|
|
|
|
|
priv->current_ap = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ap_path && (!strcmp (ap_path, "/"))) {
|
|
|
|
|
priv->current_ap = get_access_point (self, ap_path, TRUE);
|
|
|
|
|
if (priv->current_ap)
|
|
|
|
|
g_object_ref (priv->current_ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (self), NM_DEVICE_802_11_WIRELESS_ACTIVE_ACCESS_POINT);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
NMAccessPoint *
|
2007-10-03 18:20:35 +00:00
|
|
|
nm_device_802_11_wireless_get_active_access_point (NMDevice80211Wireless *device)
|
2007-02-12 09:23:43 +00:00
|
|
|
{
|
2007-10-05 20:54:13 +00:00
|
|
|
NMDevice80211WirelessPrivate *priv;
|
|
|
|
|
NMDeviceState state;
|
2007-02-12 09:23:43 +00:00
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device), NULL);
|
|
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
state = nm_device_get_state (NM_DEVICE (device));
|
|
|
|
|
switch (state) {
|
|
|
|
|
case NM_DEVICE_STATE_PREPARE:
|
|
|
|
|
case NM_DEVICE_STATE_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_NEED_AUTH:
|
|
|
|
|
case NM_DEVICE_STATE_IP_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_ACTIVATED:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
if (!priv->current_ap) {
|
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
|
|
path = nm_object_get_object_path_property (NM_OBJECT (device),
|
|
|
|
|
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
|
|
|
|
DBUS_PROP_ACTIVE_ACCESS_POINT);
|
2007-10-06 04:24:30 +00:00
|
|
|
if (path) {
|
|
|
|
|
priv->current_ap = get_access_point (device, path, TRUE);
|
|
|
|
|
if (priv->current_ap)
|
|
|
|
|
g_object_ref (priv->current_ap);
|
|
|
|
|
g_free (path);
|
|
|
|
|
}
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-10-05 20:54:13 +00:00
|
|
|
return priv->current_ap;
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-26 12:42:29 +00:00
|
|
|
NMAccessPoint *
|
2007-10-03 18:20:35 +00:00
|
|
|
nm_device_802_11_wireless_get_access_point_by_path (NMDevice80211Wireless *device,
|
|
|
|
|
const char *object_path)
|
2007-03-26 12:42:29 +00:00
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device), NULL);
|
|
|
|
|
g_return_val_if_fail (object_path != NULL, NULL);
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
return get_access_point (device, object_path, TRUE);
|
2007-03-26 12:42:29 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
static void
|
2007-10-03 18:20:35 +00:00
|
|
|
access_points_to_slist (gpointer key, gpointer value, gpointer user_data)
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
{
|
|
|
|
|
GSList **list = (GSList **) user_data;
|
|
|
|
|
|
|
|
|
|
*list = g_slist_prepend (*list, value);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-12 09:23:43 +00:00
|
|
|
GSList *
|
2007-10-03 18:20:35 +00:00
|
|
|
nm_device_802_11_wireless_get_access_points (NMDevice80211Wireless *device)
|
2007-02-12 09:23:43 +00:00
|
|
|
{
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
NMDevice80211WirelessPrivate *priv;
|
2007-02-12 09:23:43 +00:00
|
|
|
GSList *list = NULL;
|
|
|
|
|
GPtrArray *array = NULL;
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (NM_IS_DEVICE_802_11_WIRELESS (device), NULL);
|
|
|
|
|
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
if (priv->have_ap_list) {
|
|
|
|
|
g_hash_table_foreach (priv->aps, access_points_to_slist, &list);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
if (!org_freedesktop_NetworkManager_Device_Wireless_get_access_points
|
2007-03-16 09:37:53 +00:00
|
|
|
(NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device)->wireless_proxy, &array, &err)) {
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
g_warning ("Error in get_access_points: %s", err->message);
|
2007-02-12 09:23:43 +00:00
|
|
|
g_error_free (err);
|
|
|
|
|
} else {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < array->len; i++) {
|
2007-10-03 18:20:35 +00:00
|
|
|
NMAccessPoint *ap = get_access_point (device, (const char *) g_ptr_array_index (array, i), TRUE);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
if (ap)
|
|
|
|
|
list = g_slist_prepend (list, ap);
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_ptr_array_free (array, TRUE);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
list = g_slist_reverse (list);
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
priv->have_ap_list = TRUE;
|
2007-02-12 09:23:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-20 15:24:42 +00:00
|
|
|
static void
|
2007-10-03 18:20:35 +00:00
|
|
|
access_point_added_proxy (DBusGProxy *proxy, char *path, gpointer user_data)
|
2007-02-20 15:24:42 +00:00
|
|
|
{
|
2007-03-16 09:37:53 +00:00
|
|
|
NMDevice80211Wireless *device = NM_DEVICE_802_11_WIRELESS (user_data);
|
2007-02-20 15:24:42 +00:00
|
|
|
NMAccessPoint *ap;
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
ap = get_access_point (device, path, TRUE);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
if (device)
|
2007-10-03 18:20:35 +00:00
|
|
|
g_signal_emit (device, signals[ACCESS_POINT_ADDED], 0, ap);
|
2007-02-20 15:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2007-10-03 18:20:35 +00:00
|
|
|
access_point_removed_proxy (DBusGProxy *proxy, char *path, gpointer user_data)
|
2007-02-20 15:24:42 +00:00
|
|
|
{
|
2007-03-16 09:37:53 +00:00
|
|
|
NMDevice80211Wireless *device = NM_DEVICE_802_11_WIRELESS (user_data);
|
2007-02-20 15:24:42 +00:00
|
|
|
NMAccessPoint *ap;
|
|
|
|
|
|
2007-10-03 18:20:35 +00:00
|
|
|
ap = get_access_point (device, path, FALSE);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
if (device) {
|
2007-10-03 18:20:35 +00:00
|
|
|
g_signal_emit (device, signals[ACCESS_POINT_REMOVED], 0, ap);
|
|
|
|
|
g_hash_table_remove (NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device)->aps, path);
|
2007-03-02 Tambet Ingo <tambet@ximian.com>
* libnm-glib/nm-device-802-11-wireless.c: Cache networks (bssids) list.
We get signalled when it changes.
* libnm-glib/nm-client.c: Cache NMState and device list, we get signalled
when it changes.
* libnm-glib/nm-device.c: Cache the device state property.
* libnm-glib/nm-access-point.c: Cache the strength property.
* src/nm-device-802-11-wireless.c: Fix wireless device scanning scheduler.
The new algorithm is to start from SCAN_INTERVAL_MIN (currently defined as 0)
and add a SCAN_INTERVAL_STEP (currently 20 seconds) with each successful scan
until SCAN_INTERVAL_MAX (currently 120 seconds) is reached. Do not scan while
the device is down, activating, or activated (in case of A/B/G cards).
Remove some old dead ifdef'ed out code that used to configure wireless devices,
it's all done through supplicant now.
* src/supplicant-manager/nm-supplicant-interface.c: Fix the reference
counting issues with pending calls which caused leaks and crashes when
interface was removed (now that the interface actually gets removed).
* src/nm-call-store.c: Make a copy of data before running a foreach
with user callback on it - The most common usage pattern is to cancel
(and thus remove) all pending calls with foreach which would modify
the hash table we're iterating over.
* src/nm-manager.c: When a device is added, make sure it is "up". When
it's removed or disabled due to disabling wireless or networking, bring
it down.
* include/NetworkManager.h: Add new device state NM_DEVICE_STATE_DOWN.
* src/nm-device-802-11-wireless.c:
* src/nm-device-802-3-ethernet.c:
* src/nm-device.c:
- Remove "init" virtual function, all gobjects have a place for that
already (constructor).
- Replace "start" virtual function with "bring_up", devices can be
brought up and down more than just on startup now.
- Add "is_up" virtual function.
- Implement one way to bring a device down instead of previous 4 different
ways, each of witch did something different.
* src/NetworkManagerUtils.c (nm_dev_sock_open): This doesn't need an NMDevice,
all it needs is the device interface.
Get rid of NMData.dev_list (3 members to go).
Get rif of NMData in a lot of places.
* gnome/libnm_glib/libnm_glib.c: Make it compile again.
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2395 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-03-02 09:30:48 +00:00
|
|
|
}
|
2007-02-20 15:24:42 +00:00
|
|
|
}
|
2007-10-12 10:18:46 +00:00
|
|
|
|
|
|
|
|
/**************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_device_802_11_wireless_init (NMDevice80211Wireless *device)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (device);
|
|
|
|
|
|
|
|
|
|
priv->disposed = FALSE;
|
|
|
|
|
priv->aps = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
|
|
|
(GDestroyNotify) g_free,
|
|
|
|
|
(GDestroyNotify) g_object_unref);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_property (GObject *object, guint prop_id,
|
|
|
|
|
const GValue *value, GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211Wireless *device = NM_DEVICE_802_11_WIRELESS (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_HW_ADDRESS:
|
|
|
|
|
nm_device_802_11_wireless_set_hw_address (device, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MODE:
|
|
|
|
|
nm_device_802_11_wireless_set_mode (device, g_value_get_int (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_BITRATE:
|
2007-10-27 02:58:32 +00:00
|
|
|
nm_device_802_11_wireless_set_bitrate (device, g_value_get_uint (value));
|
2007-10-12 10:18:46 +00:00
|
|
|
break;
|
|
|
|
|
case PROP_ACTIVE_ACCESS_POINT:
|
|
|
|
|
nm_device_802_11_wireless_set_active_ap (device, (char *) g_value_get_boxed (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WIRELESS_CAPABILITIES:
|
|
|
|
|
nm_device_802_11_wireless_set_capabilities (device, g_value_get_uint (value));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
|
case PROP_HW_ADDRESS:
|
|
|
|
|
g_value_set_string (value, priv->hw_address);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_MODE:
|
|
|
|
|
g_value_set_int (value, priv->mode);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_BITRATE:
|
2007-10-27 02:58:32 +00:00
|
|
|
g_value_set_uint (value, priv->rate);
|
2007-10-12 10:18:46 +00:00
|
|
|
break;
|
|
|
|
|
case PROP_ACTIVE_ACCESS_POINT:
|
|
|
|
|
g_value_set_boxed (value, priv->current_ap ? nm_object_get_path (NM_OBJECT (priv->current_ap)) : "/");
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WIRELESS_CAPABILITIES:
|
|
|
|
|
g_value_set_uint (value, priv->wireless_caps);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
state_changed_cb (NMDevice *device, NMDeviceState state, gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211Wireless *self = NM_DEVICE_802_11_WIRELESS (device);
|
|
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
|
case NM_DEVICE_STATE_PREPARE:
|
|
|
|
|
case NM_DEVICE_STATE_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_NEED_AUTH:
|
|
|
|
|
case NM_DEVICE_STATE_IP_CONFIG:
|
|
|
|
|
case NM_DEVICE_STATE_ACTIVATED:
|
|
|
|
|
break;
|
|
|
|
|
case NM_DEVICE_STATE_UNKNOWN:
|
|
|
|
|
case NM_DEVICE_STATE_DOWN:
|
|
|
|
|
case NM_DEVICE_STATE_DISCONNECTED:
|
|
|
|
|
case NM_DEVICE_STATE_FAILED:
|
|
|
|
|
case NM_DEVICE_STATE_CANCELLED:
|
|
|
|
|
default:
|
|
|
|
|
nm_device_802_11_wireless_set_active_ap (self, NULL);
|
|
|
|
|
nm_device_802_11_wireless_set_bitrate (self, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GObject*
|
|
|
|
|
constructor (GType type,
|
|
|
|
|
guint n_construct_params,
|
|
|
|
|
GObjectConstructParam *construct_params)
|
|
|
|
|
{
|
|
|
|
|
GObject *object;
|
|
|
|
|
NMDevice80211WirelessPrivate *priv;
|
|
|
|
|
|
|
|
|
|
object = G_OBJECT_CLASS (nm_device_802_11_wireless_parent_class)->constructor (type,
|
|
|
|
|
n_construct_params,
|
|
|
|
|
construct_params);
|
|
|
|
|
if (!object)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
priv->wireless_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
|
|
|
|
|
NM_DBUS_SERVICE,
|
|
|
|
|
nm_object_get_path (NM_OBJECT (object)),
|
|
|
|
|
NM_DBUS_INTERFACE_DEVICE_WIRELESS);
|
|
|
|
|
|
|
|
|
|
dbus_g_proxy_add_signal (priv->wireless_proxy, "AccessPointAdded",
|
|
|
|
|
DBUS_TYPE_G_OBJECT_PATH,
|
|
|
|
|
G_TYPE_INVALID);
|
|
|
|
|
dbus_g_proxy_connect_signal (priv->wireless_proxy, "AccessPointAdded",
|
|
|
|
|
G_CALLBACK (access_point_added_proxy),
|
|
|
|
|
object, NULL);
|
|
|
|
|
|
|
|
|
|
dbus_g_proxy_add_signal (priv->wireless_proxy, "AccessPointRemoved",
|
|
|
|
|
DBUS_TYPE_G_OBJECT_PATH,
|
|
|
|
|
G_TYPE_INVALID);
|
|
|
|
|
dbus_g_proxy_connect_signal (priv->wireless_proxy, "AccessPointRemoved",
|
|
|
|
|
G_CALLBACK (access_point_removed_proxy),
|
|
|
|
|
object, NULL);
|
|
|
|
|
|
|
|
|
|
nm_object_handle_properties_changed (NM_OBJECT (object), priv->wireless_proxy);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (NM_DEVICE (object),
|
|
|
|
|
"state-changed",
|
|
|
|
|
G_CALLBACK (state_changed_cb),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
dispose (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
if (priv->disposed)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv->disposed = TRUE;
|
|
|
|
|
|
|
|
|
|
g_object_unref (priv->wireless_proxy);
|
|
|
|
|
|
|
|
|
|
g_hash_table_destroy (priv->aps);
|
|
|
|
|
priv->aps = NULL;
|
|
|
|
|
|
|
|
|
|
if (priv->current_ap)
|
|
|
|
|
g_object_unref (priv->current_ap);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_device_802_11_wireless_parent_class)->dispose (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (object);
|
|
|
|
|
|
|
|
|
|
if (priv->hw_address)
|
|
|
|
|
g_free (priv->hw_address);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (nm_device_802_11_wireless_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *device_class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (device_class);
|
|
|
|
|
|
|
|
|
|
g_type_class_add_private (device_class, sizeof (NMDevice80211WirelessPrivate));
|
|
|
|
|
|
|
|
|
|
/* virtual methods */
|
|
|
|
|
object_class->constructor = constructor;
|
|
|
|
|
object_class->set_property = set_property;
|
|
|
|
|
object_class->get_property = get_property;
|
|
|
|
|
object_class->dispose = dispose;
|
|
|
|
|
object_class->finalize = finalize;
|
|
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_HW_ADDRESS,
|
|
|
|
|
g_param_spec_string (NM_DEVICE_802_11_WIRELESS_HW_ADDRESS,
|
|
|
|
|
"MAC Address",
|
|
|
|
|
"Hardware MAC address",
|
|
|
|
|
NULL,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_MODE,
|
|
|
|
|
g_param_spec_int (NM_DEVICE_802_11_WIRELESS_MODE,
|
|
|
|
|
"Mode",
|
|
|
|
|
"Mode",
|
|
|
|
|
0, IW_MODE_INFRA, 0,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_BITRATE,
|
2007-10-27 02:58:32 +00:00
|
|
|
g_param_spec_uint (NM_DEVICE_802_11_WIRELESS_BITRATE,
|
2007-10-12 10:18:46 +00:00
|
|
|
"Bit Rate",
|
|
|
|
|
"Bit Rate",
|
2007-10-27 02:58:32 +00:00
|
|
|
0, G_MAXUINT32, 0,
|
2007-10-12 10:18:46 +00:00
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_ACTIVE_ACCESS_POINT,
|
|
|
|
|
g_param_spec_boxed (NM_DEVICE_802_11_WIRELESS_ACTIVE_ACCESS_POINT,
|
|
|
|
|
"Active Access Point",
|
|
|
|
|
"Active Access Point",
|
|
|
|
|
DBUS_TYPE_G_OBJECT_PATH,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property
|
|
|
|
|
(object_class, PROP_WIRELESS_CAPABILITIES,
|
|
|
|
|
g_param_spec_uint (NM_DEVICE_802_11_WIRELESS_CAPABILITIES,
|
|
|
|
|
"Wireless Capabilities",
|
|
|
|
|
"Wireless Capabilities",
|
|
|
|
|
0, G_MAXUINT32, 0,
|
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
/* signals */
|
|
|
|
|
signals[ACCESS_POINT_ADDED] =
|
|
|
|
|
g_signal_new ("access-point-added",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMDevice80211WirelessClass, access_point_added),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_OBJECT);
|
|
|
|
|
|
|
|
|
|
signals[ACCESS_POINT_REMOVED] =
|
|
|
|
|
g_signal_new ("access-point-removed",
|
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (NMDevice80211WirelessClass, access_point_removed),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_OBJECT);
|
|
|
|
|
}
|