diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-03 11:55:28 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-03 11:55:28 +0000 |
commit | bfa3b153493bc4d15f0be2d3dfa0b77e45065a61 (patch) | |
tree | 4f6a027084e16261046b89ed65f59972ab03fde0 /src/ats/gnunet-service-ats_normalization.c | |
parent | 3625013da298f13830847c33d04c3ce5ff430705 (diff) | |
download | gnunet-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.c | 29 |
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 | */ | ||
521 | const double * | ||
522 | GAS_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 | */ |