5 * Copyright (C) 2007-2009 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
28 struct connman_ipconfig {
30 enum connman_ipconfig_method method;
34 * connman_ipconfig_create:
36 * Allocate a new ipconfig structure.
38 * Returns: a newly-allocated #connman_ipconfig structure
40 struct connman_ipconfig *connman_ipconfig_create(void)
42 struct connman_ipconfig *ipconfig;
46 ipconfig = g_try_new0(struct connman_ipconfig, 1);
50 DBG("ipconfig %p", ipconfig);
56 * connman_ipconfig_ref:
57 * @ipconfig: ipconfig structure
59 * Increase reference counter of ipconfig
61 struct connman_ipconfig *connman_ipconfig_ref(struct connman_ipconfig *ipconfig)
63 g_atomic_int_inc(&ipconfig->refcount);
69 * connman_ipconfig_unref:
70 * @ipconfig: ipconfig structure
72 * Decrease reference counter of ipconfig
74 void connman_ipconfig_unref(struct connman_ipconfig *ipconfig)
76 if (g_atomic_int_dec_and_test(&ipconfig->refcount) == TRUE) {
81 static GSList *driver_list = NULL;
83 static gint compare_priority(gconstpointer a, gconstpointer b)
85 const struct connman_ipconfig_driver *driver1 = a;
86 const struct connman_ipconfig_driver *driver2 = b;
88 return driver2->priority - driver1->priority;
92 * connman_ipconfig_driver_register:
93 * @driver: IP configuration driver
95 * Register a new IP configuration driver
97 * Returns: %0 on success
99 int connman_ipconfig_driver_register(struct connman_ipconfig_driver *driver)
101 DBG("driver %p name %s", driver, driver->name);
103 driver_list = g_slist_insert_sorted(driver_list, driver,
110 * connman_ipconfig_driver_unregister:
111 * @driver: IP configuration driver
113 * Remove a previously registered IP configuration driver.
115 void connman_ipconfig_driver_unregister(struct connman_ipconfig_driver *driver)
117 DBG("driver %p name %s", driver, driver->name);
119 driver_list = g_slist_remove(driver_list, driver);