From 96ea65a49c3b90ad017d03dcff2b2fcb636b282a Mon Sep 17 00:00:00 2001 From: "hyunuk.tak" Date: Fri, 18 Oct 2019 09:05:11 +0900 Subject: [PATCH] Add some LCOV macro for coverage Change-Id: I59be39d5a233dee5f51dd3f0be57e20a4772a258 Signed-off-by: hyunuk.tak --- src/connection.c | 108 +++++++++++---------- src/connection_mptcp.c | 4 +- src/connection_profile.c | 242 +++++++++++++++++++++++------------------------ src/libnetwork.c | 20 ++-- src/libnetwork_mptcp.c | 2 + 5 files changed, 191 insertions(+), 185 deletions(-) diff --git a/src/connection.c b/src/connection.c index 9cc447f..ce17c04 100755 --- a/src/connection.c +++ b/src/connection.c @@ -154,7 +154,7 @@ EXPORT_API int connection_create(connection_h *connection) if (connection == NULL || __connection_check_handle_validity(*connection)) { CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_PARAMETER; } @@ -162,18 +162,18 @@ EXPORT_API int connection_create(connection_h *connection) if (*connection != NULL) { CONNECTION_LOG(CONNECTION_INFO, "New handle created[%p]", *connection); } else { - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } rv = _connection_libnet_init(*connection); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } else if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to create connection[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -213,6 +213,7 @@ EXPORT_API int connection_destroy(connection_h connection) return CONNECTION_ERROR_NONE; } +//LCOV_EXCL_START EXPORT_API int connection_create_cs(int tid, connection_h *connection) { int rv; @@ -239,6 +240,7 @@ EXPORT_API int connection_destroy_cs(int tid, connection_h connection) return rv; } +//LCOV_EXCL_STOP EXPORT_API int connection_get_type(connection_h connection, connection_type_e* type) { @@ -258,7 +260,7 @@ EXPORT_API int connection_get_type(connection_h connection, connection_type_e* t rv = vconf_get_int(VCONFKEY_NETWORK_STATUS, &status); if (rv != VCONF_OK) { CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_int Failed = %d", status); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -298,7 +300,7 @@ EXPORT_API int connection_get_ip_address(connection_h connection, if (*ip_address == NULL) { CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_str Failed"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED;//LCOV_EXCL_LINE } @@ -332,7 +334,7 @@ EXPORT_API int connection_get_proxy(connection_h connection, if (*proxy == NULL) { CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_str Failed"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -366,22 +368,23 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty char *profileName; system_info_get_platform_string("http://tizen.org/feature/profile", &profileName); if (*profileName == 't' || *profileName == 'T') - tv_profile = 1; + tv_profile = 1; //LCOV_EXCL_LINE else tv_profile = 0; free(profileName); } if (tv_profile == 1) { + //LCOV_EXCL_START fp = fopen(WIFI_MAC_INFO_FILE, "r"); if (fp == NULL) { - CONNECTION_LOG(CONNECTION_ERROR, "Failed to open file %s", WIFI_MAC_INFO_FILE); //LCOV_EXCL_LINE + CONNECTION_LOG(CONNECTION_ERROR, "Failed to open file %s", WIFI_MAC_INFO_FILE); CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; } if (fgets(buf, sizeof(buf), fp) == NULL) { - CONNECTION_LOG(CONNECTION_ERROR, "Failed to get MAC info from %s", WIFI_MAC_INFO_FILE); //LCOV_EXCL_LINE - fclose(fp); //LCOV_EXCL_LINE + CONNECTION_LOG(CONNECTION_ERROR, "Failed to get MAC info from %s", WIFI_MAC_INFO_FILE); + fclose(fp); CONN_UNLOCK; return CONNECTION_ERROR_OPERATION_FAILED; } @@ -390,19 +393,20 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty *mac_addr = (char *)malloc(CONNECTION_MAC_INFO_LENGTH + 1); if (*mac_addr == NULL) { - CONNECTION_LOG(CONNECTION_ERROR, "malloc() failed"); //LCOV_EXCL_LINE - fclose(fp); //LCOV_EXCL_LINE + CONNECTION_LOG(CONNECTION_ERROR, "malloc() failed"); + fclose(fp); CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; } g_strlcpy(*mac_addr, buf, CONNECTION_MAC_INFO_LENGTH + 1); fclose(fp); + //LCOV_EXCL_STOP } else { *mac_addr = vconf_get_str(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 - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } } @@ -440,7 +444,7 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty //LCOV_EXCL_STOP default: CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } @@ -448,7 +452,7 @@ EXPORT_API int connection_get_mac_address(connection_h connection, connection_ty if ((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; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_OPERATION; //LCOV_EXCL_LINE } @@ -474,7 +478,7 @@ EXPORT_API int connection_is_metered_network(connection_h connection, bool* is_m int rv = _connection_libnet_get_metered_state(connection, is_metered); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to get metered state[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -506,7 +510,7 @@ EXPORT_API int connection_get_cellular_state(connection_h connection, connection rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &status); if (rv != VCONF_OK) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to get cellular state"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -542,7 +546,7 @@ EXPORT_API int connection_get_cellular_state(connection_h connection, connection #endif if (rv != VCONF_OK) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to get cellular state"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } } @@ -573,7 +577,7 @@ EXPORT_API int connection_get_wifi_state(connection_h connection, connection_wif int rv = _connection_libnet_get_wifi_state(connection, state); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to get Wi-Fi state[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -727,7 +731,7 @@ EXPORT_API int connection_get_bt_state(connection_h connection, connection_bt_st int rv = _connection_libnet_get_bluetooth_state(connection, state); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to get bluetooth state[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -902,14 +906,14 @@ EXPORT_API int connection_add_profile(connection_h connection, connection_profil if (profile_info->profile_type != NET_DEVICE_CELLULAR) { CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } if (profile_info->ProfileInfo.Pdp.PSModemPath[0] != '/' || strlen(profile_info->ProfileInfo.Pdp.PSModemPath) < 2) { CONNECTION_LOG(CONNECTION_ERROR, "Modem object path is NULL"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } @@ -917,11 +921,11 @@ EXPORT_API int connection_add_profile(connection_h connection, connection_profil profile_info->ProfileInfo.Pdp.ServiceType, profile_info); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //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); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -950,18 +954,18 @@ EXPORT_API int connection_remove_profile(connection_h connection, connection_pro profile_info->profile_type != NET_DEVICE_MESH && profile_info->profile_type != NET_DEVICE_WIFI) { CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } rv = net_delete_profile(conn_handle->network_info_handle, profile_info->ProfileName); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } else if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to delete profile[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -990,11 +994,11 @@ EXPORT_API int connection_update_profile(connection_h connection, connection_pro profile_info->ProfileName, (net_profile_info_t*)profile); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } else if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to modify profile[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -1021,7 +1025,7 @@ EXPORT_API int connection_get_profile_iterator(connection_h connection, int rv = _connection_libnet_get_profile_iterator(connection, type, profile_iterator); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to get profile iterator [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1081,7 +1085,7 @@ EXPORT_API int connection_get_current_profile(connection_h connection, connectio int rv = _connection_libnet_get_current_profile(connection, profile); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to get current profile [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1106,7 +1110,7 @@ EXPORT_API int connection_get_default_cellular_service_profile( int rv = _connection_libnet_get_cellular_service_profile(connection, type, profile); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to get default cellular service profile [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1130,7 +1134,7 @@ EXPORT_API int connection_set_default_cellular_service_profile(connection_h conn int rv = _connection_libnet_set_cellular_service_profile_sync(connection, type, profile); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to set default cellular service profile [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1158,11 +1162,11 @@ EXPORT_API int connection_set_default_cellular_service_profile_async(connection_ rv = _connection_libnet_set_cellular_service_profile_async(connection, type, profile); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } else if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to set default cellular service profile[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -1191,11 +1195,11 @@ EXPORT_API int connection_open_profile(connection_h connection, connection_profi rv = _connection_libnet_open_profile(connection, profile); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } else if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to open profile[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -1224,11 +1228,11 @@ EXPORT_API int connection_close_profile(connection_h connection, connection_prof rv = _connection_libnet_close_profile(connection, profile); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } else if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to close profile[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -1255,18 +1259,18 @@ EXPORT_API int connection_reset_profile(connection_h connection, if (id < 0 || id > 1) { CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } rv = _connection_libnet_reset_profile(connection, type, id); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE } else if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to reset profile[%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -1292,7 +1296,7 @@ EXPORT_API int connection_add_route(connection_h connection, const char* interfa int rv = _connection_libnet_add_route(connection, interface_name, host_address); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to add route [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1316,7 +1320,7 @@ EXPORT_API int connection_remove_route(connection_h connection, const char* inte int rv = _connection_libnet_remove_route(connection, interface_name, host_address); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to remove route [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1340,7 +1344,7 @@ EXPORT_API int connection_add_route_ipv6(connection_h connection, const char *in int rv = _connection_libnet_add_route_ipv6(connection, interface_name, host_address, gateway); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to add route ipv6 [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1364,7 +1368,7 @@ EXPORT_API int connection_remove_route_ipv6(connection_h connection, const char int rv = _connection_libnet_remove_route_ipv6(connection, interface_name, host_address, gateway); if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Fail to remove route ipv6 [%d]", rv); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return rv; //LCOV_EXCL_LINE } @@ -1725,10 +1729,10 @@ EXPORT_API int connection_foreach_ipv6_address(connection_h connection, } if (rv != NET_ERR_NONE) { - CONNECTION_LOG(CONNECTION_ERROR, "net_get_multiple_id_address" + CONNECTION_LOG(CONNECTION_ERROR, "net_get_multiple_id_address" //LCOV_EXCL_LINE " Failed = %d\n", rv); - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } GSList *list; diff --git a/src/connection_mptcp.c b/src/connection_mptcp.c index 3d44567..9479965 100755 --- a/src/connection_mptcp.c +++ b/src/connection_mptcp.c @@ -23,6 +23,7 @@ #include "net_connection_private.h" #include "net_connection_mptcp_private.h" +//LCOV_EXCL_START EXPORT_API int connection_mptcp_is_supported(connection_h connection, bool* supported) { if (!(_connection_check_handle_validity(connection))) { @@ -168,5 +169,4 @@ EXPORT_API int connection_mptcp_get_scheduler(connection_h connection, connectio return _connection_libnet_mptcp_get_scheduler(connection, scheduler); } - - +//LCOV_EXCL_STOP diff --git a/src/connection_profile.c b/src/connection_profile.c index b63afdd..9fdd65b 100755 --- a/src/connection_profile.c +++ b/src/connection_profile.c @@ -266,18 +266,18 @@ EXPORT_API int connection_profile_create(connection_profile_type_e type, const c int rv = _connection_libnet_check_profile_privilege(); if (rv == CONNECTION_ERROR_PERMISSION_DENIED) { - CONN_UNLOCK; - return rv; + CONN_UNLOCK; //LCOV_EXCL_LINE + return rv; //LCOV_EXCL_LINE } else if (rv != CONNECTION_ERROR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Failed to create profile"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } net_profile_info_t *profile_info = g_try_malloc0(sizeof(net_profile_info_t)); if (profile_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } if (type == CONNECTION_PROFILE_TYPE_CELLULAR) { @@ -331,8 +331,8 @@ EXPORT_API int connection_profile_clone(connection_profile_h* cloned_profile, co *cloned_profile = g_try_malloc0(sizeof(net_profile_info_t)); if (*cloned_profile == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } memcpy(*cloned_profile, origin_profile, sizeof(net_profile_info_t)); @@ -358,16 +358,16 @@ EXPORT_API int connection_profile_get_id(connection_profile_h profile, char** pr char *prof_id = strrchr(profile_info->ProfileName, '/'); if (prof_id == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } prof_id++; *profile_id = g_strdup(prof_id); if (*profile_id == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -401,8 +401,8 @@ EXPORT_API int connection_profile_get_name(connection_profile_h profile, char** case NET_DEVICE_BLUETOOTH: { char *bt_name = strrchr(profile_info->ProfileName, '/'); if (bt_name == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } bt_name++; @@ -412,13 +412,13 @@ EXPORT_API int connection_profile_get_name(connection_profile_h profile, char** *profile_name = g_strdup(profile_info->ProfileInfo.Mesh.essid); break; default: - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } if (*profile_name == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -456,9 +456,9 @@ EXPORT_API int connection_profile_get_type(connection_profile_h profile, connect *type = CONNECTION_PROFILE_TYPE_MESH; break; default: - CONNECTION_LOG(CONNECTION_ERROR, "Invalid profile type"); - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONNECTION_LOG(CONNECTION_ERROR, "Invalid profile type"); //LCOV_EXCL_LINE + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -480,14 +480,14 @@ EXPORT_API int connection_profile_get_network_interface_name(connection_profile_ net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } *interface_name = g_strdup(net_info->DevName); if (*interface_name == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -514,11 +514,11 @@ EXPORT_API int connection_profile_refresh(connection_profile_h profile) rv = net_get_profile_info(NULL, profile_info->ProfileName, &profile_info_local); if (rv == NET_ERR_ACCESS_DENIED) { CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //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 information"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -591,8 +591,8 @@ EXPORT_API int connection_profile_get_ip_config_type(connection_profile_h profil net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) @@ -673,8 +673,8 @@ EXPORT_API int connection_profile_get_ip_address(connection_profile_h profile, net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) { @@ -682,15 +682,15 @@ EXPORT_API int connection_profile_get_ip_address(connection_profile_h profile, address_family); } else { if (net_get_preferred_ipv6_address(net_info->ProfileName, ip_address) != NET_ERR_NONE) { - CONNECTION_LOG(CONNECTION_ERROR, "Failed to get preferred ipv6 address"); - *ip_address = __profile_convert_ip_to_string(&net_info->IpAddr6, + CONNECTION_LOG(CONNECTION_ERROR, "Failed to get preferred ipv6 address"); //LCOV_EXCL_LINE + *ip_address = __profile_convert_ip_to_string(&net_info->IpAddr6, //LCOV_EXCL_LINE address_family); } } if (*ip_address == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -714,25 +714,25 @@ EXPORT_API int connection_profile_get_subnet_mask(connection_profile_h profile, } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) { - CONNECTION_LOG(CONNECTION_ERROR, + CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE "Please uses connection_profile_get_prefix_length()"); - CONN_UNLOCK; - return CONNECTION_ERROR_NOT_SUPPORTED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } *subnet_mask = __profile_convert_ip_to_string(&net_info->SubnetMask, address_family); if (*subnet_mask == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -758,8 +758,8 @@ EXPORT_API int connection_profile_get_gateway_address(connection_profile_h profi net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) @@ -770,8 +770,8 @@ EXPORT_API int connection_profile_get_gateway_address(connection_profile_h profi &net_info->GatewayAddr, address_family); if (*gateway_address == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -803,8 +803,8 @@ EXPORT_API int connection_profile_get_dhcp_server_address( net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } CONNECTION_LOG(CONNECTION_INFO, "IP Config %d, DHCP Server Address %s", @@ -814,8 +814,8 @@ EXPORT_API int connection_profile_get_dhcp_server_address( address_family); if (*dhcp_server == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -848,8 +848,8 @@ EXPORT_API int connection_profile_get_dhcp_lease_duration( net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } CONNECTION_LOG(CONNECTION_INFO, "Lease duration : %d", @@ -882,8 +882,8 @@ EXPORT_API int connection_profile_get_dns_address(connection_profile_h profile, net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) @@ -894,8 +894,8 @@ EXPORT_API int connection_profile_get_dns_address(connection_profile_h profile, address_family); if (*dns_address == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -917,8 +917,8 @@ EXPORT_API int connection_profile_get_proxy_type(connection_profile_h profile, c net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } //LCOV_EXCL_START @@ -977,15 +977,15 @@ EXPORT_API int connection_profile_get_proxy_address(connection_profile_h profile net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } *proxy_address = g_strdup(net_info->ProxyAddr); if (*proxy_address == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -1012,8 +1012,8 @@ EXPORT_API int connection_profile_set_ip_config_type(connection_profile_h profil net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) @@ -1100,8 +1100,8 @@ EXPORT_API int connection_profile_set_ip_address(connection_profile_h profile, net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) { @@ -1117,8 +1117,8 @@ EXPORT_API int connection_profile_set_ip_address(connection_profile_h profile, if (ip_address == NULL) net_info->IpAddr.Data.Ipv4.s_addr = 0; else if (inet_pton(AF_INET, ip_address, &net_info->IpAddr.Data.Ipv4) < 1) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } } @@ -1142,31 +1142,31 @@ EXPORT_API int connection_profile_set_subnet_mask(connection_profile_h profile, } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) { - CONNECTION_LOG(CONNECTION_ERROR, + CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE "Please uses connection_profile_set_prefix_length()"); - CONN_UNLOCK; - return CONNECTION_ERROR_NOT_SUPPORTED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE } net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (subnet_mask == NULL) net_info->SubnetMask.Data.Ipv4.s_addr = 0; else if (inet_pton(AF_INET, subnet_mask , &net_info->SubnetMask.Data.Ipv4) < 1) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } net_info->PrefixLen = __profile_convert_netmask_to_prefix_len(subnet_mask); if (net_info->PrefixLen <= 0 || net_info->PrefixLen > 31) { - CONNECTION_LOG(CONNECTION_ERROR, "Invalid Prefix length: %d", net_info->PrefixLen); - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONNECTION_LOG(CONNECTION_ERROR, "Invalid Prefix length: %d", net_info->PrefixLen); //LCOV_EXCL_LINE + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -1191,8 +1191,8 @@ EXPORT_API int connection_profile_set_gateway_address(connection_profile_h profi net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) { @@ -1208,8 +1208,8 @@ EXPORT_API int connection_profile_set_gateway_address(connection_profile_h profi if (gateway_address == NULL) net_info->GatewayAddr.Data.Ipv4.s_addr = 0; else if (inet_pton(AF_INET, gateway_address, &(net_info->GatewayAddr.Data.Ipv4)) < 1) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } } @@ -1237,8 +1237,8 @@ EXPORT_API int connection_profile_set_dns_address(connection_profile_h profile, net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) { @@ -1258,8 +1258,8 @@ EXPORT_API int connection_profile_set_dns_address(connection_profile_h profile, if (dns_address == NULL) net_info->DnsAddr[order-1].Data.Ipv4.s_addr = 0; else if (inet_pton(AF_INET, dns_address, &(net_info->DnsAddr[order-1].Data.Ipv4)) < 1) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } if (net_info->DnsCount < order) net_info->DnsCount = order; @@ -1284,8 +1284,8 @@ EXPORT_API int connection_profile_set_proxy_type(connection_profile_h profile, c net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } switch (type) { @@ -1326,8 +1326,8 @@ EXPORT_API int connection_profile_set_proxy_address(connection_profile_h profile net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (proxy_address == NULL) @@ -1357,7 +1357,7 @@ EXPORT_API int connection_profile_set_state_changed_cb(connection_profile_h prof return CONNECTION_ERROR_NONE; } - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -1374,8 +1374,8 @@ EXPORT_API int connection_profile_unset_state_changed_cb(connection_profile_h pr } if (_connection_libnet_remove_from_profile_cb_list(profile) != true) { - CONN_UNLOCK; - return CONNECTION_ERROR_INVALID_PARAMETER; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -1410,8 +1410,8 @@ EXPORT_API int connection_profile_get_wifi_essid(connection_profile_h profile, c *essid = g_strdup(profile_info->ProfileInfo.Mesh.essid); if (*essid == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -1444,8 +1444,8 @@ EXPORT_API int connection_profile_get_wifi_bssid(connection_profile_h profile, c *bssid = g_strdup(profile_info->ProfileInfo.Mesh.bssid); if (*bssid == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -1659,9 +1659,9 @@ EXPORT_API int connection_profile_is_wifi_passphrase_required(connection_profile } if (profile_info->Favourite) { - *required = false; - CONN_UNLOCK; - return CONNECTION_ERROR_NONE; + *required = false; //LCOV_EXCL_LINE + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_NONE; //LCOV_EXCL_LINE } if (profile_info->profile_type == NET_DEVICE_WIFI) @@ -1777,7 +1777,7 @@ EXPORT_API int connection_profile_get_cellular_service_type(connection_profile_h if (*type == CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN) { CONNECTION_LOG(CONNECTION_ERROR, "Invalid service type Passed"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } @@ -1801,14 +1801,14 @@ EXPORT_API int connection_profile_get_cellular_apn(connection_profile_h profile, if (profile_info->profile_type != NET_DEVICE_CELLULAR) { CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } *apn = g_strdup(profile_info->ProfileInfo.Pdp.Apn); if (*apn == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -1856,14 +1856,14 @@ EXPORT_API int connection_profile_get_cellular_auth_info(connection_profile_h pr *user_name = g_strdup(profile_info->ProfileInfo.Pdp.AuthInfo.UserName); if (*user_name == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } *password = g_strdup(profile_info->ProfileInfo.Pdp.AuthInfo.Password); if (*password == NULL) { g_free(*user_name); //LCOV_EXCL_LINE - CONN_UNLOCK; + CONN_UNLOCK; //LCOV_EXCL_LINE return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } @@ -1893,8 +1893,8 @@ EXPORT_API int connection_profile_get_cellular_home_url(connection_profile_h pro *home_url = g_strdup(profile_info->ProfileInfo.Pdp.HomeURL); if (*home_url == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OUT_OF_MEMORY; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } CONN_UNLOCK; @@ -2363,10 +2363,6 @@ EXPORT_API int connection_profile_get_ipv6_state(connection_profile_h profile, c net_profile_info_t *profile_info = profile; *state = _profile_convert_to_cp_state(profile_info->ProfileState6); - if (*state < 0) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; - } CONN_UNLOCK; return CONNECTION_ERROR_NONE; @@ -2390,9 +2386,9 @@ EXPORT_API int connection_profile_set_dns_config_type(connection_profile_h profi address_family != CONNECTION_ADDRESS_FAMILY_IPV6) || (type != CONNECTION_DNS_CONFIG_TYPE_STATIC && type != CONNECTION_DNS_CONFIG_TYPE_DYNAMIC)) { - 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 } net_dns_config_type_t *profileType = NULL; @@ -2401,8 +2397,8 @@ EXPORT_API int connection_profile_set_dns_config_type(connection_profile_h profi net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) { @@ -2442,8 +2438,8 @@ EXPORT_API int connection_profile_get_dns_config_type(connection_profile_h profi net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) @@ -2486,8 +2482,8 @@ EXPORT_API int connection_profile_set_prefix_length(connection_profile_h profile net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) { @@ -2520,8 +2516,8 @@ EXPORT_API int connection_profile_get_prefix_length(connection_profile_h profile net_profile_info_t *profile_info = profile; net_dev_info_t *net_info = __profile_get_net_info(profile_info); if (net_info == NULL) { - CONN_UNLOCK; - return CONNECTION_ERROR_OPERATION_FAILED; + CONN_UNLOCK; //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4) diff --git a/src/libnetwork.c b/src/libnetwork.c index 5100cb7..ca063eb 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -507,6 +507,7 @@ bool _connection_libnet_deinit(connection_handle_s *conn_handle, bool is_empty) return true; } +//LCOV_EXCL_START void _connection_set_cs_tid(int tid, connection_handle_s *conn_handle) { net_set_cs_tid(tid, conn_handle->network_info_handle); @@ -516,6 +517,7 @@ void _connection_unset_cs_tid(int tid, connection_handle_s *conn_handle) { net_unset_cs_tid(tid, conn_handle->network_info_handle); } +//LCOV_EXCL_STOP bool _connection_libnet_check_profile_validity(connection_profile_h profile) { @@ -541,11 +543,11 @@ int _connection_libnet_get_metered_state(connection_handle_s *conn_handle, bool* rv = net_get_metered_state(conn_handle->network_info_handle, &status); 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 metered state[%d]", rv); - return CONNECTION_ERROR_OPERATION_FAILED; + CONNECTION_LOG(CONNECTION_ERROR, "Failed to get metered state[%d]", rv); //LCOV_EXCL_LINE + return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (status == 1) @@ -729,7 +731,7 @@ int _connection_libnet_get_profile_iterator(connection_handle_s *conn_handle, profiles = g_try_new0(net_profile_info_t, count); if (profiles == NULL) { - __libnet_clear_profile_list(&profile_list); + __libnet_clear_profile_list(&profile_list); //LCOV_EXCL_LINE return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } @@ -746,7 +748,7 @@ int _connection_libnet_get_profile_iterator(connection_handle_s *conn_handle, profiles = g_try_new0(net_profile_info_t, count); if (profiles == NULL) { - __libnet_clear_profile_list(&profile_list); + __libnet_clear_profile_list(&profile_list); //LCOV_EXCL_LINE return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } @@ -868,7 +870,7 @@ int _connection_libnet_open_profile(connection_handle_s *conn_handle, net_profile_info_t *profile_info = profile; if (profile_info->profile_type == NET_DEVICE_MESH) - rv = net_open_mesh_connection_with_profile(conn_handle->network_info_handle, + rv = net_open_mesh_connection_with_profile(conn_handle->network_info_handle, //LCOV_EXCL_LINE profile_info->ProfileName); else rv = net_open_connection_with_profile(conn_handle->network_info_handle, @@ -1038,7 +1040,7 @@ int _connection_libnet_close_profile(connection_handle_s *conn_handle, connectio net_profile_info_t *profile_info = profile; if (profile_info->profile_type == NET_DEVICE_MESH) - rv = net_close_mesh_connection(conn_handle->network_info_handle, profile_info->ProfileName); + rv = net_close_mesh_connection(conn_handle->network_info_handle, profile_info->ProfileName); //LCOV_EXCL_LINE else rv = net_close_connection(conn_handle->network_info_handle, profile_info->ProfileName); @@ -1436,6 +1438,7 @@ int _connection_check_feature_supported(const char *feature_name, ...) return CONNECTION_ERROR_NONE; } +//LCOV_EXCL_START int _connection_libnet_start_tcpdump(connection_handle_s *conn_handle) { connection_error_e result = CONNECTION_ERROR_NONE; @@ -1469,6 +1472,7 @@ int _connection_libnet_get_tcpdump_state(connection_handle_s *conn_handle, return result; } +//LCOV_EXCL_STOP void _connection_lock(void) { diff --git a/src/libnetwork_mptcp.c b/src/libnetwork_mptcp.c index ebbff07..ded5052 100755 --- a/src/libnetwork_mptcp.c +++ b/src/libnetwork_mptcp.c @@ -21,6 +21,7 @@ #include "net_connection_mptcp_private.h" #include "network-mptcp-intf.h" +//LCOV_EXCL_START static const char* __convert_mptcp_path_manager_enum_to_str(connection_mptcp_path_manager_e pm) { switch (pm) { @@ -203,3 +204,4 @@ int _connection_libnet_mptcp_get_scheduler(connection_handle_s *conn_handle, con g_free(result); return CONNECTION_ERROR_NONE; } +//LCOV_EXCL_STOP -- 2.7.4