static int load_config(struct vpn_config *config, char *path, enum what action) { GKeyFile *keyfile; gsize length; char **groups; char *str; bool found = false; int i; DBG("config %p", config); keyfile = __connman_storage_load_provider_config(config->ident); if (!keyfile) return -EIO; /* Verify keys validity of the global section */ check_keys(keyfile, "global", config_possible_keys); str = __vpn_config_get_string(keyfile, "global", CONFIG_KEY_NAME, NULL); if (str) { g_free(config->name); config->name = str; } str = __vpn_config_get_string(keyfile, "global", CONFIG_KEY_DESC, NULL); if (str) { g_free(config->description); config->description = str; } groups = g_key_file_get_groups(keyfile, &length); for (i = 0; groups[i]; i++) { if (g_str_has_prefix(groups[i], "provider_")) { int ret = load_provider(keyfile, groups[i], config, action); if (ret == 0 || ret == -EALREADY) found = true; } } if (!found) connman_warn("Config file %s/%s.config does not contain any " "configuration that can be provisioned!", path, config->ident); g_strfreev(groups); g_key_file_free(keyfile); return 0; }
/** * lpf_manager_activate_provider: * @self: a #LpfManager * @name: the name of the provider to activate * @error: a #GError for errorreporting or %NULL * * Activate the given provider * * Returns: (transfer none): The activated #LpfProvider */ LpfProvider *lpf_manager_activate_provider(LpfManager *self, const gchar *name, GError **error) { gchar *path; LpfProvider *provider; LpfManagerPrivate *priv = GET_PRIVATE (self); path = plugin_path(name); provider = load_provider (path, error); if (provider) { lpf_provider_activate(provider, G_OBJECT(self)); priv->active = g_slist_prepend (priv->active, provider); } g_free(path); return provider; }