mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
2008-04-15 Dan Williams <dcbw@redhat.com>
Remove exposure of wireless-tools mode types in the API. * include/NetworkManager.h - Define NM80211Mode enum * introspection/generic-types.xml - Describe NM_802_11_MODE enum - Remove IW_MODE_* enum * introspection/nm-access-point.xml libnm-glib/nm-access-point.c libnm-glib/nm-access-point.h - 'mode' is now of type NM80211Mode, a DBUS_TYPE_UINT * introspection/nm-device-802-11-wireless.xml libnm-glib/nm-device-802-11-wireless.c libnm-glib/nm-device-802-11-wireless.h - 'mode' is now of type NM80211Mode, a DBUS_TYPE_UINT * libnm-util/nm-setting-wireless.c src/NetworkManagerAP.c src/NetworkManagerAP.h src/nm-device-802-11-wireless.c src/nm-device-802-11-wireless.h test/nm-tool.c - Use NM80211Mode not IW_MODE_* git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3562 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
95c44ecc1f
commit
1e1c99afba
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2008-04-15 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Remove exposure of wireless-tools mode types in the API.
|
||||
|
||||
* include/NetworkManager.h
|
||||
- Define NM80211Mode enum
|
||||
|
||||
* introspection/generic-types.xml
|
||||
- Describe NM_802_11_MODE enum
|
||||
- Remove IW_MODE_* enum
|
||||
|
||||
* introspection/nm-access-point.xml
|
||||
libnm-glib/nm-access-point.c
|
||||
libnm-glib/nm-access-point.h
|
||||
- 'mode' is now of type NM80211Mode, a DBUS_TYPE_UINT
|
||||
|
||||
* introspection/nm-device-802-11-wireless.xml
|
||||
libnm-glib/nm-device-802-11-wireless.c
|
||||
libnm-glib/nm-device-802-11-wireless.h
|
||||
- 'mode' is now of type NM80211Mode, a DBUS_TYPE_UINT
|
||||
|
||||
* libnm-util/nm-setting-wireless.c
|
||||
src/NetworkManagerAP.c
|
||||
src/NetworkManagerAP.h
|
||||
src/nm-device-802-11-wireless.c
|
||||
src/nm-device-802-11-wireless.h
|
||||
test/nm-tool.c
|
||||
- Use NM80211Mode not IW_MODE_*
|
||||
|
||||
2008-04-15 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Enhance nm-online based on a patch from Bill Nottingham.
|
||||
|
|
|
@ -121,6 +121,16 @@ typedef enum NMDeviceType
|
|||
#define NM_802_11_AP_SEC_KEY_MGMT_PSK 0x00000100
|
||||
#define NM_802_11_AP_SEC_KEY_MGMT_802_1X 0x00000200
|
||||
|
||||
/*
|
||||
* 802.11 AP and Station modes
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
NM_802_11_MODE_UNKNOWN = 0,
|
||||
NM_802_11_MODE_ADHOC,
|
||||
NM_802_11_MODE_INFRA,
|
||||
} NM80211Mode;
|
||||
|
||||
|
||||
/*
|
||||
* Device states
|
||||
|
|
|
@ -20,28 +20,16 @@
|
|||
<tp:member type="a{sv}" name="Value" tp:type="String_Variant_Map"/>
|
||||
</tp:mapping>
|
||||
|
||||
<tp:enum name="IW_MODE" type="i">
|
||||
<tp:enum name="NM_802_11_MODE" type="u">
|
||||
<tp:docstring></tp:docstring>
|
||||
<tp:enumvalue suffix="AUTO" value="0">
|
||||
<tp:docstring>Automatic mode controlled by the driver.</tp:docstring>
|
||||
<tp:enumvalue suffix="UNKNOWN" value="0">
|
||||
<tp:docstring>Mode is unknown.</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="ADHOC" value="1">
|
||||
<tp:docstring>Single cell network.</tp:docstring>
|
||||
<tp:docstring>Uncoordinated network without central infrastructure.</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="INFRA" value="2">
|
||||
<tp:docstring>Multi cell network, roaming.</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="MASTER" value="3">
|
||||
<tp:docstring>Synchronisation master or Access Point.</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="REPEAT" value="4">
|
||||
<tp:docstring>Wireless Repeater (forwarder).</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="SECOND" value="5">
|
||||
<tp:docstring>Secondary master/repeater (backup).</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
<tp:enumvalue suffix="MONITOR" value="6">
|
||||
<tp:docstring>Passive monitor (listen only).</tp:docstring>
|
||||
<tp:docstring>Coordinated network with one or more central controllers.</tp:docstring>
|
||||
</tp:enumvalue>
|
||||
</tp:enum>
|
||||
</tp:generic-types>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<tp:docstring>The hardware address of the access point.</tp:docstring>
|
||||
</property>
|
||||
|
||||
<property name="Mode" type="i" access="read" tp:type="IW_MODE">
|
||||
<property name="Mode" type="u" access="read" tp:type="NM_802_11_MODE">
|
||||
<tp:docstring>Describes the operating mode of the access point.</tp:docstring>
|
||||
</property>
|
||||
<property name="MaxBitrate" type="u" access="read">
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
The hardware address of the device.
|
||||
</tp:docstring>
|
||||
</property>
|
||||
<property name="Mode" type="i" access="read" tp:type="IW_MODE">
|
||||
<property name="Mode" type="u" access="read" tp:type="NM_802_11_MODE">
|
||||
<tp:docstring>
|
||||
The operating mode of the wireless device.
|
||||
</tp:docstring>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||
|
||||
#include "wireless-helper.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "nm-access-point.h"
|
||||
|
@ -25,7 +23,7 @@ typedef struct {
|
|||
GByteArray *ssid;
|
||||
guint32 frequency;
|
||||
char *hw_address;
|
||||
int mode;
|
||||
NM80211Mode mode;
|
||||
guint32 max_bitrate;
|
||||
guint8 strength;
|
||||
} NMAccessPointPrivate;
|
||||
|
@ -169,7 +167,7 @@ nm_access_point_get_hw_address (NMAccessPoint *ap)
|
|||
return priv->hw_address;
|
||||
}
|
||||
|
||||
int
|
||||
NM80211Mode
|
||||
nm_access_point_get_mode (NMAccessPoint *ap)
|
||||
{
|
||||
NMAccessPointPrivate *priv;
|
||||
|
@ -178,9 +176,9 @@ nm_access_point_get_mode (NMAccessPoint *ap)
|
|||
|
||||
priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
|
||||
if (!priv->mode) {
|
||||
priv->mode = nm_object_get_int_property (NM_OBJECT (ap),
|
||||
NM_DBUS_INTERFACE_ACCESS_POINT,
|
||||
DBUS_PROP_MODE);
|
||||
priv->mode = nm_object_get_uint_property (NM_OBJECT (ap),
|
||||
NM_DBUS_INTERFACE_ACCESS_POINT,
|
||||
DBUS_PROP_MODE);
|
||||
}
|
||||
|
||||
return priv->mode;
|
||||
|
@ -286,7 +284,7 @@ get_property (GObject *object,
|
|||
g_value_set_string (value, nm_access_point_get_hw_address (ap));
|
||||
break;
|
||||
case PROP_MODE:
|
||||
g_value_set_int (value, nm_access_point_get_mode (ap));
|
||||
g_value_set_uint (value, nm_access_point_get_mode (ap));
|
||||
break;
|
||||
case PROP_MAX_BITRATE:
|
||||
g_value_set_uint (value, nm_access_point_get_max_bitrate (ap));
|
||||
|
@ -425,10 +423,10 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
|
|||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MODE,
|
||||
g_param_spec_int (NM_ACCESS_POINT_MODE,
|
||||
g_param_spec_uint (NM_ACCESS_POINT_MODE,
|
||||
"Mode",
|
||||
"Mode",
|
||||
IW_MODE_ADHOC, IW_MODE_INFRA, IW_MODE_INFRA,
|
||||
NM_802_11_MODE_ADHOC, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <glib/gtypes.h>
|
||||
#include <glib-object.h>
|
||||
#include <NetworkManager.h>
|
||||
#include "nm-object.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -42,7 +43,7 @@ guint32 nm_access_point_get_rsn_flags (NMAccessPoint *ap);
|
|||
const GByteArray * nm_access_point_get_ssid (NMAccessPoint *ap);
|
||||
guint32 nm_access_point_get_frequency (NMAccessPoint *ap);
|
||||
const char * nm_access_point_get_hw_address (NMAccessPoint *ap);
|
||||
int nm_access_point_get_mode (NMAccessPoint *ap);
|
||||
NM80211Mode nm_access_point_get_mode (NMAccessPoint *ap);
|
||||
guint32 nm_access_point_get_max_bitrate (NMAccessPoint *ap);
|
||||
guint8 nm_access_point_get_strength (NMAccessPoint *ap);
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||
|
||||
#include "wireless-helper.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "nm-device-802-11-wireless.h"
|
||||
|
@ -26,7 +24,7 @@ typedef struct {
|
|||
DBusGProxy *proxy;
|
||||
|
||||
char *hw_address;
|
||||
int mode;
|
||||
NM80211Mode mode;
|
||||
guint32 rate;
|
||||
NMAccessPoint *active_ap;
|
||||
gboolean null_active_ap;
|
||||
|
@ -91,7 +89,7 @@ nm_device_802_11_wireless_get_hw_address (NMDevice80211Wireless *device)
|
|||
return priv->hw_address;
|
||||
}
|
||||
|
||||
int
|
||||
NM80211Mode
|
||||
nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *device)
|
||||
{
|
||||
NMDevice80211WirelessPrivate *priv;
|
||||
|
@ -100,9 +98,9 @@ nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *device)
|
|||
|
||||
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);
|
||||
priv->mode = nm_object_get_uint_property (NM_OBJECT (device),
|
||||
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
||||
DBUS_PROP_MODE);
|
||||
}
|
||||
|
||||
return priv->mode;
|
||||
|
@ -358,7 +356,7 @@ get_property (GObject *object,
|
|||
g_value_set_string (value, nm_device_802_11_wireless_get_hw_address (self));
|
||||
break;
|
||||
case PROP_MODE:
|
||||
g_value_set_int (value, nm_device_802_11_wireless_get_mode (self));
|
||||
g_value_set_uint (value, nm_device_802_11_wireless_get_mode (self));
|
||||
break;
|
||||
case PROP_BITRATE:
|
||||
g_value_set_uint (value, nm_device_802_11_wireless_get_bitrate (self));
|
||||
|
@ -558,10 +556,10 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *device_class)
|
|||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MODE,
|
||||
g_param_spec_int (NM_DEVICE_802_11_WIRELESS_MODE,
|
||||
g_param_spec_uint (NM_DEVICE_802_11_WIRELESS_MODE,
|
||||
"Mode",
|
||||
"Mode",
|
||||
0, IW_MODE_INFRA, 0,
|
||||
NM_802_11_MODE_UNKNOWN, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property
|
||||
|
|
|
@ -36,7 +36,7 @@ GType nm_device_802_11_wireless_get_type (void);
|
|||
GObject *nm_device_802_11_wireless_new (DBusGConnection *connection, const char *path);
|
||||
|
||||
const char * nm_device_802_11_wireless_get_hw_address (NMDevice80211Wireless *device);
|
||||
int nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *device);
|
||||
NM80211Mode nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *device);
|
||||
guint32 nm_device_802_11_wireless_get_bitrate (NMDevice80211Wireless *device);
|
||||
guint32 nm_device_802_11_wireless_get_capabilities (NMDevice80211Wireless *device);
|
||||
NMAccessPoint * nm_device_802_11_wireless_get_active_access_point (NMDevice80211Wireless *device);
|
||||
|
|
|
@ -82,7 +82,7 @@ nm_setting_wireless_ap_security_compatible (NMSettingWireless *s_wireless,
|
|||
|
||||
/* Adhoc WPA */
|
||||
if (!strcmp (s_wireless_sec->key_mgmt, "wpa-none")) {
|
||||
if (ap_mode != IW_MODE_ADHOC)
|
||||
if (ap_mode != NM_802_11_MODE_ADHOC)
|
||||
return FALSE;
|
||||
// FIXME: validate ciphers if the BSSID actually puts WPA/RSN IE in
|
||||
// it's beacon
|
||||
|
@ -90,7 +90,7 @@ nm_setting_wireless_ap_security_compatible (NMSettingWireless *s_wireless,
|
|||
}
|
||||
|
||||
/* Stuff after this point requires infrastructure */
|
||||
if (ap_mode != IW_MODE_INFRA)
|
||||
if (ap_mode != NM_802_11_MODE_INFRA)
|
||||
return FALSE;
|
||||
|
||||
/* Dynamic WEP or LEAP */
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct
|
|||
/* Scanned or cached values */
|
||||
GByteArray * ssid;
|
||||
struct ether_addr address;
|
||||
int mode; /* from IW_MODE_* in wireless.h */
|
||||
NM80211Mode mode;
|
||||
gint8 strength;
|
||||
guint32 freq; /* Frequency in MHz; ie 2412 (== 2.412 GHz) */
|
||||
guint32 max_bitrate;/* Maximum bitrate of the AP in Kbit/s (ie 54000 Kb/s == 54Mbit/s) */
|
||||
|
@ -102,7 +102,7 @@ nm_ap_init (NMAccessPoint *ap)
|
|||
NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (ap);
|
||||
|
||||
priv->dbus_path = NULL;
|
||||
priv->mode = IW_MODE_INFRA;
|
||||
priv->mode = NM_802_11_MODE_INFRA;
|
||||
priv->flags = NM_802_11_AP_FLAGS_NONE;
|
||||
priv->wpa_flags = NM_802_11_AP_SEC_NONE;
|
||||
priv->rsn_flags = NM_802_11_AP_SEC_NONE;
|
||||
|
@ -146,7 +146,7 @@ set_property (GObject *object, guint prop_id,
|
|||
nm_ap_set_freq (ap, g_value_get_uint (value));
|
||||
break;
|
||||
case PROP_MODE:
|
||||
nm_ap_set_mode (ap, g_value_get_int (value));
|
||||
nm_ap_set_mode (ap, g_value_get_uint (value));
|
||||
break;
|
||||
case PROP_MAX_BITRATE:
|
||||
nm_ap_set_max_bitrate (ap, g_value_get_uint (value));
|
||||
|
@ -194,7 +194,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_take_string (value, nm_ether_ntop (&priv->address));
|
||||
break;
|
||||
case PROP_MODE:
|
||||
g_value_set_int (value, priv->mode);
|
||||
g_value_set_uint (value, priv->mode);
|
||||
break;
|
||||
case PROP_MAX_BITRATE:
|
||||
g_value_set_uint (value, priv->max_bitrate);
|
||||
|
@ -291,10 +291,10 @@ nm_ap_class_init (NMAccessPointClass *ap_class)
|
|||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MODE,
|
||||
g_param_spec_int (NM_AP_MODE,
|
||||
g_param_spec_uint (NM_AP_MODE,
|
||||
"Mode",
|
||||
"Mode",
|
||||
IW_MODE_ADHOC, IW_MODE_INFRA, IW_MODE_INFRA,
|
||||
NM_802_11_MODE_ADHOC, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
|
@ -437,9 +437,9 @@ foreach_property_cb (gpointer key, gpointer value, gpointer user_data)
|
|||
|
||||
if (!strcmp (key, "capabilities")) {
|
||||
if (val & IEEE80211_CAP_ESS) {
|
||||
nm_ap_set_mode (ap, IW_MODE_INFRA);
|
||||
nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
|
||||
} else if (val & IEEE80211_CAP_IBSS) {
|
||||
nm_ap_set_mode (ap, IW_MODE_ADHOC);
|
||||
nm_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
|
||||
}
|
||||
|
||||
if (val & IEEE80211_CAP_PRIVACY) {
|
||||
|
@ -569,13 +569,13 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
|
|||
|
||||
if (s_wireless->mode) {
|
||||
if (!strcmp (s_wireless->mode, "infrastructure"))
|
||||
nm_ap_set_mode (ap, IW_MODE_INFRA);
|
||||
nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
|
||||
else if (!strcmp (s_wireless->mode, "adhoc"))
|
||||
nm_ap_set_mode (ap, IW_MODE_ADHOC);
|
||||
nm_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
|
||||
else
|
||||
goto error;
|
||||
} else {
|
||||
nm_ap_set_mode (ap, IW_MODE_INFRA);
|
||||
nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
|
||||
}
|
||||
|
||||
if (s_wireless->band && s_wireless->channel) {
|
||||
|
@ -876,9 +876,9 @@ void nm_ap_set_address (NMAccessPoint *ap, const struct ether_addr * addr)
|
|||
* Get/set functions for mode (ie Ad-Hoc, Infrastructure, etc)
|
||||
*
|
||||
*/
|
||||
int nm_ap_get_mode (NMAccessPoint *ap)
|
||||
NM80211Mode nm_ap_get_mode (NMAccessPoint *ap)
|
||||
{
|
||||
int mode;
|
||||
NM80211Mode mode;
|
||||
|
||||
g_return_val_if_fail (NM_IS_AP (ap), -1);
|
||||
|
||||
|
@ -887,13 +887,13 @@ int nm_ap_get_mode (NMAccessPoint *ap)
|
|||
return mode;
|
||||
}
|
||||
|
||||
void nm_ap_set_mode (NMAccessPoint *ap, const int mode)
|
||||
void nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode)
|
||||
{
|
||||
NMAccessPointPrivate *priv;
|
||||
|
||||
g_return_if_fail (NM_IS_AP (ap));
|
||||
|
||||
if (mode == IW_MODE_ADHOC || mode == IW_MODE_INFRA) {
|
||||
if (mode == NM_802_11_MODE_ADHOC || mode == NM_802_11_MODE_INFRA) {
|
||||
priv = NM_AP_GET_PRIVATE (ap);
|
||||
|
||||
if (priv->mode != mode) {
|
||||
|
@ -1216,10 +1216,10 @@ nm_ap_check_compatible (NMAccessPoint *self,
|
|||
|
||||
if (s_wireless->mode) {
|
||||
if ( !strcmp (s_wireless->mode, "infrastructure")
|
||||
&& (priv->mode != IW_MODE_INFRA))
|
||||
&& (priv->mode != NM_802_11_MODE_INFRA))
|
||||
return FALSE;
|
||||
if ( !strcmp (s_wireless->mode, "adhoc")
|
||||
&& (priv->mode != IW_MODE_ADHOC))
|
||||
&& (priv->mode != NM_802_11_MODE_ADHOC))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,8 @@ void nm_ap_set_rsn_flags (NMAccessPoint *ap, guint32 flags);
|
|||
const struct ether_addr * nm_ap_get_address (const NMAccessPoint *ap);
|
||||
void nm_ap_set_address (NMAccessPoint *ap, const struct ether_addr *addr);
|
||||
|
||||
int nm_ap_get_mode (NMAccessPoint *ap);
|
||||
void nm_ap_set_mode (NMAccessPoint *ap, const int mode);
|
||||
NM80211Mode nm_ap_get_mode (NMAccessPoint *ap);
|
||||
void nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode);
|
||||
|
||||
gint8 nm_ap_get_strength (NMAccessPoint *ap);
|
||||
void nm_ap_set_strength (NMAccessPoint *ap, gint8 strength);
|
||||
|
|
|
@ -742,7 +742,7 @@ real_bring_up (NMDevice *dev)
|
|||
NMDevice80211Wireless *self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
|
||||
|
||||
nm_device_802_11_wireless_set_mode (self, IW_MODE_INFRA);
|
||||
nm_device_802_11_wireless_set_mode (self, NM_802_11_MODE_INFRA);
|
||||
|
||||
priv->supplicant.mgr = nm_supplicant_manager_get ();
|
||||
priv->supplicant.mgr_state_id = g_signal_connect (priv->supplicant.mgr,
|
||||
|
@ -827,7 +827,7 @@ real_deactivate (NMDevice *dev)
|
|||
{
|
||||
NMDevice80211Wireless * self = NM_DEVICE_802_11_WIRELESS (dev);
|
||||
|
||||
nm_device_802_11_wireless_set_mode (self, IW_MODE_INFRA);
|
||||
nm_device_802_11_wireless_set_mode (self, NM_802_11_MODE_INFRA);
|
||||
/* FIXME: Should we reset the scan interval here? */
|
||||
/* nm_device_802_11_wireless_set_scan_interval (app_data, self, NM_WIRELESS_SCAN_INTERVAL_ACTIVE); */
|
||||
}
|
||||
|
@ -999,15 +999,15 @@ impl_device_get_access_points (NMDevice80211Wireless *self,
|
|||
* Get managed/infrastructure/adhoc mode on a device
|
||||
*
|
||||
*/
|
||||
int
|
||||
NM80211Mode
|
||||
nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *self)
|
||||
{
|
||||
int fd;
|
||||
int mode = IW_MODE_AUTO;
|
||||
NM80211Mode mode = NM_802_11_MODE_UNKNOWN;
|
||||
const char *iface;
|
||||
struct iwreq wrq;
|
||||
|
||||
g_return_val_if_fail (self != NULL, -1);
|
||||
g_return_val_if_fail (self != NULL, NM_802_11_MODE_UNKNOWN);
|
||||
|
||||
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
||||
if (fd < 0)
|
||||
|
@ -1018,8 +1018,16 @@ nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *self)
|
|||
strncpy (wrq.ifr_name, iface, IFNAMSIZ);
|
||||
|
||||
if (ioctl (fd, SIOCGIWMODE, &wrq) == 0) {
|
||||
if ((wrq.u.mode == IW_MODE_ADHOC) || (wrq.u.mode == IW_MODE_INFRA))
|
||||
mode = wrq.u.mode;
|
||||
switch (wrq.u.mode) {
|
||||
case IW_MODE_ADHOC:
|
||||
mode = NM_802_11_MODE_ADHOC;
|
||||
break;
|
||||
case IW_MODE_INFRA:
|
||||
mode = NM_802_11_MODE_INFRA;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (errno != ENODEV)
|
||||
nm_warning ("error getting card mode on %s: %s", iface, strerror (errno));
|
||||
|
@ -1039,7 +1047,7 @@ out:
|
|||
*/
|
||||
gboolean
|
||||
nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self,
|
||||
const int mode)
|
||||
const NM80211Mode mode)
|
||||
{
|
||||
int fd;
|
||||
const char *iface;
|
||||
|
@ -1047,7 +1055,7 @@ nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self,
|
|||
struct iwreq wrq;
|
||||
|
||||
g_return_val_if_fail (self != NULL, FALSE);
|
||||
g_return_val_if_fail ((mode == IW_MODE_INFRA) || (mode == IW_MODE_ADHOC) || (mode == IW_MODE_AUTO), FALSE);
|
||||
g_return_val_if_fail ((mode == NM_802_11_MODE_INFRA) || (mode == NM_802_11_MODE_ADHOC), FALSE);
|
||||
|
||||
if (nm_device_802_11_wireless_get_mode (self) == mode)
|
||||
return TRUE;
|
||||
|
@ -1057,7 +1065,17 @@ nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self,
|
|||
goto out;
|
||||
|
||||
memset (&wrq, 0, sizeof (struct iwreq));
|
||||
wrq.u.mode = mode;
|
||||
switch (mode) {
|
||||
case NM_802_11_MODE_ADHOC:
|
||||
wrq.u.mode = IW_MODE_ADHOC;
|
||||
break;
|
||||
case NM_802_11_MODE_INFRA:
|
||||
wrq.u.mode = IW_MODE_INFRA;
|
||||
break;
|
||||
default:
|
||||
goto out;
|
||||
}
|
||||
|
||||
iface = nm_device_get_iface (NM_DEVICE (self));
|
||||
strncpy (wrq.ifr_name, iface, IFNAMSIZ);
|
||||
|
||||
|
@ -1613,7 +1631,7 @@ ap_auth_enforced (NMConnection *connection,
|
|||
wpa_flags = nm_ap_get_wpa_flags (ap);
|
||||
rsn_flags = nm_ap_get_rsn_flags (ap);
|
||||
|
||||
if (nm_ap_get_mode (ap) == IW_MODE_ADHOC)
|
||||
if (nm_ap_get_mode (ap) == NM_802_11_MODE_ADHOC)
|
||||
goto out;
|
||||
|
||||
/* Static WEP */
|
||||
|
@ -2453,7 +2471,7 @@ build_supplicant_config (NMDevice80211Wireless *self,
|
|||
/* Figure out the Ad-Hoc frequency to use if creating an adhoc network; if
|
||||
* nothing was specified then pick something usable.
|
||||
*/
|
||||
if ((nm_ap_get_mode (ap) == IW_MODE_ADHOC) && nm_ap_get_user_created (ap)) {
|
||||
if ((nm_ap_get_mode (ap) == NM_802_11_MODE_ADHOC) && nm_ap_get_user_created (ap)) {
|
||||
adhoc_freq = nm_ap_get_freq (ap);
|
||||
if (!adhoc_freq) {
|
||||
if (s_wireless->band && !strcmp (s_wireless->band, "a")) {
|
||||
|
@ -2590,10 +2608,10 @@ real_act_stage1_prepare (NMDevice *dev)
|
|||
g_return_val_if_fail (ap != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
switch (nm_ap_get_mode (ap)) {
|
||||
case IW_MODE_ADHOC:
|
||||
case NM_802_11_MODE_ADHOC:
|
||||
nm_ap_set_user_created (ap, TRUE);
|
||||
break;
|
||||
case IW_MODE_INFRA:
|
||||
case NM_802_11_MODE_INFRA:
|
||||
default:
|
||||
nm_ap_set_broadcast (ap, FALSE);
|
||||
break;
|
||||
|
@ -2806,7 +2824,7 @@ real_act_stage4_ip_config_timeout (NMDevice *dev,
|
|||
nm_info ("Activation (%s/wireless): asking for new secrets",
|
||||
nm_device_get_iface (dev));
|
||||
}
|
||||
} else if (nm_ap_get_mode (ap) == IW_MODE_ADHOC) {
|
||||
} else if (nm_ap_get_mode (ap) == NM_802_11_MODE_ADHOC) {
|
||||
NMDevice80211WirelessClass * klass;
|
||||
NMDeviceClass * parent_class;
|
||||
|
||||
|
@ -2989,7 +3007,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_take_string (value, nm_ether_ntop (&hw_addr));
|
||||
break;
|
||||
case PROP_MODE:
|
||||
g_value_set_int (value, nm_device_802_11_wireless_get_mode (device));
|
||||
g_value_set_uint (value, nm_device_802_11_wireless_get_mode (device));
|
||||
break;
|
||||
case PROP_BITRATE:
|
||||
g_value_set_uint (value, priv->rate);
|
||||
|
@ -3050,11 +3068,11 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass)
|
|||
G_PARAM_READABLE));
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_MODE,
|
||||
g_param_spec_int (NM_DEVICE_802_11_WIRELESS_MODE,
|
||||
"Mode",
|
||||
"Mode",
|
||||
0, G_MAXINT32, 0,
|
||||
G_PARAM_READABLE));
|
||||
g_param_spec_uint (NM_DEVICE_802_11_WIRELESS_MODE,
|
||||
"Mode",
|
||||
"Mode",
|
||||
NM_802_11_MODE_UNKNOWN, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA,
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_BITRATE,
|
||||
g_param_spec_uint (NM_DEVICE_802_11_WIRELESS_BITRATE,
|
||||
|
|
|
@ -97,9 +97,9 @@ void nm_device_802_11_wireless_get_bssid (NMDevice80211Wireless *dev,
|
|||
const GByteArray * nm_device_802_11_wireless_get_ssid (NMDevice80211Wireless *self);
|
||||
|
||||
gboolean nm_device_802_11_wireless_set_mode (NMDevice80211Wireless *self,
|
||||
const int mode);
|
||||
const NM80211Mode mode);
|
||||
|
||||
int nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *self);
|
||||
NM80211Mode nm_device_802_11_wireless_get_mode (NMDevice80211Wireless *self);
|
||||
|
||||
NMAccessPoint * nm_device_802_11_wireless_get_activation_ap (NMDevice80211Wireless *self);
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "wireless-helper.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
@ -122,7 +120,7 @@ detail_access_point (gpointer data, gpointer user_data)
|
|||
str = g_string_new (NULL);
|
||||
g_string_append_printf (str,
|
||||
"%s, %s, Freq %d MHz, Rate %d Mb/s, Strength %d",
|
||||
(nm_access_point_get_mode (ap) == IW_MODE_INFRA) ? "Infra" : "Ad-Hoc",
|
||||
(nm_access_point_get_mode (ap) == NM_802_11_MODE_INFRA) ? "Infra" : "Ad-Hoc",
|
||||
nm_access_point_get_hw_address (ap),
|
||||
nm_access_point_get_frequency (ap),
|
||||
nm_access_point_get_max_bitrate (ap) / 1000,
|
||||
|
|
Loading…
Reference in a new issue