Add missing description for doxygen doc
[platform/core/api/connection.git] / src / connection.c
index f1fb3d4..8def171 100755 (executable)
@@ -79,67 +79,181 @@ bool _connection_check_handle_validity(connection_h connection)
        return __connection_check_handle_validity(connection);
 }
 
+void *_connection_get_default_handle(void)
+{
+       GSList *list = NULL;
+
+       for (list = conn_handle_list; list; list = list->next)
+               if (list->data)
+                       return list->data;
+
+       return NULL;
+}
+
+void _connection_handle_ref(connection_handle_s *handle)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "%p ref %d",
+                       handle, handle->refcount + 1);
+
+       __sync_fetch_and_add(&handle->refcount, 1);
+}
+
+void _connection_handle_unref(connection_handle_s *handle)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "%p ref %d",
+                       handle, handle->refcount - 1);
+
+       if (__sync_fetch_and_sub(&handle->refcount, 1) != 1)
+               return;
+
+       conn_handle_list = g_slist_remove(conn_handle_list, handle);
+       _connection_libnet_deinit(handle, (conn_handle_list == NULL));
+
+       g_free(handle);
+}
+
+static void __connection_dummy_type_changed_cb(connection_type_e type, void* user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
+}
+
 static void __connection_set_type_changed_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
        conn_handle->type_changed_user_data = user_data;
-       conn_handle->type_changed_callback = callback;
+       if (callback != NULL)
+               conn_handle->type_changed_callback = callback;
+       else
+               conn_handle->type_changed_callback = __connection_dummy_type_changed_cb;
+}
+
+static void __connection_dummy_address_changed_cb(const char* ipv4_address,
+                       const char* ipv6_address, void* user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
 }
 
 static void __connection_set_ip_changed_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
        conn_handle->ip_changed_user_data = user_data;
-       conn_handle->ip_changed_callback = callback;
+       if (callback != NULL)
+               conn_handle->ip_changed_callback = callback;
+       else
+               conn_handle->ip_changed_callback = __connection_dummy_address_changed_cb;
 }
 
 static void __connection_set_proxy_changed_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
        conn_handle->proxy_changed_user_data = user_data;
-       conn_handle->proxy_changed_callback = callback;
+       if (callback != NULL)
+               conn_handle->proxy_changed_callback = callback;
+       else
+               conn_handle->proxy_changed_callback = __connection_dummy_address_changed_cb;
+}
+
+static void __connection_dummy_dhcp_state_changed_cb(connection_dhcp_state_e state,
+            const char *interface_name, connection_error_e result, void *user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
+}
+
+static void __connection_set_dhcp_state_changed_callback(connection_handle_s *conn_handle,
+                       void *callback, void *user_data)
+{
+       conn_handle->dhcp_state_changed_user_data = user_data;
+       if (callback != NULL)
+               conn_handle->dhcp_state_changed_callback = callback;
+       else
+               conn_handle->dhcp_state_changed_callback = __connection_dummy_dhcp_state_changed_cb;
+}
+
+static void __connection_dummy_internet_state_changed_cb(connection_internet_state_e state,
+                       void* user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
 }
 
 static void __connection_set_internet_state_changed_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
        conn_handle->internet_state_changed_user_data = user_data;
-       conn_handle->internet_state_changed_callback = callback;
+       if (callback != NULL)
+               conn_handle->internet_state_changed_callback = callback;
+       else
+               conn_handle->internet_state_changed_callback = __connection_dummy_internet_state_changed_cb;
+}
+
+static void __connection_dummy_ethernet_cable_state_changed_cb(connection_ethernet_cable_state_e state,
+                       void* user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
 }
 
 static void __connection_set_ethernet_cable_state_changed_cb(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
-       conn_handle->ethernet_cable_state_changed_callback = callback;
        conn_handle->ethernet_cable_state_changed_user_data = user_data;
+       if (callback != NULL)
+               conn_handle->ethernet_cable_state_changed_callback = callback;
+       else
+               conn_handle->ethernet_cable_state_changed_callback = __connection_dummy_ethernet_cable_state_changed_cb;
+}
+
+static void __connection_dummy_set_default_cb(connection_error_e result, void* user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
 }
 
 static void __connection_set_default_cellular_service_profile_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
