From b49684305e14208fa5bffb817a0677df33611878 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 19 Nov 2013 14:48:18 +0000 Subject: get normalized pref per client --- src/ats/gnunet-service-ats_normalization.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/ats/gnunet-service-ats_normalization.c') diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c index 96936332a..9a4e72665 100644 --- a/src/ats/gnunet-service-ats_normalization.c +++ b/src/ats/gnunet-service-ats_normalization.c @@ -518,6 +518,30 @@ GAS_normalization_get_preferences_by_peer (const struct GNUNET_PeerIdentity *id) return rp->f_rel; } +/** + * Get the normalized preference values for a specific peer or + * the default values if + * + * @param id the peer + * @return pointer to the values, can be indexed with GNUNET_ATS_PreferenceKind, + * default preferences if peer does not exist + */ +const double +GAS_normalization_get_preferences_by_client (const void *client, enum GNUNET_ATS_PreferenceKind pref) +{ + struct PreferenceClient *c_cur; + /* Find preference client */ + for (c_cur = pc_head; NULL != c_cur; c_cur = c_cur->next) + { + if (client == c_cur->client) + break; + } + if (NULL == c_cur) + return -1; + + return 1.0; +} + /** * Get the normalized properties values for a specific peer or * the default values if @@ -922,8 +946,6 @@ GAS_normalization_stop () { struct PreferenceClient *pc; struct PreferenceClient *next_pc; - struct PreferencePeer *p; - struct PreferencePeer *next_p; if (GNUNET_SCHEDULER_NO_TASK != aging_task) { -- cgit v1.2.3