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
30 static GSList *driver_list = NULL;
32 static gint compare_priority(gconstpointer a, gconstpointer b)
34 const struct connman_timeserver_driver *driver1 = a;
35 const struct connman_timeserver_driver *driver2 = b;
37 return driver2->priority - driver1->priority;
41 * connman_timeserver_driver_register:
42 * @driver: timeserver driver definition
44 * Register a new timeserver driver
46 * Returns: %0 on success
48 int connman_timeserver_driver_register(struct connman_timeserver_driver *driver)
50 DBG("driver %p name %s", driver, driver->name);
52 driver_list = g_slist_insert_sorted(driver_list, driver,
59 * connman_timeserver_driver_unregister:
60 * @driver: timeserver driver definition
62 * Remove a previously registered timeserver driver
64 void connman_timeserver_driver_unregister(struct connman_timeserver_driver *driver)
66 DBG("driver %p name %s", driver, driver->name);
68 driver_list = g_slist_remove(driver_list, driver);
72 * connman_timeserver_append:
73 * @server: server address
75 * Append time server server address to current list
77 int connman_timeserver_append(const char *server)
79 DBG("server %s", server);
84 connman_info("Adding time server %s", server);
90 * connman_timeserver_remove:
91 * @server: server address
93 * Remover time server server address from current list
95 int connman_timeserver_remove(const char *server)
97 DBG("server %s", server);
102 connman_info("Removing time server %s", server);