Added CAPIs for C# thread handling
[platform/core/api/connection.git] / src / libnetwork.c
index f167480..c5d2433 100755 (executable)
@@ -45,6 +45,9 @@ struct _libnet_s {
        connection_set_default_cb set_default_cb;
        connection_reset_cb reset_profile_cb;
        libnet_ethernet_cable_state_changed_cb ethernet_cable_state_changed_cb;
+       libnet_type_changed_cb type_changed_cb;
+       libnet_ip_changed_cb ip_changed_cb;
+       libnet_proxy_changed_cb proxy_changed_cb;
        void *opened_user_data;
        void *closed_user_data;
        void *set_default_user_data;
@@ -65,8 +68,11 @@ struct managed_idle_data {
 };
 
 static __thread struct _profile_list_s profile_iterator = {0, 0, NULL};
-static __thread struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL, false};
+static __thread struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL,
+                                       NULL, NULL, NULL, NULL, NULL, NULL, false};
 static __thread GSList *managed_idler_list = NULL;
+static __thread bool connection_is_feature_checked[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
+static __thread bool connection_feature_supported[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
 
 bool _connection_is_created(void)
 {
@@ -78,6 +84,7 @@ static void __connection_set_created(bool tag)
        libnet.is_created = tag;
 }
 
+//LCOV_EXCL_START
 static connection_error_e __libnet_convert_to_cp_error_type(net_err_t err_type)
 {
        switch (err_type) {
@@ -309,6 +316,25 @@ static void __libnet_ethernet_cable_state_changed_cb(
                libnet.ethernet_cable_state_changed_cb(state);
 }
 
+static void __libnet_type_changed_cb(int type)
+{
+       if (libnet.type_changed_cb)
+               libnet.type_changed_cb(type);
+}
+
+static void __libnet_ip_changed_cb(connection_address_family_e addr_family,
+                                                                  char *ip_addr)
+{
+       if (libnet.ip_changed_cb)
+               libnet.ip_changed_cb(addr_family, ip_addr);
+}
+
+static void __libnet_proxy_changed_cb(char *proxy_addr)
+{
+       if (libnet.proxy_changed_cb)
+               libnet.proxy_changed_cb(proxy_addr);
+}
+
 static gboolean __libnet_state_changed_cb_idle(gpointer data)
 {
        struct _state_notify *notify = (struct _state_notify *)data;
@@ -387,7 +413,7 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
        case NET_EVENT_OPEN_IND:
                result = __libnet_convert_to_cp_error_type(event_cb->Error);
                CONNECTION_LOG(CONNECTION_INFO, "Connection opened %s[%s]",
-                                       (is_requested) ? "RSP":"IND",
+                                       (is_requested) ? "RSP" : "IND",
                                        __libnet_convert_cp_error_type_to_string(result));
 
                if (is_requested)
@@ -414,7 +440,7 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
        case NET_EVENT_CLOSE_IND:
                result = __libnet_convert_to_cp_error_type(event_cb->Error);
                CONNECTION_LOG(CONNECTION_INFO, "Connection closed %s[%s]",
-                                       (is_requested) ? "RSP":"IND",
+                                       (is_requested) ? "RSP" : "IND",
                                        __libnet_convert_cp_error_type_to_string(result));
 
                if (is_requested)
@@ -466,30 +492,39 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
                CONNECTION_LOG(CONNECTION_INFO, "Got Ethernet cable detached Indication\n");
                __libnet_ethernet_cable_state_changed_cb(CONNECTION_ETHERNET_CABLE_DETACHED);
                break;
+       case NET_EVENT_NETWORK_TYPE_CHANGED:
+               CONNECTION_LOG(CONNECTION_INFO, "Got Network Type Changed Indication");
+               int *state = (int *) event_cb->Data;
+               __libnet_type_changed_cb(*state);
+               break;
+       case NET_EVENT_IPV4_ADDRESS_CHANGED:
+               CONNECTION_LOG(CONNECTION_INFO, "Got IPv4 Address Changed Indication");
+               char *ipv4_addr = (char *)event_cb->Data;
+               __libnet_ip_changed_cb(CONNECTION_ADDRESS_FAMILY_IPV4, ipv4_addr);
+               break;
+       case NET_EVENT_IPV6_ADDRESS_CHANGED:
+               CONNECTION_LOG(CONNECTION_INFO, "Got IPv6 Address Changed Indication");
+               char *ipv6_addr = (char *)event_cb->Data;
+               __libnet_ip_changed_cb(CONNECTION_ADDRESS_FAMILY_IPV6, ipv6_addr);
+               break;
+       case NET_EVENT_PROXY_ADDRESS_CHANGED:
+               CONNECTION_LOG(CONNECTION_INFO, "Got Proxy Changed Indication");
+               char *proxy_addr = (char *)event_cb->Data;
+               __libnet_proxy_changed_cb(proxy_addr);
+               break;
 
-       default :
+       default:
                break;
        }
 }
-
-static int __libnet_check_address_type(int address_family, const char *address)
-{
-       struct in6_addr buf;
-       int err = 0;
-
-       err = inet_pton(address_family, address, &buf);
-       if(err > 0)
-               return 1;
-
-       return 0;
-}
+//LCOV_EXCL_STOP
 
 int __libnet_get_connected_count(struct _profile_list_s *profile_list)
 {
        int count = 0;
        int i = 0;
 
-       for (;i < profile_list->count;i++) {
+       for (; i < profile_list->count; i++) {
                if (profile_list->profiles[i].ProfileState == NET_STATE_TYPE_ONLINE ||
                    profile_list->profiles[i].ProfileState == NET_STATE_TYPE_READY)
                        count++;
@@ -502,7 +537,7 @@ void __libnet_copy_connected_profile(net_profile_info_t **dest, struct _profile_
 {
        int i = 0;
 
-       for (;i < source->count;i++) {
+       for (; i < source->count; i++) {
                if (source->profiles[i].ProfileState == NET_STATE_TYPE_ONLINE ||
                    source->profiles[i].ProfileState == NET_STATE_TYPE_READY) {
                        memcpy(*dest, &source->profiles[i], sizeof(net_profile_info_t));
@@ -511,12 +546,13 @@ void __libnet_copy_connected_profile(net_profile_info_t **dest, struct _profile_
        }
 }
 
+//LCOV_EXCL_START
 int __libnet_get_default_count(struct _profile_list_s *profile_list)
 {
        int count = 0;
        int i = 0;
 
-       for (;i < profile_list->count;i++) {
+       for (; i < profile_list->count; i++) {
                if (profile_list->profiles[i].ProfileInfo.Pdp.DefaultConn == TRUE)
                        count++;
        }
@@ -528,13 +564,14 @@ void __libnet_copy_default_profile(net_profile_info_t **dest, struct _profile_li
 {
        int i = 0;
 
-       for (;i < source->count;i++) {
+       for (; i < source->count; i++) {
                if (source->profiles[i].ProfileInfo.Pdp.DefaultConn == TRUE) {
                        memcpy(*dest, &source->profiles[i], sizeof(net_profile_info_t));
                        (*dest)++;
                }
        }
 }
+//LCOV_EXCL_STOP
 
 int _connection_libnet_init(void)
 {
@@ -578,6 +615,16 @@ bool _connection_libnet_deinit(void)
        return true;
 }
 
+void _connection_set_cs_tid(int tid)
+{
+       net_set_cs_tid(tid);
+}
+
+void _connection_unset_cs_tid(int tid)
+{
+       net_unset_cs_tid(tid);
+}
+
 bool _connection_libnet_check_profile_validity(connection_profile_h profile)
 {
        GSList *list;
@@ -589,12 +636,13 @@ bool _connection_libnet_check_profile_validity(connection_profile_h profile)
        for (list = prof_handle_list; list; list = list->next)
                if (profile == list->data) return true;
 
-       for (;i < profile_iterator.count;i++)
+       for (; i < profile_iterator.count; i++)
                if (profile == &profile_iterator.profiles[i]) return true;
 
        return false;
 }
 
+//LCOV_EXCL_START
 bool _connection_libnet_check_profile_cb_validity(connection_profile_h profile)
 {
        struct _profile_cb_s *cb_info;
@@ -609,21 +657,41 @@ bool _connection_libnet_check_profile_cb_validity(connection_profile_h profile)
 
        return false;
 }
+//LCOV_EXCL_STOP
 
+int _connection_libnet_get_metered_state(bool* is_metered)
+{
+       int rv = 0;
+       int status = 0;
+
+       rv = net_get_metered_state(&status);
+       if (rv == NET_ERR_ACCESS_DENIED) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+               return CONNECTION_ERROR_PERMISSION_DENIED;
+       } else if (rv != NET_ERR_NONE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get metered state[%d]", rv);
+               return CONNECTION_ERROR_OPERATION_FAILED;
+       }
+
+       if (status == 1)
+               *is_metered = true;
+       else
+               *is_metered = false;
+       return CONNECTION_ERROR_NONE;
+}
 
 int _connection_libnet_get_wifi_state(connection_wifi_state_e *state)
 {
        int rv;
        net_wifi_state_t wlan_state;
-       net_profile_name_t profile_name;
 
-       rv = net_get_wifi_state(&wlan_state, &profile_name);
+       rv = net_get_wifi_state(&wlan_state);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get Wi-Fi state[%d]", rv);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get Wi-Fi state[%d]", rv); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
        switch (wlan_state) {
@@ -639,15 +707,31 @@ int _connection_libnet_get_wifi_state(connection_wifi_state_e *state)
        case WIFI_DISCONNECTING:
                *state = CONNECTION_WIFI_STATE_CONNECTED;
                break;
-       default :
-               CONNECTION_LOG(CONNECTION_ERROR, "Unknown Wi-Fi state");
-               return CONNECTION_ERROR_INVALID_OPERATION;
+       default:
+               CONNECTION_LOG(CONNECTION_ERROR, "Unknown Wi-Fi state"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_OPERATION; //LCOV_EXCL_LINE
        }
 
        return CONNECTION_ERROR_NONE;
 }
 
-int _connection_libnet_get_ethernet_state(connection_ethernet_state_e* state)
+void _connection_libnet_set_type_changed_cb(libnet_type_changed_cb callback)
+{
+       libnet.type_changed_cb = callback;
+}
+
+void _connection_libnet_set_ip_changed_cb(libnet_ip_changed_cb callback)
+{
+       libnet.ip_changed_cb = callback;
+}
+
+void _connection_libnet_set_proxy_changed_cb(libnet_proxy_changed_cb callback)
+{
+       libnet.proxy_changed_cb = callback;
+}
+
+//LCOV_EXCL_START
+int _connection_libnet_get_ethernet_state(connection_ethernet_state_e *state)
 {
        int rv;
        struct _profile_list_s ethernet_profiles = {0, 0, NULL};
@@ -698,7 +782,7 @@ int _connection_libnet_get_ethernet_cable_state(connection_ethernet_cable_state_
                return CONNECTION_ERROR_OPERATION_FAILED;
        }
 
-       if(status == 1)
+       if (status == 1)
                *state = CONNECTION_ETHERNET_CABLE_ATTACHED;
        else
                *state = CONNECTION_ETHERNET_CABLE_DETACHED;
@@ -712,16 +796,17 @@ int _connection_libnet_set_ethernet_cable_state_changed_cb(
 
        return CONNECTION_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
-int _connection_libnet_get_bluetooth_state(connection_bt_state_estate)
+int _connection_libnet_get_bluetooth_state(connection_bt_state_e *state)
 {
        int i = 0;
        int rv = 0;
        struct _profile_list_s bluetooth_profiles = {0, 0, NULL};
        rv = net_get_profile_list(NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles, &bluetooth_profiles.count);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        }
 
        if (bluetooth_profiles.count == 0) {
@@ -729,6 +814,7 @@ int _connection_libnet_get_bluetooth_state(connection_bt_state_e* state)
                return CONNECTION_ERROR_NONE;
        }
 
+       //LCOV_EXCL_START
        for (; i < bluetooth_profiles.count; i++) {
                switch (bluetooth_profiles.profiles[i].ProfileState) {
                case NET_STATE_TYPE_ONLINE:
@@ -747,6 +833,7 @@ int _connection_libnet_get_bluetooth_state(connection_bt_state_e* state)
                        return CONNECTION_ERROR_OPERATION_FAILED;
                }
        }
+       //LCOV_EXCL_STOP
 
 done:
        __libnet_clear_profile_list(&bluetooth_profiles);
@@ -769,49 +856,49 @@ int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, con
 
        rv1 = net_get_profile_list(NET_DEVICE_WIFI, &wifi_profiles.profiles, &wifi_profiles.count);
        if (rv1 == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv1 != NET_ERR_NO_SERVICE && rv1 != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        CONNECTION_LOG(CONNECTION_INFO, "Wi-Fi profile count: %d", wifi_profiles.count);
 
        rv2 = net_get_profile_list(NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
        if (rv2 == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
                __libnet_clear_profile_list(&wifi_profiles);
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv2 != NET_ERR_NO_SERVICE && rv2 != NET_ERR_NONE) {
                __libnet_clear_profile_list(&wifi_profiles);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
        CONNECTION_LOG(CONNECTION_INFO, "Cellular profile count: %d", cellular_profiles.count);
 
        rv3 = net_get_profile_list(NET_DEVICE_ETHERNET, &ethernet_profiles.profiles, &ethernet_profiles.count);
        if (rv3 == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
                __libnet_clear_profile_list(&wifi_profiles);
                __libnet_clear_profile_list(&cellular_profiles);
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv3 != NET_ERR_NO_SERVICE && rv3 != NET_ERR_NONE) {
                __libnet_clear_profile_list(&wifi_profiles);
                __libnet_clear_profile_list(&cellular_profiles);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
        CONNECTION_LOG(CONNECTION_INFO, "Ethernet profile count : %d", ethernet_profiles.count);
 
        rv4 = net_get_profile_list(NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles, &bluetooth_profiles.count);
        if (rv4 == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
                __libnet_clear_profile_list(&wifi_profiles);
                __libnet_clear_profile_list(&cellular_profiles);
                __libnet_clear_profile_list(&ethernet_profiles);
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv4 != NET_ERR_NO_SERVICE && rv4 != NET_ERR_NONE) {
                __libnet_clear_profile_list(&wifi_profiles);
                __libnet_clear_profile_list(&cellular_profiles);
                __libnet_clear_profile_list(&ethernet_profiles);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
        CONNECTION_LOG(CONNECTION_INFO, "Bluetooth profile count : %d", bluetooth_profiles.count);
 
@@ -830,7 +917,7 @@ int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, con
                        __libnet_clear_profile_list(&cellular_profiles);
                        __libnet_clear_profile_list(&ethernet_profiles);
                        __libnet_clear_profile_list(&bluetooth_profiles);
-                       return CONNECTION_ERROR_OUT_OF_MEMORY;
+                       return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
 
                profile_iterator.profiles = profiles;
@@ -873,7 +960,7 @@ int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, con
                        __libnet_clear_profile_list(&cellular_profiles);
                        __libnet_clear_profile_list(&ethernet_profiles);
                        __libnet_clear_profile_list(&bluetooth_profiles);
-                       return CONNECTION_ERROR_OUT_OF_MEMORY;
+                       return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
 
                profile_iterator.profiles = profiles;
@@ -893,7 +980,7 @@ int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, con
                break;
        case CONNECTION_ITERATOR_TYPE_DEFAULT:
                count = __libnet_get_default_count(&cellular_profiles);
-               CONNECTION_LOG(CONNECTION_INFO, "Total default profile count : %d", count);
+               CONNECTION_LOG(CONNECTION_INFO, "Total default profile count : %d", count); //LCOV_EXCL_LINE
                if (count == 0)
                        return CONNECTION_ERROR_NONE;
 
@@ -903,7 +990,7 @@ int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, con
                        __libnet_clear_profile_list(&cellular_profiles);
                        __libnet_clear_profile_list(&ethernet_profiles);
                        __libnet_clear_profile_list(&bluetooth_profiles);
-                       return CONNECTION_ERROR_OUT_OF_MEMORY;
+                       return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
                }
 
                profile_iterator.profiles = profiles;
@@ -951,7 +1038,7 @@ bool _connection_libnet_iterator_has_next(connection_profile_iterator_h profile_
 int _connection_libnet_destroy_iterator(connection_profile_iterator_h profile_iter_h)
 {
        if (profile_iter_h != &profile_iterator)
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        __libnet_clear_profile_list(&profile_iterator);
 
@@ -965,16 +1052,16 @@ int _connection_libnet_get_current_profile(connection_profile_h *profile)
 
        rv = net_get_active_net_info(&active_profile);
        if (rv == NET_ERR_NO_SERVICE)
-               return CONNECTION_ERROR_NO_CONNECTION;
+               return CONNECTION_ERROR_NO_CONNECTION; //LCOV_EXCL_LINE
        else if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        *profile = g_try_malloc0(sizeof(net_profile_info_t));
        if (*profile == NULL)
-               return CONNECTION_ERROR_OUT_OF_MEMORY;
+               return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
 
        memcpy(*profile, &active_profile, sizeof(net_profile_info_t));
        prof_handle_list = g_slist_append(prof_handle_list, *profile);
@@ -989,11 +1076,11 @@ int _connection_libnet_reset_profile(connection_reset_option_e type,
 
        rv = net_reset_profile(type, id);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Failed to add profile[%d]", rv);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Failed to add profile[%d]", rv); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
        __libnet_set_reset_profile_cb(callback, user_data);
@@ -1007,18 +1094,18 @@ int _connection_libnet_open_profile(connection_profile_h profile,
        int rv;
 
        if (!(_connection_libnet_check_profile_validity(profile))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        net_profile_info_t *profile_info = profile;
 
        rv = net_open_connection_with_profile(profile_info->ProfileName);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        __libnet_set_opened_cb(callback, user_data);
 
@@ -1040,11 +1127,11 @@ int _connection_libnet_get_cellular_service_profile(
 
        rv = net_get_profile_list(NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get profile list (%d)", rv);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get profile list (%d)", rv); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
 #if defined TIZEN_DUALSIM_ENABLE
@@ -1052,8 +1139,8 @@ int _connection_libnet_get_cellular_service_profile(
                                                &default_subscriber_id) != 0) {
                CONNECTION_LOG(CONNECTION_ERROR,
                                                "Failed to get VCONF_TELEPHONY_DEFAULT_DATA_SERVICE");
-               __libnet_clear_profile_list(&cellular_profiles);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               __libnet_clear_profile_list(&cellular_profiles); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
        g_snprintf(subscriber_id, sizeof(subscriber_id), "%d", default_subscriber_id);
@@ -1069,14 +1156,14 @@ int _connection_libnet_get_cellular_service_profile(
                                break;
 
        if (i >= cellular_profiles.count) {
-               __libnet_clear_profile_list(&cellular_profiles);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               __libnet_clear_profile_list(&cellular_profiles); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
        *profile = g_try_malloc0(sizeof(net_profile_info_t));
        if (*profile == NULL) {
-               __libnet_clear_profile_list(&cellular_profiles);
-               return CONNECTION_ERROR_OUT_OF_MEMORY;
+               __libnet_clear_profile_list(&cellular_profiles); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
        }
 
        memcpy(*profile, &cellular_profiles.profiles[i], sizeof(net_profile_info_t));
@@ -1084,6 +1171,7 @@ int _connection_libnet_get_cellular_service_profile(
        if (cellular_profiles.profiles[i].ProfileInfo.Pdp.DefaultConn)
                goto done;
 
+       //LCOV_EXCL_START
        if (type != CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET &&
            type != CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET)
                goto done;
@@ -1100,6 +1188,7 @@ int _connection_libnet_get_cellular_service_profile(
                        goto done;
                }
        }
+       //LCOV_EXCL_STOP
 
 done:
        __libnet_clear_profile_list(&cellular_profiles);
@@ -1113,8 +1202,8 @@ int _connection_libnet_set_cellular_service_profile_sync(connection_cellular_ser
        int rv;
 
        if (!(_connection_libnet_check_profile_validity(profile))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        net_profile_info_t *profile_info = profile;
@@ -1123,14 +1212,14 @@ int _connection_libnet_set_cellular_service_profile_sync(connection_cellular_ser
        service_type = _profile_convert_to_connection_cellular_service_type(profile_info->ProfileInfo.Pdp.ServiceType);
 
        if (service_type != type)
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        rv = net_set_default_cellular_service_profile(profile_info->ProfileName);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1141,8 +1230,8 @@ int _connection_libnet_set_cellular_service_profile_async(connection_cellular_se
        int rv;
 
        if (!(_connection_libnet_check_profile_validity(profile))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        net_profile_info_t *profile_info = profile;
@@ -1151,14 +1240,14 @@ int _connection_libnet_set_cellular_service_profile_async(connection_cellular_se
        service_type = _profile_convert_to_connection_cellular_service_type(profile_info->ProfileInfo.Pdp.ServiceType);
 
        if (service_type != type)
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
 
        rv = net_set_default_cellular_service_profile_async(profile_info->ProfileName);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        __libnet_set_default_cb(callback, user_data);
 
@@ -1170,18 +1259,18 @@ int _connection_libnet_close_profile(connection_profile_h profile, connection_cl
        int rv;
 
        if (!(_connection_libnet_check_profile_validity(profile))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        net_profile_info_t *profile_info = profile;
 
        rv = net_close_connection(profile_info->ProfileName);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        __libnet_set_closed_cb(callback, user_data);
 
@@ -1194,32 +1283,23 @@ int _connection_libnet_add_route(const char *interface_name, const char *host_ad
        char *endstr = NULL;
        int address_family = 0;
 
-       if(__libnet_check_address_type(AF_INET, host_address))
-               address_family = AF_INET;
-       else
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+       address_family = AF_INET;
 
-       switch(address_family) {
-               case AF_INET:
-                       endstr = strrchr(host_address, '.');
-                       if (endstr == NULL ||
-                                       strcmp(endstr, ".0") == 0 ||
-                                       strncmp(host_address, "0.", 2) == 0 ||
-                                       strstr(host_address, "255") != NULL) {
-                               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
-                               return CONNECTION_ERROR_INVALID_PARAMETER;
-                       }
-                       break;
-               default:
-                       return CONNECTION_ERROR_OPERATION_FAILED;
+       endstr = strrchr(host_address, '.');
+       if (endstr == NULL ||
+                       strcmp(endstr, ".0") == 0 ||
+                       strncmp(host_address, "0.", 2) == 0 ||
+                       strstr(host_address, "255") != NULL) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        rv = net_add_route(host_address, interface_name, address_family);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1230,32 +1310,23 @@ int _connection_libnet_remove_route(const char *interface_name, const char *host
        char *endstr = strrchr(host_address, '.');
        int address_family = 0;
 
-       if (__libnet_check_address_type(AF_INET, host_address))
-               address_family = AF_INET;
-       else
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+       address_family = AF_INET;
 
-       switch(address_family) {
-               case AF_INET:
-                       endstr = strrchr(host_address, '.');
-                       if (endstr == NULL ||
-                               strcmp(endstr, ".0") == 0 ||
-                               strncmp(host_address, "0.", 2) == 0 ||
-                               strstr(host_address, ".0.") != NULL ||strstr(host_address, "255") != NULL) {
-                               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed");
-                               return CONNECTION_ERROR_INVALID_PARAMETER;
-                       }
-                       break;
-               default:
-                       return CONNECTION_ERROR_OPERATION_FAILED;
+       endstr = strrchr(host_address, '.');
+       if (endstr == NULL ||
+               strcmp(endstr, ".0") == 0 ||
+               strncmp(host_address, "0.", 2) == 0 ||
+               strstr(host_address, ".0.") != NULL || strstr(host_address, "255") != NULL) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        rv = net_remove_route(host_address, interface_name, address_family);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1266,30 +1337,20 @@ int _connection_libnet_add_route_ipv6(const char *interface_name, const char *ho
        int address_family = 0;
 
        address_family = AF_INET6;
-/*     if(__libnet_check_address_type(AF_INET6, host_address))
-               address_family = AF_INET6;
-       else
-               return CONNECTION_ERROR_INVALID_PARAMETER;*/
-
-       switch(address_family) {
-               case AF_INET6:
-                       if (strncmp(host_address, "fe80:", 5) == 0 ||
-                               strncmp(host_address, "ff00:", 5) == 0 ||
-                               strncmp(host_address, "::", 2) == 0) {
-                               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
-                               return CONNECTION_ERROR_INVALID_PARAMETER;
-                       }
-                       break;
-               default:
-                       return CONNECTION_ERROR_OPERATION_FAILED;
+
+       if (strncmp(host_address, "fe80:", 5) == 0 ||
+               strncmp(host_address, "ff00:", 5) == 0 ||
+               strncmp(host_address, "::", 2) == 0) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        rv = net_add_route_ipv6(host_address, interface_name, address_family, gateway);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1300,30 +1361,119 @@ int _connection_libnet_remove_route_ipv6(const char *interface_name, const char
        int address_family = 0;
 
        address_family = AF_INET6;
-/*     if (__libnet_check_address_type(AF_INET6, host_address))
-               address_family = AF_INET6;
-       else
-               return CONNECTION_ERROR_INVALID_PARAMETER;*/
-
-       switch(address_family) {
-               case AF_INET6:
-                       if (strncmp(host_address, "fe80:", 5) == 0 ||
-                               strncmp(host_address, "ff00:", 5) == 0 ||
-                               strncmp(host_address, "::", 2) == 0) {
-                               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
-                               return CONNECTION_ERROR_INVALID_PARAMETER;
-                       }
-                       break;
-               default:
-                       return CONNECTION_ERROR_OPERATION_FAILED;
+
+       if (strncmp(host_address, "fe80:", 5) == 0 ||
+               strncmp(host_address, "ff00:", 5) == 0 ||
+               strncmp(host_address, "::", 2) == 0) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
        }
 
        rv = net_remove_route_ipv6(host_address, interface_name, address_family, gateway);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+
+       return CONNECTION_ERROR_NONE;
+}
+
+int _connection_libnet_add_route_entry(connection_address_family_e address_family,
+               const char *interface_name, const char *host_address, const char *gateway)
+{
+       int rv;
+       char *endstr = NULL;
+       int address_family_type = 0;
+
+       if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4)
+               address_family_type = AF_INET;
+       else
+               address_family_type = AF_INET6;
+
+       if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) {
+
+               endstr = strrchr(host_address, '.');
+               if (endstr == NULL ||
+                               strcmp(endstr, ".0") == 0 ||
+                               strncmp(host_address, "0.", 2) == 0 ||
+                               strstr(host_address, "255") != NULL) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+               }
+
+               rv = net_add_route_entry(host_address, interface_name, address_family_type, gateway);
+               if (rv == NET_ERR_ACCESS_DENIED) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+               } else if (rv != NET_ERR_NONE)
+                       return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+
+       } else {
+
+               if (strncmp(host_address, "fe80:", 5) == 0 ||
+                       strncmp(host_address, "ff00:", 5) == 0 ||
+                       strncmp(host_address, "::", 2) == 0) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+               }
+
+               rv = net_add_route_ipv6(host_address, interface_name, address_family_type, gateway);
+               if (rv == NET_ERR_ACCESS_DENIED) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+               } else if (rv != NET_ERR_NONE)
+                       return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+       }
+
+       return CONNECTION_ERROR_NONE;
+}
+
+int _connection_libnet_remove_route_entry(connection_address_family_e address_family,
+               const char *interface_name, const char *host_address, const char *gateway)
+{
+       int rv;
+       char *endstr = strrchr(host_address, '.');
+       int address_family_type = 0;
+
+       if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4)
+               address_family_type = AF_INET;
+       else
+               address_family_type = AF_INET6;
+
+       if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) {
+               endstr = strrchr(host_address, '.');
+               if (endstr == NULL ||
+                       strcmp(endstr, ".0") == 0 ||
+                       strncmp(host_address, "0.", 2) == 0 ||
+                       strstr(host_address, ".0.") != NULL || strstr(host_address, "255") != NULL) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+               }
+
+               rv = net_remove_route_entry(host_address, interface_name, address_family_type, gateway);
+               if (rv == NET_ERR_ACCESS_DENIED) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+               } else if (rv != NET_ERR_NONE)
+                       return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+
+       } else {
+
+               if (strncmp(host_address, "fe80:", 5) == 0 ||
+                       strncmp(host_address, "ff00:", 5) == 0 ||
+                       strncmp(host_address, "::", 2) == 0) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+               }
+
+               rv = net_remove_route_ipv6(host_address, interface_name, address_family_type, gateway);
+               if (rv == NET_ERR_ACCESS_DENIED) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+               } else if (rv != NET_ERR_NONE)
+                       return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+       }
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1347,8 +1497,8 @@ bool _connection_libnet_add_to_profile_cb_list(connection_profile_h profile,
 
        struct _profile_cb_s *profile_cb_info = g_try_malloc0(sizeof(struct _profile_cb_s));
        if (profile_cb_info == NULL) {
-               g_free(profile_name);
-               return false;
+               g_free(profile_name); //LCOV_EXCL_LINE
+               return false; //LCOV_EXCL_LINE
        }
 
        profile_cb_info->callback = callback;
@@ -1367,7 +1517,7 @@ bool _connection_libnet_remove_from_profile_cb_list(connection_profile_h profile
        if (g_hash_table_remove(profile_cb_table, profile_info->ProfileName) == TRUE)
                return true;
 
-       return false;
+       return false; //LCOV_EXCL_LINE
 }
 
 int _connection_libnet_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type)
@@ -1375,10 +1525,10 @@ int _connection_libnet_set_statistics(net_device_t device_type, net_statistics_t
        int rv;
        rv = net_set_statistics(device_type, statistics_type);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1388,10 +1538,10 @@ int _connection_libnet_get_statistics(net_statistics_type_e statistics_type, uns
        int rv;
        rv = net_get_statistics(NET_DEVICE_WIFI, statistics_type, size);
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
-       }else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+       } else if (rv != NET_ERR_NONE)
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1403,13 +1553,13 @@ int _connection_libnet_set_cellular_subscriber_id(connection_profile_h profile,
        net_profile_info_t *profile_info = (net_profile_info_t *)profile;
 
        if (net_get_cellular_modem_object_path(&modem_path, sim_id) != NET_ERR_NONE) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get subscriber[%d]", sim_id);
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Failed to get subscriber[%d]", sim_id); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
        if (!modem_path) {
-               CONNECTION_LOG(CONNECTION_ERROR, "NULL modem object path");
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               CONNECTION_LOG(CONNECTION_ERROR, "NULL modem object path"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
        }
 
        g_strlcpy(profile_info->ProfileInfo.Pdp.PSModemPath, modem_path,
@@ -1442,6 +1592,8 @@ guint _connection_callback_add(GSourceFunc func, gpointer user_data)
 {
        guint id;
        struct managed_idle_data *data;
+       GMainContext *context;
+       GSource *src;
 
        if (!func)
                return 0;
@@ -1453,8 +1605,12 @@ guint _connection_callback_add(GSourceFunc func, gpointer user_data)
        data->func = func;
        data->user_data = user_data;
 
-       id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __connection_idle_cb, data,
-                       __connection_idle_destroy_cb);
+       context = g_main_context_get_thread_default();
+       src = g_idle_source_new();
+       g_source_set_callback(src, __connection_idle_cb, data,
+               __connection_idle_destroy_cb);
+       id = g_source_attach(src, context);
+       g_source_unref(src);
        if (!id) {
                g_free(data);
                return id;
@@ -1474,6 +1630,7 @@ void _connection_callback_cleanup(void)
        struct managed_idle_data *data;
 
        while (cur) {
+               //LCOV_EXCL_START
                GSList *next = cur->next;
                data = (struct managed_idle_data *)cur->data;
 
@@ -1483,6 +1640,7 @@ void _connection_callback_cleanup(void)
                        cur = managed_idler_list;
                } else
                        cur = next;
+               //LCOV_EXCL_STOP
        }
 
        g_slist_free(managed_idler_list);
@@ -1495,10 +1653,10 @@ int _connection_libnet_check_get_privilege()
 
        rv = net_check_get_privilege();
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
@@ -1509,29 +1667,46 @@ int _connection_libnet_check_profile_privilege()
 
        rv = net_check_profile_privilege();
        if (rv == NET_ERR_ACCESS_DENIED) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
-               return CONNECTION_ERROR_PERMISSION_DENIED;
+               CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
        } else if (rv != NET_ERR_NONE)
-               return CONNECTION_ERROR_OPERATION_FAILED;
+               return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
 
        return CONNECTION_ERROR_NONE;
 }
 
+bool __libnet_check_feature_supported(const char *key, connection_supported_feature_e feature)
+{
+       if (!connection_is_feature_checked[feature]) {
+               if (system_info_get_platform_bool(key, &connection_feature_supported[feature]) < 0) {
+                       CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature getting from System Info"); //LCOV_EXCL_LINE
+                       set_last_result(CONNECTION_ERROR_OPERATION_FAILED); //LCOV_EXCL_LINE
+                       return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+               }
+               connection_is_feature_checked[feature] = true;
+       }
+       return connection_feature_supported[feature];
+}
+
 int _connection_check_feature_supported(const char *feature_name, ...)
 {
        va_list list;
        const char *key;
-       bool value, feature_supported = false;
+       bool value = false;
+       bool feature_supported = false;
 
        va_start(list, feature_name);
        key = feature_name;
-       while(1) {
-               if(system_info_get_platform_bool(key, &value) < 0) {
-                       CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature getting from System Info");
-                       set_last_result(CONNECTION_ERROR_OPERATION_FAILED);
-                       return CONNECTION_ERROR_OPERATION_FAILED;
-               }
-               SECURE_CONNECTION_LOG(CONNECTION_INFO, "%s feature is %s", key, (value?"true":"false"));
+       while (1) {
+               if (strcmp(key, TELEPHONY_FEATURE) == 0)
+                       value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_TELEPHONY);
+               if (strcmp(key, WIFI_FEATURE) == 0)
+                       value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_WIFI);
+               if (strcmp(key, TETHERING_BLUETOOTH_FEATURE) == 0)
+                       value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_TETHERING_BLUETOOTH);
+               if (strcmp(key, ETHERNET_FEATURE) == 0)
+                       value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_ETHERNET);
+
                feature_supported |= value;
                key = va_arg(list, const char *);
                if (!key) break;
@@ -1539,10 +1714,44 @@ int _connection_check_feature_supported(const char *feature_name, ...)
        if (!feature_supported) {
                CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature is not supported");
                set_last_result(CONNECTION_ERROR_NOT_SUPPORTED);
+               va_end(list);
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
-       va_end(list);
 
+       va_end(list);
        set_last_result(CONNECTION_ERROR_NONE);
        return CONNECTION_ERROR_NONE;
 }
+
+int _connection_libnet_start_tcpdump(void)
+{
+       connection_error_e result = CONNECTION_ERROR_NONE;
+       net_err_t ret = NET_ERR_NONE;
+
+       ret = net_start_tcpdump();
+       result = __libnet_convert_to_cp_error_type(ret);
+
+       return result;
+}
+
+int _connection_libnet_stop_tcpdump(void)
+{
+       connection_error_e result = CONNECTION_ERROR_NONE;
+       net_err_t ret = NET_ERR_NONE;
+
+       ret = net_stop_tcpdump();
+       result = __libnet_convert_to_cp_error_type(ret);
+
+       return result;
+}
+
+int _connection_libnet_get_tcpdump_state(gboolean *tcpdump_state)
+{
+       connection_error_e result = CONNECTION_ERROR_NONE;
+       net_err_t ret = NET_ERR_NONE;
+
+       ret = net_get_tcpdump_state(tcpdump_state);
+       result = __libnet_convert_to_cp_error_type(ret);
+
+       return result;
+}