automatic transport selection and outbound bandwidth determination More...
Go to the source code of this file.
Data Structures | |
struct | GNUNET_ATS_AddressRecord |
Information we track per address, incoming or outgoing. More... | |
struct | GNUNET_ATS_SchedulingHandle |
Handle to the ATS subsystem for bandwidth/transport scheduling information. More... | |
Macros | |
#define | INTERFACE_PROCESSING_INTERVAL |
How frequently do we scan the interfaces for changes to the addresses? More... | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "ats-scheduling-api", __VA_ARGS__) |
#define | NOT_FOUND 0 |
Session ID we use if there is no session / slot. More... | |
Functions | |
static void | reconnect (struct GNUNET_ATS_SchedulingHandle *sh) |
Re-establish the connection to the ATS service. More... | |
static void | reconnect_task (void *cls) |
Re-establish the connection to the ATS service. More... | |
static void | force_reconnect (struct GNUNET_ATS_SchedulingHandle *sh) |
Disconnect from ATS and then reconnect. More... | |
static struct GNUNET_ATS_AddressRecord * | find_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id, const struct GNUNET_PeerIdentity *peer) |
Find the session object corresponding to the given session ID. More... | |
static uint32_t | find_empty_session_slot (struct GNUNET_ATS_SchedulingHandle *sh) |
Get an available session ID. More... | |
static uint32_t | find_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct GNUNET_ATS_Session *session, const struct GNUNET_HELLO_Address *address) |
Get the ID for the given session object. More... | |
static void | release_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id) |
Release the session slot from the session table (ATS service is also done using it). More... | |
static void | handle_ats_session_release (void *cls, const struct GNUNET_ATS_SessionReleaseMessage *srm) |
Type of a function to call when we receive a session release message from the service. More... | |
static void | handle_ats_address_suggestion (void *cls, const struct AddressSuggestionMessage *m) |
Type of a function to call when we receive a address suggestion message from the service. More... | |
static void | error_handler (void *cls, enum GNUNET_MQ_Error error) |
We encountered an error handling the MQ to the ATS service. More... | |
static void | send_add_address_message (struct GNUNET_ATS_SchedulingHandle *sh, const struct GNUNET_ATS_AddressRecord *ar) |
Generate and transmit the struct AddressAddMessage for the given address record. 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... | |
automatic transport selection and outbound bandwidth determination
TODO:
Definition in file ats_api_scheduling.c.
#define INTERFACE_PROCESSING_INTERVAL |
How frequently do we scan the interfaces for changes to the addresses?
Definition at line 41 of file ats_api_scheduling.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "ats-scheduling-api", __VA_ARGS__) |
Definition at line 44 of file ats_api_scheduling.c.
#define NOT_FOUND 0 |
Session ID we use if there is no session / slot.
Definition at line 49 of file ats_api_scheduling.c.
|
static |
Re-establish the connection to the ATS service.
sh | handle to use to re-connect. |
Definition at line 512 of file ats_api_scheduling.c.
References error_handler(), force_reconnect(), GNUNET_assert, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION, GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE, GNUNET_MESSAGE_TYPE_ATS_START, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_msg, GNUNET_MQ_send(), handlers, init, send_add_address_message(), sh, and START_FLAG_SCHEDULING.
Referenced by GNUNET_ATS_scheduling_init(), and reconnect_task().
|
static |
Re-establish the connection to the ATS service.
cls | handle to use to re-connect. |
Definition at line 164 of file ats_api_scheduling.c.
References reconnect(), and sh.
Referenced by force_reconnect().
|
static |
Disconnect from ATS and then reconnect.
sh | our handle |
Definition at line 179 of file ats_api_scheduling.c.
References GNUNET_BANDWIDTH_ZERO, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_add_delayed(), GNUNET_TIME_STD_BACKOFF, reconnect_task(), and sh.
Referenced by error_handler(), handle_ats_address_suggestion(), reconnect(), and release_session().
|
static |
Find the session object corresponding to the given session ID.
sh | our handle |
session_id | current session ID |
peer | peer the session belongs to |
Definition at line 206 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, GNUNET_break, GNUNET_memcmp, GNUNET_HELLO_Address::peer, peer, session_id, and sh.
Referenced by handle_ats_address_suggestion().
|
static |
Get an available session ID.
sh | our handle |
Definition at line 248 of file ats_api_scheduling.c.
References GNUNET_array_grow, GNUNET_assert, NOT_FOUND, and sh.
Referenced by GNUNET_ATS_address_add().
|
static |
Get the ID for the given session object.
sh | our handle |
session | session object |
address | the address we are looking for |
Definition at line 282 of file ats_api_scheduling.c.
References address, GNUNET_break, GNUNET_HELLO_address_cmp(), GNUNET_memcmp, GNUNET_NO, NOT_FOUND, GNUNET_ATS_AddressRecord::session, and sh.
Referenced by GNUNET_ATS_address_add().
|
static |
Release the session slot from the session table (ATS service is also done using it).
sh | our handle |
session_id | identifies session that is no longer valid |
Definition at line 315 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, force_reconnect(), GNUNET_break, GNUNET_free, GNUNET_HELLO_address_free, NOT_FOUND, GNUNET_ATS_AddressRecord::session, session_id, and sh.
Referenced by handle_ats_session_release().
|
static |
Type of a function to call when we receive a session release message from the service.
cls | the struct GNUNET_ATS_SchedulingHandle |
srm | message received |
Definition at line 350 of file ats_api_scheduling.c.
References release_session(), GNUNET_ATS_SessionReleaseMessage::session_id, and sh.
|
static |
Type of a function to call when we receive a address suggestion message from the service.
cls | the struct GNUNET_ATS_SchedulingHandle |
m | message received |
Definition at line 370 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, find_session(), force_reconnect(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_HELLO_address_check_option(), GNUNET_HELLO_ADDRESS_INFO_INBOUND, GNUNET_i2s(), GNUNET_TIME_UNIT_ZERO, GNUNET_YES, GNUNET_ATS_AddressRecord::in_destroy, LOG, m, GNUNET_HELLO_Address::peer, GNUNET_ATS_AddressRecord::session, session_id, sh, GNUNET_ATS_AddressRecord::slot, and GNUNET_HELLO_Address::transport_name.
|
static |
We encountered an error handling the MQ to the ATS service.
Reconnect.
cls | the struct GNUNET_ATS_SchedulingHandle |
error | details about the error |
Definition at line 446 of file ats_api_scheduling.c.
References force_reconnect(), GNUNET_ERROR_TYPE_DEBUG, LOG, and sh.
Referenced by reconnect().
|
static |
Generate and transmit the struct AddressAddMessage
for the given address record.
sh | the scheduling handle to use for transmission |
ar | the address to inform the ATS service about |
Definition at line 466 of file ats_api_scheduling.c.
References GNUNET_ATS_AddressRecord::address, GNUNET_HELLO_Address::address, GNUNET_HELLO_Address::address_length, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NT_UNSPECIFIED, GNUNET_HELLO_Address::local_info, LOG, m, GNUNET_HELLO_Address::peer, pm, GNUNET_ATS_AddressRecord::properties, GNUNET_ATS_PropertiesNBO::scope, GNUNET_ATS_AddressRecord::session, sh, GNUNET_ATS_AddressRecord::slot, and GNUNET_HELLO_Address::transport_name.
Referenced by GNUNET_ATS_address_add(), and reconnect().