From: Maneesh Jain Date: Mon, 30 Oct 2017 12:48:52 +0000 (+0530) Subject: Added new CAPI to get the Association Status Code from Supplicant. X-Git-Tag: submit/tizen_4.0/20171122.064346~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c86a4a84a75323ac65eeeb3ba93f0aed31d0fe51;p=platform%2Fcore%2Fapi%2Fwifi-manager.git Added new CAPI to get the Association Status Code from Supplicant. Change-Id: Ica6bb1230ba3c9a71fd2ee3a3704d511d8188218 Signed-off-by: Maneesh Jain --- diff --git a/include/network_interface.h b/include/network_interface.h index df57edb..015dd74 100755 --- a/include/network_interface.h +++ b/include/network_interface.h @@ -168,6 +168,7 @@ typedef struct { int raw_ssid_len; /** Raw SSID length */ char vsie[NET_WLAN_MAX_VSIE_LEN+1]; /** Vendor Specific Information Element of AP*/ gsize vsie_len; /** VSIE length */ + int assoc_status_code; /** Supplicant WiFi Association Status Code */ } net_profile_info_s; typedef struct { diff --git a/include/wifi-manager.h b/include/wifi-manager.h index 2f5a3ef..3fd35ee 100755 --- a/include/wifi-manager.h +++ b/include/wifi-manager.h @@ -591,6 +591,101 @@ typedef enum { } wifi_manager_disconnect_reason_e; +/** + * @brief Enumeration for Wi-Fi Association Status code, provided by the supplicant. + * @details The Wi-Fi Standard Reference : Status codes (IEEE 802.11-2007, 7.3.1.9, Table 7-23). + * @since_tizen 5.0 + */ +typedef enum { + /** + * Successful + */ + WLAN_STATUS_SUCCESS = 0, + + /** + * Unspecified failure + */ + WLAN_STATUS_UNSPECIFIED_FAILURE = 1, + + /** + * Responding STA does not support the specified authentication + * algorithm + */ + WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, + + /** + * Association denied because AP is unable to handle additional + * associated STAs + */ + WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, + + /** + * Association denied because the requesting STA does not support + * HT feature + */ + WLAN_STATUS_ASSOC_DENIED_NO_HT = 27, + + /** + * Association request rejected temporarily + */ + WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30, + + /** + * Robust management frame policy violation + */ + WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31, + + /** + * Invalid element + */ + WLAN_STATUS_INVALID_IE = 40, + + /** + * Invalid group cipher + */ + WLAN_STATUS_GROUP_CIPHER_NOT_VALID = 41, + + /** + * Invalid pairwise cipher + */ + WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID = 42, + + /** + * Invalid AKMP + */ + WLAN_STATUS_AKMP_NOT_VALID = 43, + + /** + * Cipher suite rejected because of security policy + */ + WLAN_STATUS_CIPHER_REJECTED_PER_POLICY = 46, + + /** + * Association denied because the Listen interval is too large + */ + WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE = 51, + + /** + * Invalid pairwise master key identifier (PKMID) + */ + WLAN_STATUS_INVALID_PMKID = 53, + + /** + * Invalid MDE + */ + WLAN_STATUS_INVALID_MDIE = 54, + + /** + * Invalid FTE + */ + WLAN_STATUS_INVALID_FTIE = 55, + + /** + * Association denied because the requesting STA does not support + * VHT feature + */ + WLAN_STATUS_ASSOC_DENIED_NO_VHT = 104, +} wifi_manager_assoc_status_code_e; /** * @} @@ -2615,7 +2710,6 @@ int wifi_manager_ap_set_eap_auth_type(wifi_manager_ap_h ap, wifi_manager_eap_aut */ int wifi_manager_ap_get_disconnect_reason(wifi_manager_ap_h ap, wifi_manager_disconnect_reason_e *disconnect_reason); - /** * @brief Gets the DNS config type. * @since_tizen 4.0 @@ -2693,6 +2787,20 @@ int wifi_manager_ap_set_prefix_length(wifi_manager_ap_h ap, */ int wifi_manager_ap_get_error_state(wifi_manager_ap_h ap, wifi_manager_error_e *error_state); +/** + * @brief Gets the Wi-Fi Association Status Code from the supplicant. + * @since_tizen 5.0 + * @param[in] ap The access point handle + * @param[out] status_code The supplicant Wi-Fi association status code + * @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_NOT_SUPPORTED Not supported + */ + +int wifi_manager_ap_get_assoc_status_code(wifi_manager_ap_h ap, + wifi_manager_assoc_status_code_e *status_code); /** * @} diff --git a/src/network_interface.c b/src/network_interface.c index 3fb7b86..a5fa109 100755 --- a/src/network_interface.c +++ b/src/network_interface.c @@ -980,6 +980,9 @@ static int __net_extract_wifi_info(GVariantIter *array, net_profile_info_s* Prof } else if (g_strcmp0(key, "DisconnectReason") == 0) { ProfInfo->disconnect_reason = g_variant_get_int32(var); + } else if (g_strcmp0(key, "AssocStatusCode") == 0) { + ProfInfo->assoc_status_code = g_variant_get_int32(var); + } else if (g_strcmp0(key, "EAP") == 0) { value = g_variant_get_string(var, NULL); @@ -1368,7 +1371,7 @@ int net_init_profile_info(net_profile_info_s *ProfInfo) ProfInfo->security_info.enc_mode = 0; ProfInfo->security_info.wps_support = FALSE; ProfInfo->disconnect_reason = 0; - + ProfInfo->assoc_status_code = 0; net_info = &(ProfInfo->net_info); net_info->DnsCount = 0; diff --git a/src/wifi_ap.c b/src/wifi_ap.c index 397677a..fd15fcd 100755 --- a/src/wifi_ap.c +++ b/src/wifi_ap.c @@ -2290,6 +2290,30 @@ EXPORT_API int wifi_manager_ap_get_disconnect_reason(wifi_manager_ap_h ap, return WIFI_MANAGER_ERROR_NONE; } +EXPORT_API int wifi_manager_ap_get_assoc_status_code(wifi_manager_ap_h ap, + wifi_manager_assoc_status_code_e *status_code) +{ + __NETWORK_CAPI_FUNC_ENTER__; + + CHECK_FEATURE_SUPPORTED(WIFI_FEATURE); + + if (_wifi_check_ap_validity(ap) == false || status_code == NULL) { + 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; + *status_code = (int)profile_info->assoc_status_code; + + WIFI_LOG(WIFI_INFO, "Association Status Code %d\n", + *status_code); + + __NETWORK_CAPI_FUNC_EXIT__; + + return WIFI_MANAGER_ERROR_NONE; +} + EXPORT_API int wifi_manager_ap_foreach_ipv6_address(wifi_manager_ap_h ap, wifi_manager_ap_ipv6_address_cb callback, void *user_data) { diff --git a/test/wifi_manager_test.c b/test/wifi_manager_test.c index 79d5421..82ee081 100755 --- a/test/wifi_manager_test.c +++ b/test/wifi_manager_test.c @@ -975,6 +975,7 @@ static bool __test_found_print_ap_info_callback(wifi_manager_ap_h ap, void *user bool bool_value; char *ap_name_part = (char*)user_data; wifi_manager_disconnect_reason_e disconnect_reason; + wifi_manager_assoc_status_code_e status_code; wifi_manager_rssi_level_e rssi_level; char *vsie; int length; @@ -1032,6 +1033,12 @@ static bool __test_found_print_ap_info_callback(wifi_manager_ap_h ap, void *user else printf("Fail to get disconnect reason\n"); + if (wifi_manager_ap_get_assoc_status_code(ap, &status_code) + == WIFI_MANAGER_ERROR_NONE) + printf("Association Status Code : %d\n", status_code); + else + printf("Fail to get association status code\n"); + if (wifi_manager_ap_get_error_state(ap, &int_value) == WIFI_MANAGER_ERROR_NONE) printf("error state of AP : %s\n", __test_convert_error_to_string(int_value)); else