aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_hosts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/testbed_api_hosts.c')
-rw-r--r--src/testbed/testbed_api_hosts.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index e8417c0d8..51bd632c7 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -318,7 +318,7 @@ GNUNET_TESTBED_host_replace_cfg_ (struct GNUNET_TESTBED_Host *host,
318 */ 318 */
319struct GNUNET_TESTBED_Host * 319struct GNUNET_TESTBED_Host *
320GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, 320GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname,
321 const char *username, 321 const char *username,
322 const struct GNUNET_CONFIGURATION_Handle 322 const struct GNUNET_CONFIGURATION_Handle
323 *cfg, 323 *cfg,
324 uint16_t port) 324 uint16_t port)
@@ -338,7 +338,7 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname,
338 host->port = (0 == port) ? 22 : port; 338 host->port = (0 == port) ? 22 : port;
339 host->cfg = GNUNET_CONFIGURATION_dup (cfg); 339 host->cfg = GNUNET_CONFIGURATION_dup (cfg);
340 host->opq_parallel_overlay_connect_operations = 340 host->opq_parallel_overlay_connect_operations =
341 GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, 341 GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE,
342 UINT_MAX); 342 UINT_MAX);
343 new_size = host_list_size; 343 new_size = host_list_size;
344 while (id >= new_size) 344 while (id >= new_size)
@@ -371,7 +371,7 @@ GNUNET_TESTBED_host_create (const char *hostname, const char *username,
371 static uint32_t uid_generator; 371 static uint32_t uid_generator;
372 372
373 if (NULL == hostname) 373 if (NULL == hostname)
374 return GNUNET_TESTBED_host_create_with_id (0, hostname, username, 374 return GNUNET_TESTBED_host_create_with_id (0, hostname, username,
375 cfg, port); 375 cfg, port);
376 return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname, 376 return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname,
377 username, cfg, port); 377 username, cfg, port);
@@ -398,7 +398,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
398 //struct GNUNET_TESTBED_Host **host_array; 398 //struct GNUNET_TESTBED_Host **host_array;
399 struct GNUNET_TESTBED_Host *starting_host; 399 struct GNUNET_TESTBED_Host *starting_host;
400 char *data; 400 char *data;
401 char *buf; 401 char *buf;
402 char *username; 402 char *username;
403 char *hostname; 403 char *hostname;
404 regex_t rex; 404 regex_t rex;
@@ -417,12 +417,12 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
417 } 417 }
418 if (GNUNET_OK != 418 if (GNUNET_OK !=
419 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) 419 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
420 fs = 0; 420 fs = 0;
421 if (0 == fs) 421 if (0 == fs)
422 { 422 {
423 LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename); 423 LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename);
424 return 0; 424 return 0;
425 } 425 }
426 data = GNUNET_malloc (fs); 426 data = GNUNET_malloc (fs);
427 if (fs != GNUNET_DISK_fn_read (filename, data, fs)) 427 if (fs != GNUNET_DISK_fn_read (filename, data, fs))
428 { 428 {
@@ -440,9 +440,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
440 "^(([[:alnum:]]+)@)?" /* username */ 440 "^(([[:alnum:]]+)@)?" /* username */
441 "([[:alnum:]]+[-[:alnum:]_\\.]+)" /* hostname */ 441 "([[:alnum:]]+[-[:alnum:]_\\.]+)" /* hostname */
442 "(:([[:digit:]]{1,5}))?", /* port */ 442 "(:([[:digit:]]{1,5}))?", /* port */
443 REG_EXTENDED | REG_ICASE)); 443 REG_EXTENDED | REG_ICASE));
444 while (offset < (fs - 1)) 444 while (offset < (fs - 1))
445 { 445 {
446 offset++; 446 offset++;
447 if (((data[offset] == '\n')) && (buf != &data[offset])) 447 if (((data[offset] == '\n')) && (buf != &data[offset]))
448 { 448 {
@@ -469,7 +469,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
469 } 469 }
470 if (-1 != pmatch[5].rm_so) 470 if (-1 != pmatch[5].rm_so)
471 { 471 {
472 (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port); 472 (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port);
473 } 473 }
474 size = pmatch[3].rm_eo - pmatch[3].rm_so; 474 size = pmatch[3].rm_eo - pmatch[3].rm_so;
475 hostname = GNUNET_malloc (size + 1); 475 hostname = GNUNET_malloc (size + 1);
@@ -489,7 +489,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
489 (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port); 489 (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port);
490 count++; 490 count++;
491 GNUNET_free_non_null (username); 491 GNUNET_free_non_null (username);
492 GNUNET_free (hostname); 492 GNUNET_free (hostname);
493 buf = &data[offset + 1]; 493 buf = &data[offset + 1];
494 } 494 }
495 else if ((data[offset] == '\n') || (data[offset] == '\0')) 495 else if ((data[offset] == '\n') || (data[offset] == '\0'))
@@ -516,7 +516,7 @@ const char *
516simple_resolve (const char *host) 516simple_resolve (const char *host)
517{ 517{
518 struct addrinfo *res; 518 struct addrinfo *res;
519 const struct sockaddr_in *in_addr; 519 const struct sockaddr_in *in_addr;
520 char *hostip; 520 char *hostip;
521 struct addrinfo hint; 521 struct addrinfo hint;
522 unsigned int rc; 522 unsigned int rc;
@@ -566,13 +566,13 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct
566 struct GNUNET_TESTBED_Host ***hosts) 566 struct GNUNET_TESTBED_Host ***hosts)
567{ 567{
568#if !ENABLE_LL 568#if !ENABLE_LL
569 LOG (GNUNET_ERROR_TYPE_ERROR, 569 LOG (GNUNET_ERROR_TYPE_ERROR,
570 _("The function %s is only available when compiled with (--with-ll)\n"), 570 _("The function %s is only available when compiled with (--with-ll)\n"),
571 __func__); 571 __func__);
572 GNUNET_assert (0); 572 GNUNET_assert (0);
573#else 573#else
574 const char *hostfile; 574 const char *hostfile;
575 575
576 if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE"))) 576 if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE")))
577 { 577 {
578 GNUNET_break (0); 578 GNUNET_break (0);
@@ -930,7 +930,7 @@ gen_rsh_suffix_args (const char * const *append_args)
930 } 930 }
931 if (NULL != append_args) 931 if (NULL != append_args)
932 { 932 {
933 for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) 933 for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++)
934 GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (append_args[append_cnt])); 934 GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (append_args[append_cnt]));
935 } 935 }
936 GNUNET_array_append (rshell_args, cnt, NULL); 936 GNUNET_array_append (rshell_args, cnt, NULL);
@@ -1070,7 +1070,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip,
1070 static char *const binary_argv[] = { 1070 static char *const binary_argv[] = {
1071 HELPER_TESTBED_BINARY, NULL 1071 HELPER_TESTBED_BINARY, NULL
1072 }; 1072 };
1073 1073
1074 GNUNET_assert (NULL != host); 1074 GNUNET_assert (NULL != host);
1075 GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host))); 1075 GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host)));
1076 hostname = NULL; 1076 hostname = NULL;
@@ -1118,7 +1118,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip,
1118 argstr = GNUNET_strdup (""); 1118 argstr = GNUNET_strdup ("");
1119 for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++) 1119 for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++)
1120 { 1120 {
1121 aux = argstr; 1121 aux = argstr;
1122 GNUNET_assert (0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt])); 1122 GNUNET_assert (0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt]));
1123 GNUNET_free (aux); 1123 GNUNET_free (aux);
1124 } 1124 }
@@ -1334,7 +1334,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
1334 "HELPER_BINARY_PATH", 1334 "HELPER_BINARY_PATH",
1335 &stat_args[1])) 1335 &stat_args[1]))
1336 stat_args[1] = 1336 stat_args[1] =
1337 GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); 1337 GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY);
1338 GNUNET_asprintf (&port, "%u", host->port); 1338 GNUNET_asprintf (&port, "%u", host->port);
1339 rsh_args = gen_rsh_args (port, hostname, host->username); 1339 rsh_args = gen_rsh_args (port, hostname, host->username);
1340 GNUNET_free (port); 1340 GNUNET_free (port);
@@ -1523,12 +1523,12 @@ GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle
1523 * 1523 *
1524 * @param h the host handle 1524 * @param h the host handle
1525 * @param op the operation to queue in the given host's parally overlay connect 1525 * @param op the operation to queue in the given host's parally overlay connect
1526 * queue 1526 * queue
1527 */ 1527 */
1528void 1528void
1529GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, 1529GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h,
1530 struct GNUNET_TESTBED_Operation *op) 1530 struct GNUNET_TESTBED_Operation *op)
1531{ 1531{
1532 GNUNET_TESTBED_operation_queue_insert_ 1532 GNUNET_TESTBED_operation_queue_insert_
1533 (h->opq_parallel_overlay_connect_operations, op); 1533 (h->opq_parallel_overlay_connect_operations, op);
1534} 1534}