- _("Peer `%s' %s %s\n\t%s%s\n\t%s%s\n\t%s%s\n"),
- GNUNET_i2s (&vc->id), address,
- (monitor_validation) ? GNUNET_TRANSPORT_vs2s (vc->state) : "",
- "Valid until : ", s_valid,
- "Last validation: ",s_last,
- "Next validation: ", s_next);
- GNUNET_free (s_valid);
- GNUNET_free (s_last);
- GNUNET_free (s_next);
- vc->printed = GNUNET_YES;
- }
- else
- {
- /* done */
- GNUNET_assert(address_resolutions > 0);
- address_resolutions--;
- if (GNUNET_NO == vc->printed)
- {
- if (numeric == GNUNET_NO)
- {
- /* Failed to resolve address, try numeric lookup */
- resolve_validation_address (&vc->id, vc->addrcp, GNUNET_NO,
- vc->last_validation, vc->valid_until, vc->next_validation,
- vc->state);
- }
- else
- {
- FPRINTF (stdout, _("Peer `%s' %s `%s' \n"),
- GNUNET_i2s (&vc->id), "<unable to resolve address>",
- GNUNET_TRANSPORT_vs2s (vc->state));
- }
- }
- GNUNET_free (vc->transport);
- GNUNET_free (vc->addrcp);
- GNUNET_CONTAINER_DLL_remove(vc_head, vc_tail, vc);
- GNUNET_free(vc);
- if ((0 == address_resolutions) && (iterate_validation))
- {
- if (GNUNET_SCHEDULER_NO_TASK != end)
- {
- GNUNET_SCHEDULER_cancel (end);
- end = GNUNET_SCHEDULER_NO_TASK;
- }
- if (GNUNET_SCHEDULER_NO_TASK != op_timeout)
- {
- GNUNET_SCHEDULER_cancel (op_timeout);
- op_timeout = GNUNET_SCHEDULER_NO_TASK;
- }
- ret = 0;
- end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL );
- }
- }
-}
-
-
-
-static void
-resolve_validation_address (const struct GNUNET_PeerIdentity *id,
- const struct GNUNET_HELLO_Address *address, int numeric,
- struct GNUNET_TIME_Absolute last_validation,
- struct GNUNET_TIME_Absolute valid_until,
- struct GNUNET_TIME_Absolute next_validation,
- enum GNUNET_TRANSPORT_ValidationState state)
-{
- struct ValidationResolutionContext *vc;
-
- vc = GNUNET_new (struct ValidationResolutionContext);
- GNUNET_assert(NULL != vc);
- GNUNET_CONTAINER_DLL_insert(vc_head, vc_tail, vc);
- address_resolutions++;
-
- vc->id = (*id);
- vc->transport = GNUNET_strdup(address->transport_name);
- vc->addrcp = GNUNET_HELLO_address_copy (address);
- vc->printed = GNUNET_NO;
- vc->state = state;
- vc->last_validation = last_validation;
- vc->valid_until = valid_until;
- vc->next_validation = next_validation;
-
- /* Resolve address to string */
- vc->asc = GNUNET_TRANSPORT_address_to_string (cfg, address, numeric,
- RESOLUTION_TIMEOUT, &process_validation_string, vc);
-}
-
-
-void process_validation_cb (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute last_validation,
- struct GNUNET_TIME_Absolute valid_until,
- struct GNUNET_TIME_Absolute next_validation,
- enum GNUNET_TRANSPORT_ValidationState state)
-{
- if ((NULL == peer) && (NULL == address))
- {
- /* done */
- vic = NULL;
- if (GNUNET_SCHEDULER_NO_TASK != end)
- GNUNET_SCHEDULER_cancel (end);
- end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL );
- return;
- }
- if ((NULL == peer) || (NULL == address))
- {
- /* invalid response */
- vic = NULL;
- if (GNUNET_SCHEDULER_NO_TASK != end)
- GNUNET_SCHEDULER_cancel (end);
- end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL );
- return;
- }
- resolve_validation_address (peer, address,
- numeric, last_validation,
- valid_until, next_validation, state);
-}
-
-/**
- * Test our plugin's configuration (NAT traversal, etc.).
- *
- * @param cfg configuration to test
- */
-static void
-do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- char *plugins;
- char *tok;
- unsigned long long bnd_port;
- unsigned long long adv_port;
- struct TestContext *tc;
- char *binary;
-
- if (GNUNET_OK
- != GNUNET_CONFIGURATION_get_value_string (cfg, "transport", "plugins",
- &plugins))
- {
- FPRINTF (stderr, "%s", _
- ("No transport plugins configured, peer will never communicate\n") );
- ret = 4;