{
__NETWORK_FUNC_ENTER__;
- int state = _net_get_dpm_wifi_state();
- if (state == -1) {
- net_err_e Error = _net_dbus_device_policy_get_wifi(&state);
- if (Error != NET_ERR_NONE)
- WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi failed\n");
- else
- _net_set_dpm_wifi_state(state);
+ int state = -1;
+ net_err_e Error = _net_dbus_device_policy_get_wifi(&state);
+
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi failed\n");
+ state = TRUE;
}
WIFI_LOG(WIFI_INFO, "Wifi device policy state [%d]\n", state);
{
__NETWORK_FUNC_ENTER__;
- int state = _net_get_dpm_wifi_profile_state();
- if (state == -1) {
- net_err_e Error = _net_dbus_device_policy_get_wifi_profile(&state);
- if (Error != NET_ERR_NONE)
- WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi_profile failed\n");
- else
- _net_set_dpm_wifi_profile_state(state);
+ int state = -1;
+ net_err_e Error = _net_dbus_device_policy_get_wifi_profile(&state);
+
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR, "_net_dbus_device_policy_get_wifi_profile failed\n");
+ state = TRUE;
}
+ WIFI_LOG(WIFI_INFO, "Wifi profile policy state [%d]\n", state);
+
__NETWORK_FUNC_EXIT__;
return state;
}
return NET_ERR_APP_NOT_REGISTERED; //LCOV_EXCL_LINE
}
- if (!_net_get_dpm_wifi_state()) {
+ if (!net_get_device_policy_wifi()) {
WIFI_LOG(WIFI_ERROR, "Wifi device policy restricts"); //LCOV_EXCL_LINE
__NETWORK_FUNC_EXIT__; //LCOV_EXCL_LINE
return NET_ERR_SECURITY_RESTRICTED; //LCOV_EXCL_LINE
}
- if (!_net_get_dpm_wifi_profile_state()) {
+ if (!net_get_device_policy_wifi_profile()) {
WIFI_LOG(WIFI_ERROR, "Wifi profile device policy restricts"); //LCOV_EXCL_LINE
__NETWORK_FUNC_EXIT__; //LCOV_EXCL_LINE
return NET_ERR_SECURITY_RESTRICTED; //LCOV_EXCL_LINE
static __thread guint gdbus_conn_subscribe_id_connman_scanstarted = 0;
static __thread guint gdbus_conn_subscribe_id_netconfig_wifi = 0;
static __thread guint gdbus_conn_subscribe_id_netconfig = 0;
-static __thread int net_dpm_wifi_state = -1;
-static __thread int net_dpm_wifi_profile_state = -1;
struct cs_tid_info {
int tid;
return NET_ERR_NONE;
}
-static int __net_handle_network_dpm_wifi_event(GVariant *param)
-{
- __NETWORK_FUNC_ENTER__;
-
- GVariantIter *iter = NULL;
- GVariant *value = NULL;
- const char *key = NULL;
- const gchar *sig_value = NULL;
-
- g_variant_get(param, "(a{sv})", &iter);
-
- while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
- if (g_strcmp0(key, "key") == 0) {
- sig_value = g_variant_get_string(value, NULL);
- WIFI_LOG(WIFI_INFO, "Wifi device policy : %s",
- sig_value);
- if (g_strcmp0(sig_value, "allowed") == 0)
- net_dpm_wifi_state = TRUE;
- else
- net_dpm_wifi_state = FALSE;
- }
- }
- g_variant_iter_free(iter);
-
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_NONE;
-}
-
-static int __net_handle_network_dpm_wifi_profile_event(GVariant *param)
-{
- __NETWORK_FUNC_ENTER__;
-
- GVariantIter *iter = NULL;
- GVariant *value = NULL;
- const char *key = NULL;
- const gchar *sig_value = NULL;
-
- g_variant_get(param, "(a{sv})", &iter);
-
- while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
- if (g_strcmp0(key, "key") == 0) {
- sig_value = g_variant_get_string(value, NULL);
- WIFI_LOG(WIFI_INFO, "Wifi profile device policy : %s",
- sig_value);
- if (g_strcmp0(sig_value, "allowed") == 0)
- net_dpm_wifi_profile_state = TRUE;
- else
- net_dpm_wifi_profile_state = FALSE;
- }
- }
- g_variant_iter_free(iter);
-
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_NONE;
-}
-
static void __net_connman_service_signal_filter(GDBusConnection *conn,
const gchar *name, const gchar *path, const gchar *interface,
const gchar *sig, GVariant *param, gpointer user_data)
const gchar *name, const gchar *path, const gchar *interface,
const gchar *sig, GVariant *param, gpointer user_data)
{
- if (g_strcmp0(sig, NETCONFIG_SIGNAL_DPM_WIFI) == 0)
- __net_handle_network_dpm_wifi_event(param);
- else if (g_strcmp0(sig, NETCONFIG_SIGNAL_DPM_WIFI_PROFILE) == 0)
- __net_handle_network_dpm_wifi_profile_event(param);
+ return;
}
static int __net_get_tech_states(GVariant *message, net_state_type_e *state)
return Error;
}
-int _net_get_dpm_wifi_state(void)
-{
- return net_dpm_wifi_state;
-}
-
-void _net_set_dpm_wifi_state(int state)
-{
- net_dpm_wifi_state = state;
-}
-
-gboolean _net_get_dpm_wifi_profile_state()
-{
- return net_dpm_wifi_profile_state;
-}
-
-void _net_set_dpm_wifi_profile_state(int state)
-{
- net_dpm_wifi_profile_state = state;
-}
-
void _net_set_cs_tid(int tid)
{
GSList *list;