aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-05-22 15:04:17 +0000
committerChristian Grothoff <christian@grothoff.org>2015-05-22 15:04:17 +0000
commit8d5551b3b718683d369bf343cb9cdb33c06d5906 (patch)
treec13f539ece60aca48985087c847fc5b3b698a3d2
parent8aea11bce3118cc01c66d3afb5c2ec02b766c95c (diff)
downloadgnunet-8d5551b3b718683d369bf343cb9cdb33c06d5906.tar.gz
gnunet-8d5551b3b718683d369bf343cb9cdb33c06d5906.zip
-do pass local_address_info flag from/to ATS also for performance monitor
-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 7e411fb98..f4c7af6cd 100644
--- a/src/ats/ats.h
+++ b/src/ats/ats.h
@@ -328,6 +328,12 @@ struct PeerInformationMessage
328 */ 328 */
329 struct GNUNET_ATS_PropertiesNBO properties; 329 struct GNUNET_ATS_PropertiesNBO properties;
330 330
331 /**
332 * Local-only information of the address, see
333 * `enum GNUNET_HELLO_AddressInfo`.
334 */
335 uint32_t address_local_info GNUNET_PACKED;
336
331 /* followed by: 337 /* followed by:
332 * - char address[address_length] 338 * - char address[address_length]
333 * - char plugin_name[plugin_name_length] (including '\0'-termination). 339 * - 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 a4166be10..0d71a44fb 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,
409 GNUNET_ATS_properties_ntoh (&prop, 409 GNUNET_ATS_properties_ntoh (&prop,
410 &pi->properties); 410 &pi->properties);
411 address.peer = pi->peer; 411 address.peer = pi->peer;
412 address.local_info = (enum GNUNET_HELLO_AddressInfo) ntohl (pi->address_local_info);
412 address.address = plugin_address; 413 address.address = plugin_address;
413 address.address_length = plugin_address_length; 414 address.address_length = plugin_address_length;
414 address.transport_name = plugin_name; 415 address.transport_name = plugin_name;
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 6fd345af5..1cf8368a2 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -37,7 +37,6 @@
37struct GNUNET_CONTAINER_MultiPeerMap *GSA_addresses; 37struct GNUNET_CONTAINER_MultiPeerMap *GSA_addresses;
38 38
39 39
40
41/** 40/**
42 * Update statistic on number of addresses. 41 * Update statistic on number of addresses.
43 */ 42 */
@@ -71,6 +70,7 @@ free_address (struct ATS_Address *addr)
71 addr->addr_len, 70 addr->addr_len,
72 GNUNET_NO, 71 GNUNET_NO,
73 NULL, 72 NULL,
73 addr->local_address_info,
74 GNUNET_BANDWIDTH_ZERO, 74 GNUNET_BANDWIDTH_ZERO,
75 GNUNET_BANDWIDTH_ZERO); 75 GNUNET_BANDWIDTH_ZERO);
76 GNUNET_free (addr->plugin); 76 GNUNET_free (addr->plugin);
@@ -257,6 +257,7 @@ GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
257 new_address->addr_len, 257 new_address->addr_len,
258 new_address->active, 258 new_address->active,
259 &new_address->properties, 259 &new_address->properties,
260 new_address->local_address_info,
260 GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_out), 261 GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_out),
261 GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_in)); 262 GNUNET_BANDWIDTH_value_init (new_address->assigned_bw_in));
262} 263}
@@ -304,6 +305,7 @@ GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
304 aa->addr_len, 305 aa->addr_len,
305 aa->active, 306 aa->active,
306 prop, 307 prop,
308 aa->local_address_info,
307 GNUNET_BANDWIDTH_value_init (aa->assigned_bw_out), 309 GNUNET_BANDWIDTH_value_init (aa->assigned_bw_out),
308 GNUNET_BANDWIDTH_value_init (aa->assigned_bw_in)); 310 GNUNET_BANDWIDTH_value_init (aa->assigned_bw_in));
309 311
@@ -448,6 +450,7 @@ peerinfo_it (void *cls,
448 addr->addr_len, 450 addr->addr_len,
449 addr->active, 451 addr->active,
450 &addr->properties, 452 &addr->properties,
453 addr->local_address_info,
451 GNUNET_BANDWIDTH_value_init (addr->assigned_bw_out), 454 GNUNET_BANDWIDTH_value_init (addr->assigned_bw_out),
452 GNUNET_BANDWIDTH_value_init (addr->assigned_bw_in)); 455 GNUNET_BANDWIDTH_value_init (addr->assigned_bw_in));
453 return GNUNET_OK; 456 return GNUNET_OK;
@@ -494,6 +497,7 @@ GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
494 NULL, NULL, NULL, 0, 497 NULL, NULL, NULL, 0,
495 GNUNET_NO, 498 GNUNET_NO,
496 NULL, 499 NULL,
500 GNUNET_HELLO_ADDRESS_INFO_NONE,
497 GNUNET_BANDWIDTH_ZERO, 501 GNUNET_BANDWIDTH_ZERO,
498 GNUNET_BANDWIDTH_ZERO); 502 GNUNET_BANDWIDTH_ZERO);
499} 503}
@@ -534,6 +538,7 @@ struct AddressIteration
534 * @param plugin_addr_len length of @a plugin_addr 538 * @param plugin_addr_len length of @a plugin_addr
535 * @param active #GNUNET_YES if this address is actively used 539 * @param active #GNUNET_YES if this address is actively used
536 * @param prop performance information 540 * @param prop performance information
541 * @param local_address_info flags for the address
537 * @param bandwidth_out current outbound bandwidth assigned to address 542 * @param bandwidth_out current outbound bandwidth assigned to address
538 * @param bandwidth_in current inbound bandwidth assigned to address 543 * @param bandwidth_in current inbound bandwidth assigned to address
539 */ 544 */
@@ -545,6 +550,7 @@ transmit_req_addr (struct AddressIteration *ai,
545 size_t plugin_addr_len, 550 size_t plugin_addr_len,
546 int active, 551 int active,
547 const struct GNUNET_ATS_Properties *prop, 552 const struct GNUNET_ATS_Properties *prop,
553 enum GNUNET_HELLO_AddressInfo local_address_info,
548 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 554 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
549 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 555 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
550 556
@@ -585,6 +591,7 @@ transmit_req_addr (struct AddressIteration *ai,
585 memset (&msg->properties, 591 memset (&msg->properties,
586 0, 592 0,
587 sizeof (struct GNUNET_ATS_Properties)); 593 sizeof (struct GNUNET_ATS_Properties));
594 msg->address_local_info = htonl ((uint32_t) local_address_info);
588 addrp = (char *) &msg[1]; 595 addrp = (char *) &msg[1];
589 if (NULL != plugin_addr) 596 if (NULL != plugin_addr)
590 memcpy (addrp, plugin_addr, plugin_addr_len); 597 memcpy (addrp, plugin_addr, plugin_addr_len);
@@ -616,6 +623,7 @@ transmit_req_addr (struct AddressIteration *ai,
616 * @param plugin_addr_len length of @a plugin_addr 623 * @param plugin_addr_len length of @a plugin_addr
617 * @param active is address actively used 624 * @param active is address actively used
618 * @param prop performance information 625 * @param prop performance information
626 * @param local_address_info additional local info for the address
619 * @param bandwidth_out current outbound bandwidth assigned to address 627 * @param bandwidth_out current outbound bandwidth assigned to address
620 * @param bandwidth_in current inbound bandwidth assigned to address 628 * @param bandwidth_in current inbound bandwidth assigned to address
621 */ 629 */
@@ -627,6 +635,7 @@ req_addr_peerinfo_it (void *cls,
627 size_t plugin_addr_len, 635 size_t plugin_addr_len,
628 int active, 636 int active,
629 const struct GNUNET_ATS_Properties *prop, 637 const struct GNUNET_ATS_Properties *prop,
638 enum GNUNET_HELLO_AddressInfo local_address_info,
630 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 639 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
631 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 640 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
632{ 641{
@@ -658,6 +667,7 @@ req_addr_peerinfo_it (void *cls,
658 plugin_addr, plugin_addr_len, 667 plugin_addr, plugin_addr_len,
659 active, 668 active,
660 prop, 669 prop,
670 local_address_info,
661 bandwidth_out, 671 bandwidth_out,
662 bandwidth_in); 672 bandwidth_in);
663} 673}
@@ -712,6 +722,7 @@ GAS_handle_request_address_list (void *cls,
712 NULL, NULL, NULL, 722 NULL, NULL, NULL,
713 0, GNUNET_NO, 723 0, GNUNET_NO,
714 NULL, 724 NULL,
725 GNUNET_HELLO_ADDRESS_INFO_NONE,
715 GNUNET_BANDWIDTH_ZERO, 726 GNUNET_BANDWIDTH_ZERO,
716 GNUNET_BANDWIDTH_ZERO); 727 GNUNET_BANDWIDTH_ZERO);
717 GNUNET_SERVER_receive_done (client, 728 GNUNET_SERVER_receive_done (client,
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index 072a3d078..b422b08db 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -301,9 +301,8 @@ struct ATS_Address
301 301
302 /** 302 /**
303 * Field to store local flags. 303 * Field to store local flags.
304 * FIXME: `enum GNUNET_HELLO_AddressInfo`?
305 */ 304 */
306 uint32_t local_address_info; 305 enum GNUNET_HELLO_AddressInfo local_address_info;
307 306
308 /** 307 /**
309 * ATS performance information for this address, size of the @e atsi array. 308 * ATS performance information for this address, size of the @e atsi array.
@@ -443,6 +442,7 @@ GAS_addresses_destroy_all (void);
443 * @param plugin_addr_len length of @a plugin_addr 442 * @param plugin_addr_len length of @a plugin_addr
444 * @param address_active is address actively used 443 * @param address_active is address actively used
445 * @param atsi ats performance information 444 * @param atsi ats performance information
445 * @param local_address_info flags for the address
446 * @param bandwidth_out current outbound bandwidth assigned to address 446 * @param bandwidth_out current outbound bandwidth assigned to address
447 * @param bandwidth_in current inbound bandwidth assigned to address 447 * @param bandwidth_in current inbound bandwidth assigned to address
448 */ 448 */
@@ -454,6 +454,7 @@ typedef void
454 size_t plugin_addr_len, 454 size_t plugin_addr_len,
455 const int address_active, 455 const int address_active,
456 const struct GNUNET_ATS_Properties *prop, 456 const struct GNUNET_ATS_Properties *prop,
457 enum GNUNET_HELLO_AddressInfo local_address_info,
457 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 458 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
458 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in); 459 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
459 460
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c
index 00b5de51c..d08a2d2de 100644
--- a/src/ats/gnunet-service-ats_performance.c
+++ b/src/ats/gnunet-service-ats_performance.c
@@ -22,6 +22,9 @@
22 * @brief ats service, interaction with 'performance' API 22 * @brief ats service, interaction with 'performance' API
23 * @author Matthias Wachs 23 * @author Matthias Wachs
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 * TODO:
27 * - simplify functions by passing a `struct GNUNET_HELLO_Address`
25 */ 28 */
26#include "platform.h" 29#include "platform.h"
27#include "gnunet-service-ats.h" 30#include "gnunet-service-ats.h"
@@ -55,6 +58,7 @@ static struct GNUNET_SERVER_NotificationContext *nc_pic;
55 * #GNUNET_NO if the address is not actively used; 58 * #GNUNET_NO if the address is not actively used;
56 * #GNUNET_SYSERR if this address is no longer available for ATS 59 * #GNUNET_SYSERR if this address is no longer available for ATS
57 * @param prop performance data for the address 60 * @param prop performance data for the address
61 * @param local_address_info information about the local flags for the address
58 * @param bandwidth_out assigned outbound bandwidth 62 * @param bandwidth_out assigned outbound bandwidth
59 * @param bandwidth_in assigned inbound bandwidth 63 * @param bandwidth_in assigned inbound bandwidth
60 */ 64 */
@@ -66,6 +70,7 @@ notify_client (struct GNUNET_SERVER_Client *client,
66 size_t plugin_addr_len, 70 size_t plugin_addr_len,
67 int active, 71 int active,
68 const struct GNUNET_ATS_Properties *prop, 72 const struct GNUNET_ATS_Properties *prop,
73 enum GNUNET_HELLO_AddressInfo local_address_info,
69 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 74 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
70 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 75 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
71{ 76{
@@ -98,6 +103,7 @@ notify_client (struct GNUNET_SERVER_Client *client,
98 memset (&msg->properties, 103 memset (&msg->properties,
99 0, 104 0,
100 sizeof (struct GNUNET_ATS_Properties)); 105 sizeof (struct GNUNET_ATS_Properties));
106 msg->address_local_info = htonl (local_address_info);
101 addrp = (char *) &msg[1]; 107 addrp = (char *) &msg[1];
102 memcpy (addrp, plugin_addr, plugin_addr_len); 108 memcpy (addrp, plugin_addr, plugin_addr_len);
103 strcpy (&addrp[plugin_addr_len], plugin_name); 109 strcpy (&addrp[plugin_addr_len], plugin_name);
@@ -138,6 +144,7 @@ notify_client (struct GNUNET_SERVER_Client *client,
138 * #GNUNET_NO if the address is not actively used; 144 * #GNUNET_NO if the address is not actively used;
139 * #GNUNET_SYSERR if this address is no longer available for ATS 145 * #GNUNET_SYSERR if this address is no longer available for ATS
140 * @param prop performance data for the address 146 * @param prop performance data for the address
147 * @param local_address_info information about the local flags for the address
141 * @param bandwidth_out assigned outbound bandwidth 148 * @param bandwidth_out assigned outbound bandwidth
142 * @param bandwidth_in assigned inbound bandwidth 149 * @param bandwidth_in assigned inbound bandwidth
143 */ 150 */
@@ -148,6 +155,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
148 size_t plugin_addr_len, 155 size_t plugin_addr_len,
149 int active, 156 int active,
150 const struct GNUNET_ATS_Properties *prop, 157 const struct GNUNET_ATS_Properties *prop,
158 enum GNUNET_HELLO_AddressInfo local_address_info,
151 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 159 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
152 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 160 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
153{ 161{
@@ -158,6 +166,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
158 plugin_addr_len, 166 plugin_addr_len,
159 active, 167 active,
160 prop, 168 prop,
169 local_address_info,
161 bandwidth_out, 170 bandwidth_out,
162 bandwidth_in); 171 bandwidth_in);
163 GNUNET_STATISTICS_update (GSA_stats, 172 GNUNET_STATISTICS_update (GSA_stats,
@@ -177,6 +186,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
177 * @param plugin_addr_len length of @a plugin_addr 186 * @param plugin_addr_len length of @a plugin_addr
178 * @param active is address actively used 187 * @param active is address actively used
179 * @param prop performance information 188 * @param prop performance information
189 * @param local_address_info information about the local flags for the address
180 * @param bandwidth_out current outbound bandwidth assigned to address 190 * @param bandwidth_out current outbound bandwidth assigned to address
181 * @param bandwidth_in current inbound bandwidth assigned to address 191 * @param bandwidth_in current inbound bandwidth assigned to address
182 */ 192 */
@@ -188,6 +198,7 @@ peerinfo_it (void *cls,
188 size_t plugin_addr_len, 198 size_t plugin_addr_len,
189 int active, 199 int active,
190 const struct GNUNET_ATS_Properties *prop, 200 const struct GNUNET_ATS_Properties *prop,
201 enum GNUNET_HELLO_AddressInfo local_address_info,
191 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 202 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
192 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 203 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
193{ 204{
@@ -208,6 +219,7 @@ peerinfo_it (void *cls,
208 plugin_addr_len, 219 plugin_addr_len,
209 active, 220 active,
210 prop, 221 prop,
222 local_address_info,
211 bandwidth_out, 223 bandwidth_out,
212 bandwidth_in); 224 bandwidth_in);
213} 225}
diff --git a/src/ats/gnunet-service-ats_performance.h b/src/ats/gnunet-service-ats_performance.h
index abdeb975f..eabee8797 100644
--- a/src/ats/gnunet-service-ats_performance.h
+++ b/src/ats/gnunet-service-ats_performance.h
@@ -45,6 +45,7 @@
45 * #GNUNET_NO if the address is not actively used; 45 * #GNUNET_NO if the address is not actively used;
46 * #GNUNET_SYSERR if this address is no longer available for ATS 46 * #GNUNET_SYSERR if this address is no longer available for ATS
47 * @param prop performance data for the address 47 * @param prop performance data for the address
48 * @param local_address_info information about the local flags for the address
48 * @param bandwidth_out assigned outbound bandwidth 49 * @param bandwidth_out assigned outbound bandwidth
49 * @param bandwidth_in assigned inbound bandwidth 50 * @param bandwidth_in assigned inbound bandwidth
50 */ 51 */
@@ -55,6 +56,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
55 size_t plugin_addr_len, 56 size_t plugin_addr_len,
56 int active, 57 int active,
57 const struct GNUNET_ATS_Properties *prop, 58 const struct GNUNET_ATS_Properties *prop,
59 enum GNUNET_HELLO_AddressInfo local_address_info,
58 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 60 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
59 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in); 61 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
60 62
diff --git a/src/ats/gnunet-service-ats_plugins.c b/src/ats/gnunet-service-ats_plugins.c
index 11f9c752c..f2e53ef6b 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,
217 address->addr_len, 217 address->addr_len,
218 address->active, 218 address->active,
219 &address->properties, 219 &address->properties,
220 address->local_address_info,
220 GNUNET_BANDWIDTH_value_init (address->assigned_bw_out), 221 GNUNET_BANDWIDTH_value_init (address->assigned_bw_out),
221 GNUNET_BANDWIDTH_value_init (address->assigned_bw_in)); 222 GNUNET_BANDWIDTH_value_init (address->assigned_bw_in));
222 223
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
index c030d7dc3..9ef2d275c 100644
--- a/src/include/gnunet_ats_service.h
+++ b/src/include/gnunet_ats_service.h
@@ -106,6 +106,12 @@ struct GNUNET_ATS_Properties
106{ 106{
107 107
108 /** 108 /**
109 * Delay. Time between when the time packet is sent and the packet
110 * arrives. FOREVER if we did not measure yet.
111 */
112 struct GNUNET_TIME_Relative delay;
113
114 /**
109 * Actual traffic on this connection from this peer to the other peer. 115 * Actual traffic on this connection from this peer to the other peer.
110 * Includes transport overhead. 116 * Includes transport overhead.
111 * 117 *
@@ -122,22 +128,16 @@ struct GNUNET_ATS_Properties
122 uint32_t utilization_in; 128 uint32_t utilization_in;
123 129
124 /** 130 /**
125 * Which network scope does the respective address belong to?
126 * This property does not change.
127 */
128 enum GNUNET_ATS_Network_Type scope;
129
130 /**
131 * Distance on network layer (required for distance-vector routing) 131 * Distance on network layer (required for distance-vector routing)
132 * in hops. Zero for direct connections (i.e. plain TCP/UDP). 132 * in hops. Zero for direct connections (i.e. plain TCP/UDP).
133 */ 133 */
134 unsigned int distance; 134 unsigned int distance;
135 135
136 /** 136 /**
137 * Delay. Time between when the time packet is sent and the packet 137 * Which network scope does the respective address belong to?
138 * arrives. FOREVER if we did not measure yet. 138 * This property does not change.
139 */ 139 */
140 struct GNUNET_TIME_Relative delay; 140 enum GNUNET_ATS_Network_Type scope;
141 141
142}; 142};
143 143