diff options
Diffstat (limited to 'src/include/gnunet_ats_service.h')
-rw-r--r-- | src/include/gnunet_ats_service.h | 137 |
1 files changed, 77 insertions, 60 deletions
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index a226c7b55..cd1e62bee 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -68,7 +68,8 @@ | |||
68 | /** | 68 | /** |
69 | * ATS performance characteristics for an address. | 69 | * ATS performance characteristics for an address. |
70 | */ | 70 | */ |
71 | struct GNUNET_ATS_Properties { | 71 | struct GNUNET_ATS_Properties |
72 | { | ||
72 | /** | 73 | /** |
73 | * Delay. Time between when the time packet is sent and the packet | 74 | * Delay. Time between when the time packet is sent and the packet |
74 | * arrives. FOREVER if we did not measure yet. | 75 | * arrives. FOREVER if we did not measure yet. |
@@ -109,7 +110,8 @@ struct GNUNET_ATS_Properties { | |||
109 | * ATS performance characteristics for an address in | 110 | * ATS performance characteristics for an address in |
110 | * network byte order (for IPC). | 111 | * network byte order (for IPC). |
111 | */ | 112 | */ |
112 | struct GNUNET_ATS_PropertiesNBO { | 113 | struct GNUNET_ATS_PropertiesNBO |
114 | { | ||
113 | /** | 115 | /** |
114 | * Actual traffic on this connection from this peer to the other peer. | 116 | * Actual traffic on this connection from this peer to the other peer. |
115 | * Includes transport overhead. | 117 | * Includes transport overhead. |
@@ -158,8 +160,8 @@ struct GNUNET_ATS_PropertiesNBO { | |||
158 | * @param hbo value read | 160 | * @param hbo value read |
159 | */ | 161 | */ |
160 | void | 162 | void |
161 | GNUNET_ATS_properties_hton(struct GNUNET_ATS_PropertiesNBO *nbo, | 163 | GNUNET_ATS_properties_hton (struct GNUNET_ATS_PropertiesNBO *nbo, |
162 | const struct GNUNET_ATS_Properties *hbo); | 164 | const struct GNUNET_ATS_Properties *hbo); |
163 | 165 | ||
164 | 166 | ||
165 | /** | 167 | /** |
@@ -169,8 +171,8 @@ GNUNET_ATS_properties_hton(struct GNUNET_ATS_PropertiesNBO *nbo, | |||
169 | * @param nbo value read | 171 | * @param nbo value read |
170 | */ | 172 | */ |
171 | void | 173 | void |
172 | GNUNET_ATS_properties_ntoh(struct GNUNET_ATS_Properties *hbo, | 174 | GNUNET_ATS_properties_ntoh (struct GNUNET_ATS_Properties *hbo, |
173 | const struct GNUNET_ATS_PropertiesNBO *nbo); | 175 | const struct GNUNET_ATS_PropertiesNBO *nbo); |
174 | 176 | ||
175 | 177 | ||
176 | 178 | ||
@@ -195,7 +197,7 @@ struct GNUNET_ATS_ConnectivitySuggestHandle; | |||
195 | * @return ats connectivity handle, NULL on error | 197 | * @return ats connectivity handle, NULL on error |
196 | */ | 198 | */ |
197 | struct GNUNET_ATS_ConnectivityHandle * | 199 | struct GNUNET_ATS_ConnectivityHandle * |
198 | GNUNET_ATS_connectivity_init(const struct GNUNET_CONFIGURATION_Handle *cfg); | 200 | GNUNET_ATS_connectivity_init (const struct GNUNET_CONFIGURATION_Handle *cfg); |
199 | 201 | ||
200 | 202 | ||
201 | /** | 203 | /** |
@@ -204,7 +206,7 @@ GNUNET_ATS_connectivity_init(const struct GNUNET_CONFIGURATION_Handle *cfg); | |||
204 | * @param ch handle to destroy | 206 | * @param ch handle to destroy |
205 | */ | 207 | */ |
206 | void | 208 | void |
207 | GNUNET_ATS_connectivity_done(struct GNUNET_ATS_ConnectivityHandle *ch); | 209 | GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch); |
208 | 210 | ||
209 | 211 | ||
210 | /** | 212 | /** |
@@ -217,9 +219,9 @@ GNUNET_ATS_connectivity_done(struct GNUNET_ATS_ConnectivityHandle *ch); | |||
217 | * @return suggestion handle, NULL if request is already pending | 219 | * @return suggestion handle, NULL if request is already pending |
218 | */ | 220 | */ |
219 | struct GNUNET_ATS_ConnectivitySuggestHandle * | 221 | struct GNUNET_ATS_ConnectivitySuggestHandle * |
220 | GNUNET_ATS_connectivity_suggest(struct GNUNET_ATS_ConnectivityHandle *ch, | 222 | GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch, |
221 | const struct GNUNET_PeerIdentity *peer, | 223 | const struct GNUNET_PeerIdentity *peer, |
222 | uint32_t strength); | 224 | uint32_t strength); |
223 | 225 | ||
224 | 226 | ||
225 | /** | 227 | /** |
@@ -228,7 +230,8 @@ GNUNET_ATS_connectivity_suggest(struct GNUNET_ATS_ConnectivityHandle *ch, | |||
228 | * @param sh handle | 230 | * @param sh handle |
229 | */ | 231 | */ |
230 | void | 232 | void |
231 | GNUNET_ATS_connectivity_suggest_cancel(struct GNUNET_ATS_ConnectivitySuggestHandle *sh); | 233 | GNUNET_ATS_connectivity_suggest_cancel (struct |
234 | GNUNET_ATS_ConnectivitySuggestHandle *sh); | ||
232 | 235 | ||
233 | 236 | ||
234 | /* ******************************** Scheduling API ***************************** */ | 237 | /* ******************************** Scheduling API ***************************** */ |
@@ -263,10 +266,13 @@ struct GNUNET_ATS_Session; | |||
263 | typedef void | 266 | typedef void |
264 | (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, | 267 | (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, |
265 | const struct GNUNET_PeerIdentity *peer, | 268 | const struct GNUNET_PeerIdentity *peer, |
266 | const struct GNUNET_HELLO_Address *address, | 269 | const struct |
270 | GNUNET_HELLO_Address *address, | ||
267 | struct GNUNET_ATS_Session *session, | 271 | struct GNUNET_ATS_Session *session, |
268 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 272 | struct GNUNET_BANDWIDTH_Value32NBO |
269 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in); | 273 | bandwidth_out, |
274 | struct GNUNET_BANDWIDTH_Value32NBO | ||
275 | bandwidth_in); | ||
270 | 276 | ||
271 | 277 | ||
272 | /** | 278 | /** |
@@ -278,9 +284,9 @@ typedef void | |||
278 | * @return ats context | 284 | * @return ats context |
279 | */ | 285 | */ |
280 | struct GNUNET_ATS_SchedulingHandle * | 286 | struct GNUNET_ATS_SchedulingHandle * |
281 | GNUNET_ATS_scheduling_init(const struct GNUNET_CONFIGURATION_Handle *cfg, | 287 | GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
282 | GNUNET_ATS_AddressSuggestionCallback suggest_cb, | 288 | GNUNET_ATS_AddressSuggestionCallback suggest_cb, |
283 | void *suggest_cb_cls); | 289 | void *suggest_cb_cls); |
284 | 290 | ||
285 | 291 | ||
286 | /** | 292 | /** |
@@ -289,7 +295,7 @@ GNUNET_ATS_scheduling_init(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
289 | * @param sh handle to release | 295 | * @param sh handle to release |
290 | */ | 296 | */ |
291 | void | 297 | void |
292 | GNUNET_ATS_scheduling_done(struct GNUNET_ATS_SchedulingHandle *sh); | 298 | GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh); |
293 | 299 | ||
294 | 300 | ||
295 | /** | 301 | /** |
@@ -311,10 +317,10 @@ struct GNUNET_ATS_AddressRecord; | |||
311 | * address is invalid) | 317 | * address is invalid) |
312 | */ | 318 | */ |
313 | struct GNUNET_ATS_AddressRecord * | 319 | struct GNUNET_ATS_AddressRecord * |
314 | GNUNET_ATS_address_add(struct GNUNET_ATS_SchedulingHandle *sh, | 320 | GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, |
315 | const struct GNUNET_HELLO_Address *address, | 321 | const struct GNUNET_HELLO_Address *address, |
316 | struct GNUNET_ATS_Session *session, | 322 | struct GNUNET_ATS_Session *session, |
317 | const struct GNUNET_ATS_Properties *prop); | 323 | const struct GNUNET_ATS_Properties *prop); |
318 | 324 | ||
319 | 325 | ||
320 | /** | 326 | /** |
@@ -324,8 +330,8 @@ GNUNET_ATS_address_add(struct GNUNET_ATS_SchedulingHandle *sh, | |||
324 | * @param session session handle | 330 | * @param session session handle |
325 | */ | 331 | */ |
326 | void | 332 | void |
327 | GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar, | 333 | GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar, |
328 | struct GNUNET_ATS_Session *session); | 334 | struct GNUNET_ATS_Session *session); |
329 | 335 | ||
330 | 336 | ||
331 | /** | 337 | /** |
@@ -341,8 +347,8 @@ GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar, | |||
341 | * use it still to establish a new session | 347 | * use it still to establish a new session |
342 | */ | 348 | */ |
343 | int | 349 | int |
344 | GNUNET_ATS_address_del_session(struct GNUNET_ATS_AddressRecord *ar, | 350 | GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar, |
345 | struct GNUNET_ATS_Session *session); | 351 | struct GNUNET_ATS_Session *session); |
346 | 352 | ||
347 | 353 | ||
348 | /** | 354 | /** |
@@ -359,8 +365,8 @@ GNUNET_ATS_address_del_session(struct GNUNET_ATS_AddressRecord *ar, | |||
359 | * @param prop performance data for the address | 365 | * @param prop performance data for the address |
360 | */ | 366 | */ |
361 | void | 367 | void |
362 | GNUNET_ATS_address_update(struct GNUNET_ATS_AddressRecord *ar, | 368 | GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar, |
363 | const struct GNUNET_ATS_Properties *prop); | 369 | const struct GNUNET_ATS_Properties *prop); |
364 | 370 | ||
365 | 371 | ||
366 | /** | 372 | /** |
@@ -370,7 +376,7 @@ GNUNET_ATS_address_update(struct GNUNET_ATS_AddressRecord *ar, | |||
370 | * expired and ATS may no longer use it | 376 | * expired and ATS may no longer use it |
371 | */ | 377 | */ |
372 | void | 378 | void |
373 | GNUNET_ATS_address_destroy(struct GNUNET_ATS_AddressRecord *ar); | 379 | GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar); |
374 | 380 | ||
375 | 381 | ||
376 | 382 | ||
@@ -398,11 +404,15 @@ struct GNUNET_ATS_PerformanceHandle; | |||
398 | */ | 404 | */ |
399 | typedef void | 405 | typedef void |
400 | (*GNUNET_ATS_AddressInformationCallback) (void *cls, | 406 | (*GNUNET_ATS_AddressInformationCallback) (void *cls, |
401 | const struct GNUNET_HELLO_Address *address, | 407 | const struct |
408 | GNUNET_HELLO_Address *address, | ||
402 | int address_active, | 409 | int address_active, |
403 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 410 | struct GNUNET_BANDWIDTH_Value32NBO |
404 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 411 | bandwidth_out, |
405 | const struct GNUNET_ATS_Properties *prop); | 412 | struct GNUNET_BANDWIDTH_Value32NBO |
413 | bandwidth_in, | ||
414 | const struct | ||
415 | GNUNET_ATS_Properties *prop); | ||
406 | 416 | ||
407 | 417 | ||
408 | /** | 418 | /** |
@@ -421,9 +431,9 @@ struct GNUNET_ATS_AddressListHandle; | |||
421 | * @return ats performance context | 431 | * @return ats performance context |
422 | */ | 432 | */ |
423 | struct GNUNET_ATS_PerformanceHandle * | 433 | struct GNUNET_ATS_PerformanceHandle * |
424 | GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, | 434 | GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, |
425 | GNUNET_ATS_AddressInformationCallback addr_info_cb, | 435 | GNUNET_ATS_AddressInformationCallback addr_info_cb, |
426 | void *addr_info_cb_cls); | 436 | void *addr_info_cb_cls); |
427 | 437 | ||
428 | 438 | ||
429 | /** | 439 | /** |
@@ -439,11 +449,12 @@ GNUNET_ATS_performance_init(const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
439 | * @return handle to abort the operation | 449 | * @return handle to abort the operation |
440 | */ | 450 | */ |
441 | struct GNUNET_ATS_AddressListHandle * | 451 | struct GNUNET_ATS_AddressListHandle * |
442 | GNUNET_ATS_performance_list_addresses(struct GNUNET_ATS_PerformanceHandle *ph, | 452 | GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *ph, |
443 | const struct GNUNET_PeerIdentity *peer, | 453 | const struct GNUNET_PeerIdentity *peer, |
444 | int all, | 454 | int all, |
445 | GNUNET_ATS_AddressInformationCallback infocb, | 455 | GNUNET_ATS_AddressInformationCallback |
446 | void *infocb_cls); | 456 | infocb, |
457 | void *infocb_cls); | ||
447 | 458 | ||
448 | 459 | ||
449 | /** | 460 | /** |
@@ -452,7 +463,8 @@ GNUNET_ATS_performance_list_addresses(struct GNUNET_ATS_PerformanceHandle *ph, | |||
452 | * @param alh the `struct GNUNET_ATS_AddressListHandle` handle to cancel | 463 | * @param alh the `struct GNUNET_ATS_AddressListHandle` handle to cancel |
453 | */ | 464 | */ |
454 | void | 465 | void |
455 | GNUNET_ATS_performance_list_addresses_cancel(struct GNUNET_ATS_AddressListHandle *alh); | 466 | GNUNET_ATS_performance_list_addresses_cancel (struct |
467 | GNUNET_ATS_AddressListHandle *alh); | ||
456 | 468 | ||
457 | 469 | ||
458 | /** | 470 | /** |
@@ -461,7 +473,7 @@ GNUNET_ATS_performance_list_addresses_cancel(struct GNUNET_ATS_AddressListHandle | |||
461 | * @param ph handle | 473 | * @param ph handle |
462 | */ | 474 | */ |
463 | void | 475 | void |
464 | GNUNET_ATS_performance_done(struct GNUNET_ATS_PerformanceHandle *ph); | 476 | GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph); |
465 | 477 | ||
466 | 478 | ||
467 | /** | 479 | /** |
@@ -502,11 +514,11 @@ struct GNUNET_ATS_ReservationContext; | |||
502 | * @deprecated will be replaced soon | 514 | * @deprecated will be replaced soon |
503 | */ | 515 | */ |
504 | struct GNUNET_ATS_ReservationContext * | 516 | struct GNUNET_ATS_ReservationContext * |
505 | GNUNET_ATS_reserve_bandwidth(struct GNUNET_ATS_PerformanceHandle *ph, | 517 | GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph, |
506 | const struct GNUNET_PeerIdentity *peer, | 518 | const struct GNUNET_PeerIdentity *peer, |
507 | int32_t amount, | 519 | int32_t amount, |
508 | GNUNET_ATS_ReservationCallback rcb, | 520 | GNUNET_ATS_ReservationCallback rcb, |
509 | void *rcb_cls); | 521 | void *rcb_cls); |
510 | 522 | ||
511 | 523 | ||
512 | /** | 524 | /** |
@@ -515,13 +527,15 @@ GNUNET_ATS_reserve_bandwidth(struct GNUNET_ATS_PerformanceHandle *ph, | |||
515 | * @param rc context returned by the original GNUNET_ATS_reserve_bandwidth call | 527 | * @param rc context returned by the original GNUNET_ATS_reserve_bandwidth call |
516 | */ | 528 | */ |
517 | void | 529 | void |
518 | GNUNET_ATS_reserve_bandwidth_cancel(struct GNUNET_ATS_ReservationContext *rc); | 530 | GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc); |
519 | 531 | ||
520 | 532 | ||
521 | /** | 533 | /** |
522 | * ATS preference types as array initializer | 534 | * ATS preference types as array initializer |
523 | */ | 535 | */ |
524 | #define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_LATENCY, GNUNET_ATS_PREFERENCE_END } | 536 | #define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, \ |
537 | GNUNET_ATS_PREFERENCE_LATENCY, \ | ||
538 | GNUNET_ATS_PREFERENCE_END } | ||
525 | 539 | ||
526 | /** | 540 | /** |
527 | * ATS preference types as string array initializer | 541 | * ATS preference types as string array initializer |
@@ -531,7 +545,8 @@ GNUNET_ATS_reserve_bandwidth_cancel(struct GNUNET_ATS_ReservationContext *rc); | |||
531 | /** | 545 | /** |
532 | * Enum defining all known preference categories. | 546 | * Enum defining all known preference categories. |
533 | */ | 547 | */ |
534 | enum GNUNET_ATS_PreferenceKind { | 548 | enum GNUNET_ATS_PreferenceKind |
549 | { | ||
535 | /** | 550 | /** |
536 | * Change the peer's bandwidth value (value per byte of bandwidth in | 551 | * Change the peer's bandwidth value (value per byte of bandwidth in |
537 | * the goal function) to the given amount. The argument is followed | 552 | * the goal function) to the given amount. The argument is followed |
@@ -563,7 +578,7 @@ enum GNUNET_ATS_PreferenceKind { | |||
563 | * @return a string or NULL if invalid | 578 | * @return a string or NULL if invalid |
564 | */ | 579 | */ |
565 | const char * | 580 | const char * |
566 | GNUNET_ATS_print_preference_type(enum GNUNET_ATS_PreferenceKind type); | 581 | GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type); |
567 | 582 | ||
568 | 583 | ||
569 | /** | 584 | /** |
@@ -575,9 +590,11 @@ GNUNET_ATS_print_preference_type(enum GNUNET_ATS_PreferenceKind type); | |||
575 | * desired changes | 590 | * desired changes |
576 | */ | 591 | */ |
577 | void | 592 | void |
578 | GNUNET_ATS_performance_change_preference(struct GNUNET_ATS_PerformanceHandle *ph, | 593 | GNUNET_ATS_performance_change_preference (struct |
579 | const struct GNUNET_PeerIdentity *peer, | 594 | GNUNET_ATS_PerformanceHandle *ph, |
580 | ...); | 595 | const struct |
596 | GNUNET_PeerIdentity *peer, | ||
597 | ...); | ||
581 | 598 | ||
582 | 599 | ||
583 | /** | 600 | /** |
@@ -598,10 +615,10 @@ GNUNET_ATS_performance_change_preference(struct GNUNET_ATS_PerformanceHandle *ph | |||
598 | * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes | 615 | * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes |
599 | */ | 616 | */ |
600 | void | 617 | void |
601 | GNUNET_ATS_performance_give_feedback(struct GNUNET_ATS_PerformanceHandle *ph, | 618 | GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, |
602 | const struct GNUNET_PeerIdentity *peer, | 619 | const struct GNUNET_PeerIdentity *peer, |
603 | const struct GNUNET_TIME_Relative scope, | 620 | const struct GNUNET_TIME_Relative scope, |
604 | ...); | 621 | ...); |
605 | 622 | ||
606 | #endif | 623 | #endif |
607 | 624 | ||