struct connman_network *connman_device_get_network(struct connman_device *device,
const char *identifier);
int connman_device_remove_network(struct connman_device *device,
- const char *identifier);
+ struct connman_network *network);
void connman_device_remove_all_networks(struct connman_device *device);
void connman_device_schedule_scan(struct connman_device *device);
static gboolean device_removed(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
- const char *network_path, *identifier;
+ const char *network_path;
struct connman_network *network;
struct connman_device *device;
DBusMessageIter iter;
if (device == NULL)
return TRUE;
- identifier = connman_network_get_identifier(network);
-
g_hash_table_remove(bluetooth_networks, network_path);
- connman_device_remove_network(device, identifier);
+ connman_device_remove_network(device, network);
return TRUE;
}
static void remove_network(struct connman_device *device,
struct ethernet_data *ethernet)
{
- const char *identifier;
-
if (ethernet->network == NULL)
return;
- identifier = connman_network_get_identifier(ethernet->network);
- connman_device_remove_network(device, identifier);
+ connman_device_remove_network(device, ethernet->network);
connman_network_unref(ethernet->network);
ethernet->network = NULL;
DBusMessage *message, void *user_data)
{
const char *path = dbus_message_get_path(message);
- const char *network_path, *identifier;
+ const char *network_path;
struct modem_data *modem;
struct network_info *info;
DBusMessageIter iter;
if (info == NULL)
return TRUE;
- identifier = connman_network_get_identifier(info->network);
- connman_device_remove_network(modem->device, identifier);
+ connman_device_remove_network(modem->device, info->network);
return TRUE;
}
DBG("name %s", name);
- if (wifi != NULL) {
- connman_network = connman_device_get_network(wifi->device, identifier);
-
- connman_device_remove_network(wifi->device, identifier);
+ if (wifi == NULL)
+ return;
- if (connman_network != NULL)
- connman_network_unref(connman_network);
+ connman_network = connman_device_get_network(wifi->device, identifier);
+ if (connman_network == NULL)
+ return;
- }
+ connman_device_remove_network(wifi->device, connman_network);
+ connman_network_unref(connman_network);
}
static void debug(const char *str)
* Remove network for given identifier
*/
int connman_device_remove_network(struct connman_device *device,
- const char *identifier)
+ struct connman_network *network)
{
- struct connman_network *network;
struct connman_service *service;
+ const char *identifier;
- DBG("device %p identifier %s", device, identifier);
+ DBG("device %p network %p", device, network);
- network = connman_device_get_network(device, identifier);
if (network == NULL)
return 0;
service = __connman_service_lookup_from_network(network);
+ identifier = connman_network_get_identifier(network);
g_hash_table_remove(device->networks, identifier);
if (service != NULL)