Update copyright information
[connman] / src / network.c
index de48611..977a48e 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2007-2008  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2007-2009  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
@@ -30,6 +30,7 @@
 struct connman_network {
        struct connman_element element;
        enum connman_network_type type;
+       enum connman_network_protocol protocol;
        gboolean connected;
        char *identifier;
        char *path;
@@ -355,7 +356,7 @@ void connman_network_set_index(struct connman_network *network, int index)
 
 /**
  * connman_network_get_index:
- * @device: network structure
+ * @network: network structure
  *
  * Get index number of network
  */
@@ -365,8 +366,21 @@ int connman_network_get_index(struct connman_network *network)
 }
 
 /**
+ * connman_network_set_protocol:
+ * @network: network structure
+ * @protocol: network protocol
+ *
+ * Change protocol of network
+ */
+void connman_network_set_protocol(struct connman_network *network,
+                                       enum connman_network_protocol protocol)
+{
+       network->protocol = protocol;
+}
+
+/**
  * connman_network_set_connected:
- * @netowrk: network structure
+ * @network: network structure
  * @connected: connected state
  *
  * Change connected state of network
@@ -383,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,