aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ats/ats.h6
-rw-r--r--src/ats/ats_api_performance.c1
-rw-r--r--src/ats/gnunet-service-ats_addresses.c13
-rw-r--r--src/ats/gnunet-service-ats_addresses.h5
-rw-r--r--src/ats/gnunet-service-ats_performance.c12
-rw-r--r--src/ats/gnunet-service-ats_performance.h2
-rw-r--r--src/ats/gnunet-service-ats_plugins.c1
-rw-r--r--src/include/gnunet_ats_service.h18
8 files changed, 46 insertions, 12 deletions
diff --git a/src/ats/ats.h b/src/ats/ats.h
index 7e411fb984..f4c7af6cdc 100644
--- a/src/ats/ats.h
+++ b/src/ats/ats.h
@@ -328,6 +328,12 @@ struct PeerInformationMessage
*/
struct GNUNET_ATS_PropertiesNBO properties;
+ /**
+ * Local-only information of the address, see
+ * `enum GNUNET_HELLO_AddressInfo`.
+ */
+ uint32_t address_local_info GNUNET_PACKED;
+
/* followed by:
* - char address[address_length]
* - char plugin_name[plugin_name_length] (including '\0'-termination).
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index a4166be100..0d71a44fbd 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -409,6 +409,7 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
GNUNET_ATS_properties_ntoh (&prop,
&pi->properties);
address.peer = pi->peer;
+ address.local_info = (enum GNUNET_HELLO_AddressInfo) ntohl (pi->address_local_info);
address.address = plugin_address;
address.address_length = plugin_address_length;
address.transport_name = plugin_name;
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 6fd345af52..1cf8368a28 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -37,7 +37,6 @@
struct GNUNET_CONTAINER_MultiPeerMap *GSA_addresses;
-
/**
* Update statistic on number of addresses.
*/
@@ -71,6 +70,7 @@ free_address (struct ATS_Address *addr)
addr->addr_len,
GNUNET_NO,
NULL,
+ addr->local_address_info,
GNUNET_BANDWIDTH_ZERO,
GNUNET_BANDWIDTH_ZERO);
GNUNET_free (addr->plugin);
@@ -257,6 +257,7 @@ GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
new_address->addr_len,
new_address->active,
&new_address->properties,
+ new_address->local_address_info,
GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_out),
GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_in));
}
@@ -304,6 +305,7 @@ GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
aa->addr_len,
aa->active,
prop,
+ aa->local_address_info,
GNUNET_BANDWIDTH_value_init (aa->assigned_bw_out),
GNUNET_BANDWIDTH_value_init (aa->assigned_bw_in));
@@ -448,6 +450,7 @@ peerinfo_it (void *cls,
addr->addr_len,
addr->active,
&addr->properties,
+ addr->local_address_info,
GNUNET_BANDWIDTH_value_init (addr->assigned_bw_out),
GNUNET_BANDWIDTH_value_init (addr->assigned_bw_in));
return GNUNET_OK;
@@ -494,6 +497,7 @@ GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
NULL, NULL, NULL, 0,
GNUNET_NO,
NULL,
+ GNUNET_HELLO_ADDRESS_INFO_NONE,
GNUNET_BANDWIDTH_ZERO,
GNUNET_BANDWIDTH_ZERO);
}
@@ -534,6 +538,7 @@ struct AddressIteration
* @param plugin_addr_len length of @a plugin_addr
* @param active #GNUNET_YES if this address is actively used
* @param prop performance information
+ * @param local_address_info flags for the address
* @param bandwidth_out current outbound bandwidth assigned to address
* @param bandwidth_in current inbound bandwidth assigned to address
*/
@@ -545,6 +550,7 @@ transmit_req_addr (struct AddressIteration *ai,
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)
@@ -585,6 +591,7 @@ transmit_req_addr (struct AddressIteration *ai,
memset (&msg->properties,
0,
sizeof (struct GNUNET_ATS_Properties));
+ msg->address_local_info = htonl ((uint32_t) local_address_info);
addrp = (char *) &msg[1];
if (NULL != plugin_addr)
memcpy (addrp, plugin_addr, plugin_addr_len);
@@ -616,6 +623,7 @@ transmit_req_addr (struct AddressIteration *ai,
* @param plugin_addr_len length of @a plugin_addr
* @param active is address actively used
* @param prop performance information
+ * @param local_address_info additional local info for the address
* @param bandwidth_out current outbound bandwidth assigned to address
* @param bandwidth_in current inbound bandwidth assigned to address
*/
@@ -627,6 +635,7 @@ req_addr_peerinfo_it (void *cls,
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)
{
@@ -658,6 +667,7 @@ req_addr_peerinfo_it (void *cls,
plugin_addr, plugin_addr_len,
active,
prop,
+ local_address_info,
bandwidth_out,
bandwidth_in);
}
@@ -712,6 +722,7 @@ GAS_handle_request_address_list (void *cls,
NULL, NULL, NULL,
0, GNUNET_NO,
NULL,
+ GNUNET_HELLO_ADDRESS_INFO_NONE,
GNUNET_BANDWIDTH_ZERO,
GNUNET_BANDWIDTH_ZERO);
GNUNET_SERVER_receive_done (client,
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index 072a3d078c..b422b08dbb 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -301,9 +301,8 @@ struct ATS_Address
/**
* Field to store local flags.
- * FIXME: `enum GNUNET_HELLO_AddressInfo`?
*/
- uint32_t local_address_info;
+ enum GNUNET_HELLO_AddressInfo local_address_info;
/**
* ATS performance information for this address, size of the @e atsi array.
@@ -443,6 +442,7 @@ GAS_addresses_destroy_all (void);
* @param plugin_addr_len length of @a plugin_addr
* @param address_active is address actively used
* @param atsi ats performance information
+ * @param local_address_info flags for the address
* @param bandwidth_out current outbound bandwidth assigned to address
* @param bandwidth_in current inbound bandwidth assigned to address
*/
@@ -454,6 +454,7 @@ typedef void
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);
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c
index 00b5de51ca..d08a2d2dec 100644
--- a/src/ats/gnunet-service-ats_performance.c
+++ b/src/ats/gnunet-service-ats_performance.c
@@ -22,6 +22,9 @@
* @brief ats service, interaction with 'performance' API
* @author Matthias Wachs
* @author Christian Grothoff
+ *
+ * TODO:
+ * - simplify functions by passing a `struct GNUNET_HELLO_Address`
*/
#include "platform.h"
#include "gnunet-service-ats.h"
@@ -55,6 +58,7 @@ static struct GNUNET_SERVER_NotificationContext *nc_pic;
* #GNUNET_NO if the address is not actively used;
* #GNUNET_SYSERR if this address is no longer available for ATS
* @param prop performance data for the address
+ * @param local_address_info information about the local flags for the address
* @param bandwidth_out assigned outbound bandwidth
* @param bandwidth_in assigned inbound bandwidth
*/
@@ -66,6 +70,7 @@ notify_client (struct GNUNET_SERVER_Client *client,
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)
{
@@ -98,6 +103,7 @@ notify_client (struct GNUNET_SERVER_Client *client,
memset (&msg->properties,
0,
sizeof (struct GNUNET_ATS_Properties));
+ msg->address_local_info = htonl (local_address_info);
addrp = (char *) &msg[1];
memcpy (addrp, plugin_addr, plugin_addr_len);
strcpy (&addrp[plugin_addr_len], plugin_name);
@@ -138,6 +144,7 @@ notify_client (struct GNUNET_SERVER_Client *client,
* #GNUNET_NO if the address is not actively used;
* #GNUNET_SYSERR if this address is no longer available for ATS
* @param prop performance data for the address
+ * @param local_address_info information about the local flags for the address
* @param bandwidth_out assigned outbound bandwidth
* @param bandwidth_in assigned inbound bandwidth
*/
@@ -148,6 +155,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
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)
{
@@ -158,6 +166,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
plugin_addr_len,
active,
prop,
+ local_address_info,
bandwidth_out,
bandwidth_in);
GNUNET_STATISTICS_update (GSA_stats,
@@ -177,6 +186,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
* @param plugin_addr_len length of @a plugin_addr
* @param active is address actively used
* @param prop performance information
+ * @param local_address_info information about the local flags for the address
* @param bandwidth_out current outbound bandwidth assigned to address
* @param bandwidth_in current inbound bandwidth assigned to address
*/
@@ -188,6 +198,7 @@ peerinfo_it (void *cls,
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)
{
@@ -208,6 +219,7 @@ peerinfo_it (void *cls,
plugin_addr_len,
active,
prop,
+ local_address_info,
bandwidth_out,
bandwidth_in);
}
diff --git a/src/ats/gnunet-service-ats_performance.h b/src/ats/gnunet-service-ats_performance.h
index abdeb975fc..eabee87979 100644
--- a/src/ats/gnunet-service-ats_performance.h
+++ b/src/ats/gnunet-service-ats_performance.h
@@ -45,6 +45,7 @@
* #GNUNET_NO if the address is not actively used;
* #GNUNET_SYSERR if this address is no longer available for ATS
* @param prop performance data for the address
+ * @param local_address_info information about the local flags for the address
* @param bandwidth_out assigned outbound bandwidth
* @param bandwidth_in assigned inbound bandwidth
*/
@@ -55,6 +56,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
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);
diff --git a/src/ats/gnunet-service-ats_plugins.c b/src/ats/gnunet-service-ats_plugins.c
index 11f9c752ca..f2e53ef6b9 100644
--- a/src/ats/gnunet-service-ats_plugins.c
+++ b/src/ats/gnunet-service-ats_plugins.c
@@ -217,6 +217,7 @@ bandwidth_changed_cb (void *cls,
address->addr_len,
address->active,
&address->properties,
+ address->local_address_info,
GNUNET_BANDWIDTH_value_init (address->assigned_bw_out),
GNUNET_BANDWIDTH_value_init (address->assigned_bw_in));
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
index c030d7dc3a..9ef2d275c2 100644
--- a/src/include/gnunet_ats_service.h
+++ b/src/include/gnunet_ats_service.h
@@ -106,6 +106,12 @@ struct GNUNET_ATS_Properties
{
/**
+ * Delay. Time between when the time packet is sent and the packet
+ * arrives. FOREVER if we did not measure yet.
+ */
+ struct GNUNET_TIME_Relative delay;
+
+ /**
* Actual traffic on this connection from this peer to the other peer.
* Includes transport overhead.
*
@@ -122,22 +128,16 @@ struct GNUNET_ATS_Properties
uint32_t utilization_in;
/**
- * Which network scope does the respective address belong to?
- * This property does not change.
- */
- enum GNUNET_ATS_Network_Type scope;
-
- /**
* Distance on network layer (required for distance-vector routing)
* in hops. Zero for direct connections (i.e. plain TCP/UDP).
*/
unsigned int distance;
/**
- * Delay. Time between when the time packet is sent and the packet
- * arrives. FOREVER if we did not measure yet.
+ * Which network scope does the respective address belong to?
+ * This property does not change.
*/
- struct GNUNET_TIME_Relative delay;
+ enum GNUNET_ATS_Network_Type scope;
};