diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-22 20:54:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-22 20:54:15 +0000 |
commit | 9750132ba19a96ab1756de15e91c62405a1918fb (patch) | |
tree | 41312f4ff3224895507e127f712ffd9271a19cea /src/include/gnunet_ats_service.h | |
parent | 7701720d1410c40923749c53b96ccb5770e1be09 (diff) | |
download | gnunet-9750132ba19a96ab1756de15e91c62405a1918fb.tar.gz gnunet-9750132ba19a96ab1756de15e91c62405a1918fb.zip |
towards a cleaner ATS scheduling API
Diffstat (limited to 'src/include/gnunet_ats_service.h')
-rw-r--r-- | src/include/gnunet_ats_service.h | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 271d6009e..74e7c7c80 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -460,7 +460,7 @@ struct GNUNET_ATS_AddressRecord; | |||
460 | * | 460 | * |
461 | * @param sh handle | 461 | * @param sh handle |
462 | * @param address the address | 462 | * @param address the address |
463 | * @param session session handle (if available) | 463 | * @param session session handle (if available, i.e. for incoming connections) |
464 | * @param ats performance data for the address | 464 | * @param ats performance data for the address |
465 | * @param ats_count number of performance records in @a ats | 465 | * @param ats_count number of performance records in @a ats |
466 | * @return handle to the address representation inside ATS, NULL | 466 | * @return handle to the address representation inside ATS, NULL |
@@ -476,6 +476,34 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, | |||
476 | 476 | ||
477 | 477 | ||
478 | /** | 478 | /** |
479 | * An address was used to initiate a session. | ||
480 | * | ||
481 | * @param ar address record to update information for | ||
482 | * @param session session handle | ||
483 | */ | ||
484 | void | ||
485 | GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar, | ||
486 | struct Session *session); | ||
487 | |||
488 | |||
489 | /** | ||
490 | * A session was destroyed, disassociate it from the | ||
491 | * given address record. If this was an incoming | ||
492 | * addess, destroy the address as well. | ||
493 | * | ||
494 | * @param ar address record to update information for | ||
495 | * @param session session handle | ||
496 | * @return #GNUNET_YES if the @a ar was destroyed because | ||
497 | * it was an incoming address, | ||
498 | * #GNUNET_NO if the @ar was kept because we can | ||
499 | * use it still to establish a new session | ||
500 | */ | ||
501 | int | ||
502 | GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar, | ||
503 | struct Session *session); | ||
504 | |||
505 | |||
506 | /** | ||
479 | * We have updated performance statistics for a given address. Note | 507 | * We have updated performance statistics for a given address. Note |
480 | * that this function can be called for addresses that are currently | 508 | * that this function can be called for addresses that are currently |
481 | * in use as well as addresses that are valid but not actively in use. | 509 | * in use as well as addresses that are valid but not actively in use. |
@@ -486,47 +514,36 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, | |||
486 | * suggest to switch addresses. | 514 | * suggest to switch addresses. |
487 | * | 515 | * |
488 | * @param ar address record to update information for | 516 | * @param ar address record to update information for |
489 | * @param session session handle (if available) | ||
490 | * @param ats performance data for the address | 517 | * @param ats performance data for the address |
491 | * @param ats_count number of performance records in @a ats | 518 | * @param ats_count number of performance records in @a ats |
492 | */ | 519 | */ |
493 | void | 520 | void |
494 | GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar, | 521 | GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar, |
495 | struct Session *session, | ||
496 | const struct GNUNET_ATS_Information *ats, | 522 | const struct GNUNET_ATS_Information *ats, |
497 | uint32_t ats_count); | 523 | uint32_t ats_count); |
498 | 524 | ||
499 | 525 | ||
500 | /** | 526 | /** |
501 | * An address is now in use or not used any more. | 527 | * An address is now in use, or not used any more. |
502 | * | 528 | * |
503 | * @param sh handle | 529 | * @param ar address record for which to toggle the flag |
504 | * @param address the address | ||
505 | * @param session session handle | ||
506 | * @param in_use #GNUNET_YES if this address is now used, #GNUNET_NO | 530 | * @param in_use #GNUNET_YES if this address is now used, #GNUNET_NO |
507 | * if address is not used any more | 531 | * if address is not used any more |
508 | */ | 532 | */ |
509 | void | 533 | void |
510 | GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh, | 534 | GNUNET_ATS_address_set_in_use (struct GNUNET_ATS_AddressRecord *ar, |
511 | const struct GNUNET_HELLO_Address *address, | 535 | int in_use); |
512 | struct Session *session, | ||
513 | int in_use); | ||
514 | 536 | ||
515 | 537 | ||
516 | /** | 538 | /** |
517 | * An address got destroyed, stop including it as a valid address. | 539 | * An address got destroyed, stop using it as a valid address. |
518 | * | ||
519 | * If a session is given, only the session will be removed, if no session is | ||
520 | * given the full address will be deleted. | ||
521 | * | 540 | * |
522 | * @param sh handle | 541 | * @param ar address record to destroy, it's validation has |
523 | * @param address the address | 542 | * expired and ATS may no longer use it |
524 | * @param session session handle that is no longer valid (if available) | ||
525 | */ | 543 | */ |
526 | void | 544 | void |
527 | GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh, | 545 | GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar); |
528 | const struct GNUNET_HELLO_Address *address, | 546 | |
529 | struct Session *session); | ||
530 | 547 | ||
531 | 548 | ||
532 | /* ******************************** Performance API ***************************** */ | 549 | /* ******************************** Performance API ***************************** */ |