35 #define LOG(kind, ...) GNUNET_log_from (kind, "transport-ats", __VA_ARGS__) 141 "# blocked addresses",
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",
358 if ((NULL == session) ||
400 ai =
find_ai (address, session);
447 ai =
find_ai (address, session);
457 "Notifying ATS about peer `%s''s new inbound address `%s' session %p in network %s\n",
514 "Notifying ATS about peer %s's new address `%s'\n",
567 "Telling ATS about new session for peer %s\n",
601 "Telling ATS to destroy address from peer %s\n",
657 "Telling ATS to destroy session %p from peer %s\n",
742 "Updated distance for peer `%s' to %u\n",
778 "Updated latency for peer `%s' to %s\n",
817 "Updating utilization for peer `%s' address %s: %u/%u\n",
820 (
unsigned int) bps_in,
821 (
unsigned int) bps_out);
854 "Address %s of peer %s expired\n",
static struct GNUNET_PeerIdentity GST_my_identity
Our public key.
struct GNUNET_ATS_Session * session
Session to look for (only used if the address is inbound).
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 * GNUNET_NT_to_string(enum GNUNET_NetworkType net)
Convert a enum GNUNET_NetworkType to a string.
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.
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...
void GST_ats_done()
Shutdown ATS subsystem.
uint32_t utilization_in
Actual traffic on this connection from the other peer to this peer.
Closure for find_ai_cb() and find_ai_no_session_cb().
void GST_ats_update_distance(const struct GNUNET_HELLO_Address *address, uint32_t distance)
Notify ATS about DV distance change to an address.
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_assert(cond)
Use this for fatal errors that cannot be handled.
struct AddressInfo * ret
Where to store the result.
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...
void GST_ats_add_address(const struct GNUNET_HELLO_Address *address, const struct GNUNET_ATS_Properties *prop)
Notify ATS about the new address including the network this address is located in.
struct GNUNET_ATS_Properties properties
Performance properties of this address.
static unsigned int num_blocked
Number of blocked addresses.
interfacing between transport and ATS service
int 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.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_ATS_SchedulingHandle * GST_ats
ATS scheduling handle.
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).
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.
ATS performance characteristics for an address.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
static void destroy_ai(struct AddressInfo *ai)
Release memory used by the given address data.
static struct GNUNET_CONTAINER_MultiPeerMap * p2a
Map from peer identities to one or more struct AddressInfo values for the peer.
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.
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.
static struct GNUNET_STATISTICS_Handle * GST_stats
Statistics handle.
struct GNUNET_ATS_AddressRecord * ar
Record with ATS API for the address.
static char * value
Value of the record to add/remove.
Session handle for connections.
This is an inbound address and cannot be used to initiate an outbound connection to another peer...
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.
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...
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
const char * transport_name
Name of the transport plugin enabling the communication using this address.
struct GNUNET_TIME_Relative delay
Delay.
#define LOG(kind,...)
Log convenience function.
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.
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.
const char * GST_plugins_a2s(const struct GNUNET_HELLO_Address *address)
Convert a given address to a human-readable format.
Information we track per address, incoming or outgoing.
Internal representation of the hash map.
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_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.
Information we track for each address known to ATS.
int GST_ats_is_known_no_session(const struct GNUNET_HELLO_Address *address)
Test if ATS knows about this address.
static int destroy_ai_cb(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Release memory used by the given address data.
static struct AddressInfo * find_ai_no_session(const struct GNUNET_HELLO_Address *address)
Find the address information struct for the given address (ignoring sessions)
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.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static void unblock_address(void *cls)
The blocking time for an address has expired, allow ATS to suggest it again.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
#define GNUNET_TIME_STD_BACKOFF(r)
Perform our standard exponential back-off calculation, starting at 1 ms and then going by a factor of...
struct GNUNET_PeerIdentity peer
For which peer is this an address?
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change...
Allow multiple values with the same key.
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.
const struct GNUNET_HELLO_Address * address
Address to look for.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
The identity of the host (wraps the signing key of the peer).
void GST_ats_block_reset(const struct GNUNET_HELLO_Address *address, struct GNUNET_ATS_Session *session)
Reset address blocking time.
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.
An address for communicating with a peer.
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.
struct GNUNET_HELLO_Address * GNUNET_HELLO_address_copy(const struct GNUNET_HELLO_Address *address)
Copy an address struct.
Automatic transport selection and outbound bandwidth determination.
Entry in list of pending tasks.
void GNUNET_ATS_address_destroy(struct GNUNET_ATS_AddressRecord *ar)
An address got destroyed, stop using it as a valid 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.
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...
struct GNUNET_HELLO_Address * address
The address (with peer identity).
Time for absolute times used by GNUnet, in microseconds.
void GNUNET_ATS_address_add_session(struct GNUNET_ATS_AddressRecord *ar, struct GNUNET_ATS_Session *session)
An address was used to initiate a session.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
struct GNUNET_ATS_Session * session
Session (can be NULL)
static int find_ai_cb(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Find matching address info.
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
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.
#define GNUNET_HELLO_address_free(addr)
Free an address.
int expired
Set to GNUNET_YES if the address has expired but we could not yet remove it because we still have a v...
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.
static void publish_p2a_stat_update()
Provide an update on the p2a map size to statistics.
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.
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
#define gettext_noop(String)
void GST_ats_init()
Initialize ATS subsystem.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.