From: Daniel Wagner <daniel.wag...@bmw-carit.de> And remove the unimplemented IP configuration functions. --- include/provider.h | 15 +++++++-------- src/provider.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/include/provider.h b/include/provider.h index 03700aa..37c587a 100644 --- a/include/provider.h +++ b/include/provider.h @@ -56,6 +56,7 @@ enum connman_provider_error { }; struct connman_provider; +struct connman_ipaddress; struct connman_provider *connman_provider_ref(struct connman_provider *provider); void connman_provider_unref(struct connman_provider *provider); @@ -77,14 +78,12 @@ int connman_provider_get_index(struct connman_provider *provider); void connman_provider_set_data(struct connman_provider *provider, void *data); void *connman_provider_get_data(struct connman_provider *provider); -void connman_provider_set_gateway(struct connman_provider *provider, - const char *gateway); -void connman_provider_set_address(struct connman_provider *provider, - const char *address); -void connman_provider_set_netmask(struct connman_provider *provider, - const char *netmask); -void connman_provider_set_dns(struct connman_provider *provider, - const char *dns); +void connman_provider_set_ipaddress(struct connman_provider *provider, + struct connman_ipaddress *ipaddress); +void connman_provider_nameserver_append(struct connman_provider *provider, + const char *nameserver); +void connman_provider_nameserver_remove(struct connman_provider *provider, + const char *nameserver); void connman_provider_set_domain(struct connman_provider *provider, const char *domain); diff --git a/src/provider.c b/src/provider.c index 1a97955..1efe01f 100644 --- a/src/provider.c +++ b/src/provider.c @@ -791,6 +791,47 @@ int connman_provider_get_index(struct connman_provider *provider) return provider->element.index; } +void connman_provider_set_ipaddress(struct connman_provider *provider, + struct connman_ipaddress *ipaddress) +{ + struct connman_ipconfig *ipconfig = NULL; + + if (ipaddress->family == CONNMAN_IPCONFIG_TYPE_IPV4) { + ipconfig = __connman_service_get_ip4config( + provider->vpn_service); + } else if (ipaddress->family == CONNMAN_IPCONFIG_TYPE_IPV6) { + ipconfig = __connman_service_get_ip6config( + provider->vpn_service); + } + + if (ipconfig == NULL) + return; + + __connman_ipconfig_set_local(ipconfig, ipaddress->local); + __connman_ipconfig_set_peer(ipconfig, ipaddress->peer); + __connman_ipconfig_set_broadcast(ipconfig, ipaddress->broadcast); + __connman_ipconfig_set_gateway(ipconfig, ipaddress->gateway); + __connman_ipconfig_set_prefixlen(ipconfig, ipaddress->prefixlen); +} + +void connman_provider_nameserver_append(struct connman_provider *provider, + const char *nameserver) +{ + __connman_service_nameserver_append(provider->vpn_service, nameserver); +} + +void connman_provider_nameserver_remove(struct connman_provider *provider, + const char *nameserver) +{ + __connman_service_nameserver_remove(provider->vpn_service, nameserver); +} + +void connman_provider_set_domain(struct connman_provider *provider, + const char *domain) +{ + __connman_service_set_domainname(provider->vpn_service, domain); +} + enum provider_route_type { PROVIDER_ROUTE_TYPE_NONE = 0, PROVIDER_ROUTE_TYPE_MASK = 1, -- 1.7.4 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman