aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_normalization.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-07-03 11:55:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-07-03 11:55:28 +0000
commitbfa3b153493bc4d15f0be2d3dfa0b77e45065a61 (patch)
tree4f6a027084e16261046b89ed65f59972ab03fde0 /src/ats/gnunet-service-ats_normalization.c
parent3625013da298f13830847c33d04c3ce5ff430705 (diff)
downloadgnunet-bfa3b153493bc4d15f0be2d3dfa0b77e45065a61.tar.gz
gnunet-bfa3b153493bc4d15f0be2d3dfa0b77e45065a61.zip
function to get normalized properties in solver
Diffstat (limited to 'src/ats/gnunet-service-ats_normalization.c')
-rw-r--r--src/ats/gnunet-service-ats_normalization.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c
index 86e6f1700..6ced1b49e 100644
--- a/src/ats/gnunet-service-ats_normalization.c
+++ b/src/ats/gnunet-service-ats_normalization.c
@@ -509,6 +509,35 @@ GAS_normalization_get_preferences (const struct GNUNET_PeerIdentity *id)
509 return rp->f_rel; 509 return rp->f_rel;
510} 510}
511 511
512
513/**
514 * Get the normalized properties values for a specific peer or
515 * the default values if
516 *
517 * @param address the address
518 * @return pointer to the values, can be indexed with GNUNET_ATS_PreferenceKind,
519 * default preferences if peer does not exist
520 */
521const double *
522GAS_normalization_get_properties (struct ATS_Address *address)
523{
524 static double norm_values[GNUNET_ATS_QualityPropertiesCount];
525 int i;
526
527 GNUNET_assert (NULL != address);
528
529 for (i = 0; i < GNUNET_ATS_QualityPropertiesCount; i++)
530 {
531 if ((address->atsin[i].norm >= 1.0) &&
532 (address->atsin[i].norm <= 2.0))
533 norm_values[i] = address->atsin[i].norm;
534 else
535 norm_values[i] = DEFAULT_REL_QUALITY;
536 }
537 return norm_values;
538}
539
540
512/** 541/**
513 * Quality Normalization 542 * Quality Normalization
514 */ 543 */