don't bypass GNUnet IO
[oweals/gnunet.git] / src / util / resolver_api.c
index a35f680d309ba6260d784a79c9c2e6fec07eec41..9e54282fa8b996b64eca1d7084e38001c4d269b9 100644 (file)
@@ -669,7 +669,32 @@ GNUNET_RESOLVER_hostname_get (struct GNUNET_SCHEDULER_Handle *sched,
 
 
 /**
- * Perform a reverse DNS lookup.
+ * Get local hostname
+ *
+ * @param
+ */
+char *
+GNUNET_RESOLVER_local_hostname_get ( )
+{
+
+  char hostname[GNUNET_OS_get_hostname_max_length() + 1];
+
+
+  if (0 != gethostname (hostname, sizeof (hostname) - 1))
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR |
+                           GNUNET_ERROR_TYPE_BULK, "gethostname");
+      return NULL;
+    }
+#if DEBUG_RESOLVER
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              _("Resolving our hostname `%s'\n"), hostname);
+#endif
+  return GNUNET_strdup (hostname);
+}
+
+/**
+ * Looking our own hostname.
  *
  * @param sched scheduler to use
  * @param cfg configuration to use