+/**
+ * Resolves a hostname using getaddrinfo
+ *
+ * @param host the hostname
+ * @return the string representing the IPv4 address of the given host; NULL upon error
+ */
+const char *
+simple_resolve (const char *host)
+{
+ struct addrinfo *res;
+ const struct sockaddr_in *in_addr;
+ char *hostip;
+ struct addrinfo hint;
+ unsigned int rc;
+
+ hint.ai_family = AF_INET; /* IPv4 */
+ hint.ai_socktype = 0;
+ hint.ai_protocol = 0;
+ hint.ai_addrlen = 0;
+ hint.ai_addr = NULL;
+ hint.ai_canonname = NULL;
+ hint.ai_next = NULL;
+ hint.ai_flags = AI_NUMERICSERV;
+ res = NULL;
+ LOG_DEBUG ("Resolving [%s]\n", host);
+ if (0 != (rc = getaddrinfo (host, "22", &hint, &res)))
+ {
+ LOG_GAI (GNUNET_ERROR_TYPE_ERROR, "getaddrinfo", rc);
+ return NULL;
+ }
+ GNUNET_assert (NULL != res);
+ GNUNET_assert (NULL != res->ai_addr);
+ GNUNET_assert (sizeof (struct sockaddr_in) == res->ai_addrlen);
+ in_addr = (const struct sockaddr_in *) res->ai_addr;
+ hostip = inet_ntoa (in_addr->sin_addr);
+ GNUNET_assert (NULL != hostip);
+ freeaddrinfo (res);
+ LOG_DEBUG ("Resolved [%s] to [%s]\n", host, hostip);
+ return hostip;
+}
+
+
+/**
+ * Loads the set of host allocated by the LoadLeveler Job Scheduler. This
+ * function is only available when compiled with support for LoadLeveler and is
+ * used for running on the SuperMUC
+ *
+ * @param cfg the configuration to use as a template while starting a controller
+ * on any of the loaded hosts. Operation queue sizes specific to a host
+ * are also read from this configuration handle
+ * @param hosts set to the hosts found in the file; caller must free this if
+ * number of hosts returned is greater than 0
+ * @return number of hosts returned in 'hosts', 0 on error
+ */
+unsigned int
+GNUNET_TESTBED_hosts_load_from_loadleveler (const struct
+ GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTBED_Host ***hosts)
+{
+#if !ENABLE_SUPERMUC
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("The function %s is only available when compiled with (--with-ll)\n"),
+ __func__);
+ GNUNET_assert (0);
+#else
+ const char *hostfile;
+
+ if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE")))
+ {
+ GNUNET_break (0);
+ return 0;
+ }
+ return GNUNET_TESTBED_hosts_load_from_file (hostfile, cfg, hosts);
+#endif
+}
+
+