diff options
Diffstat (limited to 'src/element.c')
-rw-r--r-- | src/element.c | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/src/element.c b/src/element.c index e0c4c002..f6d68928 100644 --- a/src/element.c +++ b/src/element.c @@ -1102,181 +1102,6 @@ const void *connman_element_get_blob(struct connman_element *element, return value; } -int __connman_element_append_ipv4(struct connman_element *element, - DBusMessageIter *dict) -{ - const char *method = NULL; - const char *address = NULL, *netmask = NULL, *gateway = NULL; - const char *broadcast = NULL, *nameserver = NULL; - const char *timeserver = NULL, *pac = NULL; - - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_METHOD, &method); - - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_ADDRESS, &address); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_NETMASK, &netmask); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_GATEWAY, &gateway); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_BROADCAST, &broadcast); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_NAMESERVER, &nameserver); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_TIMESERVER, ×erver); - connman_element_get_value(element, - CONNMAN_PROPERTY_ID_IPV4_PAC, &pac); - - if (method != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.Method", - DBUS_TYPE_STRING, &method); - - if (address != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.Address", - DBUS_TYPE_STRING, &address); - - if (netmask != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.Netmask", - DBUS_TYPE_STRING, &netmask); - - if (gateway != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.Gateway", - DBUS_TYPE_STRING, &gateway); - - if (broadcast != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.Broadcast", - DBUS_TYPE_STRING, &broadcast); - - if (nameserver != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.Nameserver", - DBUS_TYPE_STRING, &nameserver); - - if (timeserver != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.Timeserver", - DBUS_TYPE_STRING, ×erver); - - if (pac != NULL) - connman_dbus_dict_append_basic(dict, "IPv4.PAC", - DBUS_TYPE_STRING, &pac); - - return 0; -} - -int __connman_element_set_ipv4(struct connman_element *element, - const char *name, DBusMessageIter *value) -{ - int type; - - type = dbus_message_iter_get_arg_type(value); - - if (g_str_equal(name, "IPv4.Method") == TRUE) { - enum connman_ipconfig_method method; - const char *str; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, &str); - method = __connman_ipconfig_string2method(str); - if (method == CONNMAN_IPCONFIG_METHOD_UNKNOWN) - return -EINVAL; - - if (method == element->ipv4.method) - return -EALREADY; - - element->ipv4.method = method; - - connman_element_update(element); - } else if (g_str_equal(name, "IPv4.Address") == TRUE) { - const char *address; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, &address); - - g_free(element->ipv4.address); - element->ipv4.address = g_strdup(address); - - connman_element_update(element); - } else if (g_str_equal(name, "IPv4.Netmask") == TRUE) { - const char *netmask; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, &netmask); - - g_free(element->ipv4.netmask); - element->ipv4.netmask = g_strdup(netmask); - - connman_element_update(element); - } else if (g_str_equal(name, "IPv4.Gateway") == TRUE) { - const char *gateway; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, &gateway); - - g_free(element->ipv4.gateway); - element->ipv4.gateway = g_strdup(gateway); - - connman_element_update(element); - } else if (g_str_equal(name, "IPv4.Broadcast") == TRUE) { - const char *broadcast; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, &broadcast); - - g_free(element->ipv4.broadcast); - element->ipv4.broadcast = g_strdup(broadcast); - - connman_element_update(element); - } else if (g_str_equal(name, "IPv4.Nameserver") == TRUE) { - const char *nameserver; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, &nameserver); - - g_free(element->ipv4.nameserver); - element->ipv4.nameserver = g_strdup(nameserver); - - connman_element_update(element); - } else if (g_str_equal(name, "IPv4.Timeserver") == TRUE) { - const char *timeserver; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, ×erver); - - g_free(element->ipv4.timeserver); - element->ipv4.timeserver = g_strdup(timeserver); - - connman_element_update(element); - } else if (g_str_equal(name, "IPv4.PAC") == TRUE) { - const char *pac; - - if (type != DBUS_TYPE_STRING) - return -EINVAL; - - dbus_message_iter_get_basic(value, &pac); - - g_free(element->ipv4.pac); - element->ipv4.pac = g_strdup(pac); - - connman_element_update(element); - } - - return 0; -} - static void emit_state_change(DBusConnection *conn, const char *state) { DBusMessage *signal; |