Remove deprecated network subtype
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 1 Jan 2009 18:07:00 +0000 (19:07 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 1 Jan 2009 18:07:00 +0000 (19:07 +0100)
include/element.h
plugins/Makefile.am
plugins/netdev.c [deleted file]
src/device.c
src/element.c
src/network.c
src/storage.c

index 92f642f..906601e 100644 (file)
@@ -71,7 +71,6 @@ enum connman_element_type {
 enum connman_element_subtype {
        CONNMAN_ELEMENT_SUBTYPE_UNKNOWN   = 0,
        CONNMAN_ELEMENT_SUBTYPE_FAKE      = 1,
-       CONNMAN_ELEMENT_SUBTYPE_NETWORK   = 2,
        CONNMAN_ELEMENT_SUBTYPE_ETHERNET  = 3,
        CONNMAN_ELEMENT_SUBTYPE_WIFI      = 4,
        CONNMAN_ELEMENT_SUBTYPE_WIMAX     = 5,
index 045c3f0..78e6b44 100644 (file)
@@ -1,14 +1,12 @@
 
 plugindir = $(libdir)/connman/plugins
 
-plugin_LTLIBRARIES = loopback.la netdev.la ethernet.la wifi.la \
-                       bluetooth.la hso.la udhcp.la dhclient.la ipv4.la \
-                               dnsproxy.la resolvconf.la resolvfile.la
+plugin_LTLIBRARIES = loopback.la ethernet.la wifi.la bluetooth.la hso.la \
+                               udhcp.la dhclient.la ipv4.la dnsproxy.la \
+                                               resolvconf.la resolvfile.la
 
 loopback_la_SOURCES = loopback.c
 
-netdev_la_SOURCES = netdev.c
-
 ethernet_la_SOURCES = ethernet.c inet.h inet.c
 
 wifi_la_SOURCES = wifi.c inet.h inet.c supplicant.h supplicant.c
diff --git a/plugins/netdev.c b/plugins/netdev.c
deleted file mode 100644 (file)
index 2499301..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- *  Connection Manager
- *
- *  Copyright (C) 2007-2008  Intel Corporation. All rights reserved.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/plugin.h>
-#include <connman/driver.h>
-#include <connman/log.h>
-
-static void create_element(struct connman_element *parent,
-                                       enum connman_element_type type)
-{
-       struct connman_element *element;
-
-       DBG("parent %p name %s", parent, parent->name);
-
-       element = connman_element_create(NULL);
-       if (element == NULL)
-               return;
-
-       element->type = type;
-       element->index = parent->index;
-
-       if (parent->parent)
-               element->subtype = parent->parent->subtype;
-       else
-               element->subtype = CONNMAN_ELEMENT_SUBTYPE_UNKNOWN;
-
-       if (connman_element_register(element, parent) < 0)
-               connman_element_unref(element);
-}
-
-static int netdev_probe(struct connman_element *element)
-{
-       DBG("element %p name %s", element, element->name);
-
-       create_element(element, CONNMAN_ELEMENT_TYPE_DHCP);
-       create_element(element, CONNMAN_ELEMENT_TYPE_ZEROCONF);
-
-       return 0;
-}
-
-static void netdev_remove(struct connman_element *element)
-{
-       DBG("element %p name %s", element, element->name);
-}
-
-static struct connman_driver netdev_driver = {
-       .name           = "netdev",
-       .type           = CONNMAN_ELEMENT_TYPE_DEVICE,
-       .subtype        = CONNMAN_ELEMENT_SUBTYPE_NETWORK,
-       .probe          = netdev_probe,
-       .remove         = netdev_remove,
-};
-
-static int netdev_init(void)
-{
-       return connman_driver_register(&netdev_driver);
-}
-
-static void netdev_exit(void)
-{
-       connman_driver_unregister(&netdev_driver);
-}
-
-CONNMAN_PLUGIN_DEFINE(netdev, "Network device plugin", VERSION,
-                                               netdev_init, netdev_exit)
index d5e836b..3a1ae26 100644 (file)
@@ -785,8 +785,8 @@ int connman_device_set_carrier(struct connman_device *device,
 
                element = connman_element_create(NULL);
                if (element != NULL) {
-                       element->type    = CONNMAN_ELEMENT_TYPE_DEVICE;
-                       element->subtype = CONNMAN_ELEMENT_SUBTYPE_NETWORK;
+                       element->type    = CONNMAN_ELEMENT_TYPE_DHCP;
+                       element->subtype = device->element.subtype;
                        element->index   = device->element.index;
 
                        if (connman_element_register(element,
index a3bfa02..85d92fd 100644 (file)
@@ -132,8 +132,6 @@ static const char *subtype2string(enum connman_element_subtype type)
                return "unknown";
        case CONNMAN_ELEMENT_SUBTYPE_FAKE:
                return "fake";
-       case CONNMAN_ELEMENT_SUBTYPE_NETWORK:
-               return "network";
        case CONNMAN_ELEMENT_SUBTYPE_ETHERNET:
                return "ethernet";
        case CONNMAN_ELEMENT_SUBTYPE_WIFI:
@@ -631,10 +629,6 @@ static gboolean append_path(GNode *node, gpointer user_data)
                                        filter->type != element->type)
                return FALSE;
 
-       if (filter->type == CONNMAN_ELEMENT_TYPE_DEVICE &&
-                       element->subtype == CONNMAN_ELEMENT_SUBTYPE_NETWORK)
-               return FALSE;
-
        dbus_message_iter_append_basic(filter->iter,
                                DBUS_TYPE_OBJECT_PATH, &element->path);
 
@@ -1741,8 +1735,7 @@ int connman_element_register(struct connman_element *element,
        if (element->devname == NULL)
                element->devname = g_strdup(element->name);
 
-       if (device_filter && element->type == CONNMAN_ELEMENT_TYPE_DEVICE &&
-                       element->subtype != CONNMAN_ELEMENT_SUBTYPE_NETWORK) {
+       if (device_filter && element->type == CONNMAN_ELEMENT_TYPE_DEVICE) {
                if (g_pattern_match_simple(device_filter,
                                                element->devname) == FALSE) {
                        DBG("ignoring %s [%s] device", element->name,
index 69b6190..6e966e3 100644 (file)
@@ -397,11 +397,23 @@ int connman_network_set_connected(struct connman_network *network,
 
        if (connected == TRUE) {
                struct connman_element *element;
+               enum connman_element_type type;
+
+               switch (network->protocol) {
+               case CONNMAN_NETWORK_PROTOCOL_UNKNOWN:
+                       return 0;
+               case CONNMAN_NETWORK_PROTOCOL_IP:
+                       type = CONNMAN_ELEMENT_TYPE_DHCP;
+                       break;
+               case CONNMAN_NETWORK_PROTOCOL_PPP:
+                       type = CONNMAN_ELEMENT_TYPE_PPP;
+                       break;
+               }
 
                element = connman_element_create(NULL);
                if (element != NULL) {
-                       element->type    = CONNMAN_ELEMENT_TYPE_DEVICE;
-                       element->subtype = CONNMAN_ELEMENT_SUBTYPE_NETWORK;
+                       element->type    = type;
+                       element->subtype = network->element.subtype;
                        element->index   = network->element.index;
 
                        if (connman_element_register(element,
index e0e3dc5..3ed0fc1 100644 (file)
@@ -165,8 +165,7 @@ int __connman_element_store(struct connman_element *element)
                                element->type != CONNMAN_ELEMENT_TYPE_NETWORK)
                return -EINVAL;
 
-       if (element->subtype == CONNMAN_ELEMENT_SUBTYPE_FAKE ||
-                       element->subtype == CONNMAN_ELEMENT_SUBTYPE_NETWORK)
+       if (element->subtype == CONNMAN_ELEMENT_SUBTYPE_FAKE)
                return -EINVAL;
 
        pathname = g_strdup_printf("%s/elements.conf", STORAGEDIR);