3 * oFono - Open Source Telephony
5 * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 static GSList *g_drivers = NULL;
32 ofono_bool_t __ofono_cdma_provision_get_name(const char *sid, char **name)
36 if (sid == NULL || strlen(sid) == 0)
39 for (d = g_drivers; d != NULL; d = d->next) {
40 const struct ofono_cdma_provision_driver *driver = d->data;
42 if (driver->get_provider_name == NULL)
45 DBG("Calling cdma provision plugin '%s'", driver->name);
47 if (driver->get_provider_name(sid, name) < 0)
56 static gint compare_priority(gconstpointer a, gconstpointer b)
58 const struct ofono_cdma_provision_driver *plugin1 = a;
59 const struct ofono_cdma_provision_driver *plugin2 = b;
61 return plugin2->priority - plugin1->priority;
64 int ofono_cdma_provision_driver_register(
65 const struct ofono_cdma_provision_driver *driver)
67 DBG("driver: %p name: %s", driver, driver->name);
69 g_drivers = g_slist_insert_sorted(g_drivers, (void *) driver,
74 void ofono_cdma_provision_driver_unregister(
75 const struct ofono_cdma_provision_driver *driver)
77 DBG("driver: %p name: %s", driver, driver->name);
79 g_drivers = g_slist_remove(g_drivers, driver);