summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-10-06 18:32:27 +0200
committerThomas Haller <thaller@redhat.com>2016-10-06 20:35:05 +0200
commit44b2044faace455e2e8da736b801bc412642c0ea (patch)
treeb6a055e802f053a158eae5eb8783d62ce8d5435b
parent1791978007c1d1af8916d0c7dc7b5826f60c8589 (diff)
downloadNetworkManager-44b2044faace455e2e8da736b801bc412642c0ea.tar.gz
wifi: rename NMAccessPoint to NMWifiAP
NMAccessPoint was in file "nm-wifi-ap.h" with method nm_ap_*(). Make the naming consistent. Also rename "nm-wifi-ap-utils.*" as it contains general purpose wifi utilities. No need to have special "ap" utilities. Same for "test-wifi-ap-utils.c". It just contains general wifi tests.
-rw-r--r--.gitignore2
-rw-r--r--src/devices/wifi/Makefile.am4
-rw-r--r--src/devices/wifi/nm-device-wifi.c170
-rw-r--r--src/devices/wifi/nm-wifi-ap.c344
-rw-r--r--src/devices/wifi/nm-wifi-ap.h118
-rw-r--r--src/devices/wifi/nm-wifi-utils.c (renamed from src/devices/wifi/nm-wifi-ap-utils.c)23
-rw-r--r--src/devices/wifi/nm-wifi-utils.h (renamed from src/devices/wifi/nm-wifi-ap-utils.h)28
-rw-r--r--src/devices/wifi/tests/Makefile.am14
-rw-r--r--src/devices/wifi/tests/test-general.c (renamed from src/devices/wifi/tests/test-wifi-ap-utils.c)70
9 files changed, 386 insertions, 387 deletions
diff --git a/.gitignore b/.gitignore
index d491e3343e..1be14ecf55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -240,7 +240,7 @@ test-*.trs
/src/NetworkManager
/src/devices/tests/test-arping
/src/devices/tests/test-lldp
-/src/devices/wifi/tests/test-wifi-ap-utils
+/src/devices/wifi/tests/test-general
/src/dhcp-manager/nm-dhcp-helper
/src/dhcp-manager/tests/test-dhcp-dhclient
/src/dhcp-manager/tests/test-dhcp-options
diff --git a/src/devices/wifi/Makefile.am b/src/devices/wifi/Makefile.am
index dad6989cd1..04a9cca093 100644
--- a/src/devices/wifi/Makefile.am
+++ b/src/devices/wifi/Makefile.am
@@ -30,8 +30,8 @@ libnm_device_plugin_wifi_la_SOURCES = \
nm-device-wifi.h \
nm-wifi-ap.c \
nm-wifi-ap.h \
- nm-wifi-ap-utils.c \
- nm-wifi-ap-utils.h \
+ nm-wifi-utils.c \
+ nm-wifi-utils.h \
nm-device-olpc-mesh.c \
nm-device-olpc-mesh.h
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index d0fd6f69da..17c966bd7c 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -91,7 +91,7 @@ typedef struct {
gint8 invalid_strength_counter;
GHashTable * aps;
- NMAccessPoint * current_ap;
+ NMWifiAP * current_ap;
guint32 rate;
bool enabled:1; /* rfkilled or not */
bool requested_scan:1;
@@ -185,7 +185,7 @@ static void request_wireless_scan (NMDeviceWifi *self, GVariant *scan_options);
static void ap_add_remove (NMDeviceWifi *self,
guint signum,
- NMAccessPoint *ap,
+ NMWifiAP *ap,
gboolean recheck_available_connections);
static void remove_supplicant_interface_error_handler (NMDeviceWifi *self);
@@ -321,7 +321,7 @@ supplicant_interface_release (NMDeviceWifi *self)
}
}
-static NMAccessPoint *
+static NMWifiAP *
get_ap_by_path (NMDeviceWifi *self, const char *path)
{
g_return_val_if_fail (path != NULL, NULL);
@@ -329,24 +329,24 @@ get_ap_by_path (NMDeviceWifi *self, const char *path)
}
-static NMAccessPoint *
+static NMWifiAP *
get_ap_by_supplicant_path (NMDeviceWifi *self, const char *path)
{
GHashTableIter iter;
- NMAccessPoint *ap;
+ NMWifiAP *ap;
g_return_val_if_fail (path != NULL, NULL);
g_hash_table_iter_init (&iter, NM_DEVICE_WIFI_GET_PRIVATE (self)->aps);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &ap)) {
- if (g_strcmp0 (path, nm_ap_get_supplicant_path (ap)) == 0)
+ if (g_strcmp0 (path, nm_wifi_ap_get_supplicant_path (ap)) == 0)
return ap;
}
return NULL;
}
static void
-update_seen_bssids_cache (NMDeviceWifi *self, NMAccessPoint *ap)
+update_seen_bssids_cache (NMDeviceWifi *self, NMWifiAP *ap)
{
g_return_if_fail (NM_IS_DEVICE_WIFI (self));
@@ -354,21 +354,21 @@ update_seen_bssids_cache (NMDeviceWifi *self, NMAccessPoint *ap)
return;
/* Don't cache the BSSID for Ad-Hoc APs */
- if (nm_ap_get_mode (ap) != NM_802_11_MODE_INFRA)
+ if (nm_wifi_ap_get_mode (ap) != NM_802_11_MODE_INFRA)
return;
if ( nm_device_get_state (NM_DEVICE (self)) == NM_DEVICE_STATE_ACTIVATED
&& nm_device_has_unmodified_applied_connection (NM_DEVICE (self), NM_SETTING_COMPARE_FLAG_NONE)) {
nm_settings_connection_add_seen_bssid (nm_device_get_settings_connection (NM_DEVICE (self)),
- nm_ap_get_address (ap));
+ nm_wifi_ap_get_address (ap));
}
}
static void
-set_current_ap (NMDeviceWifi *self, NMAccessPoint *new_ap, gboolean recheck_available_connections)
+set_current_ap (NMDeviceWifi *self, NMWifiAP *new_ap, gboolean recheck_available_connections)
{
NMDeviceWifiPrivate *priv;
- NMAccessPoint *old_ap;
+ NMWifiAP *old_ap;
g_return_if_fail (NM_IS_DEVICE_WIFI (self));
@@ -387,10 +387,10 @@ set_current_ap (NMDeviceWifi *self, NMAccessPoint *new_ap, gboolean recheck_avai
priv->current_ap = NULL;
if (old_ap) {
- NM80211Mode mode = nm_ap_get_mode (old_ap);
+ NM80211Mode mode = nm_wifi_ap_get_mode (old_ap);
/* Remove any AP from the internal list if it was created by NM or isn't known to the supplicant */
- if (mode == NM_802_11_MODE_ADHOC || mode == NM_802_11_MODE_AP || nm_ap_get_fake (old_ap))
+ if (mode == NM_802_11_MODE_ADHOC || mode == NM_802_11_MODE_AP || nm_wifi_ap_get_fake (old_ap))
ap_add_remove (self, ACCESS_POINT_REMOVED, old_ap, recheck_available_connections);
g_object_unref (old_ap);
}
@@ -433,7 +433,7 @@ periodic_update (NMDeviceWifi *self)
/* Smooth out the strength to work around crappy drivers */
percent = nm_platform_wifi_get_quality (NM_PLATFORM_GET, ifindex);
if (percent >= 0 || ++priv->invalid_strength_counter > 3) {
- nm_ap_set_strength (priv->current_ap, (gint8) percent);
+ nm_wifi_ap_set_strength (priv->current_ap, (gint8) percent);
priv->invalid_strength_counter = 0;
}
}
@@ -455,7 +455,7 @@ periodic_update_cb (gpointer user_data)
static void
ap_add_remove (NMDeviceWifi *self,
guint signum,
- NMAccessPoint *ap,
+ NMWifiAP *ap,
gboolean recheck_available_connections)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
@@ -487,7 +487,7 @@ remove_all_aps (NMDeviceWifi *self)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
GHashTableIter iter;
- NMAccessPoint *ap;
+ NMWifiAP *ap;
if (!g_hash_table_size (priv->aps))
return;
@@ -651,24 +651,24 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
return TRUE;
}
-static NMAccessPoint *
+static NMWifiAP *
find_first_compatible_ap (NMDeviceWifi *self,
NMConnection *connection,
gboolean allow_unstable_order)
{
GHashTableIter iter;
- NMAccessPoint *ap;
- NMAccessPoint *cand_ap = NULL;
+ NMWifiAP *ap;
+ NMWifiAP *cand_ap = NULL;
g_return_val_if_fail (connection != NULL, NULL);
g_hash_table_iter_init (&iter, NM_DEVICE_WIFI_GET_PRIVATE (self)->aps);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &ap)) {
- if (!nm_ap_check_compatible (ap, connection))
+ if (!nm_wifi_ap_check_compatible (ap, connection))
continue;
if (allow_unstable_order)
return ap;
- if (!cand_ap || (nm_ap_get_id (cand_ap) < nm_ap_get_id (ap)))
+ if (!cand_ap || (nm_wifi_ap_get_id (cand_ap) < nm_wifi_ap_get_id (ap)))
cand_ap = ap;
}
return cand_ap;
@@ -690,10 +690,10 @@ check_connection_available (NMDevice *device,
* also be available in general (without @specific_object). */
if (specific_object) {
- NMAccessPoint *ap;
+ NMWifiAP *ap;
ap = get_ap_by_path (NM_DEVICE_WIFI (device), specific_object);
- return ap ? nm_ap_check_compatible (ap, connection) : FALSE;
+ return ap ? nm_wifi_ap_check_compatible (ap, connection) : FALSE;
}
/* Ad-Hoc and AP connections are always available because they may be
@@ -763,7 +763,7 @@ complete_connection (NMDevice *device,
NMSettingWireless *s_wifi;
const char *setting_mac;
char *str_ssid = NULL;
- NMAccessPoint *ap = NULL;
+ NMWifiAP *ap = NULL;
const GByteArray *ssid = NULL;
GByteArray *tmp_ssid = NULL;
GBytes *setting_ssid = NULL;
@@ -823,7 +823,7 @@ complete_connection (NMDevice *device,
}
if (ap)
- ssid = nm_ap_get_ssid (ap);
+ ssid = nm_wifi_ap_get_ssid (ap);
if (ssid == NULL) {
/* The AP must be hidden. Connecting to a WiFi AP requires the SSID
* as part of the initial handshake, so check the connection details
@@ -856,10 +856,10 @@ complete_connection (NMDevice *device,
/* If the SSID is a well-known SSID, lock the connection to the AP's
* specific BSSID so NM doesn't autoconnect to some random wifi net.
*/
- if (!nm_ap_complete_connection (ap,
- connection,
- is_manf_default_ssid (ssid),
- error)) {
+ if (!nm_wifi_ap_complete_connection (ap,
+ connection,
+ is_manf_default_ssid (ssid),
+ error)) {
if (tmp_ssid)
g_byte_array_unref (tmp_ssid);
return FALSE;
@@ -957,7 +957,7 @@ can_auto_connect (NMDevice *device,
{
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
NMSettingWireless *s_wifi;
- NMAccessPoint *ap;
+ NMWifiAP *ap;
const char *method, *mode;
guint64 timestamp = 0;
@@ -998,10 +998,10 @@ can_auto_connect (NMDevice *device,
}
static gint
-ap_id_compare (NMAccessPoint *a, NMAccessPoint *b)
+ap_id_compare (NMWifiAP *a, NMWifiAP *b)
{
- guint32 a_id = nm_ap_get_id (a);
- guint32 b_id = nm_ap_get_id (b);
+ guint32 a_id = nm_wifi_ap_get_id (a);
+ guint32 b_id = nm_wifi_ap_get_id (b);
return a_id < b_id ? -1 : (a_id == b_id ? 0 : 1);
}
@@ -1011,7 +1011,7 @@ get_sorted_ap_list (NMDeviceWifi *self)
{
GSList *sorted = NULL;
GHashTableIter iter;
- NMAccessPoint *ap;
+ NMWifiAP *ap;
g_hash_table_iter_init (&iter, NM_DEVICE_WIFI_GET_PRIVATE (self)->aps);
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &ap))
@@ -1029,9 +1029,9 @@ impl_device_wifi_get_access_points (NMDeviceWifi *self,
paths = g_ptr_array_new ();
sorted = get_sorted_ap_list (self);
for (iter = sorted; iter; iter = iter->next) {
- NMAccessPoint *ap = NM_AP (iter->data);
+ NMWifiAP *ap = NM_WIFI_AP (iter->data);
- if (nm_ap_get_ssid (ap))
+ if (nm_wifi_ap_get_ssid (ap))
g_ptr_array_add (paths, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap))));
}
g_ptr_array_add (paths, NULL);
@@ -1532,7 +1532,7 @@ ap_list_dump (gpointer user_data)
priv->scheduled_scan_time);
sorted = get_sorted_ap_list (self);
for (iter = sorted; iter; iter = iter->next)
- nm_ap_dump (NM_AP (iter->data), "dump ", nm_device_get_iface (NM_DEVICE (self)));
+ nm_wifi_ap_dump (NM_WIFI_AP (iter->data), "dump ", nm_device_get_iface (NM_DEVICE (self)));
g_slist_free (sorted);
return G_SOURCE_REMOVE;
}
@@ -1550,15 +1550,15 @@ schedule_ap_list_dump (NMDeviceWifi *self)
static void
try_fill_ssid_for_hidden_ap (NMDeviceWifi *self,
- NMAccessPoint *ap)
+ NMWifiAP *ap)
{
const char *bssid;
NMSettingsConnection *const*connections;
guint i;
- g_return_if_fail (nm_ap_get_ssid (ap) == NULL);
+ g_return_if_fail (nm_wifi_ap_get_ssid (ap) == NULL);
- bssid = nm_ap_get_address (ap);
+ bssid = nm_wifi_ap_get_address (ap);
g_return_if_fail (bssid);
/* Look for this AP's BSSID in the seen-bssids list of a connection,
@@ -1573,9 +1573,9 @@ try_fill_ssid_for_hidden_ap (NMDeviceWifi *self,
if (nm_settings_connection_has_seen_bssid (NM_SETTINGS_CONNECTION (connection), bssid)) {
GBytes *ssid = nm_setting_wireless_get_ssid (s_wifi);
- nm_ap_set_ssid (ap,
- g_bytes_get_data (ssid, NULL),
- g_bytes_get_size (ssid));
+ nm_wifi_ap_set_ssid (ap,
+ g_bytes_get_data (ssid, NULL),
+ g_bytes_get_size (ssid));
break;
}
}
@@ -1590,8 +1590,8 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface,
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
NMDeviceState state;
- NMAccessPoint *ap;
- NMAccessPoint *found_ap = NULL;
+ NMWifiAP *ap;
+ NMWifiAP *found_ap = NULL;
const GByteArray *ssid;
g_return_if_fail (self != NULL);
@@ -1605,36 +1605,36 @@ supplicant_iface_new_bss_cb (NMSupplicantInterface *iface,
if (NM_DEVICE_WIFI_GET_PRIVATE (self)->mode == NM_802_11_MODE_AP)
return;
- ap = nm_ap_new_from_properties (object_path, properties);
+ ap = nm_wifi_ap_new_from_properties (object_path, properties);
if (!ap) {
_LOGD (LOGD_WIFI_SCAN, "invalid AP properties received for %s", object_path);
return;
}
/* Let the manager try to fill in the SSID from seen-bssids lists */
- ssid = nm_ap_get_ssid (ap);
+ ssid = nm_wifi_ap_get_ssid (ap);
if (!ssid || nm_utils_is_empty_ssid (ssid->data, ssid->len)) {
/* Try to fill the SSID from the AP database */
try_fill_ssid_for_hidden_ap (self, ap);
- ssid = nm_ap_get_ssid (ap);
+ ssid = nm_wifi_ap_get_ssid (ap);
if (ssid && (nm_utils_is_empty_ssid (ssid->data, ssid->len) == FALSE)) {
/* Yay, matched it, no longer treat as hidden */
_LOGD (LOGD_WIFI_SCAN, "matched hidden AP %s => '%s'",
- nm_ap_get_address (ap), nm_utils_escape_ssid (ssid->data, ssid->len));
+ nm_wifi_ap_get_address (ap), nm_utils_escape_ssid (ssid->data, ssid->len));
} else {
/* Didn't have an entry for this AP in the database */
_LOGD (LOGD_WIFI_SCAN, "failed to match hidden AP %s",
- nm_ap_get_address (ap));
+ nm_wifi_ap_get_address (ap));
}
}
found_ap = get_ap_by_supplicant_path (self, object_path);
if (found_ap) {
- nm_ap_dump (ap, "updated ", nm_device_get_iface (NM_DEVICE (self)));
- nm_ap_update_from_properties (found_ap, object_path, properties);
+ nm_wifi_ap_dump (ap, "updated ", nm_device_get_iface (NM_DEVICE (self)));
+ nm_wifi_ap_update_from_properties (found_ap, object_path, properties);
} else {
- nm_ap_dump (ap, "added ", nm_device_get_iface (NM_DEVICE (self)));
+ nm_wifi_ap_dump (ap, "added ", nm_device_get_iface (NM_DEVICE (self)));
ap_add_remove (self, ACCESS_POINT_ADDED, ap, TRUE);
}
@@ -1656,7 +1656,7 @@ supplicant_iface_bss_updated_cb (NMSupplicantInterface *iface,
NMDeviceWifi *self)
{
NMDeviceState state;
- NMAccessPoint *ap;
+ NMWifiAP *ap;
g_return_if_fail (self != NULL);
g_return_if_fail (object_path != NULL);
@@ -1669,8 +1669,8 @@ supplicant_iface_bss_updated_cb (NMSupplicantInterface *iface,
ap = get_ap_by_supplicant_path (self, object_path);
if (ap) {
- nm_ap_dump (ap, "updated ", nm_device_get_iface (NM_DEVICE (self)));
- nm_ap_update_from_properties (ap, object_path, properties);
+ nm_wifi_ap_dump (ap, "updated ", nm_device_get_iface (NM_DEVICE (self)));
+ nm_wifi_ap_update_from_properties (ap, object_path, properties);
schedule_ap_list_dump (self);
}
}
@@ -1681,7 +1681,7 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface *iface,
NMDeviceWifi *self)
{
NMDeviceWifiPrivate *priv;
- NMAccessPoint *ap;
+ NMWifiAP *ap;
g_return_if_fail (self != NULL);
g_return_if_fail (object_path != NULL);
@@ -1695,9 +1695,9 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface *iface,
* when the current AP is changed or cleared. Set 'fake' to
* indicate that this AP is now unknown to the supplicant.
*/
- nm_ap_set_fake (ap, TRUE);
+ nm_wifi_ap_set_fake (ap, TRUE);
} else {
- nm_ap_dump (ap, "removed ", nm_device_get_iface (NM_DEVICE (self)));
+ nm_wifi_ap_dump (ap, "removed ", nm_device_get_iface (NM_DEVICE (self)));
ap_add_remove (self, ACCESS_POINT_REMOVED, ap, TRUE);
schedule_ap_list_dump (self);
}
@@ -2121,7 +2121,7 @@ supplicant_iface_notify_current_bss (NMSupplicantInterface *iface,
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
const char *current_bss;
- NMAccessPoint *new_ap = NULL;
+ NMWifiAP *new_ap = NULL;
current_bss = nm_supplicant_interface_get_current_bss (iface);
if (current_bss)
@@ -2137,17 +2137,17 @@ supplicant_iface_notify_current_bss (NMSupplicantInterface *iface,
* supplicant's current BSS yet. It'll get replaced when we receive
* the current BSS's scan result.
*/
- if (new_ap == NULL && nm_ap_get_fake (priv->current_ap))
+ if (new_ap == NULL && nm_wifi_ap_get_fake (priv->current_ap))
return;
if (new_ap) {
- new_bssid = nm_ap_get_address (new_ap);
- new_ssid = nm_ap_get_ssid (new_ap);
+ new_bssid = nm_wifi_ap_get_address (new_ap);
+ new_ssid = nm_wifi_ap_get_ssid (new_ap);
}
if (priv->current_ap) {
- old_bssid = nm_ap_get_address (priv->current_ap);
- old_ssid = nm_ap_get_ssid (priv->current_ap);
+ old_bssid = nm_wifi_ap_get_address (priv->current_ap);
+ old_ssid = nm_wifi_ap_get_ssid (priv->current_ap);
}
_LOGD (LOGD_WIFI, "roamed from BSSID %s (%s) to %s (%s)",
@@ -2357,7 +2357,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
NMActStageReturn ret;
- NMAccessPoint *ap = NULL;
+ NMWifiAP *ap = NULL;
NMActRequest *req;
NMConnection *connection;
NMSettingWireless *s_wireless;
@@ -2429,11 +2429,11 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
* until the real one is found in the scan list (Ad-Hoc or Hidden), or until
* the device is deactivated (Hotspot).
*/
- ap = nm_ap_new_fake_from_connection (connection);
+ ap = nm_wifi_ap_new_fake_from_connection (connection);
g_return_val_if_fail (ap != NULL, NM_ACT_STAGE_RETURN_FAILURE);
- if (nm_ap_is_hotspot (ap))
- nm_ap_set_address (ap, nm_device_get_hw_address (device));
+ if (nm_wifi_ap_is_hotspot (ap))
+ nm_wifi_ap_set_address (ap, nm_device_get_hw_address (device));
g_object_freeze_notify (G_OBJECT (self));
ap_add_remove (self, ACCESS_POINT_ADDED, ap, TRUE);
@@ -2451,7 +2451,7 @@ done:
static void
ensure_hotspot_frequency (NMDeviceWifi *self,
NMSettingWireless *s_wifi,
- NMAccessPoint *ap)
+ NMWifiAP *ap)
{
const char *band = nm_setting_wireless_get_band (s_wifi);
const guint32 a_freqs[] = { 5180, 5200, 5220, 5745, 5765, 5785, 5805, 0 };
@@ -2460,7 +2460,7 @@ ensure_hotspot_frequency (NMDeviceWifi *self,
g_assert (ap);
- if (nm_ap_get_freq (ap))
+ if (nm_wifi_ap_get_freq (ap))
return;
if (g_strcmp0 (band, "a") == 0)
@@ -2471,7 +2471,7 @@ ensure_hotspot_frequency (NMDeviceWifi *self,
if (!freq)
freq = (g_strcmp0 (band, "a") == 0) ? 5180 : 2462;
- nm_ap_set_freq (ap, freq);
+ nm_wifi_ap_set_freq (ap, freq);
}
static void
@@ -2514,7 +2514,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
NMSupplicantConfig *config = NULL;
NMActRequest *req;
- NMAccessPoint *ap;
+ NMWifiAP *ap;
NMConnection *connection;
const char *setting_name;
NMSettingWireless *s_wireless;
@@ -2569,14 +2569,14 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
* didn't specify one and we didn't find an AP that matched the connection,
* just pick a frequency the device supports.
*/
- if ((nm_ap_get_mode (ap) == NM_802_11_MODE_ADHOC) || nm_ap_is_hotspot (ap))
+ if ((nm_wifi_ap_get_mode (ap) == NM_802_11_MODE_ADHOC) || nm_wifi_ap_is_hotspot (ap))
ensure_hotspot_frequency (self, s_wireless, ap);
- if (nm_ap_get_mode (ap) == NM_802_11_MODE_INFRA)
+ if (nm_wifi_ap_get_mode (ap) == NM_802_11_MODE_INFRA)
set_powersave (device);
/* Build up the supplicant configuration */
- config = build_supplicant_config (self, connection, nm_ap_get_freq (ap), &error);
+ config = build_supplicant_config (self, connection, nm_wifi_ap_get_freq (ap), &error);
if (config == NULL) {
_LOGE (LOGD_DEVICE | LOGD_WIFI,
"Activation: (wifi) couldn't build wireless configuration: %s",
@@ -2822,26 +2822,26 @@ activation_success_handler (NMDevice *device)
*/
g_warn_if_fail (priv->current_ap);
if (priv->current_ap) {
- if (nm_ap_get_fake (priv->current_ap)) {
+ if (nm_wifi_ap_get_fake (priv->current_ap)) {
/* If the activation AP hasn't been seen by the supplicant in a scan
* yet, it will be "fake". This usually happens for Ad-Hoc and
* AP-mode connections. Fill in the details from the device itself
* until the supplicant sends the scan result.
*/
- if (!nm_ap_get_address (priv->current_ap)) {
+ if (!nm_wifi_ap_get_address (priv->current_ap)) {
guint8 bssid[ETH_ALEN] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
gs_free char *bssid_str = NULL;
if ( nm_platform_wifi_get_bssid (NM_PLATFORM_GET, ifindex, bssid)
&& nm_ethernet_address_is_valid (bssid, ETH_ALEN)) {
bssid_str = nm_utils_hwaddr_ntoa (bssid, ETH_ALEN);
- nm_ap_set_address (priv->current_ap, bssid_str);
+ nm_wifi_ap_set_address (priv->current_ap, bssid_str);
}
}
- if (!nm_ap_get_freq (priv->current_ap))
- nm_ap_set_freq (priv->current_ap, nm_platform_wifi_get_frequency (NM_PLATFORM_GET, ifindex));
- if (!nm_ap_get_max_bitrate (priv->current_ap))
- nm_ap_set_max_bitrate (priv->current_ap, nm_platform_wifi_get_rate (NM_PLATFORM_GET, ifindex));
+ if (!nm_wifi_ap_get_freq (priv->current_ap))
+ nm_wifi_ap_set_freq (priv->current_ap, nm_platform_wifi_get_frequency (NM_PLATFORM_GET, ifindex));
+ if (!nm_wifi_ap_get_max_bitrate (priv->current_ap))
+ nm_wifi_ap_set_max_bitrate (priv->current_ap, nm_platform_wifi_get_rate (NM_PLATFORM_GET, ifindex));
}
nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req),
@@ -3204,7 +3204,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
- NM_TYPE_AP);
+ NM_TYPE_WIFI_AP);
signals[ACCESS_POINT_REMOVED] =
g_signal_new (NM_DEVICE_WIFI_ACCESS_POINT_REMOVED,
@@ -3213,7 +3213,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
- NM_TYPE_AP);
+ NM_TYPE_WIFI_AP);
signals[SCANNING_ALLOWED] =
g_signal_new (NM_DEVICE_WIFI_SCANNING_ALLOWED,
diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c
index e723cd868b..bf640cf18a 100644
--- a/src/devices/wifi/nm-wifi-ap.c
+++ b/src/devices/wifi/nm-wifi-ap.c
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include "nm-wifi-ap.h"
-#include "nm-wifi-ap-utils.h"
+#include "nm-wifi-utils.h"
#include "NetworkManagerUtils.h"
#include "nm-utils.h"
#include "nm-core-internal.h"
@@ -57,22 +57,22 @@ typedef struct
bool fake; /* Whether or not the AP is from a scan */
bool hotspot; /* Whether the AP is a local device's hotspot network */
gint32 last_seen; /* Timestamp when the AP was seen lastly (obtained via nm_utils_get_monotonic_timestamp_s()) */
-} NMAccessPointPrivate;
+} NMWifiAPPrivate;
-struct _NMAccessPoint {
+struct _NMWifiAP {
NMExportedObject parent;
- NMAccessPointPrivate _priv;
+ NMWifiAPPrivate _priv;
};
-struct _NMAccessPointClass{
+struct _NMWifiAPClass{
NMExportedObjectClass parent;
};
-#define NM_AP_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMAccessPoint, NM_IS_AP)
+#define NM_WIFI_AP_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMWifiAP, NM_IS_WIFI_AP)
-G_DEFINE_TYPE (NMAccessPoint, nm_ap, NM_TYPE_EXPORTED_OBJECT)
+G_DEFINE_TYPE (NMWifiAP, nm_wifi_ap, NM_TYPE_EXPORTED_OBJECT)
-NM_GOBJECT_PROPERTIES_DEFINE (NMAccessPoint,
+NM_GOBJECT_PROPERTIES_DEFINE (NMWifiAP,
PROP_FLAGS,
PROP_WPA_FLAGS,
PROP_RSN_FLAGS,
@@ -88,38 +88,38 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMAccessPoint,
/*****************************************************************************/
const char *
-nm_ap_get_supplicant_path (NMAccessPoint *ap)
+nm_wifi_ap_get_supplicant_path (NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), NULL);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), NULL);
- return NM_AP_GET_PRIVATE (ap)->supplicant_path;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->supplicant_path;
}
guint32
-nm_ap_get_id (NMAccessPoint *ap)
+nm_wifi_ap_get_id (NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), 0);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), 0);
g_return_val_if_fail (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (ap)), 0);
return atoi (strrchr (nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap)), '/') + 1);
}
-const GByteArray * nm_ap_get_ssid (const NMAccessPoint *ap)
+const GByteArray * nm_wifi_ap_get_ssid (const NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), NULL);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), NULL);
- return NM_AP_GET_PRIVATE (ap)->ssid;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->ssid;
}
void
-nm_ap_set_ssid (NMAccessPoint *ap, const guint8 *ssid, gsize len)
+nm_wifi_ap_set_ssid (NMWifiAP *ap, const guint8 *ssid, gsize len)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
g_return_if_fail (ssid == NULL || len > 0);
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
/* same SSID */
if ((ssid && priv->ssid) && (len == priv->ssid->len)) {
@@ -141,13 +141,13 @@ nm_ap_set_ssid (NMAccessPoint *ap, const guint8 *ssid, gsize len)
}
static void
-nm_ap_set_flags (NMAccessPoint *ap, NM80211ApFlags flags)
+nm_wifi_ap_set_flags (NMWifiAP *ap, NM80211ApFlags flags)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->flags != flags) {
priv->flags = flags;
@@ -156,13 +156,13 @@ nm_ap_set_flags (NMAccessPoint *ap, NM80211ApFlags flags)
}
static void
-nm_ap_set_wpa_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags)
+nm_wifi_ap_set_wpa_flags (NMWifiAP *ap, NM80211ApSecurityFlags flags)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->wpa_flags != flags) {
priv->wpa_flags = flags;
_notify (ap, PROP_WPA_FLAGS);
@@ -170,13 +170,13 @@ nm_ap_set_wpa_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags)
}
static void
-nm_ap_set_rsn_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags)
+nm_wifi_ap_set_rsn_flags (NMWifiAP *ap, NM80211ApSecurityFlags flags)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->rsn_flags != flags) {
priv->rsn_flags = flags;
_notify (ap, PROP_RSN_FLAGS);
@@ -184,23 +184,23 @@ nm_ap_set_rsn_flags (NMAccessPoint *ap, NM80211ApSecurityFlags flags)
}
const char *
-nm_ap_get_address (const NMAccessPoint *ap)
+nm_wifi_ap_get_address (const NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), NULL);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), NULL);
- return NM_AP_GET_PRIVATE (ap)->address;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->address;
}
void
-nm_ap_set_address (NMAccessPoint *ap, const char *addr)
+nm_wifi_ap_set_address (NMWifiAP *ap, const char *addr)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
g_return_if_fail (addr != NULL);
g_return_if_fail (nm_utils_hwaddr_valid (addr, ETH_ALEN));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (!priv->address || !nm_utils_hwaddr_matches (addr, -1, priv->address, -1)) {
g_free (priv->address);
@@ -210,23 +210,23 @@ nm_ap_set_address (NMAccessPoint *ap, const char *addr)
}
NM80211Mode
-nm_ap_get_mode (NMAccessPoint *ap)
+nm_wifi_ap_get_mode (NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), NM_802_11_MODE_UNKNOWN);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), NM_802_11_MODE_UNKNOWN);
- return NM_AP_GET_PRIVATE (ap)->mode;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->mode;
}
static void
-nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode)
+nm_wifi_ap_set_mode (NMWifiAP *ap, const NM80211Mode mode)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
g_return_if_fail ( mode == NM_802_11_MODE_ADHOC
|| mode == NM_802_11_MODE_INFRA);
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->mode != mode) {
priv->mode = mode;
@@ -235,29 +235,29 @@ nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode)
}
gboolean
-nm_ap_is_hotspot (NMAccessPoint *ap)
+nm_wifi_ap_is_hotspot (NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), FALSE);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), FALSE);
- return NM_AP_GET_PRIVATE (ap)->hotspot;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->hotspot;
}
gint8
-nm_ap_get_strength (NMAccessPoint *ap)
+nm_wifi_ap_get_strength (NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), 0);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), 0);
- return NM_AP_GET_PRIVATE (ap)->strength;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->strength;
}
void
-nm_ap_set_strength (NMAccessPoint *ap, const gint8 strength)
+nm_wifi_ap_set_strength (NMWifiAP *ap, const gint8 strength)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->strength != strength) {
priv->strength = strength;
@@ -266,22 +266,22 @@ nm_ap_set_strength (NMAccessPoint *ap, const gint8 strength)
}
guint32
-nm_ap_get_freq (NMAccessPoint *ap)
+nm_wifi_ap_get_freq (NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), 0);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), 0);
- return NM_AP_GET_PRIVATE (ap)->freq;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->freq;
}
void
-nm_ap_set_freq (NMAccessPoint *ap,
- const guint32 freq)
+nm_wifi_ap_set_freq (NMWifiAP *ap,
+ const guint32 freq)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->freq != freq) {
priv->freq = freq;
@@ -290,22 +290,22 @@ nm_ap_set_freq (NMAccessPoint *ap,
}
guint32
-nm_ap_get_max_bitrate (NMAccessPoint *ap)
+nm_wifi_ap_get_max_bitrate (NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), 0);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), 0);
g_return_val_if_fail (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (ap)), 0);
- return NM_AP_GET_PRIVATE (ap)->max_bitrate;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->max_bitrate;
}
void
-nm_ap_set_max_bitrate (NMAccessPoint *ap, guint32 bitrate)
+nm_wifi_ap_set_max_bitrate (NMWifiAP *ap, guint32 bitrate)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->max_bitrate != bitrate) {
priv->max_bitrate = bitrate;
@@ -314,29 +314,29 @@ nm_ap_set_max_bitrate (NMAccessPoint *ap, guint32 bitrate)
}
gboolean
-nm_ap_get_fake (const NMAccessPoint *ap)
+nm_wifi_ap_get_fake (const NMWifiAP *ap)
{
- g_return_val_if_fail (NM_IS_AP (ap), FALSE);
+ g_return_val_if_fail (NM_IS_WIFI_AP (ap), FALSE);
- return NM_AP_GET_PRIVATE (ap)->fake;
+ return NM_WIFI_AP_GET_PRIVATE (ap)->fake;
}
void
-nm_ap_set_fake (NMAccessPoint *ap, gboolean fake)
+nm_wifi_ap_set_fake (NMWifiAP *ap, gboolean fake)
{
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- NM_AP_GET_PRIVATE (ap)->fake = fake;
+ NM_WIFI_AP_GET_PRIVATE (ap)->fake = fake;
}
static void
-nm_ap_set_last_seen (NMAccessPoint *ap, gint32 last_seen)
+nm_wifi_ap_set_last_seen (NMWifiAP *ap, gint32 last_seen)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
- g_return_if_fail (NM_IS_AP (ap));
+ g_return_if_fail (NM_IS_WIFI_AP (ap));
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
if (priv->last_seen != last_seen) {
priv->last_seen = last_seen;
@@ -387,11 +387,11 @@ security_from_vardict (GVariant *security)
}
void
-nm_ap_update_from_properties (NMAccessPoint *ap,
- const char *supplicant_path,
- GVariant *properties)
+nm_wifi_ap_update_from_properties (NMWifiAP *ap,
+ const char *supplicant_path,
+ GVariant *properties)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
char *addr;
const guint8 *bytes;
GVariant *v;
@@ -403,25 +403,25 @@ nm_ap_update_from_properties (NMAccessPoint *ap,
g_return_if_fail (ap != NULL);
g_return_if_fail (properties != NULL);
- priv = NM_AP_GET_PRIVATE (ap);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
g_object_freeze_notify (G_OBJECT (ap));
if (g_variant_lookup (properties, "Privacy", "b", &b) && b)
- nm_ap_set_flags (ap, priv->flags | NM_802_11_AP_FLAGS_PRIVACY);
+ nm_wifi_ap_set_flags (ap, priv->flags | NM_802_11_AP_FLAGS_PRIVACY);
if (g_variant_lookup (properties, "Mode", "&s", &s)) {
if (!g_strcmp0 (s, "infrastructure"))
- nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
+ nm_wifi_ap_set_mode (ap, NM_802_11_MODE_INFRA);
else if (!g_strcmp0 (s, "ad-hoc"))
- nm_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
+ nm_wifi_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
}
if (g_variant_lookup (properties, "Signal", "n", &i16))
- nm_ap_set_strength (ap, nm_ap_utils_level_to_quality (i16));
+ nm_wifi_ap_set_strength (ap, nm_wifi_utils_level_to_quality (i16));
if (g_variant_lookup (properties, "Frequency", "q", &u16))
- nm_ap_set_freq (ap, u16);
+ nm_wifi_ap_set_freq (ap, u16);
v = g_variant_lookup_value (properties, "SSID", G_VARIANT_TYPE_BYTESTRING);
if (v) {
@@ -432,7 +432,7 @@ nm_ap_update_from_properties (NMAccessPoint *ap,
if ( bytes && len
&& !(((len == 8) || (len == 9)) && !memcmp (bytes, "<hidden>", 8))
&& !nm_utils_is_empty_ssid (bytes, len))
- nm_ap_set_ssid (ap, bytes, len);
+ nm_wifi_ap_set_ssid (ap, bytes, len);
g_variant_unref (v);
}
@@ -442,7 +442,7 @@ nm_ap_update_from_properties (NMAccessPoint *ap,
bytes = g_variant_get_fixed_array (v, &len, 1);
if (len == ETH_ALEN) {
addr = nm_utils_hwaddr_ntoa (bytes, len);
- nm_ap_set_address (ap, addr);
+ nm_wifi_ap_set_address (ap, addr);
g_free (addr);
}
g_variant_unref (v);
@@ -458,7 +458,7 @@ nm_ap_update_from_properties (NMAccessPoint *ap,
for (i = 0; i < len; i++) {
if (rates[i] > maxrate) {
maxrate = rates[i];
- nm_ap_set_max_bitrate (ap, rates[i] / 1000);
+ nm_wifi_ap_set_max_bitrate (ap, rates[i] / 1000);
}
}
g_variant_unref (v);
@@ -466,41 +466,41 @@ nm_ap_update_from_properties (NMAccessPoint *ap,
v = g_variant_lookup_value (properties, "WPA", G_VARIANT_TYPE_VARDICT);
if (v) {
- nm_ap_set_wpa_flags (ap, priv->wpa_flags | security_from_vardict (v));
+ nm_wifi_ap_set_wpa_flags (ap, priv->wpa_flags | security_from_vardict (v));
g_variant_unref (v);
}
v = g_variant_lookup_value (properties, "RSN", G_VARIANT_TYPE_VARDICT);
if (v) {
- nm_ap_set_rsn_flags (ap, priv->rsn_flags | security_from_vardict (v));
+ nm_wifi_ap_set_rsn_flags (ap, priv->rsn_flags | security_from_vardict (v));
g_variant_unref (v);
}
if (!priv->supplicant_path)
priv->supplicant_path = g_strdup (supplicant_path);
- nm_ap_set_last_seen (ap, nm_utils_get_monotonic_timestamp_s ());
+ nm_wifi_ap_set_last_seen (ap, nm_utils_get_monotonic_timestamp_s ());
priv->fake = FALSE;
g_object_thaw_notify (G_OBJECT (ap));
}
-NMAccessPoint *
-nm_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
+NMWifiAP *
+nm_wifi_ap_new_from_properties (const char *supplicant_path, GVariant *properties)
{
const char bad_bssid1[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const char bad_bssid2[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
- NMAccessPoint *ap;
+ NMWifiAP *ap;
const char *addr;
g_return_val_if_fail (supplicant_path != NULL, NULL);
g_return_val_if_fail (properties != NULL, NULL);
- ap = (NMAccessPoint *) g_object_new (NM_TYPE_AP, NULL);
- nm_ap_update_from_properties (ap, supplicant_path, properties);
+ ap = (NMWifiAP *) g_object_new (NM_TYPE_WIFI_AP, NULL);
+ nm_wifi_ap_update_from_properties (ap, supplicant_path, properties);
/* ignore APs with invalid or missing BSSIDs */
- addr = nm_ap_get_address (ap);
+ addr = nm_wifi_ap_get_address (ap);
if ( !addr
|| nm_utils_hwaddr_matches (addr, -1, bad_bssid1, ETH_ALEN)
|| nm_utils_hwaddr_matches (addr, -1, bad_bssid2, ETH_ALEN)) {
@@ -531,9 +531,9 @@ has_proto (NMSettingWirelessSecurity *sec, const char *proto)
}
static void
-add_pair_ciphers (NMAccessPoint *ap, NMSettingWirelessSecurity *sec)
+add_pair_ciphers (NMWifiAP *ap, NMSettingWirelessSecurity *sec)
{
- NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (ap);
+ NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE (ap);
guint32 num = nm_setting_wireless_security_get_num_pairwise (sec);
NM80211ApSecurityFlags flags = NM_802_11_AP_SEC_NONE;
guint32 i;
@@ -553,15 +553,15 @@ add_pair_ciphers (NMAccessPoint *ap, NMSettingWirelessSecurity *sec)
}
if (has_proto (sec, PROTO_WPA))
- nm_ap_set_wpa_flags (ap, priv->wpa_flags | flags);
+ nm_wifi_ap_set_wpa_flags (ap, priv->wpa_flags | flags);
if (has_proto (sec, PROTO_RSN))
- nm_ap_set_rsn_flags (ap, priv->rsn_flags | flags);
+ nm_wifi_ap_set_rsn_flags (ap, priv->rsn_flags | flags);
}
static void
-add_group_ciphers (NMAccessPoint *ap, NMSettingWirelessSecurity *sec)
+add_group_ciphers (NMWifiAP *ap, NMSettingWirelessSecurity *sec)
{
- NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (ap);
+ NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE (ap);
guint32 num = nm_setting_wireless_security_get_num_groups (sec);
NM80211ApSecurityFlags flags = NM_802_11_AP_SEC_NONE;
guint32 i;
@@ -585,16 +585,16 @@ add_group_ciphers (NMAccessPoint *ap, NMSettingWirelessSecurity *sec)
}
if (has_proto (sec, PROTO_WPA))
- nm_ap_set_wpa_flags (ap, priv->wpa_flags | flags);
+ nm_wifi_ap_set_wpa_flags (ap, priv->wpa_flags | flags);
if (has_proto (sec, PROTO_RSN))
- nm_ap_set_rsn_flags (ap, priv->rsn_flags | flags);
+ nm_wifi_ap_set_rsn_flags (ap, priv->rsn_flags | flags);
}
-NMAccessPoint *
-nm_ap_new_fake_from_connection (NMConnection *connection)
+NMWifiAP *
+nm_wifi_ap_new_fake_from_connection (NMConnection *connection)
{
- NMAccessPoint *ap;
- NMAccessPointPrivate *priv;
+ NMWifiAP *ap;
+ NMWifiAPPrivate *priv;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wireless_sec;
GBytes *ssid;
@@ -612,26 +612,26 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
g_return_val_if_fail (ssid != NULL, NULL);
g_return_val_if_fail (g_bytes_get_size (ssid) > 0, NULL);
- ap = (NMAccessPoint *) g_object_new (NM_TYPE_AP, NULL);
- priv = NM_AP_GET_PRIVATE (ap);
+ ap = (NMWifiAP *) g_object_new (NM_TYPE_WIFI_AP, NULL);
+ priv = NM_WIFI_AP_GET_PRIVATE (ap);
priv->fake = TRUE;
- nm_ap_set_ssid (ap, g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
+ nm_wifi_ap_set_ssid (ap, g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
// FIXME: bssid too?
mode = nm_setting_wireless_get_mode (s_wireless);
if (mode) {
if (!strcmp (mode, "infrastructure"))
- nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
+ nm_wifi_ap_set_mode (ap, NM_802_11_MODE_INFRA);
else if (!strcmp (mode, "adhoc"))
- nm_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
+ nm_wifi_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
else if (!strcmp (mode, "ap")) {
- nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
- NM_AP_GET_PRIVATE (ap)->hotspot = TRUE;
+ nm_wifi_ap_set_mode (ap, NM_802_11_MODE_INFRA);
+ NM_WIFI_AP_GET_PRIVATE (ap)->hotspot = TRUE;
} else
goto error;
} else {
- nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
+ nm_wifi_ap_set_mode (ap, NM_802_11_MODE_INFRA);
}
band = nm_setting_wireless_get_band (s_wireless);
@@ -643,7 +643,7 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
if (freq == 0)
goto error;
- nm_ap_set_freq (ap, freq);
+ nm_wifi_ap_set_freq (ap, freq);
}
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
@@ -654,7 +654,7 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wireless_sec);
/* Everything below here uses encryption */
- nm_ap_set_flags (ap, priv->flags | NM_802_11_AP_FLAGS_PRIVACY);
+ nm_wifi_ap_set_flags (ap, priv->flags | NM_802_11_AP_FLAGS_PRIVACY);
/* Static & Dynamic WEP */
if (!strcmp (key_mgmt, "none") || !strcmp (key_mgmt, "ieee8021x"))
@@ -665,11 +665,11 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
if (psk || eap) {
if (has_proto (s_wireless_sec, PROTO_WPA)) {
flags = priv->wpa_flags | (eap ? NM_802_11_AP_SEC_KEY_MGMT_802_1X : NM_802_11_AP_SEC_KEY_MGMT_PSK);
- nm_ap_set_wpa_flags (ap, flags);
+ nm_wifi_ap_set_wpa_flags (ap, flags);
}
if (has_proto (s_wireless_sec, PROTO_RSN)) {
flags = priv->rsn_flags | (eap ? NM_802_11_AP_SEC_KEY_MGMT_802_1X : NM_802_11_AP_SEC_KEY_MGMT_PSK);
- nm_ap_set_rsn_flags (ap, flags);
+ nm_wifi_ap_set_rsn_flags (ap, flags);
}
add_pair_ciphers (ap, s_wireless_sec);
@@ -704,10 +704,10 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
if (!(flags & NM_802_11_AP_SEC_GROUP_CCMP))
flags |= NM_802_11_AP_SEC_GROUP_TKIP;
- nm_ap_set_wpa_flags (ap, flags);
+ nm_wifi_ap_set_wpa_flags (ap, flags);
/* Don't use Ad-Hoc RSN yet */
- nm_ap_set_rsn_flags (ap, NM_802_11_AP_SEC_NONE);
+ nm_wifi_ap_set_rsn_flags (ap, NM_802_11_AP_SEC_NONE);
}
done:
@@ -719,9 +719,9 @@ error:
}
static char
-mode_to_char (NMAccessPoint *self)
+mode_to_char (NMWifiAP *self)
{
- NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (self);
+ NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE (self);
if (priv->mode == NM_802_11_MODE_ADHOC)
return '*';
@@ -733,17 +733,17 @@ mode_to_char (NMAccessPoint *self)
}
void
-nm_ap_dump (NMAccessPoint *self,
- const char *prefix,
- const char *ifname)
+nm_wifi_ap_dump (NMWifiAP *self,
+ const char *prefix,
+ const char *ifname)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
const char *supplicant_id = "-";
guint32 chan;
- g_return_if_fail (NM_IS_AP (self));
+ g_return_if_fail (NM_IS_WIFI_AP (self));
- priv = NM_AP_GET_PRIVATE (self);
+ priv = NM_WIFI_AP_GET_PRIVATE (self);
chan = nm_utils_wifi_freq_to_channel (priv->freq);
if (priv->supplicant_path)
supplicant_id = strrchr (priv->supplicant_path, '/');
@@ -775,10 +775,10 @@ freq_to_band (guint32 freq)
}
gboolean
-nm_ap_check_compatible (NMAccessPoint *self,
- NMConnection *connection)
+nm_wifi_ap_check_compatible (NMWifiAP *self,
+ NMConnection *connection)
{
- NMAccessPointPrivate *priv;
+ NMWifiAPPrivate *priv;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wireless_sec;
GBytes *ssid;
@@ -787,10 +787,10 @@ nm_ap_check_compatible (NMAccessPoint *self,
const char *bssid;
guint32 channel;
- g_return_val_if_fail (NM_IS_AP (self), FALSE);
+ g_return_val_if_fail (NM_IS_WIFI_AP (self), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
- priv = NM_AP_GET_PRIVATE (self);
+ priv = NM_WIFI_AP_GET_PRIVATE (self);
s_wireless = nm_connection_get_setting_wireless (connection);
if (s_wireless == NULL)
@@ -851,32 +851,32 @@ nm_ap_check_compatible (NMAccessPoint *self,
}
gboolean
-nm_ap_complete_connection (NMAccessPoint *self,
- NMConnection *connection,
- gboolean lock_bssid,
- GError **error)
+nm_wifi_ap_complete_connection (NMWifiAP *self,
+ NMConnection *connection,
+ gboolean lock_bssid,
+ GError **error)
{
- NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (self);
+ NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE (self);
g_return_val_if_fail (connection != NULL, FALSE);
- return nm_ap_utils_complete_connection (priv->ssid,
- priv->address,
- priv->mode,
- priv->flags,
- priv->wpa_flags,
- priv->rsn_flags,
- connection,
- lock_bssid,
- error);
+ return nm_wifi_utils_complete_connection (priv->ssid,
+ priv->address,
+ priv->mode,
+ priv->flags,
+ priv->wpa_flags,
+ priv->rsn_flags,
+ connection,
+ lock_bssid,
+ error);
}
/*****************************************************************************/
static void
-nm_ap_init (NMAccessPoint *ap)
+nm_wifi_ap_init (NMWifiAP *ap)
{
- NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE (ap);
+ NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE (ap);
priv->mode = NM_802_11_MODE_INFRA;
priv->flags = NM_802_11_AP_FLAGS_NONE;
@@ -888,14 +888,14 @@ nm_ap_init (NMAccessPoint *ap)
static void
finalize (GObject *object)
{
- NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE ((NMAccessPoint *) object);
+ NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE ((NMWifiAP *) object);
g_free (priv->supplicant_path);
if (priv->ssid)
g_byte_array_free (priv->ssid, TRUE);
g_free (priv->address);
- G_OBJECT_CLASS (nm_ap_parent_class)->finalize (object);
+ G_OBJECT_CLASS (nm_wifi_ap_parent_class)->finalize (object);
}
static void
@@ -909,7 +909,7 @@ static void
get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
- NMAccessPointPrivate *priv = NM_AP_GET_PRIVATE ((NMAccessPoint *) object);
+ NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE ((NMWifiAP *) object);
GVariant *ssid;
switch (prop_id) {
@@ -958,7 +958,7 @@ get_property (GObject *object, guint prop_id,
}
static void
-nm_ap_class_init (NMAccessPointClass *ap_class)
+nm_wifi_ap_class_init (NMWifiAPClass *ap_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (ap_class);
@@ -983,59 +983,59 @@ nm_ap_class_init (NMAccessPointClass *ap_class)
/* properties */
obj_properties[PROP_FLAGS] =
- g_param_spec_uint (NM_AP_FLAGS, "", "",
+ g_param_spec_uint (NM_WIFI_AP_FLAGS, "", "",
NM_802_11_AP_FLAGS_NONE,
NM_802_11_AP_FLAGS_PRIVACY,
NM_802_11_AP_FLAGS_NONE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_WPA_FLAGS] =
- g_param_spec_uint (NM_AP_WPA_FLAGS, "", "",
+ g_param_spec_uint (NM_WIFI_AP_WPA_FLAGS, "", "",
NM_802_11_AP_SEC_NONE,
all_sec_flags,
NM_802_11_AP_SEC_NONE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_RSN_FLAGS] =
- g_param_spec_uint (NM_AP_RSN_FLAGS, "", "",
+ g_param_spec_uint (NM_WIFI_AP_RSN_FLAGS, "", "",
NM_802_11_AP_SEC_NONE,
all_sec_flags,
NM_802_11_AP_SEC_NONE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_SSID] =
- g_param_spec_variant (NM_AP_SSID, "", "",
+ g_param_spec_variant (NM_WIFI_AP_SSID, "", "",
G_VARIANT_TYPE ("ay"),
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_FREQUENCY] =
- g_param_spec_uint (NM_AP_FREQUENCY, "", "",
+ g_param_spec_uint (NM_WIFI_AP_FREQUENCY, "", "",
0, 10000, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_HW_ADDRESS] =
- g_param_spec_string (NM_AP_HW_ADDRESS, "", "",
+ g_param_spec_string (NM_WIFI_AP_HW_ADDRESS, "", "",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_MODE] =
- g_param_spec_uint (NM_AP_MODE, "", "",
+ g_param_spec_uint (NM_WIFI_AP_MODE, "", "",
NM_802_11_MODE_ADHOC, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_MAX_BITRATE] =
- g_param_spec_uint (NM_AP_MAX_BITRATE, "", "",
+ g_param_spec_uint (NM_WIFI_AP_MAX_BITRATE, "", "",
0, G_MAXUINT16, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_STRENGTH] =
- g_param_spec_uchar (NM_AP_STRENGTH, "", "",
+ g_param_spec_uchar (NM_WIFI_AP_STRENGTH, "", "",
0, G_MAXINT8, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_LAST_SEEN] =
- g_param_spec_int (NM_AP_LAST_SEEN, "", "",
+ g_param_spec_int (NM_WIFI_AP_LAST_SEEN, "", "",
-1, G_MAXINT, -1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
diff --git a/src/devices/wifi/nm-wifi-ap.h b/src/devices/wifi/nm-wifi-ap.h
index 035d1b5e57..f0edcc9436 100644
--- a/src/devices/wifi/nm-wifi-ap.h
+++ b/src/devices/wifi/nm-wifi-ap.h
@@ -19,78 +19,78 @@
* Copyright (C) 2006 - 2008 Novell, Inc.
*/
-#ifndef __NETWORKMANAGER_ACCESS_POINT_H__
-#define __NETWORKMANAGER_ACCESS_POINT_H__
+#ifndef __NM_WIFI_AP_H__
+#define __NM_WIFI_AP_H__
#include "nm-exported-object.h"
#include "nm-dbus-interface.h"
#include "nm-connection.h"
-#define NM_TYPE_AP (nm_ap_get_type ())
-#define NM_AP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AP, NMAccessPoint))
-#define NM_AP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_AP, NMAccessPointClass))
-#define NM_IS_AP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_AP))
-#define NM_IS_AP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_AP))
-#define NM_AP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AP, NMAccessPointClass))
+#define NM_TYPE_WIFI_AP (nm_wifi_ap_get_type ())
+#define NM_WIFI_AP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_WIFI_AP, NMWifiAP))
+#define NM_WIFI_AP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_WIFI_AP, NMWifiAPClass))
+#define NM_IS_WIFI_AP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_WIFI_AP))
+#define NM_IS_WIFI_AP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_WIFI_AP))
+#define NM_WIFI_AP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_WIFI_AP, NMWifiAPClass))
-#define NM_AP_FLAGS "flags"
-#define NM_AP_WPA_FLAGS "wpa-flags"
-#define NM_AP_RSN_FLAGS "rsn-flags"
-#define NM_AP_SSID "ssid"
-#define NM_AP_FREQUENCY "frequency"
-#define NM_AP_HW_ADDRESS "hw-address"
-#define NM_AP_MODE "mode"
-#define NM_AP_MAX_BITRATE "max-bitrate"
-#define NM_AP_STRENGTH "strength"
-#define NM_AP_LAST_SEEN "last-seen"
+#define NM_WIFI_AP_FLAGS "flags"
+#define NM_WIFI_AP_WPA_FLAGS "wpa-flags"
+#define NM_WIFI_AP_RSN_FLAGS "rsn-flags"
+#define NM_WIFI_AP_SSID "ssid"
+#define NM_WIFI_AP_FREQUENCY "frequency"
+#define NM_WIFI_AP_HW_ADDRESS "hw-address"
+#define NM_WIFI_AP_MODE "mode"
+#define NM_WIFI_AP_MAX_BITRATE "max-bitrate"
+#define NM_WIFI_AP_STRENGTH "strength"
+#define NM_WIFI_AP_LAST_SEEN "last-seen"
-typedef struct _NMAccessPoint NMAccessPoint;
-typedef struct _NMAccessPointClass NMAccessPointClass;
+typedef struct _NMWifiAP NMWifiAP;
+typedef struct _NMWifiAPClass NMWifiAPClass;
-GType nm_ap_get_type (void);
+GType nm_wifi_ap_get_type (void);
-NMAccessPoint * nm_ap_new_from_properties (const char *supplicant_path,
+NMWifiAP * nm_wifi_ap_new_from_properties (const char *supplicant_path,
GVariant *properties);
-NMAccessPoint * nm_ap_new_fake_from_connection (NMConnection *connection);
+NMWifiAP * nm_wifi_ap_new_fake_from_connection (NMConnection *connection);
-void nm_ap_update_from_properties (NMAccessPoint *ap,
- const char *supplicant_path,
- GVariant *properties);
+void nm_wifi_ap_update_from_properties (NMWifiAP *ap,
+ const char *supplicant_path,
+ GVariant *properties);
-gboolean nm_ap_check_compatible (NMAccessPoint *self,
- NMConnection *connection);
+gboolean nm_wifi_ap_check_compatible (NMWifiAP *self,
+ NMConnection *connection);
-gboolean nm_ap_complete_connection (NMAccessPoint *self,
- NMConnection *connection,
- gboolean lock_bssid,
- GError **error);
+gboolean nm_wifi_ap_complete_connection (NMWifiAP *self,
+ NMConnection *connection,
+ gboolean lock_bssid,
+ GError **error);
-const char * nm_ap_get_supplicant_path (NMAccessPoint *ap);
-guint32 nm_ap_get_id (NMAccessPoint *ap);
-const GByteArray *nm_ap_get_ssid (const NMAccessPoint *ap);
-void nm_ap_set_ssid (NMAccessPoint *ap,
- const guint8 *ssid,
- gsize len);
-const char * nm_ap_get_address (const NMAccessPoint *ap);
-void nm_ap_set_address (NMAccessPoint *ap,
- const char *addr);
-NM80211Mode nm_ap_get_mode (NMAccessPoint *ap);
-gboolean nm_ap_is_hotspot (NMAccessPoint *ap);
-gint8 nm_ap_get_strength (NMAccessPoint *ap);
-void nm_ap_set_strength (NMAccessPoint *ap,
- gint8 strength);
-guint32 nm_ap_get_freq (NMAccessPoint *ap);
-void nm_ap_set_freq (NMAccessPoint *ap,
- guint32 freq);
-guint32 nm_ap_get_max_bitrate (NMAccessPoint *ap);
-void nm_ap_set_max_bitrate (NMAccessPoint *ap,
- guint32 bitrate);
-gboolean nm_ap_get_fake (const NMAccessPoint *ap);
-void nm_ap_set_fake (NMAccessPoint *ap,
- gboolean fake);
+const char * nm_wifi_ap_get_supplicant_path (NMWifiAP *ap);
+guint32 nm_wifi_ap_get_id (NMWifiAP *ap);
+const GByteArray *nm_wifi_ap_get_ssid (const NMWifiAP *ap);
+void nm_wifi_ap_set_ssid (NMWifiAP *ap,
+ const guint8 *ssid,
+ gsize len);
+const char * nm_wifi_ap_get_address (const NMWifiAP *ap);
+void nm_wifi_ap_set_address (NMWifiAP *ap,
+ const char *addr);
+NM80211Mode nm_wifi_ap_get_mode (NMWifiAP *ap);
+gboolean nm_wifi_ap_is_hotspot (NMWifiAP *ap);
+gint8 nm_wifi_ap_get_strength (NMWifiAP *ap);
+void nm_wifi_ap_set_strength (NMWifiAP *ap,
+ gint8 strength);
+guint32 nm_wifi_ap_get_freq (NMWifiAP *ap);
+void nm_wifi_ap_set_freq (NMWifiAP *ap,
+ guint32 freq);
+guint32 nm_wifi_ap_get_max_bitrate (NMWifiAP *ap);
+void nm_wifi_ap_set_max_bitrate (NMWifiAP *ap,
+ guint32 bitrate);
+gboolean nm_wifi_ap_get_fake (const NMWifiAP *ap);
+void nm_wifi_ap_set_fake (NMWifiAP *ap,
+ gboolean fake);
-void nm_ap_dump (NMAccessPoint *self,
- const char *prefix,
- const char *ifname);
+void nm_wifi_ap_dump (NMWifiAP *self,
+ const char *prefix,
+ const char *ifname);
-#endif /* __NETWORKMANAGER_ACCESS_POINT_H__ */
+#endif /* __NM_WIFI_AP_H__ */
diff --git a/src/devices/wifi/nm-wifi-ap-utils.c b/src/devices/wifi/nm-wifi-utils.c
index bcf439daa7..06da92cecd 100644
--- a/src/devices/wifi/nm-wifi-ap-utils.c
+++ b/src/devices/wifi/nm-wifi-utils.c
@@ -20,10 +20,11 @@
#include "nm-default.h"
+#include "nm-wifi-utils.h"
+
#include <string.h>
#include <stdlib.h>
-#include "nm-wifi-ap-utils.h"
#include "nm-utils.h"
static gboolean
@@ -524,15 +525,15 @@ verify_adhoc (NMSettingWirelessSecurity *s_wsec,
}
gboolean
-nm_ap_utils_complete_connection (const GByteArray *ap_ssid,
- const char *bssid,
- NM80211Mode ap_mode,
- guint32 ap_flags,
- guint32 ap_wpa_flags,
- guint32 ap_rsn_flags,
- NMConnection *connection,
- gboolean lock_bssid,
- GError **error)
+nm_wifi_utils_complete_connection (const GByteArray *ap_ssid,
+ const char *bssid,
+ NM80211Mode ap_mode,
+ guint32 ap_flags,
+ guint32 ap_wpa_flags,
+ guint32 ap_rsn_flags,
+ NMConnection *connection,
+ gboolean lock_bssid,
+ GError **error)
{
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
@@ -763,7 +764,7 @@ nm_ap_utils_complete_connection (const GByteArray *ap_ssid,
}
guint32
-nm_ap_utils_level_to_quality (gint val)
+nm_wifi_utils_level_to_quality (gint val)
{
if (val < 0) {
/* Assume dBm already; rough conversion: best = -40, worst = -100 */
diff --git a/src/devices/wifi/nm-wifi-ap-utils.h b/src/devices/wifi/nm-wifi-utils.h
index 31c12cd7b2..39c7fa177c 100644
--- a/src/devices/wifi/nm-wifi-ap-utils.h
+++ b/src/devices/wifi/nm-wifi-utils.h
@@ -18,9 +18,8 @@
* (C) Copyright 2011 Red Hat, Inc.
*/
-#ifndef __NETWORKMANAGER_WIFI_AP_UTILS_H__
-#define __NETWORKMANAGER_WIFI_AP_UTILS_H__
-
+#ifndef __NM_WIFI_UTILS_H__
+#define __NM_WIFI_UTILS_H__
#include <nm-dbus-interface.h>
#include <nm-connection.h>
@@ -28,17 +27,16 @@
#include <nm-setting-wireless-security.h>
#include <nm-setting-8021x.h>
-gboolean nm_ap_utils_complete_connection (const GByteArray *ssid,
- const char *bssid,
- NM80211Mode mode,
- guint32 flags,
- guint32 wpa_flags,
- guint32 rsn_flags,
- NMConnection *connection,
- gboolean lock_bssid,
- GError **error);
-
-guint32 nm_ap_utils_level_to_quality (gint val);
+gboolean nm_wifi_utils_complete_connection (const GByteArray *ssid,
+ const char *bssid,
+ NM80211Mode mode,
+ guint32 flags,
+ guint32 wpa_flags,
+ guint32 rsn_flags,
+ NMConnection *connection,
+ gboolean lock_bssid,
+ GError **error);
-#endif /* NM_WIFI_AP_UTILS_H */
+guint32 nm_wifi_utils_level_to_quality (gint val);
+#endif /* __NM_WIFI_UTILS_H__ */
diff --git a/src/devices/wifi/tests/Makefile.am b/src/devices/wifi/tests/Makefile.am
index d05ccf7e14..80f552fb9a 100644
--- a/src/devices/wifi/tests/Makefile.am
+++ b/src/devices/wifi/tests/Makefile.am
@@ -12,17 +12,17 @@ AM_CPPFLAGS = \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON \
$(GLIB_CFLAGS)
-noinst_PROGRAMS = test-wifi-ap-utils
+noinst_PROGRAMS = test-general
-test_wifi_ap_utils_SOURCES = \
- test-wifi-ap-utils.c \
+test_general_SOURCES = \
+ test-general.c \
$(srcdir)/../nm-wifi-ap.c \
$(srcdir)/../nm-wifi-ap.h \
- $(srcdir)/../nm-wifi-ap-utils.c \
- $(srcdir)/../nm-wifi-ap-utils.h
+ $(srcdir)/../nm-wifi-utils.c \
+ $(srcdir)/../nm-wifi-utils.h
-test_wifi_ap_utils_LDADD = $(top_builddir)/src/libNetworkManager.la
+test_general_LDADD = $(top_builddir)/src/libNetworkManager.la
@VALGRIND_RULES@
-TESTS = test-wifi-ap-utils
+TESTS = test-general
diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-general.c
index 1ef18e6af9..227ff5b7eb 100644
--- a/src/devices/wifi/tests/test-wifi-ap-utils.c
+++ b/src/devices/wifi/tests/test-general.c
@@ -22,7 +22,7 @@
#include <string.h>
-#include "nm-wifi-ap-utils.h"
+#include "nm-wifi-utils.h"
#include "nm-core-internal.h"
@@ -88,15 +88,15 @@ complete_connection (const char *ssid,
tmp = g_byte_array_sized_new (strlen (ssid));
g_byte_array_append (tmp, (const guint8 *) ssid, strlen (ssid));
- success = nm_ap_utils_complete_connection (tmp,
- bssid,
- mode,
- flags,
- wpa_flags,
- rsn_flags,
- src,
- lock_bssid,
- error);
+ success = nm_wifi_utils_complete_connection (tmp,
+ bssid,
+ mode,
+ flags,
+ wpa_flags,
+ rsn_flags,
+ src,
+ lock_bssid,
+ error);
g_byte_array_free (tmp, TRUE);
return success;
}
@@ -1289,17 +1289,17 @@ static void
test_strength_dbm (void)
{
/* boundary conditions first */
- g_assert_cmpint (nm_ap_utils_level_to_quality (-1), ==, 100);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-40), ==, 100);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-30), ==, 100);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-100), ==, 0);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-200), ==, 0);
-
- g_assert_cmpint (nm_ap_utils_level_to_quality (-81), ==, 32);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-92), ==, 14);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-74), ==, 44);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-81), ==, 32);
- g_assert_cmpint (nm_ap_utils_level_to_quality (-66), ==, 57);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-1), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-40), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-30), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-100), ==, 0);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-200), ==, 0);
+
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-81), ==, 32);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-92), ==, 14);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-74), ==, 44);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-81), ==, 32);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (-66), ==, 57);
}
static void
@@ -1308,30 +1308,30 @@ test_strength_percent (void)
int i;
/* boundary conditions first */
- g_assert_cmpint (nm_ap_utils_level_to_quality (0), ==, 0);
- g_assert_cmpint (nm_ap_utils_level_to_quality (100), ==, 100);
- g_assert_cmpint (nm_ap_utils_level_to_quality (110), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (0), ==, 0);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (100), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (110), ==, 100);
for (i = 0; i <= 100; i++)
- g_assert_cmpint (nm_ap_utils_level_to_quality (i), ==, i);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (i), ==, i);
}
static void
test_strength_wext (void)
{
/* boundary conditions that we assume aren't WEXT first */
- g_assert_cmpint (nm_ap_utils_level_to_quality (256), ==, 100);
- g_assert_cmpint (nm_ap_utils_level_to_quality (110), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (256), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (110), ==, 100);
/* boundary conditions that we assume are WEXT */
- g_assert_cmpint (nm_ap_utils_level_to_quality (111), ==, 0);
- g_assert_cmpint (nm_ap_utils_level_to_quality (150), ==, 0);
- g_assert_cmpint (nm_ap_utils_level_to_quality (225), ==, 100);
- g_assert_cmpint (nm_ap_utils_level_to_quality (255), ==, 100);
-
- g_assert_cmpint (nm_ap_utils_level_to_quality (157), ==, 2);
- g_assert_cmpint (nm_ap_utils_level_to_quality (200), ==, 74);
- g_assert_cmpint (nm_ap_utils_level_to_quality (215), ==, 99);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (111), ==, 0);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (150), ==, 0);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (225), ==, 100);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (255), ==, 100);
+
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (157), ==, 2);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (200), ==, 74);
+ g_assert_cmpint (nm_wifi_utils_level_to_quality (215), ==, 99);
}
/*****************************************************************************/