diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-07 12:33:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-07 12:33:51 +0000 |
commit | 577ad3b798f0cd62c2e9ab92fdc58cfe75a3fcdc (patch) | |
tree | c0b50fb6b802221d17ea691f4e6a16ce30f8e6de /src/ats/gnunet-service-ats_plugins.h | |
parent | c20f6b6366bcfd93ca613b5771dd0dae4b5ccca3 (diff) | |
download | gnunet-577ad3b798f0cd62c2e9ab92fdc58cfe75a3fcdc.tar.gz gnunet-577ad3b798f0cd62c2e9ab92fdc58cfe75a3fcdc.zip |
simplify logic
Diffstat (limited to 'src/ats/gnunet-service-ats_plugins.h')
-rw-r--r-- | src/ats/gnunet-service-ats_plugins.h | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/src/ats/gnunet-service-ats_plugins.h b/src/ats/gnunet-service-ats_plugins.h index dd85bd361..7e093d940 100644 --- a/src/ats/gnunet-service-ats_plugins.h +++ b/src/ats/gnunet-service-ats_plugins.h | |||
@@ -108,6 +108,15 @@ GAS_normalized_property_changed (struct ATS_Address *address, | |||
108 | double prop_rel); | 108 | double prop_rel); |
109 | 109 | ||
110 | 110 | ||
111 | /** | ||
112 | * Tell the solver that the given address can now be used | ||
113 | * for talking to the respective peer. | ||
114 | * | ||
115 | * @param new_address the new address | ||
116 | * @param addr_net network scope the address is in | ||
117 | * @param atsi performance data for the address | ||
118 | * @param atsi_count size of the @a atsi array | ||
119 | */ | ||
111 | void | 120 | void |
112 | GAS_plugin_new_address (struct ATS_Address *new_address, | 121 | GAS_plugin_new_address (struct ATS_Address *new_address, |
113 | enum GNUNET_ATS_Network_Type addr_net, | 122 | enum GNUNET_ATS_Network_Type addr_net, |
@@ -115,45 +124,83 @@ GAS_plugin_new_address (struct ATS_Address *new_address, | |||
115 | uint32_t atsi_count); | 124 | uint32_t atsi_count); |
116 | 125 | ||
117 | 126 | ||
127 | /** | ||
128 | * Tell the solver that updated performance data was | ||
129 | * observed for the given address. | ||
130 | * | ||
131 | * @param new_address the new address | ||
132 | * @param atsi updated performance data for the address | ||
133 | * @param atsi_count size of the @a atsi array | ||
134 | */ | ||
118 | void | 135 | void |
119 | GAS_plugin_update_address (struct ATS_Address *address, | 136 | GAS_plugin_update_address (struct ATS_Address *address, |
120 | const struct GNUNET_ATS_Information *atsi, | 137 | const struct GNUNET_ATS_Information *atsi, |
121 | uint32_t atsi_count); | 138 | uint32_t atsi_count); |
122 | 139 | ||
123 | 140 | ||
141 | /** | ||
142 | * Tell the solver that the given address is no longer valid | ||
143 | * can cannot be used any longer. | ||
144 | * | ||
145 | * @param address address that was deleted | ||
146 | */ | ||
124 | void | 147 | void |
125 | GAS_plugin_update_preferences (void *client, | 148 | GAS_plugin_delete_address (struct ATS_Address *address); |
126 | const struct GNUNET_PeerIdentity *peer, | ||
127 | enum GNUNET_ATS_PreferenceKind kind, | ||
128 | float score_abs); | ||
129 | 149 | ||
130 | 150 | ||
151 | /** | ||
152 | * Tell the solver that the given client has expressed its | ||
153 | * appreciation for the past performance of a given connection. | ||
154 | * | ||
155 | * @param application client providing the feedback | ||
156 | * @param peer peer the feedback is about | ||
157 | * @param scope timeframe the feedback applies to | ||
158 | * @param kind performance property the feedback relates to | ||
159 | * @param score_abs degree of the appreciation | ||
160 | */ | ||
131 | void | 161 | void |
132 | GAS_plugin_preference_feedback (void *application, | 162 | GAS_plugin_preference_feedback (struct GNUNET_SERVER_Client *application, |
133 | const struct GNUNET_PeerIdentity *peer, | 163 | const struct GNUNET_PeerIdentity *peer, |
134 | const struct GNUNET_TIME_Relative scope, | 164 | const struct GNUNET_TIME_Relative scope, |
135 | enum GNUNET_ATS_PreferenceKind kind, | 165 | enum GNUNET_ATS_PreferenceKind kind, |
136 | float score_abs); | 166 | float score_abs); |
137 | 167 | ||
138 | 168 | ||
139 | void | ||
140 | GAS_plugin_delete_address (struct ATS_Address *address); | ||
141 | 169 | ||
142 | 170 | ||
171 | /** | ||
172 | * Stop instant solving, there are many state updates | ||
173 | * happening in bulk right now. | ||
174 | */ | ||
143 | void | 175 | void |
144 | GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid); | 176 | GAS_plugin_solver_lock (void); |
145 | 177 | ||
146 | 178 | ||
179 | /** | ||
180 | * Resume instant solving, we are done with the bulk state updates. | ||
181 | */ | ||
147 | void | 182 | void |
148 | GAS_plugin_request_connect_stop (const struct GNUNET_PeerIdentity *pid); | 183 | GAS_plugin_solver_unlock (void); |
149 | 184 | ||
150 | 185 | ||
186 | /** | ||
187 | * Notify the plugin that a request to connect to | ||
188 | * a particular peer was given to us. | ||
189 | * | ||
190 | * @param pid identity of peer we now care about | ||
191 | */ | ||
151 | void | 192 | void |
152 | GAS_plugin_solver_lock (void); | 193 | GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid); |
153 | 194 | ||
154 | 195 | ||
196 | /** | ||
197 | * Notify the plugin that a request to connect to | ||
198 | * a particular peer was dropped. | ||
199 | * | ||
200 | * @param pid identity of peer we care now less about | ||
201 | */ | ||
155 | void | 202 | void |
156 | GAS_plugin_solver_unlock (void); | 203 | GAS_plugin_request_connect_stop (const struct GNUNET_PeerIdentity *pid); |
157 | 204 | ||
158 | 205 | ||
159 | #endif | 206 | #endif |