[PATCH 2/6] devices/wifi: Move is_manf_default_ssid to nm-wifi-utils.c
- From: Andrew Zaborowski <andrew zaborowski intel com>
- To: networkmanager-list gnome org
- Subject: [PATCH 2/6] devices/wifi: Move is_manf_default_ssid to nm-wifi-utils.c
- Date: Sat, 9 Dec 2017 16:28:09 +0100
Move the function for easier code reuse.
---
src/devices/wifi/nm-device-wifi.c | 36 ++----------------------------------
src/devices/wifi/nm-wifi-utils.c | 32 ++++++++++++++++++++++++++++++++
src/devices/wifi/nm-wifi-utils.h | 2 ++
3 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
index 23777ae60..b3c1269b4 100644
--- a/src/devices/wifi/nm-device-wifi.c
+++ b/src/devices/wifi/nm-device-wifi.c
@@ -48,6 +48,7 @@
#include "nm-auth-utils.h"
#include "settings/nm-settings-connection.h"
#include "settings/nm-settings.h"
+#include "nm-wifi-utils.h"
#include "nm-core-internal.h"
#include "nm-config.h"
@@ -730,39 +731,6 @@ check_connection_available (NMDevice *device,
}
static gboolean
-is_manf_default_ssid (const GByteArray *ssid)
-{
- int i;
- /*
- * List of manufacturer default SSIDs that are often unchanged by users.
- *
- * NOTE: this list should *not* contain networks that you would like to
- * automatically roam to like "Starbucks" or "AT&T" or "T-Mobile HotSpot".
- */
- static const char *manf_defaults[] = {
- "linksys",
- "linksys-a",
- "linksys-g",
- "default",
- "belkin54g",
- "NETGEAR",
- "o2DSL",
- "WLAN",
- "ALICE-WLAN",
- "Speedport W 501V",
- "TURBONETT",
- };
-
- for (i = 0; i < G_N_ELEMENTS (manf_defaults); i++) {
- if (ssid->len == strlen (manf_defaults[i])) {
- if (memcmp (manf_defaults[i], ssid->data, ssid->len) == 0)
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static gboolean
complete_connection (NMDevice *device,
NMConnection *connection,
const char *specific_object,
@@ -882,7 +850,7 @@ complete_connection (NMDevice *device,
*/
if (!nm_wifi_ap_complete_connection (ap,
connection,
- is_manf_default_ssid (ssid),
+ nm_wifi_utils_is_manf_default_ssid (ssid),
error)) {
if (tmp_ssid)
g_byte_array_unref (tmp_ssid);
diff --git a/src/devices/wifi/nm-wifi-utils.c b/src/devices/wifi/nm-wifi-utils.c
index 06da92cec..d85f62381 100644
--- a/src/devices/wifi/nm-wifi-utils.c
+++ b/src/devices/wifi/nm-wifi-utils.c
@@ -784,3 +784,35 @@ nm_wifi_utils_level_to_quality (gint val)
return (guint32) val;
}
+gboolean
+nm_wifi_utils_is_manf_default_ssid (const GByteArray *ssid)
+{
+ int i;
+ /*
+ * List of manufacturer default SSIDs that are often unchanged by users.
+ *
+ * NOTE: this list should *not* contain networks that you would like to
+ * automatically roam to like "Starbucks" or "AT&T" or "T-Mobile HotSpot".
+ */
+ static const char *manf_defaults[] = {
+ "linksys",
+ "linksys-a",
+ "linksys-g",
+ "default",
+ "belkin54g",
+ "NETGEAR",
+ "o2DSL",
+ "WLAN",
+ "ALICE-WLAN",
+ "Speedport W 501V",
+ "TURBONETT",
+ };
+
+ for (i = 0; i < G_N_ELEMENTS (manf_defaults); i++) {
+ if (ssid->len == strlen (manf_defaults[i])) {
+ if (memcmp (manf_defaults[i], ssid->data, ssid->len) == 0)
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
diff --git a/src/devices/wifi/nm-wifi-utils.h b/src/devices/wifi/nm-wifi-utils.h
index 1b6c2f4bf..def64dd6f 100644
--- a/src/devices/wifi/nm-wifi-utils.h
+++ b/src/devices/wifi/nm-wifi-utils.h
@@ -39,4 +39,6 @@ gboolean nm_wifi_utils_complete_connection (const GByteArray *ssid,
guint32 nm_wifi_utils_level_to_quality (gint val);
+gboolean nm_wifi_utils_is_manf_default_ssid (const GByteArray *ssid);
+
#endif /* __NM_WIFI_UTILS_H__ */
--
2.11.0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]