110 const void *plugin_addr,
111 size_t plugin_addr_len,
170 fac->exact_address = aa;
190 fac.exact_address = NULL;
195 return fac.exact_address;
202 const void *plugin_addr,
203 size_t plugin_addr_len,
204 uint32_t local_address_info,
234 "Adding new address for peer `%s' slot %u\n",
278 "Received ADDRESS_UPDATE for peer `%s' slot %u\n",
323 "Received ADDRESS_DESTROYED for peer `%s' session %u\n",
373 "Destroying all addresses\n");
394 "Shutting down addresses\n");
443 addr->local_address_info,
464 "Returning information for %s from a total of %u known addresses\n",
471 pi_ctx.
it_cls = pi_it_cls;
532 const void *plugin_addr,
533 size_t plugin_addr_len,
558 msg->id = htonl (
ai->id);
561 msg->address_length = htons (plugin_addr_len);
562 msg->address_active = ntohl (active);
569 msg->address_local_info = htonl ((uint32_t) local_address_info);
570 addrp = (
char *) &
msg[1];
575 strcpy (&addrp[plugin_addr_len],
601 const void *plugin_addr,
602 size_t plugin_addr_len,
613 (NULL == plugin_addr))
616 "Address iteration done for one peer\n");
620 "Callback for %s peer `%s' plugin `%s' BW out %u, BW in %u\n",
621 (active ==
GNUNET_YES) ?
"ACTIVE" :
"INACTIVE",
624 (
unsigned int) ntohl (bandwidth_out.
value__),
625 (
unsigned int) ntohl (bandwidth_in.
value__));
634 plugin_addr, plugin_addr_len,
651 "Received ADDRESSLIST_REQUEST message\n");
652 ai.all = ntohl (alrm->
all);
653 ai.id = ntohl (alrm->
id);
674 "Finished handling `%s' message\n",
675 "ADDRESSLIST_REQUEST");
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
struct GNUNET_STATISTICS_Handle * GSA_stats
Handle for statistics.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_HashCode session_id
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_HashCode key
The key used in the DHT.
static char * value
Value of the record to add/remove.
#define GAS_normalization_queue_length
void GAS_addresses_destroy(const struct GNUNET_PeerIdentity *peer, uint32_t session_id)
Remove an address for a peer.
static void req_addr_peerinfo_it(void *cls, const struct GNUNET_PeerIdentity *id, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, int active, const struct GNUNET_ATS_Properties *prop, enum GNUNET_HELLO_AddressInfo local_address_info, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Iterator for GAS_addresses_get_peer_info(), called with peer-specific information to be passed back t...
void GAS_addresses_get_peer_info(const struct GNUNET_PeerIdentity *peer, GNUNET_ATS_PeerInfo_Iterator pi_it, void *pi_it_cls)
Return information all peers currently known to ATS.
void GAS_addresses_init()
Initialize address subsystem.
struct GNUNET_CONTAINER_MultiPeerMap * GSA_addresses
A multihashmap to store all addresses.
static int find_address_cb(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Find session matching given session ID.
void GAS_addresses_update(const struct GNUNET_PeerIdentity *peer, uint32_t session_id, const struct GNUNET_ATS_Properties *prop)
Update an address with new performance information for a peer.
static struct ATS_Address * create_address(const struct GNUNET_PeerIdentity *peer, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, uint32_t local_address_info, uint32_t session_id)
Create a ATS_address with the given information.
void GAS_addresses_destroy_all()
Remove all addresses.
static struct ATS_Address * find_exact_address(const struct GNUNET_PeerIdentity *peer, uint32_t session_id)
Find the exact address.
static void update_addresses_stat()
Update statistic on number of addresses.
void GAS_addresses_add(const struct GNUNET_PeerIdentity *peer, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, uint32_t local_address_info, uint32_t session_id, const struct GNUNET_ATS_Properties *prop)
Add a new address for a peer.
static int peerinfo_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Iterator to iterate over a peer's addresses.
static void init_norm(struct GAS_NormalizationInfo *norm)
Initialize norm.
static void free_address(struct ATS_Address *addr)
Free the given address.
void GAS_handle_request_address_list(struct GNUNET_SERVICE_Client *client, const struct AddressListRequestMessage *alrm)
Handle 'address list request' messages from clients.
static int destroy_all_address_it(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Destroy all addresses iterator.
void GAS_addresses_done()
Shutdown address subsystem.
static void transmit_req_addr(struct AddressIteration *ai, const struct GNUNET_PeerIdentity *id, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, int active, const struct GNUNET_ATS_Properties *prop, enum GNUNET_HELLO_AddressInfo local_address_info, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Send a GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE with the given address details to the client iden...
ats service address management
void(* GNUNET_ATS_PeerInfo_Iterator)(void *cls, const struct GNUNET_PeerIdentity *id, const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len, const int address_active, const struct GNUNET_ATS_Properties *prop, enum GNUNET_HELLO_AddressInfo local_address_info, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
Iterator for GAS_addresses_get_peer_info()
void GAS_normalization_update_property(struct ATS_Address *address)
Update and normalize atsi performance information.
ats service address: management of ATS properties and preferences normalization
void GAS_plugin_solver_unlock()
Resume instant solving, we are done with the bulk state updates.
void GAS_plugin_solver_lock()
Stop instant solving, there are many state updates happening in bulk right now.
void GAS_plugin_delete_address(struct ATS_Address *address)
Tell the solver that the given address is no longer valid can cannot be used any longer.
void GAS_plugin_new_address(struct ATS_Address *new_address)
Tell the solver that the given address can now be used for talking to the respective peer.
ats service plugin management
static char * plugin_name
Name of our plugin.
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
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.
#define GNUNET_BANDWIDTH_ZERO
Convenience definition to use for 0-bandwidth.
struct GNUNET_BANDWIDTH_Value32NBO GNUNET_BANDWIDTH_value_init(uint32_t bytes_per_second)
Create a new bandwidth value.
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.
GNUNET_HELLO_AddressInfo
Additional local information about an address.
@ GNUNET_HELLO_ADDRESS_INFO_NONE
No additional information.
#define GNUNET_is_zero(a)
Check that memory in a is all zeros.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
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_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
@ GNUNET_NT_UNSPECIFIED
Category of last resort.
#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE
Type of the 'struct AddressListResponseMessage' sent by ATS to client with information about addresse...
struct GNUNET_MQ_Handle * GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
Obtain the message queue of c.
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_absolute_get(void)
Get the current time.
uint32_t fac(uint32_t x)
Factorial.
Address with additional information.
struct GAS_NormalizationInfo norm_delay
Normalized delay information for this address.
uint32_t assigned_bw_in
Inbound bandwidth assigned by solver.
char * plugin
Plugin name.
struct GNUNET_PeerIdentity peer
Peer ID this address is for.
int active
Is this the active address for this peer?
enum GNUNET_HELLO_AddressInfo local_address_info
Field to store local flags.
void * solver_information
Solver-specific information for this address.
struct GNUNET_TIME_Absolute t_last_activity
Time when address had last activity (update, in uses)
uint32_t assigned_bw_out
Outbound bandwidth assigned by solver.
struct GAS_NormalizationInfo norm_distance
Normalized distance information for this address.
struct GAS_NormalizationInfo norm_utilization_out
Normalized utilization outbound for this address.
uint32_t session_id
Session ID, can never be 0.
size_t addr_len
Address length, number of bytes in addr.
struct GAS_NormalizationInfo norm_utilization_in
Normalized utilization inbound for this address.
struct GNUNET_ATS_Properties properties
ATS performance information for this address.
const void * addr
Address (in plugin-specific binary format).
struct GNUNET_TIME_Absolute t_added
Time when address was added.
Information we need for the callbacks to return a list of addresses back to the client.
uint32_t id
Which ID should be included in the response?
struct GNUNET_SERVICE_Client * client
Actual handle to the client.
int all
Are we sending all addresses, or only those that are active?
Client to service: please give us an overview of the addresses.
uint32_t id
ID used to match replies to this request.
struct GNUNET_PeerIdentity peer
Which peer do we care about? All zeros for all.
int32_t all
GNUNET_YES to get information about all addresses, GNUNET_NO to only return addresses that are in use...
Closure for find_address_cb()
uint32_t session_id
Session Id to look for.
struct ATS_Address * exact_address
Where to store matching address result.
Information provided by ATS normalization.
uint64_t atsi_abs[3]
Averaging queue.
ATS performance characteristics for an address.
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
uint32_t value__
The actual value (bytes per second).
Internal representation of the hash map.
The identity of the host (wraps the signing key of the peer).
Handle to a client that is connected to a service.
Closure for peerinfo_it().
GNUNET_ATS_PeerInfo_Iterator it
Function to call for each address.
void * it_cls
Closure for it.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.