-       conn_handle->set_default_callback = callback;
        conn_handle->set_default_user_data = user_data;
+       if (callback != NULL)
+               conn_handle->set_default_callback = callback;
+       else
+               conn_handle->set_default_callback = __connection_dummy_set_default_cb;
+}
+
+static void __connection_dummy_opened_cb(connection_error_e result, void* user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
 }
 
 static void __connection_open_profile_set_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
-       conn_handle->opened_callback = callback;
        conn_handle->opened_user_data = user_data;
+       if (callback != NULL)
+               conn_handle->opened_callback = callback;
+       else
+               conn_handle->opened_callback = __connection_dummy_opened_cb;
+}
+
+static void __connection_dummy_closed_cb(connection_error_e result, void* user_data)
+{
+       CONNECTION_LOG(CONNECTION_INFO, "Dummy callback");
 }
 
 static void __connection_close_profile_set_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
-       conn_handle->closed_callback = callback;
        conn_handle->closed_user_data = user_data;
+       if (callback != NULL)
+               conn_handle->closed_callback = callback;
+       else
+               conn_handle->closed_callback = __connection_dummy_closed_cb;
 }
 
 static void __connection_reset_profile_set_callback(connection_handle_s *conn_handle,
                        void *callback, void *user_data)
 {
-       conn_handle->reset_callback = callback;
        conn_handle->reset_user_data = user_data;
+       if (callback != NULL)
+               conn_handle->reset_callback = callback;
+       else
+               conn_handle->reset_callback = __connection_dummy_opened_cb;
 }
 //LCOV_EXCL_STOP
 
@@ -182,6 +296,7 @@ EXPORT_API int connection_create(connection_h *connection)
        }
 
        conn_handle_list = g_slist_prepend(conn_handle_list, *connection);
+       _connection_handle_ref(*connection);
 
        CONN_UNLOCK;
        return CONNECTION_ERROR_NONE;
@@ -206,12 +321,9 @@ EXPORT_API int connection_destroy(connection_h connection)
        __connection_set_proxy_changed_callback(connection, NULL, NULL);
        __connection_set_internet_state_changed_callback(connection, NULL, NULL);
        __connection_set_ethernet_cable_state_changed_cb(connection, NULL, NULL);
+       __connection_set_dhcp_state_changed_callback(connection, NULL, NULL);
 
-       conn_handle_list = g_slist_remove(conn_handle_list, connection);
-       _connection_libnet_deinit(connection, (conn_handle_list == NULL));
-
-       g_free(connection);
-       connection = NULL;
+       _connection_handle_unref(connection);
 
        CONN_UNLOCK;
        return CONNECTION_ERROR_NONE;
@@ -254,7 +366,7 @@ EXPORT_API int connection_destroy_cs(int tid, connection_h connection)
 }
 //LCOV_EXCL_STOP
 
