technology: return already enabled when tethering is enabled
[framework/connectivity/connman.git] / src / utsname.c
index 2da08a7..1451c74 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2007-2009  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2007-2012  Intel Corporation. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -68,6 +68,34 @@ void connman_utsname_driver_unregister(struct connman_utsname_driver *driver)
        driver_list = g_slist_remove(driver_list, driver);
 }
 
+/**
+ * connman_utsname_get_hostname:
+ *
+ * Returns current hostname
+ */
+const char *connman_utsname_get_hostname(void)
+{
+       GSList *list;
+
+       DBG("");
+
+       for (list = driver_list; list; list = list->next) {
+               struct connman_utsname_driver *driver = list->data;
+               const char *hostname;
+
+               DBG("driver %p name %s", driver, driver->name);
+
+               if (driver->get_hostname == NULL)
+                       continue;
+
+               hostname = driver->get_hostname();
+               if (hostname != NULL)
+                       return hostname;
+       }
+
+       return NULL;
+}
+
 int __connman_utsname_set_hostname(const char *hostname)
 {
        GSList *list;