+/**
+ * Test address
+ */
+static struct Test_Address test_addr;
+
+/**
+ * Test peer
+ */
+static struct PeerContext p;
+
+/**
+ * HELLO address
+ */
+struct GNUNET_HELLO_Address test_hello_address;
+
+/**
+ * Session
+ */
+static void *test_session;
+
+/**
+ * Test ats info
+ */
+struct GNUNET_ATS_Information test_ats_info[2];
+
+/**
+ * Test ats count
+ */
+uint32_t test_ats_count;
+
+
+static int
+stat_cb(void *cls, const char *subsystem, const char *name, uint64_t value,
+ int is_persistent);
+
+static void
+end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n");
+
+ if (die_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (die_task);
+ die_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+
+ if (NULL != sched_ats)
+ {
+ GNUNET_ATS_scheduling_done (sched_ats);
+ sched_ats = NULL;
+ }
+
+ GNUNET_STATISTICS_watch_cancel (stats, "ats", "# addresses", &stat_cb, NULL);
+ if (NULL != stats)
+ {
+ GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
+ stats = NULL;
+ }
+
+ free_test_address (&test_addr);
+
+ ret = 0;
+}
+
+
+static void
+end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ die_task = GNUNET_SCHEDULER_NO_TASK;
+ end ( NULL, NULL);
+ ret = GNUNET_SYSERR;
+}
+
+static void
+address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
+ struct Session *session,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
+ const struct GNUNET_ATS_Information *atsi,
+ uint32_t ats_count)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n");
+ GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+ return;
+}
+
+
+static int
+stat_cb(void *cls, const char *subsystem,
+ const char *name, uint64_t value,
+ int is_persistent)
+{
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n",
+ subsystem,name, value);
+ if (1 == value)
+ {
+ GNUNET_SCHEDULER_add_now (&end, NULL);
+ }
+ return GNUNET_OK;
+}