-EXPORT_API int connection_get_type(connection_h connection, connection_type_etype)
+EXPORT_API int connection_get_type(connection_h connection, connection_type_e *type)
 {
        int rv = 0;
        int status = 0;
@@ -269,7 +381,7 @@ EXPORT_API int connection_get_type(connection_h connection, connection_type_e* t
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       rv = vconf_get_int(VCONFKEY_NETWORK_STATUS, &status);
+       rv = _connection_vconf_get_int(connection, VCONFKEY_NETWORK_STATUS, &status);
        if (rv != VCONF_OK) {
                CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_int Failed = %d", status); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
@@ -299,10 +411,10 @@ EXPORT_API int connection_get_ip_address(connection_h connection,
 
        switch (address_family) {
        case CONNECTION_ADDRESS_FAMILY_IPV4:
-               *ip_address = vconf_get_str(VCONFKEY_NETWORK_IP);
+               *ip_address = _connection_vconf_get_str(connection, VCONFKEY_NETWORK_IP);
                break;
        case CONNECTION_ADDRESS_FAMILY_IPV6:
-               *ip_address = vconf_get_str(VCONFKEY_NETWORK_IP6);
+               *ip_address = _connection_vconf_get_str(connection, VCONFKEY_NETWORK_IP6);
                break;
        default:
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
@@ -336,7 +448,7 @@ EXPORT_API int connection_get_proxy(connection_h connection,
        switch (address_family) {
        case CONNECTION_ADDRESS_FAMILY_IPV4:
        case CONNECTION_ADDRESS_FAMILY_IPV6:
-               *proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
+               *proxy = _connection_vconf_get_str(connection, VCONFKEY_NETWORK_PROXY);
                break;
        default:
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
@@ -381,18 +493,18 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty
 
                if (fp) {
                        if (fgets(buf, sizeof(buf), fp) == NULL) {
-                               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get MAC info from %s", WIFI_MAC_INFO_FILE);
-                               fclose(fp);
-                               CONN_UNLOCK;
-                               return CONNECTION_ERROR_OPERATION_FAILED;
+                               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get MAC info from %s", WIFI_MAC_INFO_FILE); //LCOV_EXCL_LINE
+                               fclose(fp); //LCOV_EXCL_LINE
+                               CONN_UNLOCK; //LCOV_EXCL_LINE
+                               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
                        }
 
-                       CONNECTION_LOG(CONNECTION_INFO, "%s : %s", WIFI_MAC_INFO_FILE, buf);
+                       CONNECTION_LOG(CONNECTION_INFO, "%s : %s", WIFI_MAC_INFO_FILE, buf); //LCOV_EXCL_LINE
 
-                       *mac_addr = g_strdup(buf);
-                       fclose(fp);
+                       *mac_addr = g_strdup(buf); //LCOV_EXCL_LINE
+                       fclose(fp); //LCOV_EXCL_LINE
                } else {
-                       *mac_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+                       *mac_addr = _connection_vconf_get_str(connection, VCONFKEY_WIFI_BSSID_ADDRESS);
 
                        if (*mac_addr == NULL) {
                                CONNECTION_LOG(CONNECTION_ERROR, "Failed to get vconf from %s", VCONFKEY_WIFI_BSSID_ADDRESS); //LCOV_EXCL_LINE
@@ -401,7 +513,7 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty
                        }
 
                        if (strlen(*mac_addr) == 0) {
-                               CONNECTION_LOG(CONNECTION_ERROR, "Mac address is invalid"
+                               CONNECTION_LOG(CONNECTION_ERROR, "Mac address is invalid" //LCOV_EXCL_LINE
                                        " from %s", VCONFKEY_WIFI_BSSID_ADDRESS); //LCOV_EXCL_LINE
                                g_free(*mac_addr); //LCOV_EXCL_LINE
                                *mac_addr = NULL; //LCOV_EXCL_LINE
@@ -439,7 +551,7 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty
        }
 
        /* Checking Invalid MAC Address */
-       if ((strcmp(*mac_addr, "00:00:00:00:00:00") == 0) ||
+       if (*mac_addr == NULL || (strcmp(*mac_addr, "00:00:00:00:00:00") == 0) ||
                        (strcmp(*mac_addr, "ff:ff:ff:ff:ff:ff") == 0)) {
                CONNECTION_LOG(CONNECTION_ERROR, "MAC Address(%s) is invalid", *mac_addr); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
@@ -478,7 +590,7 @@ EXPORT_API int connection_is_metered_network(connection_h connection, bool* is_m
 }
 
 
-EXPORT_API int connection_get_cellular_state(connection_h connection, connection_cellular_state_estate)
+EXPORT_API int connection_get_cellular_state(connection_h connection, connection_cellular_state_e *state)
 {
        int rv = 0;
        int status = 0;
@@ -492,12 +604,12 @@ EXPORT_API int connection_get_cellular_state(connection_h connection, connection
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
 
        if (state == NULL || !(__connection_check_handle_validity(connection))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               CONN_UNLOCK;
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
-       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &status);
+       rv = _connection_vconf_get_int(connection, VCONFKEY_NETWORK_CELLULAR_STATE, &status);
        if (rv != VCONF_OK) {
                CONNECTION_LOG(CONNECTION_ERROR, "Failed to get cellular state"); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
@@ -509,7 +621,7 @@ EXPORT_API int connection_get_cellular_state(connection_h connection, connection
 
        if (*state == CONNECTION_CELLULAR_STATE_AVAILABLE) {
 #if defined TIZEN_DUALSIM_ENABLE
-               rv = vconf_get_int(VCONF_TELEPHONY_DEFAULT_DATA_SERVICE, &sim_id);
+               rv = _connection_vconf_get_int(connection, VCONF_TELEPHONY_DEFAULT_DATA_SERVICE, &sim_id);
                if (rv != VCONF_OK) {
                        CONNECTION_LOG(CONNECTION_ERROR,
                                        "Failed to get default subscriber id", sim_id);
@@ -520,12 +632,12 @@ EXPORT_API int connection_get_cellular_state(connection_h connection, connection
                switch (sim_id) {
                case CONNECTION_CELLULAR_SUBSCRIBER_1:
 #endif
-                       rv = vconf_get_int(VCONFKEY_DNET_STATE, &cellular_state);
+                       rv = _connection_vconf_get_int(connection, VCONFKEY_DNET_STATE, &cellular_state);
 #if defined TIZEN_DUALSIM_ENABLE
                        break;
 
                case CONNECTION_CELLULAR_SUBSCRIBER_2:
-                       rv = vconf_get_int(VCONFKEY_DNET_STATE2, &cellular_state);
+                       rv = _connection_vconf_get_int(connection, VCONFKEY_DNET_STATE2, &cellular_state);
                        break;
 
                default:
@@ -552,7 +664,7 @@ EXPORT_API int connection_get_cellular_state(connection_h connection, connection
        return CONNECTION_ERROR_NONE;
 }
 
-EXPORT_API int connection_get_wifi_state(connection_h connection, connection_wifi_state_estate)
+EXPORT_API int connection_get_wifi_state(connection_h connection, connection_wifi_state_e *state)
 {
        CONN_LOCK;
 
@@ -623,6 +735,31 @@ EXPORT_API int connection_get_ethernet_cable_state(connection_h connection, conn
        return CONNECTION_ERROR_NONE;
 }
 
+EXPORT_API int connection_get_dhcp_state(connection_h connection,
+               const char *interface_name, connection_dhcp_state_e *state)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+       if (interface_name == NULL || state == NULL ||
+                       !(__connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+       }
+
+       int rv = _connection_libnet_get_dhcp_state(connection, interface_name, state);
+       if (rv != CONNECTION_ERROR_NONE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Fail to get DHCP  state[%d]", rv); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return rv; //LCOV_EXCL_LINE
+       }
+
+       CONN_UNLOCK; //LCOV_EXCL_LINE
+       return CONNECTION_ERROR_NONE; //LCOV_EXCL_LINE
+}
+
 EXPORT_API int connection_set_ethernet_cable_state_chaged_cb(connection_h connection,
                          connection_ethernet_cable_state_chaged_cb callback, void *user_data)
 {
@@ -711,9 +848,9 @@ EXPORT_API int connection_get_bt_state(connection_h connection, connection_bt_st
        CHECK_FEATURE_SUPPORTED(TETHERING_BLUETOOTH_FEATURE);
 
        if (state == NULL || !(__connection_check_handle_validity(connection))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               CONN_UNLOCK;
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        int rv = _connection_libnet_get_bluetooth_state(connection, state);
@@ -727,6 +864,7 @@ EXPORT_API int connection_get_bt_state(connection_h connection, connection_bt_st
        return CONNECTION_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 EXPORT_API int connection_set_type_changed_cb(connection_h connection,
                                        connection_type_changed_cb callback, void* user_data)
 {
@@ -763,6 +901,7 @@ EXPORT_API int connection_unset_type_changed_cb(connection_h connection)
        CONN_UNLOCK;
        return CONNECTION_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 EXPORT_API int connection_set_ip_address_changed_cb(connection_h connection,
                                connection_address_changed_cb callback, void* user_data)
@@ -838,6 +977,43 @@ EXPORT_API int connection_unset_proxy_address_changed_cb(connection_h connection
        return CONNECTION_ERROR_NONE;
 }
 
+EXPORT_API int connection_set_dhcp_state_changed_cb(connection_h connection,
+               connection_dhcp_state_changed_cb callback, void *user_data)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+       if (callback == NULL || !(__connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               CONN_UNLOCK;
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
+       __connection_set_dhcp_state_changed_callback(connection, callback, user_data);
+
+       CONN_UNLOCK;
+       return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_unset_dhcp_state_changed_cb(connection_h connection)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+       if (!(__connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               CONN_UNLOCK;
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
+       __connection_set_dhcp_state_changed_callback(connection, NULL, NULL);
+
+       CONN_UNLOCK;
+       return CONNECTION_ERROR_NONE;
+}
+
 EXPORT_API int connection_set_internet_state_changed_cb(connection_h connection,
                connection_internet_state_changed_cb callback, void *user_data)
 {
@@ -887,9 +1063,9 @@ EXPORT_API int connection_add_profile(connection_h connection, connection_profil
 
        if (!(__connection_check_handle_validity(connection)) ||
            !(_connection_libnet_check_profile_validity(profile))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               CONN_UNLOCK;
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
@@ -898,15 +1074,15 @@ EXPORT_API int connection_add_profile(connection_h connection, connection_profil
                return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
-       if (profile_info->ProfileInfo.Pdp.PSModemPath[0] != '/' ||
-                       strlen(profile_info->ProfileInfo.Pdp.PSModemPath) < 2) {
+       if (profile_info->profile_info.pdp.ps_modem_path[0] != '/' ||
+                       strlen(profile_info->profile_info.pdp.ps_modem_path) < 2) {
                CONNECTION_LOG(CONNECTION_ERROR, "Modem object path is NULL"); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
                return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        rv = net_add_profile(conn_handle->network_info_handle,
-                               profile_info->ProfileInfo.Pdp.ServiceType, profile_info);
+                               profile_info->profile_info.pdp.service_type, profile_info);
        if (rv == NET_ERR_ACCESS_DENIED) {
                CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
@@ -946,7 +1122,7 @@ EXPORT_API int connection_remove_profile(connection_h connection, connection_pro
                return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
-       rv = net_delete_profile(conn_handle->network_info_handle, profile_info->ProfileName);
+       rv = net_delete_profile(conn_handle->network_info_handle, profile_info->profile_name);
        if (rv == NET_ERR_ACCESS_DENIED) {
                CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
@@ -979,7 +1155,7 @@ EXPORT_API int connection_update_profile(connection_h connection, connection_pro
        }
 
        rv = net_modify_profile(conn_handle->network_info_handle,
-                       profile_info->ProfileName, (net_profile_info_t*)profile);
+                       profile_info->profile_name, (net_profile_info_t*)profile);
        if (rv == NET_ERR_ACCESS_DENIED) {
                CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
                CONN_UNLOCK; //LCOV_EXCL_LINE
@@ -995,7 +1171,7 @@ EXPORT_API int connection_update_profile(connection_h connection, connection_pro
 }
 
 EXPORT_API int connection_get_profile_iterator(connection_h connection,
-               connection_iterator_type_e type, connection_profile_iterator_hprofile_iterator)
+               connection_iterator_type_e type, connection_profile_iterator_h *profile_iterator)
 {
        CONN_LOCK;
 
@@ -1022,7 +1198,7 @@ EXPORT_API int connection_get_profile_iterator(connection_h connection,
 }
 
 EXPORT_API int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator,
-                                                       connection_profile_hprofile)
+                                                       connection_profile_h *profile)
 {
        CONN_LOCK;
 
@@ -1058,7 +1234,7 @@ EXPORT_API int connection_destroy_profile_iterator(connection_profile_iterator_h
        return rv;
 }
 
-EXPORT_API int connection_get_current_profile(connection_h connection, connection_profile_hprofile)
+EXPORT_API int connection_get_current_profile(connection_h connection, connection_profile_h *profile)
 {
        CONN_LOCK;
 
@@ -1090,9 +1266,9 @@ EXPORT_API int connection_get_default_cellular_service_profile(
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               CONN_UNLOCK;
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        int rv = _connection_libnet_get_cellular_service_profile(connection, type, profile);
@@ -1114,9 +1290,9 @@ EXPORT_API int connection_set_default_cellular_service_profile(connection_h conn
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               CONN_UNLOCK;
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        int rv = _connection_libnet_set_cellular_service_profile_sync(connection, type, profile);
@@ -1240,9 +1416,9 @@ EXPORT_API int connection_reset_profile(connection_h connection,
        int rv;
 
        if (!(__connection_check_handle_validity(connection))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed");
-               CONN_UNLOCK;
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        if (id < 0 || id > 1) {
@@ -1273,6 +1449,7 @@ EXPORT_API int connection_add_route(connection_h connection, const char* interfa
        CONN_LOCK;
 
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+       CHECK_FEATURE_SUPPORTED(ROUTE_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) ||
            interface_name == NULL || host_address == NULL) {
@@ -1297,6 +1474,7 @@ EXPORT_API int connection_remove_route(connection_h connection, const char* inte
        CONN_LOCK;
 
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+       CHECK_FEATURE_SUPPORTED(ROUTE_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) ||
            interface_name == NULL || host_address == NULL) {
@@ -1321,6 +1499,7 @@ EXPORT_API int connection_add_route_ipv6(connection_h connection, const char *in
        CONN_LOCK;
 
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+       CHECK_FEATURE_SUPPORTED(ROUTE_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) ||
            interface_name == NULL || host_address == NULL) {
@@ -1345,6 +1524,7 @@ EXPORT_API int connection_remove_route_ipv6(connection_h connection, const char
        CONN_LOCK;
 
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+       CHECK_FEATURE_SUPPORTED(ROUTE_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) ||
            interface_name == NULL || host_address == NULL) {
@@ -1371,6 +1551,7 @@ EXPORT_API int connection_add_route_entry(connection_h connection,
        CONN_LOCK;
 
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+       CHECK_FEATURE_SUPPORTED(ROUTE_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) ||
                (address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
@@ -1401,6 +1582,7 @@ EXPORT_API int connection_remove_route_entry(connection_h connection,
        CONN_LOCK;
 
        CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+       CHECK_FEATURE_SUPPORTED(ROUTE_FEATURE);
 
        if (!(__connection_check_handle_validity(connection)) ||
                (address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
@@ -1424,7 +1606,8 @@ EXPORT_API int connection_remove_route_entry(connection_h connection,
        }
 }
 
-static int __get_cellular_statistic(connection_statistics_type_e statistics_type, long long *llsize)
+static int __get_cellular_statistic(connection_handle_s *conn_handle,
+               connection_statistics_type_e statistics_type, long long *llsize)
 {
        int rv = VCONF_OK, rv1 = VCONF_OK;
        int last_size = 0, size = 0;
@@ -1448,7 +1631,7 @@ static int __get_cellular_statistic(connection_statistics_type_e statistics_type
        }
 
 #if defined TIZEN_DUALSIM_ENABLE
-       rv = vconf_get_int(VCONF_TELEPHONY_DEFAULT_DATA_SERVICE, &sim_id);
+       rv = _connection_vconf_get_int(conn_handle, VCONF_TELEPHONY_DEFAULT_DATA_SERVICE, &sim_id);
        if (rv != VCONF_OK) {
                CONNECTION_LOG(CONNECTION_ERROR, "Failed to get default subscriber id");
                *llsize = 0;
@@ -1460,18 +1643,18 @@ static int __get_cellular_statistic(connection_statistics_type_e statistics_type
 #endif
                switch (statistics_type) {
                case CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT, &last_size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT, &last_size);
                        break;
                case CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV, &last_size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV, &last_size);
                        break;
                case CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT, &last_size);
-                       rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT, &size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT, &last_size);
+                       rv1 = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT, &size);
                        break;
                case CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV, &last_size);
-                       rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV, &size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV, &last_size);
+                       rv1 = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV, &size);
                        break;
                }
 #if defined TIZEN_DUALSIM_ENABLE
@@ -1479,18 +1662,18 @@ static int __get_cellular_statistic(connection_statistics_type_e statistics_type
        case 1:
                switch (statistics_type) {
                case CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT2, &last_size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT2, &last_size);
                        break;
                case CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV2, &last_size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV2, &last_size);
                        break;
                case CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT2, &last_size);
-                       rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT2, &size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT2, &last_size);
+                       rv1 = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT2, &size);
                        break;
                case CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
-                       rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV2, &last_size);
-                       rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV2, &size);
+                       rv = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV2, &last_size);
+                       rv1 = _connection_vconf_get_int(conn_handle, VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV2, &size);
                        break;
                }
                break;
@@ -1532,7 +1715,7 @@ static int __get_statistic(connection_handle_s *conn_handle, connection_type_e c
        }
 
        if (connection_type == CONNECTION_TYPE_CELLULAR)
-               return __get_cellular_statistic(statistics_type, llsize);
+               return __get_cellular_statistic(conn_handle, statistics_type, llsize);
        else if (connection_type == CONNECTION_TYPE_WIFI) {
                switch (statistics_type) {
                case CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA:
@@ -1835,3 +2018,114 @@ EXPORT_API int connection_profile_save_ethernet_eap_config(connection_h connecti
        CONN_UNLOCK;
        return CONNECTION_ERROR_NONE;
 }
+
+//LCOV_EXCL_START
+EXPORT_API int connection_clock_is_updated(connection_h connection, bool *updated)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+       if (!(_connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER;//LCOV_EXCL_LINE
+       }
+
+       int rv = _connection_libnet_get_clock_updated(connection, updated);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Fail to get clock update information[%d]", rv); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return rv; //LCOV_EXCL_LINE
+       }
+
+       CONNECTION_LOG(CONNECTION_INFO, "Clock updated: %s", *updated ? "true" : "false");
+       CONN_UNLOCK;
+
+       return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_get_ntp_server(connection_h connection, char **ntp_server)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+       if (ntp_server == NULL || !(_connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER;//LCOV_EXCL_LINE
+       }
+
+       char *server = NULL;
+
+       int rv = _connection_libnet_get_ntp_server(connection, &server);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Fail to get ntp server [%d]", rv); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return rv; //LCOV_EXCL_LINE
+       }
+
+       if (server) {
+               *ntp_server = strdup(server);
+               g_free(server);
+       }
+
+       CONNECTION_LOG(CONNECTION_INFO, "NTP SERVER:  %s", *ntp_server);
+       CONN_UNLOCK;
+
+       return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_set_ntp_server(connection_h connection, const char *ntp_server)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(WIFI_FEATURE, ETHERNET_FEATURE);
+
+       if (!(__connection_check_handle_validity(connection)) || ntp_server == NULL) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               CONN_UNLOCK;
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
+       int rv = _connection_libnet_set_ntp_server(connection, ntp_server);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Fail to set NTP server[%d]", rv); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return rv; //LCOV_EXCL_LINE
+       }
+
+       CONN_UNLOCK;
+
+       return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_clear_ntp_server(connection_h connection)
+{
+       CONN_LOCK;
+
+       CHECK_FEATURE_SUPPORTED(WIFI_FEATURE, ETHERNET_FEATURE);
+
+       if (!(__connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               CONN_UNLOCK;
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
+       int rv = _connection_libnet_clear_ntp_server(connection);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Fail to clear NTP server[%d]", rv); //LCOV_EXCL_LINE
+               CONN_UNLOCK; //LCOV_EXCL_LINE
+               return rv; //LCOV_EXCL_LINE
+       }
+
+       CONN_UNLOCK;
+
+       return CONNECTION_ERROR_NONE;
+}
+//LCOV_EXCL_STOP