X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftestbed%2Ftestbed_api_hosts.c;h=ed3379d880e2bf933ec91341832307e5c247c56f;hb=db9c68c76d7a9eb3f200df9d0fcaf971387cb061;hp=e8417c0d8542494b657ffe7778b3a862f32a2f34;hpb=87ed5554b390cbf16a9bd15c4aec13ab34d7f080;p=oweals%2Fgnunet.git diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index e8417c0d8..ed3379d88 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, */ struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, - const char *username, + const char *username, const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t port) @@ -331,14 +331,14 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, LOG (GNUNET_ERROR_TYPE_WARNING, "Host with id: %u already created\n", id); return NULL; } - host = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host)); + host = GNUNET_new (struct GNUNET_TESTBED_Host); host->hostname = (NULL != hostname) ? GNUNET_strdup (hostname) : NULL; host->username = (NULL != username) ? GNUNET_strdup (username) : NULL; host->id = id; host->port = (0 == port) ? 22 : port; host->cfg = GNUNET_CONFIGURATION_dup (cfg); host->opq_parallel_overlay_connect_operations = - GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, + GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, UINT_MAX); new_size = host_list_size; while (id >= new_size) @@ -371,7 +371,7 @@ GNUNET_TESTBED_host_create (const char *hostname, const char *username, static uint32_t uid_generator; if (NULL == hostname) - return GNUNET_TESTBED_host_create_with_id (0, hostname, username, + return GNUNET_TESTBED_host_create_with_id (0, hostname, username, cfg, port); return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname, username, cfg, port); @@ -398,7 +398,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, //struct GNUNET_TESTBED_Host **host_array; struct GNUNET_TESTBED_Host *starting_host; char *data; - char *buf; + char *buf; char *username; char *hostname; regex_t rex; @@ -417,12 +417,12 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, } if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) - fs = 0; + fs = 0; if (0 == fs) { LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename); return 0; - } + } data = GNUNET_malloc (fs); if (fs != GNUNET_DISK_fn_read (filename, data, fs)) { @@ -440,9 +440,9 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, "^(([[:alnum:]]+)@)?" /* username */ "([[:alnum:]]+[-[:alnum:]_\\.]+)" /* hostname */ "(:([[:digit:]]{1,5}))?", /* port */ - REG_EXTENDED | REG_ICASE)); + REG_EXTENDED | REG_ICASE)); while (offset < (fs - 1)) - { + { offset++; if (((data[offset] == '\n')) && (buf != &data[offset])) { @@ -469,7 +469,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, } if (-1 != pmatch[5].rm_so) { - (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port); + (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port); } size = pmatch[3].rm_eo - pmatch[3].rm_so; hostname = GNUNET_malloc (size + 1); @@ -489,7 +489,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port); count++; GNUNET_free_non_null (username); - GNUNET_free (hostname); + GNUNET_free (hostname); buf = &data[offset + 1]; } else if ((data[offset] == '\n') || (data[offset] == '\0')) @@ -516,7 +516,7 @@ const char * simple_resolve (const char *host) { struct addrinfo *res; - const struct sockaddr_in *in_addr; + const struct sockaddr_in *in_addr; char *hostip; struct addrinfo hint; unsigned int rc; @@ -565,14 +565,14 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTBED_Host ***hosts) { -#if !ENABLE_LL - LOG (GNUNET_ERROR_TYPE_ERROR, +#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); @@ -649,7 +649,7 @@ GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host, return; } } - rc = GNUNET_malloc (sizeof (struct RegisteredController)); + rc = GNUNET_new (struct RegisteredController); rc->controller = controller; GNUNET_CONTAINER_DLL_insert_tail (host->rc_head, host->rc_tail, rc); } @@ -930,7 +930,7 @@ gen_rsh_suffix_args (const char * const *append_args) } if (NULL != append_args) { - for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) + for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (append_args[append_cnt])); } GNUNET_array_append (rshell_args, cnt, NULL); @@ -1070,7 +1070,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, static char *const binary_argv[] = { HELPER_TESTBED_BINARY, NULL }; - + GNUNET_assert (NULL != host); GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host))); hostname = NULL; @@ -1079,7 +1079,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, host->locked = GNUNET_YES; API_VIOLATION (GNUNET_NO == host->controller_started, "Attempting to start a controller on a host which is already started a controller"); - cp = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ControllerProc)); + cp = GNUNET_new (struct GNUNET_TESTBED_ControllerProc); if (0 == GNUNET_TESTBED_host_get_id_ (host)) { cp->helper = @@ -1102,7 +1102,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, GNUNET_asprintf (&port, "%u", host->port); LOG_DEBUG ("Starting remote connection to destination %s\n", hostname); if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, "testbed", + GNUNET_CONFIGURATION_get_value_filename (cfg, "testbed", "HELPER_BINARY_PATH", &helper_binary_path_args[0])) helper_binary_path_args[0] = @@ -1118,7 +1118,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, argstr = GNUNET_strdup (""); for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++) { - aux = argstr; + aux = argstr; GNUNET_assert (0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt])); GNUNET_free (aux); } @@ -1324,17 +1324,17 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, const char *hostname; char *port; - h = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostHabitableCheckHandle)); + h = GNUNET_new (struct GNUNET_TESTBED_HostHabitableCheckHandle); h->cb = cb; h->cb_cls = cb_cls; h->host = host; hostname = (NULL == host->hostname) ? "127.0.0.1" : host->hostname; if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (config, "testbed", + GNUNET_CONFIGURATION_get_value_filename (config, "testbed", "HELPER_BINARY_PATH", &stat_args[1])) stat_args[1] = - GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); + GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); GNUNET_asprintf (&port, "%u", host->port); rsh_args = gen_rsh_args (port, hostname, host->username); GNUNET_free (port); @@ -1349,7 +1349,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, free_argv (rsh_args); h->auxp = GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, NULL, - NULL, h->helper_argv[0], h->helper_argv); + NULL, NULL, h->helper_argv[0], h->helper_argv); if (NULL == h->auxp) { GNUNET_break (0); /* Cannot exec SSH? */ @@ -1374,7 +1374,7 @@ GNUNET_TESTBED_is_host_habitable_cancel (struct *handle) { GNUNET_SCHEDULER_cancel (handle->habitability_check_task); - (void) GNUNET_OS_process_kill (handle->auxp, SIGTERM); + (void) GNUNET_OS_process_kill (handle->auxp, GNUNET_TERM_SIG); (void) GNUNET_OS_process_wait (handle->auxp); GNUNET_OS_process_destroy (handle->auxp); free_argv (handle->helper_argv); @@ -1449,7 +1449,7 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller, (NULL == hostname) ? "localhost" : hostname); return NULL; } - rh = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostRegistrationHandle)); + rh = GNUNET_new (struct GNUNET_TESTBED_HostRegistrationHandle); rh->host = host; rh->c = controller; GNUNET_assert (NULL != cc); @@ -1523,12 +1523,12 @@ GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle * * @param h the host handle * @param op the operation to queue in the given host's parally overlay connect - * queue + * queue */ void -GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, +GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, struct GNUNET_TESTBED_Operation *op) -{ +{ GNUNET_TESTBED_operation_queue_insert_ (h->opq_parallel_overlay_connect_operations, op); }