*
* 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
struct connman_network {
struct connman_element element;
enum connman_network_type type;
+ enum connman_network_protocol protocol;
gboolean connected;
char *identifier;
char *path;
/**
* connman_network_get_index:
- * @device: network structure
+ * @network: network structure
*
* Get index number of 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
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,