Added new CAPI to get the Association Status Code from Supplicant. 69/161169/1
authorManeesh Jain <maneesh.jain@samsung.com>
Mon, 30 Oct 2017 12:48:52 +0000 (18:18 +0530)
committertaesub kim <taesub.kim@samsung.com>
Wed, 22 Nov 2017 04:23:09 +0000 (13:23 +0900)
Change-Id: Ica6bb1230ba3c9a71fd2ee3a3704d511d8188218
Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
include/network_interface.h
include/wifi-manager.h
src/network_interface.c
src/wifi_ap.c
test/wifi_manager_test.c

index df57edb85fa3adbd49544b50311e587c7ec32fea..015dd744aa956437ec69b7160f248c77903ce930 100755 (executable)
@@ -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 {
index 2f5a3efd3793f086c19bbf51b2bd19371b727cb0..3fd35ee5c2e8245f5d6c89f893ddcd9d0182cbef 100755 (executable)
@@ -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);
 
 /**
 * @}
index 3fb7b8672835d69c2be69c3a3358b537f91b665b..a5fa109b0540fb436321028ea0474161d58a0849 100755 (executable)
@@ -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;
index 397677a55dac972a72b9df230851781528a02f7b..fd15fcd7d920f79a9c25462e61dcf0b202b90371 100755 (executable)
@@ -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)
 {
index 79d5421f128a46d374bfbf9cebeb780c11882dbc..82ee08109522996b8cd46925b64561ed18becb1b 100755 (executable)
@@ -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