guint32 peer_id, guint32 own_id, gboolean is_initiator);
int _net_dbus_set_mac_policy(network_info_s *network_info, unsigned int policy);
+int _net_dbus_get_mac_policy(network_info_s *network_info, unsigned int *policy);
int _net_dbus_set_preassoc_mac_policy(network_info_s *network_info, unsigned int policy);
+int _net_dbus_get_preassoc_mac_policy(network_info_s *network_info, unsigned int *policy);
int _net_dbus_set_random_mac_lifetime(network_info_s *network_info, unsigned int lifetime);
+int _net_dbus_get_random_mac_lifetime(network_info_s *network_info, unsigned int *lifetime);
int _net_dbus_set_country_code(network_info_s *network_info, const char *country);
int _net_dbus_get_country_code(network_info_s *network_info, char **country);
guint32 peer_id, guint32 own_id, gboolean is_initiator);
int net_wifi_set_mac_policy(network_info_s *network_info, unsigned int policy);
+int net_wifi_get_mac_policy(network_info_s *network_info, unsigned int *policy);
int net_wifi_set_preassoc_mac_policy(network_info_s *network_info, unsigned int policy);
+int net_wifi_get_preassoc_mac_policy(network_info_s *network_info, unsigned int *policy);
int net_wifi_set_random_mac_lifetime(network_info_s *network_info, unsigned int lifetime);
+int net_wifi_get_random_mac_lifetime(network_info_s *network_info, unsigned int *lifetime);
int net_wifi_set_country_code(network_info_s *network_info, const char *country);
int net_wifi_get_country_code(network_info_s *network_info, char **country);
Name: capi-network-wifi-manager
Summary: Network Wi-Fi library in TIZEN C API
-Version: 1.3.8
+Version: 1.3.9
Release: 5
Group: System/Network
License: Apache-2.0
return Error;
}
+int _net_dbus_get_mac_policy(network_info_s *network_info, unsigned int *policy)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+ GVariant *value = NULL;
+ GVariantIter *iter = NULL;
+ gchar *key = NULL;
+
+ message = _net_invoke_dbus_method(network_info,
+ CONNMAN_SERVICE, CONNMAN_WIFI_TECHNOLOGY_PREFIX,
+ CONNMAN_TECHNOLOGY_INTERFACE, "GetProperties",
+ NULL, &Error);
+
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get properties");
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ g_variant_get(message, "(a{sv})", &iter);
+
+ while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+ if (g_strcmp0(key, "MacPolicy") == 0) {
+ *policy = g_variant_get_uint32(value);
+ WIFI_LOG(WIFI_INFO, "Successfully get mac policy: %u", *policy);
+
+ g_variant_unref(value);
+ g_free(key);
+ break;
+ }
+ }
+
+ g_variant_iter_free(iter);
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int _net_dbus_set_preassoc_mac_policy(network_info_s *network_info, unsigned int policy)
{
__NETWORK_FUNC_ENTER__;
return Error;
}
+int _net_dbus_get_preassoc_mac_policy(network_info_s *network_info, unsigned int *policy)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+ GVariant *value = NULL;
+ GVariantIter *iter = NULL;
+ gchar *key = NULL;
+
+ message = _net_invoke_dbus_method(network_info,
+ CONNMAN_SERVICE, CONNMAN_WIFI_TECHNOLOGY_PREFIX,
+ CONNMAN_TECHNOLOGY_INTERFACE, "GetProperties",
+ NULL, &Error);
+
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get properties");
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ g_variant_get(message, "(a{sv})", &iter);
+
+ while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+ if (g_strcmp0(key, "PreassocMacPolicy") == 0) {
+ *policy = g_variant_get_uint32(value);
+ WIFI_LOG(WIFI_INFO, "Successfully get preassoc mac policy: %u", *policy);
+
+ g_variant_unref(value);
+ g_free(key);
+ break;
+ }
+ }
+
+ g_variant_iter_free(iter);
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int _net_dbus_set_random_mac_lifetime(network_info_s *network_info, unsigned int lifetime)
{
__NETWORK_FUNC_ENTER__;
return Error;
}
+int _net_dbus_get_random_mac_lifetime(network_info_s *network_info, unsigned int *lifetime)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+ GVariant *value = NULL;
+ GVariantIter *iter = NULL;
+ gchar *key = NULL;
+
+ message = _net_invoke_dbus_method(network_info,
+ CONNMAN_SERVICE, CONNMAN_WIFI_TECHNOLOGY_PREFIX,
+ CONNMAN_TECHNOLOGY_INTERFACE, "GetProperties",
+ NULL, &Error);
+
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get properties");
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ g_variant_get(message, "(a{sv})", &iter);
+
+ while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+ if (g_strcmp0(key, "RandomMacLifetime") == 0) {
+ *lifetime = g_variant_get_uint32(value);
+ WIFI_LOG(WIFI_INFO, "Successfully get random mac lifetime: %u", *lifetime);
+
+ g_variant_unref(value);
+ g_free(key);
+ break;
+ }
+ }
+
+ g_variant_iter_free(iter);
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int _net_dbus_set_country_code(network_info_s *network_info, const char *country)
{
__NETWORK_FUNC_ENTER__;
return Error;
}
+int net_wifi_get_mac_policy(network_info_s *network_info, unsigned int *policy)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ Error = _net_dbus_get_mac_policy(network_info, policy);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int net_wifi_set_preassoc_mac_policy(network_info_s *network_info, unsigned int policy)
{
__NETWORK_FUNC_ENTER__;
return Error;
}
+int net_wifi_get_preassoc_mac_policy(network_info_s *network_info, unsigned int *policy)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ Error = _net_dbus_get_preassoc_mac_policy(network_info, policy);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int net_wifi_set_random_mac_lifetime(network_info_s *network_info, unsigned int lifetime)
{
__NETWORK_FUNC_ENTER__;
return Error;
}
+int net_wifi_get_random_mac_lifetime(network_info_s *network_info, unsigned int *lifetime)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ Error = _net_dbus_get_random_mac_lifetime(network_info, lifetime);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int net_wifi_set_country_code(network_info_s *network_info, const char *country)
{
__NETWORK_FUNC_ENTER__;
int _wifi_get_mac_policy(wifi_manager_h wifi, unsigned int *policy)
{
+ int rv;
wifi_manager_handle_s *wifi_handle = wifi;
- *policy = wifi_handle->mac_policy;
+ rv = net_wifi_get_mac_policy(wifi_handle->network_info, policy);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE)
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
return WIFI_MANAGER_ERROR_NONE;
}
int _wifi_get_preassoc_mac_policy(wifi_manager_h wifi, unsigned int *policy)
{
+ int rv;
wifi_manager_handle_s *wifi_handle = wifi;
- *policy = wifi_handle->preassoc_mac_policy;
+ rv = net_wifi_get_preassoc_mac_policy(wifi_handle->network_info, policy);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE)
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
return WIFI_MANAGER_ERROR_NONE;
}
int _wifi_get_random_mac_lifetime(wifi_manager_h wifi, unsigned int *lifetime)
{
+ int rv;
wifi_manager_handle_s *wifi_handle = wifi;
- *lifetime = wifi_handle->random_mac_lifetime;
+ rv = net_wifi_get_random_mac_lifetime(wifi_handle->network_info, lifetime);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE)
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
return WIFI_MANAGER_ERROR_NONE;
}
static GVariant * __get_mock_variant_get_properties(void)
{
- return NULL;
+ GVariant *return_parameter;
+ GVariantBuilder *builder_properties = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+
+ g_variant_builder_add(builder_properties, "{sv}", "MacPolicy", g_variant_new_uint32(1));
+ g_variant_builder_add(builder_properties, "{sv}", "PreassocMacPolicy", g_variant_new_uint32(2));
+ g_variant_builder_add(builder_properties, "{sv}", "RandomMacAddrLifetime", g_variant_new_uint32(20));
+
+ return_parameter = g_variant_new("(a{sv})", builder_properties);
+
+ g_variant_builder_unref(builder_properties);
+
+ return return_parameter;
}
static GVariant * __get_mock_variant_get_interfaces(void)