![]() |
GNUnet
0.11.x
|
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 this 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 879 of file gnunet-service-transport_ats.c.
References GNUNET_CONTAINER_multipeermap_create(), and GNUNET_YES.
Referenced by run().
void GST_ats_done | ( | void | ) |
Shutdown ATS subsystem.
Definition at line 909 of file gnunet-service-transport_ats.c.
References destroy_ai_cb(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), 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 find_ai(), GNUNET_NO, and GNUNET_YES.
Referenced by GST_neighbours_session_terminated(), set_alternative_address(), 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 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 ai, AddressInfo::ar, AddressInfo::back_off, AddressInfo::blocked, 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, GNUNET_HELLO_Address::peer, publish_p2a_stat_update(), unblock_address(), and AddressInfo::unblock_task.
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 ai, AddressInfo::back_off, find_ai(), GNUNET_break, GNUNET_TIME_UNIT_ZERO, GST_my_identity, GNUNET_HELLO_Address::peer, and AddressInfo::unblock_task.
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 AddressInfo::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, GNUNET_HELLO_Address::peer, AddressInfo::properties, publish_p2a_stat_update(), GNUNET_ATS_Properties::scope, AddressInfo::session, and GNUNET_HELLO_Address::transport_name.
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 this address is located in.
The address must NOT be inbound and must be new to ATS.
address | the address |
prop | performance information |
Notify ATS about a new address including the network this 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 488 of file gnunet-service-transport_ats.c.
References AddressInfo::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, GNUNET_HELLO_Address::peer, AddressInfo::properties, publish_p2a_stat_update(), GNUNET_ATS_Properties::scope, and GNUNET_HELLO_Address::transport_name.
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 544 of file gnunet-service-transport_ats.c.
References ai, AddressInfo::ar, find_ai(), GNUNET_assert, GNUNET_ATS_address_add_session(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GST_my_identity, LOG, GNUNET_HELLO_Address::peer, AddressInfo::session, and AddressInfo::unblock_task.
Referenced by multicast_pong(), send_syn_ack_message(), set_alternative_address(), 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 804 of file gnunet-service-transport_ats.c.
References ai, AddressInfo::ar, find_ai_no_session(), GNUNET_ATS_address_update(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GST_manipulation_manipulate_metrics(), GST_plugins_a2s(), LOG, GNUNET_HELLO_Address::peer, AddressInfo::properties, AddressInfo::session, GNUNET_ATS_Properties::utilization_in, and GNUNET_ATS_Properties::utilization_out.
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 |
session | the session |
delay | new delay value |
Does nothing if the address is not known to us.
address | the address |
delay | new delay value |
Definition at line 766 of file gnunet-service-transport_ats.c.
References ai, AddressInfo::ar, delay, GNUNET_ATS_Properties::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(), LOG, GNUNET_HELLO_Address::peer, AddressInfo::properties, and AddressInfo::session.
Referenced by GST_neighbours_keepalive_response(), 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 730 of file gnunet-service-transport_ats.c.
References ai, AddressInfo::ar, GNUNET_ATS_Properties::distance, find_ai_no_session(), GNUNET_ATS_address_update(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GST_manipulation_manipulate_metrics(), LOG, GNUNET_HELLO_Address::peer, AddressInfo::properties, and AddressInfo::session.
Referenced by plugin_env_update_distance().
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 626 of file gnunet-service-transport_ats.c.
References ai, AddressInfo::ar, destroy_ai(), AddressInfo::expired, 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, GNUNET_HELLO_Address::peer, 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 844 of file gnunet-service-transport_ats.c.
References ai, destroy_ai(), AddressInfo::expired, find_ai_no_session(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_YES, GST_my_identity, GST_plugins_a2s(), LOG, GNUNET_HELLO_Address::peer, and AddressInfo::session.
Referenced by cleanup_validation_entry().