}
+EXPORT_API int connection_is_metered_network(connection_h connection, bool* is_metered)
+{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
+ if (is_metered == NULL || !(__connection_check_handle_validity(connection))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ int rv = _connection_libnet_get_metered_state(is_metered);
+ if (rv != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Fail to get metered state[%d]", rv); //LCOV_EXCL_LINE
+ return rv; //LCOV_EXCL_LINE
+ }
+
+ CONNECTION_LOG(CONNECTION_INFO, "metered state: %s", is_metered ? "true" : "false");
+ return CONNECTION_ERROR_NONE;
+}
+
+
EXPORT_API int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state)
{
int rv = 0;
return _connection_libnet_remove_route_ipv6(interface_name, host_address, gateway);
}
+EXPORT_API int connection_add_route_entry(connection_h connection,
+ connection_address_family_e address_family, const char *interface_name,
+ const char *host_address, const char *gateway)
+{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+
+ if (!(__connection_check_handle_validity(connection)) ||
+ (address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
+ address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
+ interface_name == NULL || host_address == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4)
+ return _connection_libnet_add_route_entry(CONNECTION_ADDRESS_FAMILY_IPV4,
+ interface_name, host_address, gateway);
+ else
+ return _connection_libnet_add_route_entry(CONNECTION_ADDRESS_FAMILY_IPV6,
+ interface_name, host_address, gateway);
+
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_remove_route_entry(connection_h connection,
+ connection_address_family_e address_family, const char *interface_name,
+ const char *host_address, const char *gateway)
+{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+
+ if (!(__connection_check_handle_validity(connection)) ||
+ (address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
+ address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
+ interface_name == NULL || host_address == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4)
+ return _connection_libnet_remove_route_entry(CONNECTION_ADDRESS_FAMILY_IPV4,
+ interface_name, host_address, gateway);
+ else
+ return _connection_libnet_remove_route_entry(CONNECTION_ADDRESS_FAMILY_IPV6,
+ interface_name, host_address, gateway);
+
+ return CONNECTION_ERROR_NONE;
+}
+
static int __get_cellular_statistic(connection_statistics_type_e statistics_type, long long *llsize)
{
int rv = VCONF_OK, rv1 = VCONF_OK;