aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_normalization.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-05 12:52:20 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-05 12:52:20 +0000
commitc55971f17dc99f9833af48e078c8f681be771cb7 (patch)
tree544fd671b67903506419c98d463d086a696e25a1 /src/ats/gnunet-service-ats_normalization.h
parent15dd8e6cc1199d611d804853e134882bf13b234a (diff)
downloadgnunet-c55971f17dc99f9833af48e078c8f681be771cb7.tar.gz
gnunet-c55971f17dc99f9833af48e078c8f681be771cb7.zip
big ATS refactoring, no serious semantic changes should stem from this
Diffstat (limited to 'src/ats/gnunet-service-ats_normalization.h')
-rw-r--r--src/ats/gnunet-service-ats_normalization.h48
1 files changed, 12 insertions, 36 deletions
diff --git a/src/ats/gnunet-service-ats_normalization.h b/src/ats/gnunet-service-ats_normalization.h
index 2cbf7ab77..e542097c9 100644
--- a/src/ats/gnunet-service-ats_normalization.h
+++ b/src/ats/gnunet-service-ats_normalization.h
@@ -24,51 +24,37 @@
24 * @author Matthias Wachs 24 * @author Matthias Wachs
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 */ 26 */
27#include "platform.h" 27#ifndef GNUNET_SERVICE_ATS_NORMALIZATION_H
28#define GNUNET_SERVICE_ATS_NORMALIZATION_H
28#include "gnunet_ats_service.h" 29#include "gnunet_ats_service.h"
29 30
30#define PREF_AGING_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
31#define PREF_AGING_FACTOR 0.95
32#define PREF_EPSILON 0.01
33
34#define DEFAULT_REL_PREFERENCE 0.0
35#define DEFAULT_ABS_PREFERENCE 0.0
36
37#define DEFAULT_REL_QUALITY 1.0 31#define DEFAULT_REL_QUALITY 1.0
38 32
39typedef void
40(*GAS_Normalization_preference_changed_cb) (void *cls,
41 const struct GNUNET_PeerIdentity *peer,
42 enum GNUNET_ATS_PreferenceKind kind,
43 double pref_rel);
44
45typedef void
46(*GAS_Normalization_property_changed_cb) (void *cls,
47 struct ATS_Address *peer,
48 uint32_t type,
49 double prop_rel);
50
51 33
52/** 34/**
53 * Get the normalized preference values for a specific peer 35 * Get the normalized preference values for a specific peer
54 * 36 *
37 * @param cls ignored
55 * @param id the peer @return pointer to the values, can be indexed 38 * @param id the peer @return pointer to the values, can be indexed
56 * with GNUNET_ATS_PreferenceKind, NULL if peer does not exist 39 * with GNUNET_ATS_PreferenceKind, NULL if peer does not exist
57 */ 40 */
58const double * 41const double *
59GAS_normalization_get_preferences_by_peer (const struct GNUNET_PeerIdentity *id); 42GAS_normalization_get_preferences_by_peer (void *cls,
43 const struct GNUNET_PeerIdentity *id);
60 44
61 45
62/** 46/**
63 * Get the normalized properties values for a specific peer or 47 * Get the normalized properties values for a specific peer or
64 * the default values if 48 * the default values if
65 * 49 *
50 * @param cls ignored
66 * @param address the address 51 * @param address the address
67 * @return pointer to the values, can be indexed with GNUNET_ATS_PreferenceKind, 52 * @return pointer to the values, can be indexed with GNUNET_ATS_PreferenceKind,
68 * default preferences if peer does not exist 53 * default preferences if peer does not exist
69 */ 54 */
70const double * 55const double *
71GAS_normalization_get_properties (const struct ATS_Address *address); 56GAS_normalization_get_properties (void *cls,
57 const struct ATS_Address *address);
72 58
73 59
74/** 60/**
@@ -101,14 +87,12 @@ GAS_normalization_normalize_preference (void *client,
101/** 87/**
102 * Update and normalize a atsi performance information 88 * Update and normalize a atsi performance information
103 * 89 *
104 * @param addresses hashmap containing all addresses
105 * @param address the address to update 90 * @param address the address to update
106 * @param atsi the array of performance information 91 * @param atsi the array of performance information
107 * @param atsi_count the number of atsi information in the array 92 * @param atsi_count the number of atsi information in the array
108 */ 93 */
109void 94void
110GAS_normalization_normalize_property (struct GNUNET_CONTAINER_MultiPeerMap *addresses, 95GAS_normalization_normalize_property (struct ATS_Address *address,
111 struct ATS_Address *address,
112 const struct GNUNET_ATS_Information *atsi, 96 const struct GNUNET_ATS_Information *atsi,
113 uint32_t atsi_count); 97 uint32_t atsi_count);
114 98
@@ -124,24 +108,16 @@ GAS_normalization_preference_client_disconnect (void *client);
124 108
125/** 109/**
126 * Start the normalization component 110 * Start the normalization component
127 *
128 * @param pref_ch_cb callback to call on relative preference changing
129 * @param pref_ch_cb_cls cls for the preference callback
130 * @param property_ch_cb callback to call on relative property changing
131 * @param property_ch_cb_cls cls for the property callback
132 */ 111 */
133void 112void
134GAS_normalization_start (GAS_Normalization_preference_changed_cb pref_ch_cb, 113GAS_normalization_start (void);
135 void *pref_ch_cb_cls,
136 GAS_Normalization_property_changed_cb property_ch_cb,
137 void *property_ch_cb_cls);
138 114
139 115
140/** 116/**
141 * Stop the normalization component and free all items 117 * Stop the normalization component and free all items
142 */ 118 */
143void 119void
144GAS_normalization_stop (); 120GAS_normalization_stop (void);
145
146 121
122#endif
147/* end of gnunet-service-ats_normalization.h */ 123/* end of gnunet-service-ats_normalization.h */