diff options
Diffstat (limited to 'src/rps/rps-sampler_common.h')
-rw-r--r-- | src/rps/rps-sampler_common.h | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/src/rps/rps-sampler_common.h b/src/rps/rps-sampler_common.h index 4a45c0193..72202dc93 100644 --- a/src/rps/rps-sampler_common.h +++ b/src/rps/rps-sampler_common.h | |||
@@ -103,7 +103,8 @@ typedef void | |||
103 | /** | 103 | /** |
104 | * Closure for #sampler_mod_get_rand_peer() and #sampler_get_rand_peer | 104 | * Closure for #sampler_mod_get_rand_peer() and #sampler_get_rand_peer |
105 | */ | 105 | */ |
106 | struct GetPeerCls { | 106 | struct GetPeerCls |
107 | { | ||
107 | /** | 108 | /** |
108 | * DLL | 109 | * DLL |
109 | */ | 110 | */ |
@@ -150,12 +151,13 @@ struct GetPeerCls { | |||
150 | /** | 151 | /** |
151 | * Sampler with its own array of SamplerElements | 152 | * Sampler with its own array of SamplerElements |
152 | */ | 153 | */ |
153 | struct RPS_Sampler { | 154 | struct RPS_Sampler |
155 | { | ||
154 | /** | 156 | /** |
155 | * Number of sampler elements we hold. | 157 | * Number of sampler elements we hold. |
156 | */ | 158 | */ |
157 | unsigned int sampler_size; | 159 | unsigned int sampler_size; |
158 | //size_t size; | 160 | // size_t size; |
159 | 161 | ||
160 | /** | 162 | /** |
161 | * All sampler elements in one array. | 163 | * All sampler elements in one array. |
@@ -220,8 +222,8 @@ struct RPS_Sampler { | |||
220 | * @param num_peers The estimated value | 222 | * @param num_peers The estimated value |
221 | */ | 223 | */ |
222 | void | 224 | void |
223 | RPS_sampler_update_with_nw_size(struct RPS_Sampler *sampler, | 225 | RPS_sampler_update_with_nw_size (struct RPS_Sampler *sampler, |
224 | uint32_t num_peers); | 226 | uint32_t num_peers); |
225 | 227 | ||
226 | 228 | ||
227 | /** | 229 | /** |
@@ -235,8 +237,8 @@ RPS_sampler_update_with_nw_size(struct RPS_Sampler *sampler, | |||
235 | * @param desired_probability | 237 | * @param desired_probability |
236 | */ | 238 | */ |
237 | void | 239 | void |
238 | RPS_sampler_set_desired_probability(struct RPS_Sampler *sampler, | 240 | RPS_sampler_set_desired_probability (struct RPS_Sampler *sampler, |
239 | double desired_probability); | 241 | double desired_probability); |
240 | 242 | ||
241 | 243 | ||
242 | /** | 244 | /** |
@@ -249,8 +251,8 @@ RPS_sampler_set_desired_probability(struct RPS_Sampler *sampler, | |||
249 | * @param desired_probability | 251 | * @param desired_probability |
250 | */ | 252 | */ |
251 | void | 253 | void |
252 | RPS_sampler_set_deficiency_factor(struct RPS_Sampler *sampler, | 254 | RPS_sampler_set_deficiency_factor (struct RPS_Sampler *sampler, |
253 | double deficiency_factor); | 255 | double deficiency_factor); |
254 | 256 | ||
255 | 257 | ||
256 | /** | 258 | /** |
@@ -264,9 +266,9 @@ RPS_sampler_set_deficiency_factor(struct RPS_Sampler *sampler, | |||
264 | * @return The context containing callback and closure | 266 | * @return The context containing callback and closure |
265 | */ | 267 | */ |
266 | struct SamplerNotifyUpdateCTX * | 268 | struct SamplerNotifyUpdateCTX * |
267 | sampler_notify_on_update(struct RPS_Sampler *sampler, | 269 | sampler_notify_on_update (struct RPS_Sampler *sampler, |
268 | SamplerNotifyUpdateCB notify_cb, | 270 | SamplerNotifyUpdateCB notify_cb, |
269 | void *cls); | 271 | void *cls); |
270 | 272 | ||
271 | 273 | ||
272 | /** | 274 | /** |
@@ -276,8 +278,8 @@ sampler_notify_on_update(struct RPS_Sampler *sampler, | |||
276 | * @param id the PeerID that is put in the sampler | 278 | * @param id the PeerID that is put in the sampler |
277 | */ | 279 | */ |
278 | void | 280 | void |
279 | RPS_sampler_update(struct RPS_Sampler *sampler, | 281 | RPS_sampler_update (struct RPS_Sampler *sampler, |
280 | const struct GNUNET_PeerIdentity *id); | 282 | const struct GNUNET_PeerIdentity *id); |
281 | 283 | ||
282 | 284 | ||
283 | /** | 285 | /** |
@@ -289,8 +291,8 @@ RPS_sampler_update(struct RPS_Sampler *sampler, | |||
289 | * @param id the id of the sampler elements to update. | 291 | * @param id the id of the sampler elements to update. |
290 | */ | 292 | */ |
291 | void | 293 | void |
292 | RPS_sampler_reinitialise_by_value(struct RPS_Sampler *sampler, | 294 | RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler, |
293 | const struct GNUNET_PeerIdentity *id); | 295 | const struct GNUNET_PeerIdentity *id); |
294 | 296 | ||
295 | 297 | ||
296 | /** | 298 | /** |
@@ -300,7 +302,7 @@ RPS_sampler_reinitialise_by_value(struct RPS_Sampler *sampler, | |||
300 | * @return the size of the sampler | 302 | * @return the size of the sampler |
301 | */ | 303 | */ |
302 | unsigned int | 304 | unsigned int |
303 | RPS_sampler_get_size(struct RPS_Sampler *sampler); | 305 | RPS_sampler_get_size (struct RPS_Sampler *sampler); |
304 | 306 | ||
305 | 307 | ||
306 | /** | 308 | /** |
@@ -310,7 +312,7 @@ RPS_sampler_get_size(struct RPS_Sampler *sampler); | |||
310 | * @param new_size the new size of the sampler | 312 | * @param new_size the new size of the sampler |
311 | */ | 313 | */ |
312 | void | 314 | void |
313 | RPS_sampler_resize(struct RPS_Sampler *sampler, unsigned int new_size); | 315 | RPS_sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size); |
314 | 316 | ||
315 | 317 | ||
316 | /** | 318 | /** |
@@ -328,10 +330,10 @@ RPS_sampler_resize(struct RPS_Sampler *sampler, unsigned int new_size); | |||
328 | * @param num_peers the number of peers requested | 330 | * @param num_peers the number of peers requested |
329 | */ | 331 | */ |
330 | struct RPS_SamplerRequestHandle * | 332 | struct RPS_SamplerRequestHandle * |
331 | RPS_sampler_get_n_rand_peers(struct RPS_Sampler *sampler, | 333 | RPS_sampler_get_n_rand_peers (struct RPS_Sampler *sampler, |
332 | uint32_t num_peers, | 334 | uint32_t num_peers, |
333 | RPS_sampler_n_rand_peers_ready_cb cb, | 335 | RPS_sampler_n_rand_peers_ready_cb cb, |
334 | void *cls); | 336 | void *cls); |
335 | 337 | ||
336 | 338 | ||
337 | /** | 339 | /** |
@@ -342,9 +344,9 @@ RPS_sampler_get_n_rand_peers(struct RPS_Sampler *sampler, | |||
342 | * @param cls closure given to @a cb | 344 | * @param cls closure given to @a cb |
343 | */ | 345 | */ |
344 | struct RPS_SamplerRequestHandleSingleInfo * | 346 | struct RPS_SamplerRequestHandleSingleInfo * |
345 | RPS_sampler_get_rand_peer_info(struct RPS_Sampler *sampler, | 347 | RPS_sampler_get_rand_peer_info (struct RPS_Sampler *sampler, |
346 | RPS_sampler_sinlge_info_ready_cb cb, | 348 | RPS_sampler_sinlge_info_ready_cb cb, |
347 | void *cls); | 349 | void *cls); |
348 | 350 | ||
349 | 351 | ||
350 | /** | 352 | /** |
@@ -356,8 +358,8 @@ RPS_sampler_get_rand_peer_info(struct RPS_Sampler *sampler, | |||
356 | * @return the number of occurrences of id. | 358 | * @return the number of occurrences of id. |
357 | */ | 359 | */ |
358 | uint32_t | 360 | uint32_t |
359 | RPS_sampler_count_id(struct RPS_Sampler *sampler, | 361 | RPS_sampler_count_id (struct RPS_Sampler *sampler, |
360 | const struct GNUNET_PeerIdentity *id); | 362 | const struct GNUNET_PeerIdentity *id); |
361 | 363 | ||
362 | 364 | ||
363 | /** | 365 | /** |
@@ -366,7 +368,7 @@ RPS_sampler_count_id(struct RPS_Sampler *sampler, | |||
366 | * @param req_handle the handle to the request | 368 | * @param req_handle the handle to the request |
367 | */ | 369 | */ |
368 | void | 370 | void |
369 | RPS_sampler_request_cancel(struct RPS_SamplerRequestHandle *req_handle); | 371 | RPS_sampler_request_cancel (struct RPS_SamplerRequestHandle *req_handle); |
370 | 372 | ||
371 | 373 | ||
372 | /** | 374 | /** |
@@ -375,7 +377,7 @@ RPS_sampler_request_cancel(struct RPS_SamplerRequestHandle *req_handle); | |||
375 | * @param req_handle the handle to the request | 377 | * @param req_handle the handle to the request |
376 | */ | 378 | */ |
377 | void | 379 | void |
378 | RPS_sampler_request_single_info_cancel( | 380 | RPS_sampler_request_single_info_cancel ( |
379 | struct RPS_SamplerRequestHandleSingleInfo *req_single_info_handle); | 381 | struct RPS_SamplerRequestHandleSingleInfo *req_single_info_handle); |
380 | 382 | ||
381 | 383 | ||
@@ -383,7 +385,7 @@ RPS_sampler_request_single_info_cancel( | |||
383 | * Cleans the sampler. | 385 | * Cleans the sampler. |
384 | */ | 386 | */ |
385 | void | 387 | void |
386 | RPS_sampler_destroy(struct RPS_Sampler *sampler); | 388 | RPS_sampler_destroy (struct RPS_Sampler *sampler); |
387 | 389 | ||
388 | #endif /* RPS_SAMPLER_COMMON_H */ | 390 | #endif /* RPS_SAMPLER_COMMON_H */ |
389 | /* end of rps-sampler_common.h */ | 391 | /* end of rps-sampler_common.h */ |