/** Reset default cellular profile Response Event */
NET_EVENT_CELLULAR_RESET_DEFAULT_RSP,
- /** Wi-Fi interface Scanning Indication Event*/
+ /** Wi-Fi interface Scanning Indication Event */
NET_EVENT_WIFI_SCANNING_IND,
/** Wi-Fi interface Scan Indication Event(WPS scan) */
/** Ethernet Cable Detached Event */
NET_EVENT_ETHERNET_CABLE_DETACHED,
- /** Wi-Fi TDLS Peer Connected EVENT) */
+ /** Wi-Fi TDLS Peer Connected EVENT */
NET_EVENT_TDLS_CONNECTED_IND,
- /** Wi-Fi TDLS Peer Disconnect EVENT) */
+ /** Wi-Fi TDLS Peer Disconnect EVENT */
NET_EVENT_TDLS_DISCONNECTED_IND,
} net_event_t;
* @return NET_ERR_NONE on success, negative values for errors
*/
-int net_check_get_privilege();
+int net_check_get_privilege(void);
/**
* @fn int net_check_profile_privilege()
* @return NET_ERR_NONE on success, negative values for errors
*/
-int net_check_profile_privilege();
+int net_check_profile_privilege(void);
#if defined TIZEN_TV
/**
int net_wifi_tdls_disconnect(const char* peer_mac_addr);
int net_wifi_tdls_connected_peer(char** peer_mac_addr);
+int net_get_device_policy_wifi(void);
+int net_get_device_policy_wifi_profile(void);
+
/**
* \}
*/
Name: libnet-client
Summary: Network Client library (Shared library)
-Version: 1.1.52
+Version: 1.1.53
Release: 1
Group: System/Network
License: Flora-1.1
int _net_dbus_tdls_disconnect(const char* peer_mac_addr);
int _net_dbus_tdls_connected_peer(char** peer_mac_addr);
+int _net_dbus_device_policy_get_wifi(int *state);
+int _net_dbus_device_policy_get_wifi_profile(int *state);
+
#ifdef __cplusplus
}
#endif
#define NETCONFIG_SIGNAL_TDLS_DISCONNECTED "TDLSDisconnect"
#define NETCONFIG_SIGNAL_TDLS_PEER_FOUND "TDLSPeerFound"
#define NETCONFIG_SIGNAL_WIFI_CONNECT_FAIL "WiFiConnectFail"
+#define NETCONFIG_SIGNAL_DPM_WIFI "DPMWifi"
+#define NETCONFIG_SIGNAL_DPM_WIFI_PROFILE "DPMWifiProfile"
#undef LOG_TAG
#define LOG_TAG "NET_CLIENT"
int _net_register_signal(void);
int _net_subscribe_signal_wifi(void);
int _net_init_service_state_table(void);
+int _net_get_dpm_wifi_state(void);
+void _net_set_dpm_wifi_state(int state);
+int _net_get_dpm_wifi_profile_state(void);
+void _net_set_dpm_wifi_profile_state(int state);
+
#ifdef __cplusplus
}
return Error;
}
+
+int _net_dbus_device_policy_get_wifi(int *state)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_t Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+
+ if (state == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_PARAM;
+ }
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_NETWORK_PATH,
+ NETCONFIG_NETWORK_INTERFACE, "DevicePolicyGetWifi", NULL, &Error);
+
+ if (message == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "Failed to get wifi device policy\n");
+ return Error;
+ }
+
+ g_variant_get(message, "(i)", state);
+
+ NETWORK_LOG(NETWORK_LOW, "Wifi device policy state [%d]\n", *state);
+
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int _net_dbus_device_policy_get_wifi_profile(int *state)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_t Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+
+ if (state == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "Invalid Parameter\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_PARAM;
+ }
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_NETWORK_PATH,
+ NETCONFIG_NETWORK_INTERFACE, "DevicePolicyGetWifiProfile", NULL, &Error);
+
+ if (message == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "Failed to get wifi device policy\n");
+ return Error;
+ }
+
+ g_variant_get(message, "(i)", state);
+
+ NETWORK_LOG(NETWORK_LOW, "Wifi profile device policy state [%d]\n", *state);
+
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
#include <arpa/inet.h>
#include "network-internal.h"
+#include "network-signal-handler.h"
#include "network-dbus-request.h"
#define DBUS_OBJECT_PATH_MAX 150
return NET_ERR_APP_NOT_REGISTERED;
}
+ if (!_net_get_dpm_wifi_profile_state()) {
+ NETWORK_LOG(NETWORK_ERROR, "Wifi profile device policy restricts");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_SECURITY_RESTRICTED;
+ }
+
Error = net_get_profile_info(profile_name, &exProfInfo);
if (Error != NET_ERR_NONE) {
NETWORK_LOG(NETWORK_ERROR,
static __thread guint gdbus_conn_subscribe_id_supplicant = 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;
static int __net_handle_wifi_power_rsp(gboolean value)
{
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);
+ NETWORK_LOG(NETWORK_LOW, "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);
+
+ return NET_ERR_NONE;
+ __NETWORK_FUNC_EXIT__;
+}
+
+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);
+ NETWORK_LOG(NETWORK_LOW, "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);
+
+ return NET_ERR_NONE;
+ __NETWORK_FUNC_EXIT__;
+}
+
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)
{
if (g_strcmp0(sig, NETCONFIG_SIGNAL_ETHERNET_CABLE_STATE) == 0)
__net_handle_ethernet_cable_state_rsp(param);
+ else 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);
}
/*****************************************************************************
* Global Functions
*****************************************************************************/
+
+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;
+}
+
int _net_deregister_signal(void)
{
__NETWORK_FUNC_ENTER__;
return NET_ERR_APP_NOT_REGISTERED;
}
+ if (!net_get_device_policy_wifi()) {
+ NETWORK_LOG(NETWORK_ERROR, "Wifi profile device policy restricts");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_SECURITY_RESTRICTED;
+ }
+
vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &hotspot_state);
if (hotspot_state & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) {
NETWORK_LOG(NETWORK_ERROR, "Wi-Fi hotspot is enabled!");
return Error;
}
+
+EXPORT_API int net_get_device_policy_wifi(void)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ int state = _net_get_dpm_wifi_state();
+ if (state == -1) {
+ net_err_t Error = _net_dbus_device_policy_get_wifi(&state);
+ if (Error != NET_ERR_NONE)
+ NETWORK_LOG(NETWORK_ERROR, "_net_dbus_device_policy_get_wifi failed\n");
+ else
+ _net_set_dpm_wifi_state(state);
+ }
+
+ NETWORK_LOG(NETWORK_LOW, "Wifi device policy state [%d]\n", state);
+
+ __NETWORK_FUNC_EXIT__;
+ return state;
+}
+
+EXPORT_API int net_get_device_policy_wifi_profile(void)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ int state = _net_get_dpm_wifi_profile_state();
+ if (state == -1) {
+ net_err_t Error = _net_dbus_device_policy_get_wifi_profile(&state);
+ if (Error != NET_ERR_NONE)
+ NETWORK_LOG(NETWORK_ERROR, "_net_dbus_device_policy_get_wifi_profile failed\n");
+ else
+ _net_set_dpm_wifi_profile_state(state);
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return state;
+}