From b9402af687d4a4a24531b217e3e20053ac324a34 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 9 Feb 2016 17:08:03 -0600 Subject: [PATCH] scan: Add scan_ssid_security_to_str --- src/scan.c | 16 ++++++++++++++++ src/scan.h | 2 ++ src/wiphy.c | 20 ++------------------ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/scan.c b/src/scan.c index 7835fc21..c932e892 100644 --- a/src/scan.c +++ b/src/scan.c @@ -83,6 +83,22 @@ struct scan_results { struct scan_freq_set *freqs; }; +const char *scan_ssid_security_to_str(enum scan_ssid_security ssid_security) +{ + switch (ssid_security) { + case SCAN_SSID_SECURITY_NONE: + return "open"; + case SCAN_SSID_SECURITY_WEP: + return "wep"; + case SCAN_SSID_SECURITY_PSK: + return "psk"; + case SCAN_SSID_SECURITY_8021X: + return "8021x"; + } + + return NULL; +} + static void scan_done(struct l_genl_msg *msg, void *userdata); static bool scan_context_match(const void *a, const void *b) diff --git a/src/scan.h b/src/scan.h index 32da4e74..b4e55d55 100644 --- a/src/scan.h +++ b/src/scan.h @@ -65,6 +65,8 @@ struct scan_bss { uint16_t rank; }; +const char *scan_ssid_security_to_str(enum scan_ssid_security ssid_security); + uint32_t scan_passive(uint32_t ifindex, scan_trigger_func_t trigger, scan_notify_func_t notify, void *userdata, scan_destroy_func_t destroy); diff --git a/src/wiphy.c b/src/wiphy.c index b71336b0..f39dbda9 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -135,22 +135,6 @@ static bool eapol_read(struct l_io *io, void *user_data) return true; } -static const char *ssid_security_to_str(enum scan_ssid_security ssid_security) -{ - switch (ssid_security) { - case SCAN_SSID_SECURITY_NONE: - return "open"; - case SCAN_SSID_SECURITY_WEP: - return "wep"; - case SCAN_SSID_SECURITY_PSK: - return "psk"; - case SCAN_SSID_SECURITY_8021X: - return "8021x"; - } - - return NULL; -} - static const char *iwd_network_get_path(struct netdev *netdev, const uint8_t *ssid, size_t ssid_len, enum scan_ssid_security ssid_security) @@ -165,7 +149,7 @@ static const char *iwd_network_get_path(struct netdev *netdev, ssid[i]); snprintf(path + pos, sizeof(path) - pos, "_%s", - ssid_security_to_str(ssid_security)); + scan_ssid_security_to_str(ssid_security)); return path; } @@ -1730,7 +1714,7 @@ static void process_bss(struct netdev *netdev, struct scan_bss *bss) network->object_path, network); l_debug("Added new Network \"%s\" security %s", network->ssid, - ssid_security_to_str(ssid_security)); + scan_ssid_security_to_str(ssid_security)); if (!l_dbus_register_interface(dbus_get_bus(), network->object_path,