From: Marcel Holtmann Date: Sun, 20 Dec 2009 05:39:02 +0000 (-0800) Subject: Update handling of IPv4 configuration settings X-Git-Tag: 0.48~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abe57f90a552a75c9e858707e817d8fc3032afb9;p=platform%2Fupstream%2Fconnman.git Update handling of IPv4 configuration settings --- diff --git a/src/connman.h b/src/connman.h index a391236..f030785 100644 --- a/src/connman.h +++ b/src/connman.h @@ -128,7 +128,7 @@ const char *__connman_ipconfig_method2string(enum connman_ipconfig_method method enum connman_ipconfig_method __connman_ipconfig_string2method(const char *method); void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, - DBusMessageIter *iter, const char *prefix); + DBusMessageIter *iter); int __connman_ipconfig_set_ipv4(struct connman_ipconfig *ipconfig, const char *key, DBusMessageIter *value); diff --git a/src/ipconfig.c b/src/ipconfig.c index 15fe2f0..c2dd555 100644 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -879,25 +879,8 @@ enum connman_ipconfig_method __connman_ipconfig_string2method(const char *method return CONNMAN_IPCONFIG_METHOD_UNKNOWN; } -static void append_basic(DBusMessageIter *iter, const char *prefix, - const char *key, int type, void *val) -{ - char *str; - - if (prefix == NULL) { - connman_dbus_dict_append_basic(iter, key, type, val); - return; - } - - str = g_strdup_printf("%s%s", prefix, key); - if (str != NULL) - connman_dbus_dict_append_basic(iter, str, type, val); - - g_free(str); -} - void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, - DBusMessageIter *iter, const char *prefix) + DBusMessageIter *iter) { const char *str; @@ -905,7 +888,7 @@ void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, if (str == NULL) return; - append_basic(iter, prefix, "Method", DBUS_TYPE_STRING, &str); + connman_dbus_dict_append_basic(iter, "Method", DBUS_TYPE_STRING, &str); if (ipconfig->address == NULL) return; @@ -914,12 +897,13 @@ void __connman_ipconfig_append_ipv4(struct connman_ipconfig *ipconfig, struct in_addr netmask; char *mask; - append_basic(iter, prefix, "Address", + connman_dbus_dict_append_basic(iter, "Address", DBUS_TYPE_STRING, &ipconfig->address->local); netmask.s_addr = ~0 << (32 - ipconfig->address->prefixlen); mask = inet_ntoa(netmask); - append_basic(iter, prefix, "Netmask", DBUS_TYPE_STRING, &mask); + connman_dbus_dict_append_basic(iter, "Netmask", + DBUS_TYPE_STRING, &mask); } } diff --git a/src/service.c b/src/service.c index 0135544..641a982 100644 --- a/src/service.c +++ b/src/service.c @@ -400,14 +400,13 @@ static void append_settings(DBusMessageIter *iter, void *user_data) } if (service->ipconfig != NULL) - __connman_ipconfig_append_ipv4(service->ipconfig, - iter, "IPv4."); + __connman_ipconfig_append_ipv4(service->ipconfig, iter); } static void settings_changed(struct connman_service *service) { connman_dbus_property_changed_dict(service->path, - CONNMAN_SERVICE_INTERFACE, "Settings", + CONNMAN_SERVICE_INTERFACE, "IPv4", append_settings, service); }