aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-04-02 14:25:30 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-04-02 14:25:30 +0000
commit457a16442aaa51f16a93394eb72a76a3a0262b37 (patch)
treef2f73c280bac3acfa2d633f1fc46f8296992722e /src
parentd723a288c2185671ef410a70d9113d1f19a5c36a (diff)
downloadgnunet-457a16442aaa51f16a93394eb72a76a3a0262b37.tar.gz
gnunet-457a16442aaa51f16a93394eb72a76a3a0262b37.zip
documentation
Diffstat (limited to 'src')
-rw-r--r--src/ats/gnunet-service-ats_addresses.c125
-rw-r--r--src/ats/gnunet-service-ats_addresses.h104
2 files changed, 202 insertions, 27 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index acf550196..2d3abefac 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -688,6 +688,19 @@ lookup_address (struct GAS_Addresses_Handle *handle,
688} 688}
689 689
690 690
691
692/**
693 * Add a new address for a peer.
694 *
695 * @param handle the address handle to use
696 * @param peer peer
697 * @param plugin_name transport plugin name
698 * @param plugin_addr plugin address
699 * @param plugin_addr_len length of the plugin address
700 * @param session_id session id, can be 0
701 * @param atsi performance information for this address
702 * @param atsi_count number of performance information contained
703 */
691void 704void
692GAS_addresses_add (struct GAS_Addresses_Handle *handle, 705GAS_addresses_add (struct GAS_Addresses_Handle *handle,
693 const struct GNUNET_PeerIdentity *peer, 706 const struct GNUNET_PeerIdentity *peer,
@@ -786,6 +799,21 @@ GAS_addresses_add (struct GAS_Addresses_Handle *handle,
786} 799}
787 800
788 801
802/**
803 * Update an address with a session or performance information for a peer.
804 *
805 * If an address was added without a session it will be updated with the
806 * session
807 *
808 * @param handle the address handle to use
809 * @param peer peer
810 * @param plugin_name transport plugin name
811 * @param plugin_addr plugin address
812 * @param plugin_addr_len length of the plugin address
813 * @param session_id session id, can be 0
814 * @param atsi performance information for this address
815 * @param atsi_count number of performance information contained
816 */
789void 817void
790GAS_addresses_update (struct GAS_Addresses_Handle *handle, 818GAS_addresses_update (struct GAS_Addresses_Handle *handle,
791 const struct GNUNET_PeerIdentity *peer, 819 const struct GNUNET_PeerIdentity *peer,
@@ -940,11 +968,24 @@ destroy_by_session_id (void *cls, const struct GNUNET_HashCode * key, void *valu
940 return GNUNET_OK; 968 return GNUNET_OK;
941} 969}
942 970
971
972/**
973 * Remove an address or just a session for a peer.
974 *
975 * @param handle the address handle to use
976 * @param peer peer
977 * @param plugin_name transport plugin name
978 * @param plugin_addr plugin address
979 * @param plugin_addr_len length of the plugin address
980 * @param session_id session id, can be 0
981 */
943void 982void
944GAS_addresses_destroy (struct GAS_Addresses_Handle *handle, 983GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
945 const struct GNUNET_PeerIdentity *peer, 984 const struct GNUNET_PeerIdentity *peer,
946 const char *plugin_name, const void *plugin_addr, 985 const char *plugin_name,
947 size_t plugin_addr_len, uint32_t session_id) 986 const void *plugin_addr,
987 size_t plugin_addr_len,
988 uint32_t session_id)
948{ 989{
949 struct ATS_Address *ea; 990 struct ATS_Address *ea;
950 struct DestroyContext dc; 991 struct DestroyContext dc;
@@ -978,11 +1019,33 @@ GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
978} 1019}
979 1020
980 1021
1022/**
1023 * Notification about active use of an address.
1024 * in_use == GNUNET_YES:
1025 * This address is used to maintain an active connection with a peer.
1026 * in_use == GNUNET_NO:
1027 * This address is no longer used to maintain an active connection with a peer.
1028 *
1029 * Note: can only be called with in_use == GNUNET_NO if called with GNUNET_YES
1030 * before
1031 *
1032 * @param handle the address handle to use
1033 * @param peer peer
1034 * @param plugin_name transport plugin name
1035 * @param plugin_addr plugin address
1036 * @param plugin_addr_len length of the plugin address
1037 * @param session_id session id, can be 0
1038 * @param in_use GNUNET_YES if GNUNET_NO
1039 * @return GNUNET_SYSERR on failure (address unknown ...)
1040 */
981int 1041int
982GAS_addresses_in_use (struct GAS_Addresses_Handle *handle, 1042GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
983 const struct GNUNET_PeerIdentity *peer, 1043 const struct GNUNET_PeerIdentity *peer,
984 const char *plugin_name, const void *plugin_addr, 1044 const char *plugin_name,
985 size_t plugin_addr_len, uint32_t session_id, int in_use) 1045 const void *plugin_addr,
1046 size_t plugin_addr_len,
1047 uint32_t session_id,
1048 int in_use)
986{ 1049{
987 struct ATS_Address *ea; 1050 struct ATS_Address *ea;
988 1051
@@ -1030,7 +1093,7 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
1030 * Cancel address suggestions for a peer 1093 * Cancel address suggestions for a peer
1031 * 1094 *
1032 * @param handle the address handle 1095 * @param handle the address handle
1033 * @param peer the respective peer 1096 * @param peer the peer id
1034 */ 1097 */
1035void 1098void
1036GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle, 1099GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle,
@@ -1064,10 +1127,10 @@ GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle,
1064 1127
1065 1128
1066/** 1129/**
1067 * Add an address suggestions for a peer 1130 * Request address suggestions for a peer
1068 * 1131 *
1069 * @param handle the address handle 1132 * @param handle the address handle
1070 * @param peer the respective peer 1133 * @param peer the peer id
1071 */ 1134 */
1072void 1135void
1073GAS_addresses_request_address (struct GAS_Addresses_Handle *handle, 1136GAS_addresses_request_address (struct GAS_Addresses_Handle *handle,
@@ -1145,6 +1208,15 @@ reset_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
1145} 1208}
1146 1209
1147 1210
1211/**
1212 * Reset suggestion backoff for a peer
1213 *
1214 * Suggesting addresses is blocked for ATS_BLOCKING_DELTA. Blocking can be
1215 * reset using this function
1216 *
1217 * @param handle the address handle
1218 * @param peer the peer id
1219 */
1148void 1220void
1149GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle, 1221GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle,
1150 const struct GNUNET_PeerIdentity *peer) 1222 const struct GNUNET_PeerIdentity *peer)
@@ -1161,6 +1233,15 @@ GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle,
1161} 1233}
1162 1234
1163 1235
1236/**
1237 * Change the preference for a peer
1238 *
1239 * @param handle the address handle
1240 * @param client the client sending this request
1241 * @param peer the peer id
1242 * @param kind the preference kind to change
1243 * @param score the new preference score
1244 */
1164void 1245void
1165GAS_addresses_change_preference (struct GAS_Addresses_Handle *handle, 1246GAS_addresses_change_preference (struct GAS_Addresses_Handle *handle,
1166 void *client, 1247 void *client,
@@ -1348,10 +1429,14 @@ bandwidth_changed_cb (void *cls, struct ATS_Address *address)
1348 1429
1349 1430
1350/** 1431/**
1351 * Initialize address subsystem. 1432 * Initialize address subsystem. The addresses subsystem manages the addresses
1433 * known and current performance information. It has a solver component
1434 * responsible for the resource allocation. It tells the solver about changes
1435 * and receives updates when the solver changes the ressource allocation.
1352 * 1436 *
1353 * @param cfg configuration to use 1437 * @param cfg configuration to use
1354 * @param stats the statistics handle to use 1438 * @param stats the statistics handle to use
1439 * @return an address handle
1355 */ 1440 */
1356struct GAS_Addresses_Handle * 1441struct GAS_Addresses_Handle *
1357GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 1442GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -1484,6 +1569,11 @@ free_address_it (void *cls, const struct GNUNET_HashCode * key, void *value)
1484} 1569}
1485 1570
1486 1571
1572/**
1573 * Remove all addresses
1574 *
1575 * @param handle the address handle to use
1576 */
1487void 1577void
1488GAS_addresses_destroy_all (struct GAS_Addresses_Handle *handle) 1578GAS_addresses_destroy_all (struct GAS_Addresses_Handle *handle)
1489{ 1579{
@@ -1501,6 +1591,8 @@ GAS_addresses_destroy_all (struct GAS_Addresses_Handle *handle)
1501 1591
1502/** 1592/**
1503 * Shutdown address subsystem. 1593 * Shutdown address subsystem.
1594 *
1595 * @param handle the address handle to shutdown
1504 */ 1596 */
1505void 1597void
1506GAS_addresses_done (struct GAS_Addresses_Handle *handle) 1598GAS_addresses_done (struct GAS_Addresses_Handle *handle)
@@ -1550,16 +1642,18 @@ peer_it (void *cls,
1550 return GNUNET_OK; 1642 return GNUNET_OK;
1551} 1643}
1552 1644
1645
1553/** 1646/**
1554 * Return all peers currently known to ATS 1647 * Return information all peers currently known to ATS
1555 * 1648 *
1556 * @param handle the address handle 1649 * @param handle the address handle to use
1557 * @param p_it the iterator to call for every peer, callbach with id == NULL 1650 * @param p_it the iterator to call for every peer
1558 * when done
1559 * @param p_it_cls the closure for the iterator 1651 * @param p_it_cls the closure for the iterator
1560 */ 1652 */
1561void 1653void
1562GAS_addresses_iterate_peers (struct GAS_Addresses_Handle *handle, GNUNET_ATS_Peer_Iterator p_it, void *p_it_cls) 1654GAS_addresses_iterate_peers (struct GAS_Addresses_Handle *handle,
1655 GNUNET_ATS_Peer_Iterator p_it,
1656 void *p_it_cls)
1563{ 1657{
1564 struct PeerIteratorContext ip_ctx; 1658 struct PeerIteratorContext ip_ctx;
1565 unsigned int size; 1659 unsigned int size;
@@ -1580,6 +1674,7 @@ GAS_addresses_iterate_peers (struct GAS_Addresses_Handle *handle, GNUNET_ATS_Pee
1580 p_it (p_it_cls, NULL); 1674 p_it (p_it_cls, NULL);
1581} 1675}
1582 1676
1677
1583struct PeerInfoIteratorContext 1678struct PeerInfoIteratorContext
1584{ 1679{
1585 GNUNET_ATS_PeerInfo_Iterator it; 1680 GNUNET_ATS_PeerInfo_Iterator it;
@@ -1616,9 +1711,9 @@ peerinfo_it (void *cls,
1616 1711
1617 1712
1618/** 1713/**
1619 * Return all peers currently known to ATS 1714 * Return information all peers currently known to ATS
1620 * 1715 *
1621 * @param handle the address handle 1716 * @param handle the address handle to use
1622 * @param peer the respective peer 1717 * @param peer the respective peer
1623 * @param pi_it the iterator to call for every peer 1718 * @param pi_it the iterator to call for every peer
1624 * @param pi_it_cls the closure for the iterator 1719 * @param pi_it_cls the closure for the iterator
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index 82d42a6b1..dffd2a824 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -438,10 +438,11 @@ struct GAS_Addresses_Handle *
438GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 438GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
439 const struct GNUNET_STATISTICS_Handle *stats); 439 const struct GNUNET_STATISTICS_Handle *stats);
440 440
441
441/** 442/**
442 * Shutdown address subsystem. 443 * Shutdown address subsystem.
443 * 444 *
444 * @param the address handle to shutdown 445 * @param handle the address handle to shutdown
445 */ 446 */
446void 447void
447GAS_addresses_done (struct GAS_Addresses_Handle *handle); 448GAS_addresses_done (struct GAS_Addresses_Handle *handle);
@@ -498,26 +499,67 @@ GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
498 uint32_t session_id, 499 uint32_t session_id,
499 int in_use); 500 int in_use);
500 501
502
503/**
504 * Update an address with a session or performance information for a peer.
505 *
506 * If an address was added without a session it will be updated with the
507 * session
508 *
509 * @param handle the address handle to use
510 * @param peer peer
511 * @param plugin_name transport plugin name
512 * @param plugin_addr plugin address
513 * @param plugin_addr_len length of the plugin address
514 * @param session_id session id, can be 0
515 * @param atsi performance information for this address
516 * @param atsi_count number of performance information contained
517 */
501void 518void
502GAS_addresses_update (struct GAS_Addresses_Handle *handle, 519GAS_addresses_update (struct GAS_Addresses_Handle *handle,
503 const struct GNUNET_PeerIdentity *peer, 520 const struct GNUNET_PeerIdentity *peer,
504 const char *plugin_name, const void *plugin_addr, 521 const char *plugin_name,
505 size_t plugin_addr_len, uint32_t session_id, 522 const void *plugin_addr,
523 size_t plugin_addr_len,
524 uint32_t session_id,
506 const struct GNUNET_ATS_Information *atsi, 525 const struct GNUNET_ATS_Information *atsi,
507 uint32_t atsi_count); 526 uint32_t atsi_count);
508 527
509 528
529/**
530 * Remove an address or just a session for a peer.
531 *
532 * @param handle the address handle to use
533 * @param peer peer
534 * @param plugin_name transport plugin name
535 * @param plugin_addr plugin address
536 * @param plugin_addr_len length of the plugin address
537 * @param session_id session id, can be 0
538 */
510void 539void
511GAS_addresses_destroy (struct GAS_Addresses_Handle *handle, 540GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
512 const struct GNUNET_PeerIdentity *peer, 541 const struct GNUNET_PeerIdentity *peer,
513 const char *plugin_name, const void *plugin_addr, 542 const char *plugin_name,
514 size_t plugin_addr_len, uint32_t session_id); 543 const void *plugin_addr,
544 size_t plugin_addr_len,
545 uint32_t session_id);
515 546
516 547
548/**
549 * Remove all addresses
550 *
551 * @param handle the address handle to use
552 */
517void 553void
518GAS_addresses_destroy_all (struct GAS_Addresses_Handle *handle); 554GAS_addresses_destroy_all (struct GAS_Addresses_Handle *handle);
519 555
520 556
557/**
558 * Request address suggestions for a peer
559 *
560 * @param handle the address handle
561 * @param peer the peer id
562 */
521void 563void
522GAS_addresses_request_address (struct GAS_Addresses_Handle *handle, 564GAS_addresses_request_address (struct GAS_Addresses_Handle *handle,
523 const struct GNUNET_PeerIdentity *peer); 565 const struct GNUNET_PeerIdentity *peer);
@@ -525,23 +567,37 @@ GAS_addresses_request_address (struct GAS_Addresses_Handle *handle,
525/** 567/**
526 * Cancel address suggestions for a peer 568 * Cancel address suggestions for a peer
527 * 569 *
528 * @param peer the respective peer 570 * @param handle the address handle
571 * @param peer the peer id
529 */ 572 */
530void 573void
531GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle, 574GAS_addresses_request_address_cancel (struct GAS_Addresses_Handle *handle,
532 const struct GNUNET_PeerIdentity *peer); 575 const struct GNUNET_PeerIdentity *peer);
533 576
534 577
535
536
537/** 578/**
579 * Reset suggestion backoff for a peer
580 *
581 * Suggesting addresses is blocked for ATS_BLOCKING_DELTA. Blocking can be
582 * reset using this function
538 * 583 *
584 * @param handle the address handle
585 * @param peer the peer id
539 */ 586 */
540void 587void
541GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle, 588GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle,
542 const struct GNUNET_PeerIdentity *peer); 589 const struct GNUNET_PeerIdentity *peer);
543 590
544 591
592/**
593 * Change the preference for a peer
594 *
595 * @param handle the address handle
596 * @param client the client sending this request
597 * @param peer the peer id
598 * @param kind the preference kind to change
599 * @param score the new preference score
600 */
545void 601void
546GAS_addresses_change_preference (struct GAS_Addresses_Handle *handle, 602GAS_addresses_change_preference (struct GAS_Addresses_Handle *handle,
547 void *client, 603 void *client,
@@ -550,13 +606,20 @@ GAS_addresses_change_preference (struct GAS_Addresses_Handle *handle,
550 float score); 606 float score);
551 607
552 608
553 609/**
610 * Iterator for GAS_addresses_iterate_peers
611 *
612 * @param p_it_cls closure
613 * @param id the peer id
614 */
554typedef void (*GNUNET_ATS_Peer_Iterator) (void *p_it_cls, 615typedef void (*GNUNET_ATS_Peer_Iterator) (void *p_it_cls,
555 const struct GNUNET_PeerIdentity *id); 616 const struct GNUNET_PeerIdentity *id);
556 617
618
557/** 619/**
558 * Return all peers currently known to ATS 620 * Return all peers currently known to ATS
559 * 621 *
622 * @param handle the address handle to use
560 * @param p_it the iterator to call for every peer 623 * @param p_it the iterator to call for every peer
561 * @param p_it_cls the closure for the iterator 624 * @param p_it_cls the closure for the iterator
562 */ 625 */
@@ -565,20 +628,37 @@ GAS_addresses_iterate_peers (struct GAS_Addresses_Handle *handle,
565 GNUNET_ATS_Peer_Iterator p_it, 628 GNUNET_ATS_Peer_Iterator p_it,
566 void *p_it_cls); 629 void *p_it_cls);
567 630
631
632/**
633 * Iterator for GAS_addresses_get_peer_info
634 *
635 * @param p_it_cls closure closure
636 * @param id the peer id
637 * @param plugin_name plugin name
638 * @param plugin_addr address
639 * @param plugin_addr_len address length
640 * @param address_active is address actively used
641 * @param atsi ats performance information
642 * @param atsi_count number of ats performance elements
643 * @param bandwidth_out current outbound bandwidth assigned to address
644 * @param bandwidth_in current inbound bandwidth assigned to address
645 */
568typedef void (*GNUNET_ATS_PeerInfo_Iterator) (void *p_it_cls, 646typedef void (*GNUNET_ATS_PeerInfo_Iterator) (void *p_it_cls,
569 const struct GNUNET_PeerIdentity *id, 647 const struct GNUNET_PeerIdentity *id,
570 const char *plugin_name, 648 const char *plugin_name,
571 const void *plugin_addr, size_t plugin_addr_len, 649 const void *plugin_addr,
650 size_t plugin_addr_len,
572 const int address_active, 651 const int address_active,
573 const struct GNUNET_ATS_Information *atsi, 652 const struct GNUNET_ATS_Information *atsi,
574 uint32_t atsi_count, 653 uint32_t atsi_count,
575 struct GNUNET_BANDWIDTH_Value32NBO 654 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
576 bandwidth_out,
577 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in); 655 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
578 656
657
579/** 658/**
580 * Return information all peers currently known to ATS 659 * Return information all peers currently known to ATS
581 * 660 *
661 * @param handle the address handle to use
582 * @param peer the respective peer 662 * @param peer the respective peer
583 * @param pi_it the iterator to call for every peer 663 * @param pi_it the iterator to call for every peer
584 * @param pi_it_cls the closure for the iterator 664 * @param pi_it_cls the closure for the iterator