summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-06-16 09:44:53 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2011-06-16 15:26:11 +0200
commit81530ed8aa05ce414dfa88999be5979451e0af09 (patch)
tree9320430184ad26afeeb48fc7d613433367b09cf4 /plugins
parent2b2cb7b5ab0cb6da76d378242575c83b8188a769 (diff)
downloadconnman-81530ed8aa05ce414dfa88999be5979451e0af09.tar.gz
connman-81530ed8aa05ce414dfa88999be5979451e0af09.tar.bz2
connman-81530ed8aa05ce414dfa88999be5979451e0af09.zip
element: Remove network code
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bluetooth.c3
-rw-r--r--plugins/ethernet.c3
-rw-r--r--plugins/fake.c2
-rw-r--r--plugins/iwmx.c3
-rw-r--r--plugins/ofono.c5
-rw-r--r--plugins/wifi.c10
6 files changed, 25 insertions, 1 deletions
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index ccc5e9bb..d112f876 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -215,6 +215,7 @@ done:
dbus_pending_call_unref(call);
+ connman_network_unregister(network);
connman_network_unref(network);
}
@@ -438,6 +439,8 @@ static void network_properties_reply(DBusPendingCall *call, void *user_data)
if (network == NULL)
goto done;
+ connman_network_register(network);
+
connman_network_set_string(network, "Path", path);
connman_network_set_name(network, name);
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index 2ccd4989..4829a33b 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -92,12 +92,15 @@ static void add_network(struct connman_device *device)
if (network == NULL)
return;
+ connman_network_register(network);
+
index = connman_device_get_index(device);
connman_network_set_index(network, index);
connman_network_set_name(network, "Wired");
if (connman_device_add_network(device, network) < 0) {
+ connman_network_unregister(network);
connman_network_unref(network);
return;
}
diff --git a/plugins/fake.c b/plugins/fake.c
index a3aed229..6ec4ba56 100644
--- a/plugins/fake.c
+++ b/plugins/fake.c
@@ -38,6 +38,8 @@ static void create_network(struct connman_device *device, const char *name)
if (network == NULL)
return;
+ connman_network_register(network);
+
connman_device_add_network(device, network);
connman_network_unref(network);
}
diff --git a/plugins/iwmx.c b/plugins/iwmx.c
index 419b3c98..e79c1af9 100644
--- a/plugins/iwmx.c
+++ b/plugins/iwmx.c
@@ -132,6 +132,7 @@ struct connman_network *__iwmx_cm_network_available(
DBG("new network %s", station_name);
nw = connman_network_create(station_name,
CONNMAN_NETWORK_TYPE_WIMAX);
+ connman_network_register(nw);
connman_network_set_index(nw, connman_device_get_index(dev));
connman_network_set_name(nw, station_name);
connman_network_set_blob(nw, "WiMAX.NSP.name",
@@ -148,6 +149,7 @@ struct connman_network *__iwmx_cm_network_available(
group[3 * cnt + 1] = 0;
connman_network_set_group(nw, station_name);
if (connman_device_add_network(dev, nw) < 0) {
+ connman_network_unregister(nw);
connman_network_unref(nw);
goto error_add;
}
@@ -255,6 +257,7 @@ static void __iwmx_cm_dev_disconnected(struct wmxsdk *wmxsdk)
DBG("disconnected from network %s\n",
connman_network_get_identifier(nw));
connman_network_set_connected(nw, FALSE);
+ connman_network_unregister(nw);
connman_network_unref(nw);
wmxsdk->nw = NULL;
} else
diff --git a/plugins/ofono.c b/plugins/ofono.c
index 0c234623..1b9264ac 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -366,6 +366,7 @@ static void remove_network(gpointer data)
{
struct network_info *info = data;
+ connman_network_unregister(info->network);
connman_network_unref(info->network);
g_free(info);
@@ -831,8 +832,11 @@ static int add_network(struct connman_device *device,
if (network == NULL)
return -ENOMEM;
+ connman_network_register(network);
+
info = g_try_new0(struct network_info, 1);
if (info == NULL) {
+ connman_network_unregister(network);
connman_network_unref(network);
return -ENOMEM;
}
@@ -903,6 +907,7 @@ static int add_network(struct connman_device *device,
return 0;
error:
+ connman_network_unregister(network);
connman_network_unref(network);
g_hash_table_remove(network_hash, hash_path);
return -EIO;
diff --git a/plugins/wifi.c b/plugins/wifi.c
index e3849ce4..b30af226 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -783,6 +783,8 @@ static void network_added(GSupplicantNetwork *supplicant_network)
if (network == NULL)
return;
+ connman_network_register(network);
+
connman_network_set_index(network, wifi->index);
if (connman_device_add_network(wifi->device, network) < 0) {
@@ -812,6 +814,7 @@ static void network_removed(GSupplicantNetwork *network)
GSupplicantInterface *interface;
struct wifi_data *wifi;
const char *name, *identifier;
+ struct connman_network *connman_network;
interface = g_supplicant_network_get_interface(network);
wifi = g_supplicant_interface_get_data(interface);
@@ -820,8 +823,13 @@ static void network_removed(GSupplicantNetwork *network)
DBG("name %s", name);
- if (wifi != NULL)
+ if (wifi != NULL) {
+ connman_network = connman_device_get_network(wifi->device, identifier);
+ if (connman_network != NULL)
+ connman_network_unregister(connman_network);
+
connman_device_remove_network(wifi->device, identifier);
+ }
}
static void debug(const char *str)