void (*remove) (struct connman_network *network);
int (*connect) (struct connman_network *network);
int (*disconnect) (struct connman_network *network);
+ int (*setup) (struct connman_network *network, const char *key);
};
int connman_network_driver_register(struct connman_network_driver *driver);
if (connman_network_get_index(network) >= 0)
return -EISCONN;
- set_apn(network);
-
return set_network_active(network, TRUE);
}
DBG("network %p", network);
}
+static int network_setup(struct connman_network *network, const char *key)
+{
+ DBG("");
+
+ if (g_strcmp0(key, "Cellular.APN") == 0)
+ set_apn(network);
+
+ return 0;
+}
+
static struct connman_network_driver network_driver = {
.name = "network",
.type = CONNMAN_NETWORK_TYPE_CELLULAR,
.remove = network_remove,
.connect = network_connect,
.disconnect = network_disconnect,
+ .setup = network_setup,
};
static void add_network(struct connman_device *device, const char *path)
int connman_network_set_string(struct connman_network *network,
const char *key, const char *value)
{
+ int err;
+
DBG("network %p key %s value %s", network, key, value);
if (g_strcmp0(key, "Name") == 0)
network->wifi.phase2_auth = g_strdup(value);
}
- return connman_element_set_string(&network->element, key, value);
+ err = connman_element_set_string(&network->element, key, value);
+ if (err < 0)
+ return err;
+
+ if (network->driver == NULL)
+ return 0;
+
+ if (network->driver->setup)
+ return network->driver->setup(network, key);
+
+ return 0;
}
/**