From 6c937680c28892c73b6fd380d4ee75e5251274fb Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Mon, 19 Nov 2012 15:54:08 +0000 Subject: - changes --- src/ats-tool/gnunet-ats.c | 175 +++++++++++++++++++++++++++++------------- src/ats/ats_api_performance.c | 30 +++++++- 2 files changed, 149 insertions(+), 56 deletions(-) diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 902dc4a20..0ca28724a 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c @@ -36,8 +36,6 @@ static int ret; static int results; static int resolve_addresses_numeric; -static int monitor; - /** * For which peer should we change preference values? */ @@ -54,16 +52,29 @@ static int verbose; /** * List only addresses currently used (active) */ -static int list_used; +static int op_list_used; /** * List all addresses */ -static int list_all; +static int op_list_all; + +/** + * List all addresses + */ +static int op_set_pref; + +/** + * Monitor addresses used + */ +static int op_monitor; + static struct GNUNET_ATS_PerformanceHandle *ph; +struct GNUNET_ATS_AddressListHandle *alh; + static struct GNUNET_CONFIGURATION_Handle *cfg; GNUNET_SCHEDULER_TaskIdentifier end_task; @@ -183,6 +194,15 @@ void ats_perf_cb (void *cls, results++; } +void la_cb (void *cls, + const struct GNUNET_HELLO_Address * address, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, + struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, + const struct GNUNET_ATS_Information *ats, uint32_t ats_count) +{ + +} + void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -190,6 +210,12 @@ void end (void *cls, struct PendingResolutions * next; unsigned int pending; + if (NULL != alh) + { + GNUNET_ATS_performance_list_addresses_cancel (alh); + alh = NULL; + } + GNUNET_ATS_performance_done (ph); ph = NULL; @@ -225,23 +251,8 @@ void testservice_ats (void *cls, return; } - if ((GNUNET_YES == list_all) && (GNUNET_YES ==list_used)) - { - FPRINTF (stderr, _("Please select one operation : %s or %s \n"),"--used", "--all"); - return; - } - - if ((GNUNET_NO == list_all) && (GNUNET_NO == list_used)) - list_used = GNUNET_YES; /* set default */ - - - if (GNUNET_YES == list_all) - { - FPRINTF (stderr, _("NOT YET IMPLEMENTED\n")); - return; - } - results = 0; + if (NULL != pid_str) { if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (pid_str, &pid.hashPubKey)) @@ -254,44 +265,95 @@ void testservice_ats (void *cls, FPRINTF (stderr, "%s", _("Type required\n")); return; } + } - for (c = 0; cpending_head)) { GNUNET_CONTAINER_DLL_remove (ph->pending_head, ph->pending_tail, p); GNUNET_free (p); } + while (NULL != (alh = ph->addresslist_head)) + { + GNUNET_CONTAINER_DLL_remove (ph->addresslist_head, ph->addresslist_tail, + alh); + GNUNET_free (alh); + } while (NULL != (rc = ph->reservation_head)) { GNUNET_CONTAINER_DLL_remove (ph->reservation_head, ph->reservation_tail, @@ -630,6 +652,9 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand GNUNET_assert (NULL != handle); alh = GNUNET_malloc (sizeof (struct GNUNET_ATS_AddressListHandle)); + alh->cb = infocb; + alh->cb_cls = infocb_cls; + alh->ph = handle; alh->all_addresses = all; if (NULL == peer) alh->all_peers = GNUNET_YES; @@ -642,6 +667,7 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand GNUNET_CONTAINER_DLL_insert (handle->addresslist_head, handle->addresslist_tail, alh); /* TODO */ + FPRINTF (stderr, "TBD"); return alh; } @@ -655,8 +681,10 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand void GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandle *handle) { + GNUNET_assert (NULL != handle); - + GNUNET_CONTAINER_DLL_remove (handle->ph->addresslist_head, handle->ph->addresslist_tail, handle); + GNUNET_free (handle); } -- cgit v1.2.3