int wifi_manager_get_country_code(wifi_manager_h wifi, char **country_code);
/**
+ * @brief Checks available security types of the AP.
+ * @details An AP may support several types of security modes together.
+ * You can check all supported security modes with this API.
+ * @since_tizen 7.0
+ *
+ * @param[in] ap The access point handle
+ * @param[in] type Wi-Fi security type
+ * @param[out] supported true when enabled and false when disabled
+ *
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @pre This API needs wifi_manager_initialize() and wifi_manager_activate() before use.
+ */
+int wifi_manager_ap_is_security_type_supported(wifi_manager_ap_h ap,
+ wifi_manager_security_type_e type, bool *supported);
+
+/**
* @}
*/
g_variant_iter_free(iter_sub);
}
+static inline void _net_extract_winfo_security_list(GVariant *var, net_profile_info_s *ProfInfo)
+{
+ const gchar *value;
+ GVariantIter *iter_sub = NULL;
+
+ g_variant_get(var, "as", &iter_sub);
+ while (g_variant_iter_loop(iter_sub, "s", &value)) {
+ if (g_strcmp0(value, "none") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_NONE] = TRUE;
+ else if (g_strcmp0(value, "wep") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_WEP] = TRUE;
+ else if (g_strcmp0(value, "psk") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_WPA_PSK] = TRUE;
+ else if (g_strcmp0(value, "ft_psk") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_WPA_FT_PSK] = TRUE;
+ else if (g_strcmp0(value, "ieee8021x") == 0 || g_strcmp0(value, "ft_ieee8021x") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_EAP] = TRUE;
+ else if (g_strcmp0(value, "rsn") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK] = TRUE;
+ else if (g_strcmp0(value, "sae") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_SAE] = TRUE;
+ else if (g_strcmp0(value, "owe") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_OWE] = TRUE;
+ else if (g_strcmp0(value, "dpp") == 0)
+ ProfInfo->security_info.sec_list[WIFI_MANAGER_SECURITY_TYPE_DPP] = TRUE;
+ }
+ g_variant_iter_free(iter_sub);
+}
+
static inline void _net_extract_winfo_encryptionmode(const gchar *value, net_profile_info_s *ProfInfo)
{
if (g_strcmp0(value, "none") == 0)
ProfInfo->wlan_mode = _net_extract_winfo_mode(value);
} else if (g_strcmp0(key, "Security") == 0) {
_net_extract_winfo_security(var, ProfInfo);
+ } else if (g_strcmp0(key, "SecurityList") == 0) {
+ _net_extract_winfo_security_list(var, ProfInfo);
} else if (g_strcmp0(key, "EncryptionMode") == 0) {
value = g_variant_get_string(var, NULL);
_net_extract_winfo_encryptionmode(value, ProfInfo);
#include <glib.h>
#include "network_config.h"
+#include "wifi-manager.h"
#ifdef __cplusplus
extern "C" {
wlan_auth_info_u authentication; /** authentication information */
char wps_support; /** If WPS is supported, then this property will be set to TRUE */
unsigned int keymgmt; /** If WPS is supported, then this property will be set to TRUE */
+ gboolean sec_list[WIFI_MANAGER_SECURITY_TYPE_DPP+1]; /** security mode list */
} wlan_security_info_s;
#ifdef __cplusplus
return WIFI_MANAGER_ERROR_NONE;
}
+
+EXPORT_API int wifi_manager_ap_is_security_type_supported(wifi_manager_ap_h ap,
+ wifi_manager_security_type_e type, bool *supported)
+{
+ /* __NETWORK_CAPI_FUNC_ENTER__; */
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (_wifi_check_ap_validity(ap) == false ||
+ supported == NULL ||
+ type < WIFI_MANAGER_SECURITY_TYPE_NONE ||
+ type > WIFI_MANAGER_SECURITY_TYPE_DPP) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ /* __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE */
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ net_profile_info_s *profile_info = ap;
+
+ if (profile_info->security_info.sec_list[type])
+ *supported = true;
+ else
+ *supported = false;
+
+ /* __NETWORK_CAPI_FUNC_EXIT__; */
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_ap_get_encryption_type(wifi_manager_ap_h ap,
wifi_manager_encryption_type_e *type)
{
return 1;
}
+static bool __test_found_check_security_type_callback(wifi_manager_ap_h ap, void *user_data)
+{
+ int rv = 0;
+ char *ap_name = NULL;
+ char *ap_name_part = user_data;
+ int sec_type = 0;
+ bool supported = false;
+
+ rv = wifi_manager_ap_get_essid(ap, &ap_name);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("[Wi-Fi] Fail to get AP name [%s]\n", wman_test_strerror(rv));
+ return false;
+ }
+
+ if (wman_test_compare_ap_name(ap_name, ap_name_part)) {
+ printf("Enter security type to check\n"
+ "(0:None, 1:WEP, 2:WPA, 3:WPA2, 4:EAP, 5:FT_PSK, 6:SAE, 7:OWE, 8:DPP): ");
+ rv = scanf(" %d", &sec_type);
+
+ rv = wifi_manager_ap_is_security_type_supported(ap, sec_type, &supported);
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ printf("Fail to get security info[%s]\n", wman_test_strerror(rv));
+ else
+ printf("Supported: %s\n", supported ? "TRUE" : "FALSE");
+
+ free(ap_name);
+ return false;
+ }
+
+ free(ap_name);
+ return true;
+}
+
+int wman_test_check_supported_security_type(wifi_manager_h wifi)
+{
+ int rv = 0;
+ char ap_name[33];
+ bool state = false;
+
+ wifi_manager_is_activated(wifi, &state);
+ if (state == false)
+ return -1;
+
+ printf("[Wi-Fi] Input a part of AP name to get : ");
+ rv = scanf(" %32[^\n]s", ap_name);
+ if (rv <= 0)
+ return -1;
+
+ rv = wifi_manager_foreach_found_ap(wifi, __test_found_check_security_type_callback, ap_name);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("[Wi-Fi] Fail to get up (can't get AP list) [%s]\n", wman_test_strerror(rv));
+ return -1;
+ }
+
+ return 1;
+}
+
void wman_test_print_connection_mode(wifi_manager_ap_h ap)
{
wifi_manager_connection_mode_e mode;
int wman_test_get_mac_policies(wifi_manager_h wifi);
int wman_test_set_country_code(wifi_manager_h wifi);
int wman_test_get_country_code(wifi_manager_h wifi);
+int wman_test_check_supported_security_type(wifi_manager_h wifi);
void wman_test_print_connection_mode(wifi_manager_ap_h ap);
printf("$ - Get mac policies\n");
printf("^ - Set country code\n");
printf("& - Get country code\n");
+ printf("* - Check available security type\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
case '&':
rv = wman_test_get_country_code(wifi);
break;
+ case '*':
+ rv = wman_test_check_supported_security_type(wifi);
+ break;
default:
break;
}