diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-18 16:38:52 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-18 16:38:52 +0000 |
commit | 44f92861e676181ca60892c76654bb5e69651637 (patch) | |
tree | 292a2ac699e041b768120ff27982da76c53b42b5 /src/testbed | |
parent | 47032db495464716a0d0c94ce4c830e146ceee9c (diff) | |
download | gnunet-44f92861e676181ca60892c76654bb5e69651637.tar.gz gnunet-44f92861e676181ca60892c76654bb5e69651637.zip |
Exposing GNUNET_TESTBED_host_get_hostname
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index e5fe07bcc..1663f8962 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -190,6 +190,19 @@ GNUNET_TESTBED_host_get_hostname_ (const struct GNUNET_TESTBED_Host *host) | |||
190 | 190 | ||
191 | 191 | ||
192 | /** | 192 | /** |
193 | * Obtain the host's hostname. | ||
194 | * | ||
195 | * @param host handle to the host, NULL means 'localhost' | ||
196 | * @return hostname of the host | ||
197 | */ | ||
198 | const char * | ||
199 | GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host) | ||
200 | { | ||
201 | return GNUNET_TESTBED_host_get_hostname_ (host); | ||
202 | } | ||
203 | |||
204 | |||
205 | /** | ||
193 | * Obtain the host's username | 206 | * Obtain the host's username |
194 | * | 207 | * |
195 | * @param host handle to the host, NULL means 'localhost' | 208 | * @param host handle to the host, NULL means 'localhost' |
@@ -305,7 +318,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
305 | int ret; | 318 | int ret; |
306 | unsigned int offset; | 319 | unsigned int offset; |
307 | unsigned int count; | 320 | unsigned int count; |
308 | 321 | ||
309 | 322 | ||
310 | GNUNET_assert (NULL != filename); | 323 | GNUNET_assert (NULL != filename); |
311 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) | 324 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) |
@@ -313,7 +326,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
313 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s not found\n"), filename); | 326 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s not found\n"), filename); |
314 | return 0; | 327 | return 0; |
315 | } | 328 | } |
316 | if (GNUNET_OK != | 329 | if (GNUNET_OK != |
317 | GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) | 330 | GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) |
318 | fs = 0; | 331 | fs = 0; |
319 | if (0 == fs) | 332 | if (0 == fs) |
@@ -321,7 +334,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
321 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename); | 334 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename); |
322 | return 0; | 335 | return 0; |
323 | } | 336 | } |
324 | data = GNUNET_malloc (fs); | 337 | data = GNUNET_malloc (fs); |
325 | if (fs != GNUNET_DISK_fn_read (filename, data, fs)) | 338 | if (fs != GNUNET_DISK_fn_read (filename, data, fs)) |
326 | { | 339 | { |
327 | GNUNET_free (data); | 340 | GNUNET_free (data); |
@@ -361,11 +374,11 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
361 | buf = &data[offset + 1]; | 374 | buf = &data[offset + 1]; |
362 | } | 375 | } |
363 | else if ((data[offset] == '\n') || (data[offset] == '\0')) | 376 | else if ((data[offset] == '\n') || (data[offset] == '\0')) |
364 | buf = &data[offset + 1]; | 377 | buf = &data[offset + 1]; |
365 | } | 378 | } |
366 | GNUNET_free (data); | 379 | GNUNET_free (data); |
367 | if (NULL == starting_host) | 380 | if (NULL == starting_host) |
368 | return 0; | 381 | return 0; |
369 | *hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * count); | 382 | *hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * count); |
370 | memcpy (*hosts, | 383 | memcpy (*hosts, |
371 | &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)], | 384 | &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)], |
@@ -506,7 +519,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host) | |||
506 | remote_args[argp++] = "NoHostAuthenticationForLocalhost=yes"; | 519 | remote_args[argp++] = "NoHostAuthenticationForLocalhost=yes"; |
507 | remote_args[argp++] = ssh_addr; | 520 | remote_args[argp++] = ssh_addr; |
508 | remote_args[argp++] = "which"; | 521 | remote_args[argp++] = "which"; |
509 | remote_args[argp++] = "gnunet-helper-testbed"; | 522 | remote_args[argp++] = "gnunet-helper-testbed"; |
510 | remote_args[argp++] = NULL; | 523 | remote_args[argp++] = NULL; |
511 | GNUNET_assert (argp == 11); | 524 | GNUNET_assert (argp == 11); |
512 | auxp = | 525 | auxp = |