interfacing between transport and ATS service More...
#include "gnunet_ats_service.h"
Go to the source code of this file.
Functions | |
void | GST_ats_init (void) |
Initialize ATS subsystem. More... | |
void | GST_ats_done (void) |
Shutdown ATS subsystem. More... | |
int | GST_ats_is_known (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Test if ATS knows about this address and session. More... | |
int | GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address) |
Test if ATS knows about this address. More... | |
void | GST_ats_block_address (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Temporarily block a valid address for use by ATS for address suggestions. More... | |
void | GST_ats_block_reset (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Reset address blocking time. More... | |
void | GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_ATS_Properties *prop) |
Notify ATS about a new inbound address. More... | |
void | GST_ats_add_address (const struct GNUNET_HELLO_Address *address, const struct GNUNET_ATS_Properties *prop) |
Notify ATS about a new address including the network the address is located in. More... | |
void | GST_ats_new_session (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Notify ATS about a new session now existing for the given address. More... | |
void | GST_ats_update_utilization (const struct GNUNET_HELLO_Address *address, uint32_t bps_in, uint32_t bps_out) |
Notify ATS about utilization changes to an address. More... | |
void | GST_ats_update_delay (const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Relative delay) |
Notify ATS about delay changes to properties of an address. More... | |
void | GST_ats_update_distance (const struct GNUNET_HELLO_Address *address, uint32_t distance) |
Notify ATS about DV distance change to an address. More... | |
void | GST_ats_del_session (const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session) |
Notify ATS that the session (but not the address) of a given address is no longer relevant. More... | |
void | GST_ats_expire_address (const struct GNUNET_HELLO_Address *address) |
Notify ATS that the address has expired and thus cannot be used any longer. More... | |
interfacing between transport and ATS service
Definition in file gnunet-service-transport_ats.h.
void GST_ats_init | ( | void | ) |
Initialize ATS subsystem.
Definition at line 865 of file gnunet-service-transport_ats.c.
References GNUNET_CONTAINER_multipeermap_create(), GNUNET_YES, and p2a.
Referenced by run().
void GST_ats_done | ( | void | ) |
Shutdown ATS subsystem.
Definition at line 895 of file gnunet-service-transport_ats.c.
References destroy_ai_cb(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), p2a, and publish_p2a_stat_update().
Referenced by shutdown_task().
int GST_ats_is_known | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session | ||
) |
Test if ATS knows about this address and session.
Note that even if the address is expired, we return GNUNET_YES if the respective session matches.
address | the address |
session | the session |
Definition at line 265 of file gnunet-service-transport_ats.c.
References address, find_ai(), GNUNET_NO, GNUNET_YES, and FindClosure::session.
Referenced by GST_neighbours_session_terminated(), send_with_session(), set_primary_address(), and try_run_fast_ats_update().
int GST_ats_is_known_no_session | ( | const struct GNUNET_HELLO_Address * | address | ) |
Test if ATS knows about this address.
Note that expired addresses do not count.
address | the address |
Definition at line 280 of file gnunet-service-transport_ats.c.
References address, find_ai_no_session(), GNUNET_NO, and GNUNET_YES.
Referenced by add_valid_address(), cleanup_validation_entry(), find_validation_entry(), and GST_validation_handle_pong().
void GST_ats_block_address | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session | ||
) |
Temporarily block a valid address for use by ATS for address suggestions.
This function should be called if an address was suggested by ATS but failed to perform (i.e. failure to establish a session or to exchange the PING/PONG).
address | the address to block |
session | the session (can be NULL) |
Definition at line 324 of file gnunet-service-transport_ats.c.
References address, ai, find_ai(), GNUNET_ATS_address_del_session(), GNUNET_ATS_address_destroy(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_HELLO_address_check_option(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_i2s(), GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_STD_BACKOFF, GNUNET_YES, GST_my_identity, GST_plugins_a2s(), LOG, num_blocked, publish_p2a_stat_update(), AddressInfo::session, and unblock_address().
Referenced by free_address(), GST_neighbours_switch_to_address(), set_primary_address(), and switch_address_bl_check_cont().
void GST_ats_block_reset | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session | ||
) |
Reset address blocking time.
Resets the exponential back-off timer for this address to zero. Called when an address was used to create a successful connection.
address | the address to reset the blocking timer |
session | the session (can be NULL) |
Definition at line 390 of file gnunet-service-transport_ats.c.
References address, ai, find_ai(), GNUNET_break, GNUNET_TIME_UNIT_ZERO, GST_my_identity, and AddressInfo::session.
Referenced by GST_neighbours_handle_session_ack().
void GST_ats_add_inbound_address | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session, | ||
const struct GNUNET_ATS_Properties * | prop | ||
) |
Notify ATS about a new inbound address.
The address in combination with the session must be new, but this function will perform a santiy check. If the address is indeed new, make it available to ATS.
address | the address |
session | the session |
prop | performance information |
Definition at line 423 of file gnunet-service-transport_ats.c.
References address, GNUNET_TRANSPORT_AddressIdentifier::address, ai, AddressInfo::ar, find_ai(), GNUNET_assert, GNUNET_ATS_address_add(), GNUNET_break, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELLO_address_check_option(), GNUNET_HELLO_address_copy(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_i2s(), GNUNET_new, GNUNET_NT_to_string(), GNUNET_NT_UNSPECIFIED, GNUNET_YES, GST_ats, GST_my_identity, GST_plugins_a2s(), LOG, p2a, publish_p2a_stat_update(), GNUNET_ATS_Properties::scope, and AddressInfo::session.
Referenced by plugin_env_session_start().
void GST_ats_add_address | ( | const struct GNUNET_HELLO_Address * | address, |
const struct GNUNET_ATS_Properties * | prop | ||
) |
Notify ATS about a new address including the network the address is located in.
The address must NOT be inbound and must be new to ATS.
address | the address |
prop | performance information |
Definition at line 481 of file gnunet-service-transport_ats.c.
References address, GNUNET_TRANSPORT_AddressIdentifier::address, ai, AddressInfo::ar, find_ai_no_session(), GNUNET_assert, GNUNET_ATS_address_add(), GNUNET_break, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_INFO, GNUNET_HELLO_address_check_option(), GNUNET_HELLO_address_copy(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_i2s(), GNUNET_new, GNUNET_NT_UNSPECIFIED, GNUNET_YES, GST_ats, GST_my_identity, GST_plugins_a2s(), LOG, p2a, publish_p2a_stat_update(), and GNUNET_ATS_Properties::scope.
Referenced by add_valid_address(), and GST_validation_handle_pong().
void GST_ats_new_session | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session | ||
) |
Notify ATS about a new session now existing for the given address.
Essentially, an outbound address was used to establish a session. It is safe to call this function repeatedly for the same address and session pair.
address | the address |
session | the session |
Definition at line 537 of file gnunet-service-transport_ats.c.
References address, ai, find_ai(), GNUNET_assert, GNUNET_ATS_address_add_session(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GST_my_identity, LOG, and AddressInfo::session.
Referenced by multicast_pong(), send_syn_ack_message(), send_with_session(), and switch_address_bl_check_cont().
void GST_ats_update_utilization | ( | const struct GNUNET_HELLO_Address * | address, |
uint32_t | bps_in, | ||
uint32_t | bps_out | ||
) |
Notify ATS about utilization changes to an address.
Does nothing if the address is not known to us.
address | our information about the address |
bps_in | new utilization inbound |
bps_out | new utilization outbound |
Definition at line 790 of file gnunet-service-transport_ats.c.
References address, ai, find_ai_no_session(), GNUNET_ATS_address_update(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GST_manipulation_manipulate_metrics(), GST_plugins_a2s(), and LOG.
Referenced by send_utilization_data().
void GST_ats_update_delay | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_TIME_Relative | delay | ||
) |
Notify ATS about delay changes to properties of an address.
Does nothing if the address is not known to us.
address | the address |
delay | new delay value |
Definition at line 752 of file gnunet-service-transport_ats.c.
References address, ai, delay, find_ai_no_session(), GNUNET_ATS_address_update(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_YES, GST_manipulation_manipulate_metrics(), and LOG.
Referenced by GST_neighbours_calculate_receive_delay(), and GST_validation_handle_pong().
void GST_ats_update_distance | ( | const struct GNUNET_HELLO_Address * | address, |
uint32_t | distance | ||
) |
Notify ATS about DV distance change to an address.
Does nothing if the address is not known to us.
address | the address |
distance | new distance value |
Definition at line 723 of file gnunet-service-transport_ats.c.
References address, ai, find_ai_no_session(), GNUNET_ATS_address_update(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GST_manipulation_manipulate_metrics(), and LOG.
Referenced by plugin_env_address_to_type().
void GST_ats_del_session | ( | const struct GNUNET_HELLO_Address * | address, |
struct GNUNET_ATS_Session * | session | ||
) |
Notify ATS that the session (but not the address) of a given address is no longer relevant.
(The session went down.) This function may be called even if for the respective outbound address GST_ats_new_session() was never called and thus the pair is unknown to ATS. In this case, the call is simply ignored.
address | the address |
session | the session |
Definition at line 619 of file gnunet-service-transport_ats.c.
References address, ai, destroy_ai(), find_ai(), GNUNET_assert, GNUNET_ATS_address_del_session(), GNUNET_ATS_address_destroy(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELLO_address_check_option(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_i2s(), GNUNET_NO, GNUNET_YES, GST_my_identity, LOG, and AddressInfo::session.
Referenced by plugin_env_session_end().
void GST_ats_expire_address | ( | const struct GNUNET_HELLO_Address * | address | ) |
Notify ATS that the address has expired and thus cannot be used any longer.
This function must only be called if the corresponding session is already gone.
address | the address |
Definition at line 830 of file gnunet-service-transport_ats.c.
References address, ai, destroy_ai(), find_ai_no_session(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_YES, GST_my_identity, GST_plugins_a2s(), and LOG.
Referenced by cleanup_validation_entry().