From: Daniel Wagner <daniel.wag...@bmw-carit.de> Remove also connman_ipaddress_set_ipv4/ipv6. --- include/inet.h | 2 -- include/ipconfig.h | 3 --- src/connman.h | 6 ++++++ src/ipconfig.c | 48 +++++++++++++++++++++++++++++++++++++----------- 4 files changed, 43 insertions(+), 16 deletions(-)
diff --git a/include/inet.h b/include/inet.h index 94d1951..9ba7781 100644 --- a/include/inet.h +++ b/include/inet.h @@ -70,8 +70,6 @@ int connman_inet_del_ipv6_host_route(int index, const char *host); int connman_inet_set_ipv6_gateway_address(int index, const char *gateway); int connman_inet_clear_ipv6_gateway_address(int index, const char *gateway); -void connman_ipaddress_set_ipv4(struct connman_ipaddress *ipaddress, - const char *address, const char *netmask, const char *gateway); int connman_inet_add_to_bridge(int index, const char *bridge); int connman_inet_remove_from_bridge(int index, const char *bridge); diff --git a/include/ipconfig.h b/include/ipconfig.h index 9bc97d5..10c9b0c 100644 --- a/include/ipconfig.h +++ b/include/ipconfig.h @@ -88,9 +88,6 @@ const char *connman_ipconfig_get_ifname(struct connman_ipconfig *ipconfig); void connman_ipconfig_set_ops(struct connman_ipconfig *ipconfig, const struct connman_ipconfig_ops *ops); -int connman_ipaddress_set_ipv6(struct connman_ipaddress *ipaddress, - const char *address, const char *gateway, - unsigned char prefix_length); int connman_ipconfig_set_method(struct connman_ipconfig *ipconfig, enum connman_ipconfig_method method); void connman_ipconfig_bind(struct connman_ipconfig *ipconfig, diff --git a/src/connman.h b/src/connman.h index b2e87a6..36e2d91 100644 --- a/src/connman.h +++ b/src/connman.h @@ -256,6 +256,12 @@ void __connman_ipconfig_append_ethernet(struct connman_ipconfig *ipconfig, DBusMessageIter *iter); enum connman_ipconfig_method __connman_ipconfig_get_method( struct connman_ipconfig *ipconfig); +int __connman_ipconfig_set_ipv4(struct connman_ipconfig *ipconfig, + const char *address, const char *netmask, + const char *gateway); +int __connman_ipconfig_set_ipv6(struct connman_ipconfig *ipconfig, + const char *address, const char *gateway, + unsigned char prefix_length); void __connman_ipconfig_set_element_ipv6_gateway( struct connman_ipconfig *ipconfig, diff --git a/src/ipconfig.c b/src/ipconfig.c index b30dd0f..690a61e 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -149,9 +149,9 @@ static gboolean check_ipv6_address(const char *address) return FALSE; } -int connman_ipaddress_set_ipv6(struct connman_ipaddress *ipaddress, +static int ipaddress_set_ipv6(struct connman_ipaddress *ipaddress, const char *address, const char *gateway, - unsigned char prefix_length) + unsigned char prefix_length) { if (ipaddress == NULL) return -EINVAL; @@ -176,11 +176,11 @@ int connman_ipaddress_set_ipv6(struct connman_ipaddress *ipaddress, return 0; } -void connman_ipaddress_set_ipv4(struct connman_ipaddress *ipaddress, +static int ipaddress_set_ipv4(struct connman_ipaddress *ipaddress, const char *address, const char *netmask, const char *gateway) { if (ipaddress == NULL) - return; + return -EINVAL; ipaddress->prefixlen = __connman_ipconfig_netmask_prefix_len(netmask); @@ -189,6 +189,8 @@ void connman_ipaddress_set_ipv4(struct connman_ipaddress *ipaddress, g_free(ipaddress->gateway); ipaddress->gateway = g_strdup(gateway); + + return 0; } void connman_ipaddress_clear(struct connman_ipaddress *ipaddress) @@ -1233,6 +1235,28 @@ enum connman_ipconfig_method __connman_ipconfig_get_method(struct connman_ipconf return ipconfig->method; } +int __connman_ipconfig_set_ipv4(struct connman_ipconfig *ipconfig, + const char *address, const char *netmask, + const char *gateway) +{ + if (ipconfig == NULL) + return -EINVAL; + + return ipaddress_set_ipv4(ipconfig->address, address, + netmask, gateway); +} + +int __connman_ipconfig_set_ipv6(struct connman_ipconfig *ipconfig, + const char *address, const char *gateway, + unsigned char prefix_length) +{ + if (ipconfig == NULL) + return -EINVAL; + + return ipaddress_set_ipv6(ipconfig->address, address, + gateway, prefix_length); +} + /** * connman_ipconfig_bind: * @ipconfig: ipconfig structure @@ -1787,13 +1811,15 @@ int __connman_ipconfig_set_config(struct connman_ipconfig *ipconfig, ipconfig->method = method; - if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV4) - connman_ipaddress_set_ipv4(ipconfig->address, - address, netmask, gateway); - else - return connman_ipaddress_set_ipv6( - ipconfig->address, address, - gateway, prefix_length); + if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV4) { + return ipaddress_set_ipv4(ipconfig->address, + address, netmask, + gateway); + } else { + return ipaddress_set_ipv6(ipconfig->address, + address, gateway, + prefix_length); + } break; case CONNMAN_IPCONFIG_METHOD_DHCP: -- 1.7.4 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman