summary refs log tree commit diff
path: root/src/nm-wifi-ap.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2013-02-03 14:49:22 +0100
committerMichael Biebl <biebl@debian.org>2013-02-03 14:49:22 +0100
commit9c202e3e860b3be9e1f8882630b69affbb130102 (patch)
tree8202bf39f2129486971fa7d5ae0dee61a561aa53 /src/nm-wifi-ap.c
parent36cb2f364a821e1be50b23e03a18891ec55adb06 (diff)
Imported Upstream version 0.9.7.995 upstream/0.9.7.995
Diffstat (limited to 'src/nm-wifi-ap.c')
-rw-r--r--src/nm-wifi-ap.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/nm-wifi-ap.c b/src/nm-wifi-ap.c
index 6a607960..e6db6920 100644
--- a/src/nm-wifi-ap.c
+++ b/src/nm-wifi-ap.c
@@ -58,6 +58,7 @@ typedef struct
 
 	/* Non-scanned attributes */
 	gboolean			fake;	/* Whether or not the AP is from a scan */
+	gboolean            hotspot;    /* Whether the AP is a local device's hotspot network */
 	gboolean			broadcast;	/* Whether or not the AP is broadcasting (hidden) */
 	glong				last_seen;	/* Last time the AP was seen in a scan in seconds */
 } NMAccessPointPrivate;
@@ -650,7 +651,10 @@ nm_ap_new_fake_from_connection (NMConnection *connection)
 			nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
 		else if (!strcmp (mode, "adhoc"))
 			nm_ap_set_mode (ap, NM_802_11_MODE_ADHOC);
-		else
+		else if (!strcmp (mode, "ap")) {
+			nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
+			NM_AP_GET_PRIVATE (ap)->hotspot = TRUE;
+		} else
 			goto error;
 	} else {
 		nm_ap_set_mode (ap, NM_802_11_MODE_INFRA);
@@ -975,6 +979,13 @@ void nm_ap_set_mode (NMAccessPoint *ap, const NM80211Mode mode)
 	}
 }
 
+gboolean
+nm_ap_is_hotspot (NMAccessPoint *ap)
+{
+	g_return_val_if_fail (NM_IS_AP (ap), FALSE);
+
+	return NM_AP_GET_PRIVATE (ap)->hotspot;
+}
 
 /*
  * Get/set functions for strength
@@ -1160,6 +1171,9 @@ nm_ap_check_compatible (NMAccessPoint *self,
 			return FALSE;
 		if (!strcmp (mode, "adhoc") && (priv->mode != NM_802_11_MODE_ADHOC))
 			return FALSE;
+		if (   !strcmp (mode, "ap")
+		    && (priv->mode != NM_802_11_MODE_INFRA || priv->hotspot != TRUE))
+			return FALSE;
 	}
 
 	band = nm_setting_wireless_get_band (s_wireless);