Bandwidth allocation. More...
Data Structures | |
struct | GNUNET_ATS_Properties |
ATS performance characteristics for an address. More... | |
struct | GNUNET_ATS_PropertiesNBO |
ATS performance characteristics for an address in network byte order (for IPC). More... | |
Macros | |
#define | GNUNET_ATS_DefaultBandwidth 65536 |
Default bandwidth assigned to a network : 64 KB/s. More... | |
#define | GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX |
Undefined value for an enum GNUNET_ATS_Property More... | |
#define | GNUNET_ATS_VALUE_UNDEFINED_STR "undefined" |
String representation for GNUNET_ATS_VALUE_UNDEFINED. More... | |
#define | GNUNET_ATS_MaxBandwidth UINT32_MAX |
Maximum bandwidth assigned to a network : 4095 MB/s. More... | |
#define | GNUNET_ATS_MaxBandwidthString "unlimited" |
Textual equivalent for GNUNET_ATS_MaxBandwidth. More... | |
#define | GNUNET_ATS_PreferenceType |
ATS preference types as array initializer. More... | |
#define | GNUNET_ATS_PreferenceTypeString { "BANDWIDTH", "LATENCY", "END" } |
ATS preference types as string array initializer. More... | |
Typedefs | |
typedef void(* | GNUNET_ATS_AddressSuggestionCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
Signature of a function called by ATS with the current bandwidth and address preferences as determined by ATS. More... | |
typedef void(* | GNUNET_ATS_AddressInformationCallback) (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop) |
Signature of a function that is called with QoS information about an address. More... | |
typedef void(* | GNUNET_ATS_ReservationCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, int32_t amount, struct GNUNET_TIME_Relative res_delay) |
Function called with reservation result. More... | |
typedef void(* | GNUNET_ATS_AllocationCallback) (void *cls, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
Signature of a function called by ATS with the current bandwidth allocation to be used as determined by ATS. More... | |
typedef void(* | GNUNET_ATS_SuggestionCallback) (void *cls, const struct GNUNET_PeerIdentity *pid, const char *address) |
Signature of a function called by ATS suggesting transport to try connecting with a particular address. More... | |
Enumerations | |
enum | GNUNET_ATS_PreferenceKind { GNUNET_ATS_PREFERENCE_BANDWIDTH = 0 , GNUNET_ATS_PREFERENCE_LATENCY = 1 , GNUNET_ATS_PREFERENCE_END = 2 } |
Enum defining all known preference categories. More... | |
Functions | |
struct GNUNET_ATS_ApplicationHandle * | GNUNET_ATS_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Initialize the ATS application client handle. More... | |
void | GNUNET_ATS_application_done (struct GNUNET_ATS_ApplicationHandle *ch) |
Shutdown ATS application client. More... | |
struct GNUNET_ATS_ApplicationSuggestHandle * | GNUNET_ATS_application_suggest (struct GNUNET_ATS_ApplicationHandle *ch, const struct GNUNET_PeerIdentity *peer, enum GNUNET_MQ_PreferenceKind pk, struct GNUNET_BANDWIDTH_Value32NBO bw) |
An application would like to communicate with a peer. More... | |
void | GNUNET_ATS_application_suggest_cancel (struct GNUNET_ATS_ApplicationSuggestHandle *sh) |
We no longer care about communicating with a peer. More... | |
void | GNUNET_ATS_properties_hton (struct GNUNET_ATS_PropertiesNBO *nbo, const struct GNUNET_ATS_Properties *hbo) |
Convert ATS properties from host to network byte order. More... | |
void | GNUNET_ATS_properties_ntoh (struct GNUNET_ATS_Properties *hbo, const struct GNUNET_ATS_PropertiesNBO *nbo) |
Convert ATS properties from network to host byte order. More... | |
struct GNUNET_ATS_ConnectivityHandle * | GNUNET_ATS_connectivity_init (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Initialize the ATS connectivity suggestion client handle. More... | |
void | GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch) |
Shutdown ATS connectivity suggestion client. More... | |
struct GNUNET_ATS_ConnectivitySuggestHandle * | GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch, const struct GNUNET_PeerIdentity *peer, uint32_t strength) |
We would like to establish a new connection with a peer. More... | |
void | GNUNET_ATS_connectivity_suggest_cancel (struct GNUNET_ATS_ConnectivitySuggestHandle *sh) |
We no longer care about being connected to a peer. More... | |
struct GNUNET_ATS_SchedulingHandle * | GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressSuggestionCallback suggest_cb, void *suggest_cb_cls) |
Initialize the ATS scheduling subsystem. More... | |
void | GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh) |
Client is done with ATS scheduling, release resources. More... | |
struct GNUNET_ATS_AddressRecord * | GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, const struct GNUNET_ATS_Properties *prop) |
We have a new address ATS should know. More... | |
void | GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar, struct GNUNET_ATS_Session *session) |
An address was used to initiate a session. More... | |
int | GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar, struct GNUNET_ATS_Session *session) |
A session was destroyed, disassociate it from the given address record. More... | |
void | GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar, const struct GNUNET_ATS_Properties *prop) |
We have updated performance statistics for a given address. More... | |
void | GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar) |
An address got destroyed, stop using it as a valid address. More... | |
struct GNUNET_ATS_PerformanceHandle * | GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AddressInformationCallback addr_info_cb, void *addr_info_cb_cls) |
Get handle to access performance API of the ATS subsystem. More... | |
struct GNUNET_ATS_AddressListHandle * | GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, int all, GNUNET_ATS_AddressInformationCallback infocb, void *infocb_cls) |
Get information about addresses known to the ATS subsystem. More... | |
void | GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandle *alh) |
Cancel a pending address listing operation. More... | |
void | GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph) |
Client is done using the ATS performance subsystem, release resources. More... | |
struct GNUNET_ATS_ReservationContext * | GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, int32_t amount, GNUNET_ATS_ReservationCallback rcb, void *rcb_cls) |
Reserve inbound bandwidth from the given peer. More... | |
void | GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc) |
Cancel request for reserving bandwidth. More... | |
const char * | GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type) |
Convert an enum GNUNET_ATS_PreferenceType to a string. More... | |
void | GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer,...) |
Change preferences for the given peer. More... | |
void | GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TIME_Relative scope,...) |
Application feedback on how good preference requirements are fulfilled for the preferences included in the given time scope [now - scope . More... | |
struct GNUNET_ATS_TransportHandle * | GNUNET_ATS_transport_init (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_ATS_AllocationCallback alloc_cb, void *alloc_cb_cls, GNUNET_ATS_SuggestionCallback suggest_cb, void *suggest_cb_cls) |
Initialize the ATS transport subsystem. More... | |
void | GNUNET_ATS_transport_done (struct GNUNET_ATS_TransportHandle *ath) |
Client is done with ATS transport, release resources. More... | |
struct GNUNET_ATS_SessionRecord * | GNUNET_ATS_session_add (struct GNUNET_ATS_TransportHandle *ath, const struct GNUNET_PeerIdentity *pid, const char *address, struct GNUNET_ATS_Session *session, const struct GNUNET_ATS_Properties *prop) |
We have a new session ATS should know. More... | |
void | GNUNET_ATS_session_update (struct GNUNET_ATS_SessionRecord *ar, const struct GNUNET_ATS_Properties *prop) |
We have updated performance statistics for a given session. More... | |
void | GNUNET_ATS_session_del (struct GNUNET_ATS_SessionRecord *ar) |
A session was destroyed, ATS should now schedule and allocate under the assumption that this ar is no longer in use. More... | |
Bandwidth allocation.
Bandwidth allocation for transport service.
Automatic Transport Selection and outbound bandwidth determination.
#define GNUNET_ATS_DefaultBandwidth 65536 |
Default bandwidth assigned to a network : 64 KB/s.
Definition at line 49 of file gnunet_ats_service.h.
#define GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX |
Undefined value for an enum GNUNET_ATS_Property
Definition at line 54 of file gnunet_ats_service.h.
#define GNUNET_ATS_VALUE_UNDEFINED_STR "undefined" |
String representation for GNUNET_ATS_VALUE_UNDEFINED.
Definition at line 59 of file gnunet_ats_service.h.
#define GNUNET_ATS_MaxBandwidth UINT32_MAX |
Maximum bandwidth assigned to a network : 4095 MB/s.
Definition at line 64 of file gnunet_ats_service.h.
#define GNUNET_ATS_MaxBandwidthString "unlimited" |
Textual equivalent for GNUNET_ATS_MaxBandwidth.
Definition at line 69 of file gnunet_ats_service.h.
#define GNUNET_ATS_PreferenceType |
ATS preference types as array initializer.
Definition at line 537 of file gnunet_ats_service.h.
#define GNUNET_ATS_PreferenceTypeString { "BANDWIDTH", "LATENCY", "END" } |
ATS preference types as string array initializer.
Definition at line 544 of file gnunet_ats_service.h.
typedef void(* GNUNET_ATS_AddressSuggestionCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
Signature of a function called by ATS with the current bandwidth and address preferences as determined by ATS.
If our connection to ATS dies and thus all suggestions become invalid, this function is called ONCE with all arguments (except cls) being NULL/0.
cls | closure |
peer | for which we suggest an address, NULL if ATS connection died |
address | suggested address (including peer identity of the peer), may be NULL to signal disconnect from peer |
session | session to use, NULL to establish a new outgoing session |
bandwidth_out | assigned outbound bandwidth for the connection, 0 to signal disconnect |
bandwidth_in | assigned inbound bandwidth for the connection, 0 to signal disconnect |
Definition at line 268 of file gnunet_ats_service.h.
typedef void(* GNUNET_ATS_AddressInformationCallback) (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop) |
Signature of a function that is called with QoS information about an address.
cls | closure |
address | the address, NULL if ATS service was disconnected or when the iteration is completed in the case of GNUNET_ATS_performance_list_addresses() |
address_active | GNUNET_YES if this address is actively used to maintain a connection to a peer; GNUNET_NO if the address is not actively used; GNUNET_SYSERR if this address is no longer available for ATS |
bandwidth_out | assigned outbound bandwidth for the connection |
bandwidth_in | assigned inbound bandwidth for the connection |
prop | performance data for the address |
Definition at line 406 of file gnunet_ats_service.h.
typedef void(* GNUNET_ATS_ReservationCallback) (void *cls, const struct GNUNET_PeerIdentity *peer, int32_t amount, struct GNUNET_TIME_Relative res_delay) |
Function called with reservation result.
cls | closure |
peer | identifies the peer |
amount | set to the amount that was actually reserved or unreserved; either the full requested amount or zero (no partial reservations) |
res_delay | if the reservation could not be satisfied (amount was 0), how long should the client wait until re-trying? |
Definition at line 490 of file gnunet_ats_service.h.
typedef void(* GNUNET_ATS_AllocationCallback) (void *cls, struct GNUNET_ATS_Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
Signature of a function called by ATS with the current bandwidth allocation to be used as determined by ATS.
cls | closure |
session | session this is about |
bandwidth_out | assigned outbound bandwidth for the connection, 0 to signal disconnect |
bandwidth_in | assigned inbound bandwidth for the connection, 0 to signal disconnect |
Definition at line 136 of file gnunet_ats_transport_service.h.
typedef void(* GNUNET_ATS_SuggestionCallback) (void *cls, const struct GNUNET_PeerIdentity *pid, const char *address) |
Signature of a function called by ATS suggesting transport to try connecting with a particular address.
cls | closure |
pid | target peer |
address | the address to try |
Definition at line 153 of file gnunet_ats_transport_service.h.
Enum defining all known preference categories.
Definition at line 549 of file gnunet_ats_service.h.
struct GNUNET_ATS_ApplicationHandle* GNUNET_ATS_application_init | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Initialize the ATS application client handle.
cfg | configuration to use |
void GNUNET_ATS_application_done | ( | struct GNUNET_ATS_ApplicationHandle * | ch | ) |
Shutdown ATS application client.
ch | handle to destroy |
struct GNUNET_ATS_ApplicationSuggestHandle* GNUNET_ATS_application_suggest | ( | struct GNUNET_ATS_ApplicationHandle * | ch, |
const struct GNUNET_PeerIdentity * | peer, | ||
enum GNUNET_MQ_PreferenceKind | pk, | ||
struct GNUNET_BANDWIDTH_Value32NBO | bw | ||
) |
An application would like to communicate with a peer.
ATS should allocate bandwidth using a suitable address for requiremetns pk to transport.
ch | handle |
peer | identity of the peer we need an address for |
pk | what kind of application will the application require (can be GNUNET_MQ_PREFERENCE_NONE, we will still try to connect) |
bw | desired bandwidth, can be zero (we will still try to connect) |
void GNUNET_ATS_application_suggest_cancel | ( | struct GNUNET_ATS_ApplicationSuggestHandle * | sh | ) |
We no longer care about communicating with a peer.
sh | handle |
void GNUNET_ATS_properties_hton | ( | struct GNUNET_ATS_PropertiesNBO * | nbo, |
const struct GNUNET_ATS_Properties * | hbo | ||
) |
Convert ATS properties from host to network byte order.
nbo[out] | value written |
hbo | value read |
nbo[OUT] | value written |
hbo | value read |
Definition at line 36 of file ats_api_scanner.c.
References GNUNET_ATS_PropertiesNBO::delay, GNUNET_ATS_Properties::delay, GNUNET_ATS_Properties::distance, GNUNET_ATS_PropertiesNBO::distance, GNUNET_TIME_relative_hton(), GNUNET_ATS_Properties::scope, GNUNET_ATS_PropertiesNBO::scope, GNUNET_ATS_Properties::utilization_in, GNUNET_ATS_PropertiesNBO::utilization_in, GNUNET_ATS_Properties::utilization_out, and GNUNET_ATS_PropertiesNBO::utilization_out.
Referenced by GNUNET_ATS_address_add(), GNUNET_ATS_address_update(), GNUNET_TRANSPORT_manipulation_set(), notify_client(), and transmit_req_addr().
void GNUNET_ATS_properties_ntoh | ( | struct GNUNET_ATS_Properties * | hbo, |
const struct GNUNET_ATS_PropertiesNBO * | nbo | ||
) |
Convert ATS properties from network to host byte order.
hbo[out] | value written |
nbo | value read |
hbo[OUT] | value written |
nbo | value read |
Definition at line 54 of file ats_api_scanner.c.
References GNUNET_ATS_PropertiesNBO::delay, GNUNET_ATS_Properties::delay, GNUNET_ATS_Properties::distance, GNUNET_ATS_PropertiesNBO::distance, GNUNET_TIME_relative_ntoh(), GNUNET_ATS_Properties::scope, GNUNET_ATS_PropertiesNBO::scope, GNUNET_ATS_Properties::utilization_in, GNUNET_ATS_PropertiesNBO::utilization_in, GNUNET_ATS_Properties::utilization_out, and GNUNET_ATS_PropertiesNBO::utilization_out.
Referenced by GAS_handle_address_add(), GAS_handle_address_update(), GST_manipulation_set_metric(), handle_address_list(), and handle_peer_information().
struct GNUNET_ATS_ConnectivityHandle* GNUNET_ATS_connectivity_init | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Initialize the ATS connectivity suggestion client handle.
cfg | configuration to use |
Definition at line 227 of file ats_api_connectivity.c.
References cfg, ch, GNUNET_CONTAINER_multipeermap_create(), GNUNET_new, GNUNET_YES, and reconnect().
Referenced by GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_start_peer(), libgnunet_plugin_dhtu_gnunet_init(), opstart_get_handle_ats_connectivity(), and run().
void GNUNET_ATS_connectivity_done | ( | struct GNUNET_ATS_ConnectivityHandle * | ch | ) |
Shutdown ATS connectivity suggestion client.
ch | handle to destroy |
Shutdown ATS connectivity suggestion client.
ch | handle to release |
Definition at line 267 of file ats_api_connectivity.c.
References ch, free_sug_handle(), GNUNET_CONTAINER_multipeermap_destroy(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), and GNUNET_CADET_Channel::mq.
Referenced by cleaning_task(), end(), GNUNET_TRANSPORT_TESTING_restart_peer(), GNUNET_TRANSPORT_TESTING_stop_peer(), libgnunet_plugin_dhtu_gnunet_done(), oprelease_get_handle_ats_connectivity(), run(), shutdown_rest(), and shutdown_task().
struct GNUNET_ATS_ConnectivitySuggestHandle* GNUNET_ATS_connectivity_suggest | ( | struct GNUNET_ATS_ConnectivityHandle * | ch, |
const struct GNUNET_PeerIdentity * | peer, | ||
uint32_t | strength | ||
) |
We would like to establish a new connection with a peer.
ATS should suggest a good address to begin with.
ch | handle |
peer | identity of the peer we need an address for |
strength | how urgent is the need for such a suggestion |
We would like to establish a new connection with a peer.
ATS will respond with a call to the continuation immediately containing an address or no address if none is available. ATS can suggest more addresses until we call GNUNET_ATS_connectivity_suggest_cancel().
ch | handle |
peer | identity of the peer we need an address for |
strength | how urgent is the need for such a suggestion |
Definition at line 299 of file ats_api_connectivity.c.
References GNUNET_ATS_ConnectivitySuggestHandle::ch, ch, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CONTAINER_multipeermap_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_i2s(), GNUNET_new, GNUNET_OK, GNUNET_ATS_ConnectivitySuggestHandle::id, LOG, GNUNET_CADET_Channel::mq, peer, GNUNET_ATS_ConnectivitySuggestHandle::strength, and transmit_suggestion().
Referenced by attempt_connect(), consider_peer_activate(), gnunet_drop(), gnunet_hold(), GNUNET_TRANSPORT_TESTING_connect_peers(), notify_disconnect(), occ_cache_get_handle_ats_occ_cb(), occ_cache_get_handle_ats_rocc_cb(), run(), and setup_neighbour().
void GNUNET_ATS_connectivity_suggest_cancel | ( | struct GNUNET_ATS_ConnectivitySuggestHandle * | sh | ) |
We no longer care about being connected to a peer.
sh | handle to stop |
Definition at line 334 of file ats_api_connectivity.c.
Referenced by attempt_connect(), cleanup_occ_lp2c(), cleanup_rocc(), consider_peer_activate(), core_disconnect_cb(), destroy_peer(), end(), free_neighbour(), free_peer(), gnunet_drop(), gnunet_hold(), GNUNET_TRANSPORT_TESTING_connect_peers_cancel(), notify_connect(), and shutdown_task().
struct GNUNET_ATS_SchedulingHandle* GNUNET_ATS_scheduling_init | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_ATS_AddressSuggestionCallback | suggest_cb, | ||
void * | suggest_cb_cls | ||
) |
Initialize the ATS scheduling subsystem.
cfg | configuration to use |
suggest_cb | notification to call whenever the suggestation changed |
suggest_cb_cls | closure for suggest_cb |
Definition at line 561 of file ats_api_scheduling.c.
References cfg, GNUNET_array_grow, GNUNET_new, reconnect(), sh, GNUNET_ATS_SchedulingHandle::suggest_cb, and GNUNET_ATS_SchedulingHandle::suggest_cb_cls.
Referenced by run().
void GNUNET_ATS_scheduling_done | ( | struct GNUNET_ATS_SchedulingHandle * | sh | ) |
Client is done with ATS scheduling, release resources.
sh | handle to release |
Definition at line 585 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, GNUNET_array_grow, GNUNET_free, GNUNET_HELLO_address_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), and sh.
Referenced by shutdown_task().
struct GNUNET_ATS_AddressRecord* GNUNET_ATS_address_add | ( | struct GNUNET_ATS_SchedulingHandle * | sh, |
const struct GNUNET_HELLO_Address * | address, | ||
struct GNUNET_ATS_Session * | session, | ||
const struct GNUNET_ATS_Properties * | prop | ||
) |
We have a new address ATS should know.
Addresses have to be added with this function before they can be: updated, set in use and destroyed
sh | handle |
address | the address |
session | session handle (if available, e.g for incoming connections) |
prop | performance data for the address |
Addresses have to be added with this function before they can be: updated, set in use and destroyed.
sh | handle |
address | the address |
session | session handle, can be NULL |
prop | performance data for the address |
Definition at line 629 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, address, find_empty_session_slot(), find_session_id(), GNUNET_ATS_properties_hton(), GNUNET_break, GNUNET_HELLO_address_copy(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_new, GNUNET_NT_UNSPECIFIED, NOT_FOUND, GNUNET_ATS_AddressRecord::properties, GNUNET_ATS_Properties::scope, send_add_address_message(), GNUNET_ATS_AddressRecord::session, GNUNET_ATS_AddressRecord::sh, sh, and GNUNET_ATS_AddressRecord::slot.
Referenced by GST_ats_add_address(), GST_ats_add_inbound_address(), and unblock_address().
void GNUNET_ATS_address_add_session | ( | struct GNUNET_ATS_AddressRecord * | ar, |
struct GNUNET_ATS_Session * | session | ||
) |
An address was used to initiate a session.
ar | address record to update information for |
session | session handle |
Definition at line 688 of file ats_api_scheduling.c.
References GNUNET_break, and GNUNET_ATS_AddressRecord::session.
Referenced by GST_ats_new_session().
int GNUNET_ATS_address_del_session | ( | struct GNUNET_ATS_AddressRecord * | ar, |
struct GNUNET_ATS_Session * | session | ||
) |
A session was destroyed, disassociate it from the given address record.
If this was an incoming address, destroys the address as well.
ar | address record to update information for |
session | session handle |
Definition at line 697 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, GNUNET_assert, GNUNET_ATS_address_destroy(), GNUNET_HELLO_address_check_option(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_NO, GNUNET_YES, and GNUNET_ATS_AddressRecord::session.
Referenced by GST_ats_block_address(), and GST_ats_del_session().
void GNUNET_ATS_address_update | ( | struct GNUNET_ATS_AddressRecord * | ar, |
const struct GNUNET_ATS_Properties * | prop | ||
) |
We have updated performance statistics for a given address.
Note that this function can be called for addresses that are currently in use as well as addresses that are valid but not actively in use. Furthermore, the peer may not even be connected to us right now (session value of NULL used to signal disconnect, or somehow we otherwise got updated on ats information). Based on the information provided, ATS may update bandwidth assignments and suggest to switch addresses.
ar | address record to update information for |
prop | performance data for the address |
Note that this function can be called for addresses that are currently in use as well as addresses that are valid but not actively in use. Furthermore, the peer may not even be connected to us right now (in which case the call may be ignored or the information may be stored for later use). Update bandwidth assignments.
ar | address record to update information for |
prop | performance data for the address |
Definition at line 724 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, GNUNET_ATS_properties_hton(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NT_UNSPECIFIED, LOG, m, GNUNET_HELLO_Address::peer, GNUNET_ATS_AddressRecord::properties, GNUNET_ATS_Properties::scope, GNUNET_ATS_AddressRecord::session, GNUNET_ATS_AddressRecord::sh, sh, GNUNET_ATS_AddressRecord::slot, and GNUNET_HELLO_Address::transport_name.
Referenced by GST_ats_update_delay(), GST_ats_update_distance(), and GST_ats_update_utilization().
void GNUNET_ATS_address_destroy | ( | struct GNUNET_ATS_AddressRecord * | ar | ) |
An address got destroyed, stop using it as a valid address.
ar | address record to destroy, its validation has expired and ATS may no longer use it |
ar | address to destroy |
Definition at line 757 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_YES, GNUNET_ATS_AddressRecord::in_destroy, LOG, m, GNUNET_HELLO_Address::peer, GNUNET_ATS_AddressRecord::session, GNUNET_ATS_AddressRecord::sh, sh, GNUNET_ATS_AddressRecord::slot, and GNUNET_HELLO_Address::transport_name.
Referenced by destroy_ai(), GNUNET_ATS_address_del_session(), GST_ats_block_address(), and GST_ats_del_session().
struct GNUNET_ATS_PerformanceHandle* GNUNET_ATS_performance_init | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_ATS_AddressInformationCallback | addr_info_cb, | ||
void * | addr_info_cb_cls | ||
) |
Get handle to access performance API of the ATS subsystem.
cfg | configuration to use |
addr_info_cb | callback called when performance characteristics for an address change |
addr_info_cb_cls | closure for addr_info_cb |
Definition at line 613 of file ats_api_performance.c.
References GNUNET_ATS_PerformanceHandle::addr_info_cb, addr_info_cb(), GNUNET_ATS_PerformanceHandle::addr_info_cb_cls, cfg, GNUNET_ATS_PerformanceHandle::cfg, GNUNET_free, GNUNET_new, GNUNET_ATS_PerformanceHandle::mq, ph, and reconnect().
Referenced by run().
struct GNUNET_ATS_AddressListHandle* GNUNET_ATS_performance_list_addresses | ( | struct GNUNET_ATS_PerformanceHandle * | ph, |
const struct GNUNET_PeerIdentity * | peer, | ||
int | all, | ||
GNUNET_ATS_AddressInformationCallback | infocb, | ||
void * | infocb_cls | ||
) |
Get information about addresses known to the ATS subsystem.
ph | the performance handle to use |
peer | peer idm can be NULL for all peers |
all | GNUNET_YES to get information about all addresses or GNUNET_NO to get only address currently used |
infocb | callback to call with the addresses, will callback with address == NULL when done |
infocb_cls | closure for infocb |
Definition at line 715 of file ats_api_performance.c.
References GNUNET_ATS_PerformanceHandle::addresslist_head, GNUNET_ATS_PerformanceHandle::addresslist_tail, alh, AddressListRequestMessage::all, GNUNET_ATS_AddressListHandle::all_addresses, GNUNET_ATS_AddressListHandle::all_peers, GNUNET_ATS_AddressListHandle::cb, GNUNET_ATS_AddressListHandle::cb_cls, env, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_NO, GNUNET_YES, GNUNET_ATS_AddressListHandle::id, GNUNET_ATS_PerformanceHandle::id, m, GNUNET_ATS_PerformanceHandle::mq, GNUNET_ATS_AddressListHandle::peer, peer, ph, and GNUNET_ATS_AddressListHandle::ph.
Referenced by run().
void GNUNET_ATS_performance_list_addresses_cancel | ( | struct GNUNET_ATS_AddressListHandle * | alh | ) |
Cancel a pending address listing operation.
alh | the struct GNUNET_ATS_AddressListHandle handle to cancel |
Definition at line 764 of file ats_api_performance.c.
References GNUNET_ATS_PerformanceHandle::addresslist_head, GNUNET_ATS_PerformanceHandle::addresslist_tail, alh, GNUNET_CONTAINER_DLL_remove, GNUNET_free, ph, and GNUNET_ATS_AddressListHandle::ph.
Referenced by end().
void GNUNET_ATS_performance_done | ( | struct GNUNET_ATS_PerformanceHandle * | ph | ) |
Client is done using the ATS performance subsystem, release resources.
ph | handle |
Definition at line 639 of file ats_api_performance.c.
References GNUNET_ATS_PerformanceHandle::addresslist_head, GNUNET_ATS_PerformanceHandle::addresslist_tail, alh, GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_ATS_PerformanceHandle::mq, ph, GNUNET_ATS_ReservationContext::rcb, GNUNET_ATS_PerformanceHandle::reservation_head, GNUNET_ATS_PerformanceHandle::reservation_tail, and GNUNET_ATS_PerformanceHandle::task.
Referenced by do_shutdown(), end(), and shutdown_task().
struct GNUNET_ATS_ReservationContext* GNUNET_ATS_reserve_bandwidth | ( | struct GNUNET_ATS_PerformanceHandle * | ph, |
const struct GNUNET_PeerIdentity * | peer, | ||
int32_t | amount, | ||
GNUNET_ATS_ReservationCallback | rcb, | ||
void * | rcb_cls | ||
) |
Reserve inbound bandwidth from the given peer.
ATS will look at the current amount of traffic we receive from the peer and ensure that the peer could add 'amount' of data to its stream.
ph | performance handle |
peer | identifies the peer |
amount | reserve N bytes for receiving, negative amounts can be used to undo a (recent) reservation; |
rcb | function to call with the resulting reservation information |
rcb_cls | closure for rcb |
Definition at line 674 of file ats_api_performance.c.
References ReservationRequestMessage::amount, env, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_YES, m, GNUNET_ATS_PerformanceHandle::mq, GNUNET_ATS_ReservationContext::peer, peer, ph, GNUNET_ATS_ReservationContext::rcb, GNUNET_ATS_ReservationContext::rcb_cls, GNUNET_ATS_PerformanceHandle::reservation_head, GNUNET_ATS_PerformanceHandle::reservation_tail, GNUNET_ATS_ReservationContext::size, and GNUNET_ATS_ReservationContext::undo.
Referenced by GSF_peer_connect_handler(), handle_reservation_result(), retry_reservation(), and schedule_transmission().
void GNUNET_ATS_reserve_bandwidth_cancel | ( | struct GNUNET_ATS_ReservationContext * | rc | ) |
Cancel request for reserving bandwidth.
rc | context returned by the original GNUNET_ATS_reserve_bandwidth() call |
Definition at line 708 of file ats_api_performance.c.
References GNUNET_ATS_ReservationContext::rcb.
Referenced by GSF_peer_disconnect_handler().
const char* GNUNET_ATS_print_preference_type | ( | enum GNUNET_ATS_PreferenceKind | type | ) |
Convert an enum GNUNET_ATS_PreferenceType
to a string.
type | the preference type |
Definition at line 777 of file ats_api_performance.c.
References GNUNET_ATS_PREFERENCE_END, GNUNET_ATS_PreferenceTypeString, and type.
Referenced by GNUNET_ATS_solver_generate_preferences_start(), GNUNET_ATS_solver_generate_preferences_stop(), GNUNET_ATS_solver_logging_eval(), GNUNET_ATS_solver_logging_now(), load_op_start_set_preference(), load_op_stop_set_preference(), recalculate_relative_preferences(), set_feedback_task(), set_pref_task(), update_preference(), update_rel_sum(), and update_relative_values_for_peer().
void GNUNET_ATS_performance_change_preference | ( | struct GNUNET_ATS_PerformanceHandle * | ph, |
const struct GNUNET_PeerIdentity * | peer, | ||
... | |||
) |
Change preferences for the given peer.
Preference changes are forgotten if peers disconnect.
ph | performance handle |
peer | identifies the peer |
... | GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes |
Definition at line 788 of file ats_api_performance.c.
References env, GNUNET_assert, GNUNET_ATS_PREFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_END, GNUNET_ATS_PREFERENCE_LATENCY, GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_VA_ARG_ENUM, m, GNUNET_ATS_PerformanceHandle::mq, peer, ph, and pi.
Referenced by run(), and schedule_transmission().
void GNUNET_ATS_performance_give_feedback | ( | struct GNUNET_ATS_PerformanceHandle * | ph, |
const struct GNUNET_PeerIdentity * | peer, | ||
const struct GNUNET_TIME_Relative | scope, | ||
... | |||
) |
Application feedback on how good preference requirements are fulfilled for the preferences included in the given time scope [now - scope .
. now]
An application notifies ATS if (and only if) it has feedback information for specific properties. This values are valid until the feedback scores are updated by the application.
If the application has no feedback for this preference kind the application will not explicitly call for this property and will not include it in this function call.
ph | performance handle |
scope | the time interval this valid for: [now - scope .. now] |
peer | identifies the peer |
... | GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes |
Application feedback on how good preference requirements are fulfilled for the preferences included in the given time scope [now - scope .
ph | performance handle |
scope | the time interval this valid for: [now - scope .. now] |
peer | identifies the peer |
... | GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes |
Definition at line 872 of file ats_api_performance.c.
References env, GNUNET_assert, GNUNET_ATS_PREFERENCE_BANDWIDTH, GNUNET_ATS_PREFERENCE_END, GNUNET_ATS_PREFERENCE_LATENCY, GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TIME_relative_hton(), GNUNET_VA_ARG_ENUM, m, GNUNET_ATS_PerformanceHandle::mq, peer, ph, pi, and scope.
struct GNUNET_ATS_TransportHandle* GNUNET_ATS_transport_init | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_ATS_AllocationCallback | alloc_cb, | ||
void * | alloc_cb_cls, | ||
GNUNET_ATS_SuggestionCallback | suggest_cb, | ||
void * | suggest_cb_cls | ||
) |
Initialize the ATS transport subsystem.
cfg | configuration to use |
alloc_cb | notification to call whenever the allocation changed |
alloc_cb_cls | closure for alloc_cb |
suggest_cb | notification to call whenever the suggestation is made |
suggest_cb_cls | closure for suggest_cb |
void GNUNET_ATS_transport_done | ( | struct GNUNET_ATS_TransportHandle * | ath | ) |
Client is done with ATS transport, release resources.
ath | handle to release |
struct GNUNET_ATS_SessionRecord* GNUNET_ATS_session_add | ( | struct GNUNET_ATS_TransportHandle * | ath, |
const struct GNUNET_PeerIdentity * | pid, | ||
const char * | address, | ||
struct GNUNET_ATS_Session * | session, | ||
const struct GNUNET_ATS_Properties * | prop | ||
) |
We have a new session ATS should know.
Sessiones have to be added with this function before they can be: updated, set in use and destroyed
ath | handle |
pid | peer we connected to |
address | the address (human readable version), |
session | transport-internal handle for the session/queue, NULL if the session is inbound-only |
prop | performance data for the session |
void GNUNET_ATS_session_update | ( | struct GNUNET_ATS_SessionRecord * | ar, |
const struct GNUNET_ATS_Properties * | prop | ||
) |
We have updated performance statistics for a given session.
Based on the information provided, ATS may update bandwidth assignments.
ar | session record to update information for |
prop | performance data for the session |
void GNUNET_ATS_session_del | ( | struct GNUNET_ATS_SessionRecord * | ar | ) |
A session was destroyed, ATS should now schedule and allocate under the assumption that this ar is no longer in use.
ar | session record to drop |