35 #define LOG(kind, ...) GNUNET_log_from (kind, "transport-ats", __VA_ARGS__)
141 "# blocked addresses",
299 ai->unblock_task = NULL;
301 "Unblocking address %s of peer %s\n",
336 if ((NULL ==
ai) || (NULL ==
ai->ar))
347 "Removing address %s of peer %s from use (inbound died)\n",
352 "Blocking address %s of peer %s from use for %s\n",
437 if (NULL ==
address->transport_name)
457 "Notifying ATS about peer `%s''s new inbound address `%s' session %p in network %s\n",
470 ai->properties = *prop;
493 if (NULL ==
address->transport_name)
507 "Notifying ATS about peer %s's new address `%s'\n",
518 ai->properties = *prop;
560 "Telling ATS about new session for peer %s\n",
583 if (NULL !=
ai->unblock_task)
586 ai->unblock_task = NULL;
594 "Telling ATS to destroy address from peer %s\n",
650 "Telling ATS to destroy session %p from peer %s\n",
735 "Updated distance for peer `%s' to %u\n",
738 ai->properties.distance = distance;
764 "Updated latency for peer `%s' to %s\n",
803 "Updating utilization for peer `%s' address %s: %u/%u\n",
806 (
unsigned int) bps_in,
807 (
unsigned int) bps_out);
808 ai->properties.utilization_in = bps_in;
809 ai->properties.utilization_out = bps_out;
840 "Address %s of peer %s expired\n",
849 if (NULL !=
ai->session)
#define gettext_noop(String)
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static char * address
GNS address for this phone.
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
static struct GNUNET_PeerIdentity GST_my_identity
Our public key.
static struct GNUNET_STATISTICS_Handle * GST_stats
Statistics handle.
struct GNUNET_ATS_SchedulingHandle * GST_ats
ATS scheduling handle.
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.
static struct GNUNET_CONTAINER_MultiPeerMap * p2a
Map from peer identities to one or more struct AddressInfo values for the peer.
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.
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.
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.
void GST_ats_init()
Initialize ATS subsystem.
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.
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.
static struct AddressInfo * find_ai(const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session)
Find the address information struct for the given address and session.
static struct AddressInfo * find_ai_no_session(const struct GNUNET_HELLO_Address *address)
Find the address information struct for the given address (ignoring sessions)
static int destroy_ai_cb(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Release memory used by the given address data.
void GST_ats_block_reset(const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session)
Reset address blocking time.
static unsigned int num_blocked
Number of blocked addresses.
int GST_ats_is_known_no_session(const struct GNUNET_HELLO_Address *address)
Test if ATS knows about this address.
static void publish_p2a_stat_update()
Provide an update on the p2a map size to statistics.
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.
static int find_ai_no_session_cb(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Find matching address info, ignoring sessions and expired addresses.
static int find_ai_cb(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Find matching address info.
static void destroy_ai(struct AddressInfo *ai)
Release memory used by the given address data.
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.
void GST_ats_done()
Shutdown ATS subsystem.
static void unblock_address(void *cls)
The blocking time for an address has expired, allow ATS to suggest it again.
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.
#define LOG(kind,...)
Log convenience function.
void GST_ats_update_distance(const struct GNUNET_HELLO_Address *address, uint32_t distance)
Notify ATS about DV distance change to an address.
interfacing between transport and ATS service
void GST_manipulation_manipulate_metrics(const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session, struct GNUNET_ATS_Properties *prop)
Function that will be called to manipulate ATS information according to current manipulation settings...
const char * GST_plugins_a2s(const struct GNUNET_HELLO_Address *address)
Convert a given address to a human-readable format.
Automatic transport selection and outbound bandwidth determination.
void GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar, struct GNUNET_ATS_Session *session)
An address was used to initiate a 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.
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.
void GNUNET_ATS_address_destroy(struct GNUNET_ATS_AddressRecord *ar)
An address got destroyed, stop using it as a valid address.
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.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
int GNUNET_CONTAINER_multipeermap_get_multiple(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map that match a particular key.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
#define GNUNET_HELLO_address_free(addr)
Free an address.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_copy(const struct GNUNET_HELLO_Address *address)
Copy an address struct.
int GNUNET_HELLO_address_check_option(const struct GNUNET_HELLO_Address *address, enum GNUNET_HELLO_AddressInfo option)
Check if an address has a local option set.
int GNUNET_HELLO_address_cmp(const struct GNUNET_HELLO_Address *a1, const struct GNUNET_HELLO_Address *a2)
Compare two addresses.
@ GNUNET_HELLO_ADDRESS_INFO_INBOUND
This is an inbound address and cannot be used to initiate an outbound connection to another peer.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
const char * GNUNET_NT_to_string(enum GNUNET_NetworkType net)
Convert a enum GNUNET_NetworkType to a string.
@ GNUNET_NT_UNSPECIFIED
Category of last resort.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
Information we track for each address known to ATS.
int expired
Set to GNUNET_YES if the address has expired but we could not yet remove it because we still have a v...
struct GNUNET_ATS_AddressRecord * ar
Record with ATS API for the address.
struct GNUNET_SCHEDULER_Task * unblock_task
Task scheduled to unblock an ATS-blocked address at blocked time, or NULL if the address is not block...
struct GNUNET_ATS_Properties properties
Performance properties of this address.
struct GNUNET_TIME_Relative back_off
If an address is blocked as part of an exponential back-off, we track the current size of the backoff...
struct GNUNET_ATS_Session * session
Session (can be NULL)
struct GNUNET_TIME_Absolute blocked
Time until when this address is blocked and should thus not be made available to ATS (ar should be NU...
struct GNUNET_HELLO_Address * address
The address (with peer identity).
Closure for find_ai_cb() and find_ai_no_session_cb().
struct GNUNET_ATS_Session * session
Session to look for (only used if the address is inbound).
struct AddressInfo * ret
Where to store the result.
const struct GNUNET_HELLO_Address * address
Address to look for.
Information we track per address, incoming or outgoing.
ATS performance characteristics for an address.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change.
Session handle for connections.
Internal representation of the hash map.
An address for communicating with a peer.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
char * address
The actual address.