Add CAPI to provide PMF information 34/271034/2 accepted/tizen/unified/20220216.175741 submit/tizen/20220215.060643
authorJaehyun Kim <jeik01.kim@samsung.com>
Mon, 14 Feb 2022 11:22:35 +0000 (20:22 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Mon, 14 Feb 2022 11:25:52 +0000 (20:25 +0900)
Change-Id: Idf213f236d201e21c7a26ab7eb79d3a8997c244e
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
include/wifi-manager-extension.h
packaging/capi-network-wifi-manager.spec
src/network_interface.c
src/network_interface.h
src/wifi_ap.c
tools/manager-test/wman_test_ap.c
tools/manager-test/wman_test_extension.h

index 0c7019f..71115b0 100644 (file)
@@ -821,17 +821,29 @@ int wifi_manager_unset_roaming_cb(wifi_manager_h wifi);
  *
  * @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
+  * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER    Invalid parameter
+  * @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);
 
 /**
+ * @brief Checks whether Protected Management Frame is required.
+ * @since_tizen 7.0
+ *
+ * @param[in] ap             The access point handle
+ * @param[out] required      true when required and false when not required
+ *
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE                 Successful
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @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_pmf_required(wifi_manager_ap_h ap, bool *required);
+
+/**
  * @}
  */
 
index dc69e73..c81601f 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-wifi-manager
 Summary:       Network Wi-Fi library in TIZEN C API
-Version:       1.3.17
+Version:       1.3.18
 Release:       0
 Group:         System/Network
 License:       Apache-2.0
index f2c4e08..b2835cc 100644 (file)
@@ -1093,6 +1093,8 @@ static int __net_extract_wifi_info(GVariantIter *array, net_profile_info_s *Prof
                        _net_extract_winfo_bssid_list(var, ProfInfo);
                } else if (g_strcmp0(key, "Hidden") == 0) {
                        ProfInfo->ap_hidden_status = g_variant_get_boolean(var);
+               } else if (g_strcmp0(key, "PmfReq") == 0) {
+                       ProfInfo->pmf_required = g_variant_get_boolean(var);
                } else
                        Error = __net_extract_common_info(key, var, ProfInfo);
        }
index caef5e7..150d1de 100644 (file)
@@ -151,6 +151,7 @@ typedef struct {
        unsigned int connection_mode;                                   /** Connection mode (IEEE 802.11b/g/n/a/ac) */
        GSList *bssid_list;                     /** List if BSSID, strength and frequency of AP **/
        gboolean ap_hidden_status;              /** Hidden Status of connected AP */
+       gboolean pmf_required;                  /** TRUE if Protected Management Frame is required. */
 
        network_info_s *network_info;
 } net_profile_info_s;
index 45e8dbd..c84313a 100644 (file)
@@ -2087,6 +2087,29 @@ EXPORT_API int wifi_manager_ap_is_hidden(wifi_manager_ap_h ap, bool *is_hidden)
        return WIFI_MANAGER_ERROR_NONE;
 }
 
+EXPORT_API int wifi_manager_ap_is_pmf_required(wifi_manager_ap_h ap, bool *required)
+{
+       /* __NETWORK_CAPI_FUNC_ENTER__; */
+
+       CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+       if (_wifi_check_ap_validity(ap) == false || required == 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;
+
+       if (profile_info->pmf_required)
+               *required = true;
+       else
+               *required = false;
+
+       /* __NETWORK_CAPI_FUNC_EXIT__; */
+       return WIFI_MANAGER_ERROR_NONE;
+}
+
 /* Wi-Fi EAP *****************************************************************/
 EXPORT_API int wifi_manager_ap_set_eap_passphrase(wifi_manager_ap_h ap,
                const char *user_name, const char *password)
index b473189..35ae5dd 100644 (file)
@@ -1153,6 +1153,11 @@ static inline void __test_found_print_ap_basic_info_cb(wifi_manager_ap_h ap)
                printf("error state of AP : %s\n", wman_test_strerror(int_value));
        else
                printf("Fail to get error state of AP\n");
+
+       if (wifi_manager_ap_is_pmf_required(ap, &bool_value) == WIFI_MANAGER_ERROR_NONE)
+               printf("PMF Required : %s\n", bool_value ? "TRUE" : "FALSE");
+       else
+               printf("Fail to get PMF status\n");
 }
 
 static bool __test_found_print_ap_info_cb(wifi_manager_ap_h ap, void *user_data)
index 80b377f..22ae231 100644 (file)
@@ -15,7 +15,7 @@
  */
 #pragma once
 
-#include <wifi-manager.h>
+#include <wifi-manager-extension.h>
 
 int wman_test_set_autoscan_state(wifi_manager_h wifi);
 int wman_test_set_autoscan_mode(wifi_manager_h wifi);