aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/ats.h6
-rw-r--r--src/ats/ats_api.c8
-rw-r--r--src/ats/ats_api.h2
-rw-r--r--src/ats/ats_api_performance.c8
-rw-r--r--src/ats/ats_api_scheduling.c20
-rw-r--r--src/ats/gnunet-service-ats_addresses.c8
-rw-r--r--src/ats/gnunet-service-ats_addresses.h3
-rw-r--r--src/ats/gnunet-service-ats_math.c12
-rw-r--r--src/ats/gnunet-service-ats_math.h12
-rw-r--r--src/ats/gnunet-service-ats_performance.c12
-rw-r--r--src/ats/gnunet-service-ats_performance.h4
-rw-r--r--src/ats/gnunet-service-ats_scheduling.c20
-rw-r--r--src/ats/gnunet-service-ats_scheduling.h2
-rw-r--r--src/ats/test_ats_api_bandwidth_consumption.c6
-rw-r--r--src/ats/test_ats_api_scheduling.c6
-rw-r--r--src/ats/test_ats_api_update_address.c6
16 files changed, 67 insertions, 68 deletions
diff --git a/src/ats/ats.h b/src/ats/ats.h
index bef63553e..fbc6ca712 100644
--- a/src/ats/ats.h
+++ b/src/ats/ats.h
@@ -77,7 +77,7 @@ struct AddressUpdateMessage
77 uint32_t session_id GNUNET_PACKED; 77 uint32_t session_id GNUNET_PACKED;
78 78
79 /* followed by: 79 /* followed by:
80 - struct GNUNET_TRANSPORT_ATS_Information [ats_count]; 80 - struct GNUNET_ATS_Information [ats_count];
81 - char address[address_length] 81 - char address[address_length]
82 - char plugin_name[plugin_name_length] (including '\0'-termination). 82 - char plugin_name[plugin_name_length] (including '\0'-termination).
83 */ 83 */
@@ -126,7 +126,7 @@ struct AddressSuggestionMessage
126 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; 126 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
127 127
128 /* followed by: 128 /* followed by:
129 - struct GNUNET_TRANSPORT_ATS_Information [ats_count]; 129 - struct GNUNET_ATS_Information [ats_count];
130 - char address[address_length] 130 - char address[address_length]
131 - char plugin_name[plugin_name_length] (including '\0'-termination). 131 - char plugin_name[plugin_name_length] (including '\0'-termination).
132 */ 132 */
@@ -151,7 +151,7 @@ struct PeerInformationMessage
151 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; 151 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
152 152
153 /* followed by: 153 /* followed by:
154 - struct GNUNET_TRANSPORT_ATS_Information [ats_count]; 154 - struct GNUNET_ATS_Information [ats_count];
155 - char address[address_length] 155 - char address[address_length]
156 - char plugin_name[plugin_name_length] (including '\0'-termination). 156 - char plugin_name[plugin_name_length] (including '\0'-termination).
157 */ 157 */
diff --git a/src/ats/ats_api.c b/src/ats/ats_api.c
index 29a273e3e..61d3895d2 100644
--- a/src/ats/ats_api.c
+++ b/src/ats/ats_api.c
@@ -523,7 +523,7 @@ update_session (void *cls, const GNUNET_HashCode * key, void *value)
523static struct AllocationRecord * 523static struct AllocationRecord *
524create_allocation_record (const char *plugin_name, struct Session *session, 524create_allocation_record (const char *plugin_name, struct Session *session,
525 const void *plugin_addr, size_t plugin_addr_len, 525 const void *plugin_addr, size_t plugin_addr_len,
526 const struct GNUNET_TRANSPORT_ATS_Information *ats, 526 const struct GNUNET_ATS_Information *ats,
527 uint32_t ats_count) 527 uint32_t ats_count)
528{ 528{
529 struct AllocationRecord *ar; 529 struct AllocationRecord *ar;
@@ -539,7 +539,7 @@ create_allocation_record (const char *plugin_name, struct Session *session,
539 GNUNET_assert (ats_count > 0); 539 GNUNET_assert (ats_count > 0);
540 GNUNET_array_grow (ar->ats, ar->ats_count, ats_count); 540 GNUNET_array_grow (ar->ats, ar->ats_count, ats_count);
541 memcpy (ar->ats, ats, 541 memcpy (ar->ats, ats,
542 ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 542 ats_count * sizeof (struct GNUNET_ATS_Information));
543 ar->connected = GNUNET_SYSERR; /* aka: not known / no change */ 543 ar->connected = GNUNET_SYSERR; /* aka: not known / no change */
544 return ar; 544 return ar;
545} 545}
@@ -587,7 +587,7 @@ GNUNET_ATS_peer_connect (struct GNUNET_ATS_SchedulingHandle *atc,
587 const struct GNUNET_PeerIdentity *peer, 587 const struct GNUNET_PeerIdentity *peer,
588 const char *plugin_name, struct Session *session, 588 const char *plugin_name, struct Session *session,
589 const void *plugin_addr, size_t plugin_addr_len, 589 const void *plugin_addr, size_t plugin_addr_len,
590 const struct GNUNET_TRANSPORT_ATS_Information *ats, 590 const struct GNUNET_ATS_Information *ats,
591 uint32_t ats_count) 591 uint32_t ats_count)
592{ 592{
593 struct AllocationRecord *ar; 593 struct AllocationRecord *ar;
@@ -761,7 +761,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *atc,
761 struct GNUNET_TIME_Absolute valid_until, 761 struct GNUNET_TIME_Absolute valid_until,
762 const char *plugin_name, struct Session *session, 762 const char *plugin_name, struct Session *session,
763 const void *plugin_addr, size_t plugin_addr_len, 763 const void *plugin_addr, size_t plugin_addr_len,
764 const struct GNUNET_TRANSPORT_ATS_Information *ats, 764 const struct GNUNET_ATS_Information *ats,
765 uint32_t ats_count) 765 uint32_t ats_count)
766{ 766{
767 struct AllocationRecord *ar; 767 struct AllocationRecord *ar;
diff --git a/src/ats/ats_api.h b/src/ats/ats_api.h
index 2c98194be..a10607817 100644
--- a/src/ats/ats_api.h
+++ b/src/ats/ats_api.h
@@ -37,7 +37,7 @@ struct AllocationRecord
37 /** 37 /**
38 * Performance information associated with this address (array). 38 * Performance information associated with this address (array).
39 */ 39 */
40 struct GNUNET_TRANSPORT_ATS_Information *ats; 40 struct GNUNET_ATS_Information *ats;
41 41
42 /** 42 /**
43 * Name of the plugin 43 * Name of the plugin
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index 2cae8a51f..c3a5d2bed 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -250,7 +250,7 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
250 const struct GNUNET_MessageHeader *msg) 250 const struct GNUNET_MessageHeader *msg)
251{ 251{
252 const struct PeerInformationMessage *pi; 252 const struct PeerInformationMessage *pi;
253 const struct GNUNET_TRANSPORT_ATS_Information *atsi; 253 const struct GNUNET_ATS_Information *atsi;
254 const char *address; 254 const char *address;
255 const char *plugin_name; 255 const char *plugin_name;
256 uint16_t address_length; 256 uint16_t address_length;
@@ -271,14 +271,14 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
271 ats_count = ntohl (pi->ats_count); 271 ats_count = ntohl (pi->ats_count);
272 address_length = ntohs (pi->address_length); 272 address_length = ntohs (pi->address_length);
273 plugin_name_length = ntohs (pi->plugin_name_length); 273 plugin_name_length = ntohs (pi->plugin_name_length);
274 atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &pi[1]; 274 atsi = (const struct GNUNET_ATS_Information*) &pi[1];
275 address = (const char*) &atsi[ats_count]; 275 address = (const char*) &atsi[ats_count];
276 plugin_name = &address[address_length]; 276 plugin_name = &address[address_length];
277 if ( (address_length + 277 if ( (address_length +
278 plugin_name_length + 278 plugin_name_length +
279 ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + 279 ats_count * sizeof (struct GNUNET_ATS_Information) +
280 sizeof (struct PeerInformationMessage) != ntohs (msg->size)) || 280 sizeof (struct PeerInformationMessage) != ntohs (msg->size)) ||
281 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)) || 281 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)) ||
282 (plugin_name[plugin_name_length - 1] != '\0') ) 282 (plugin_name[plugin_name_length - 1] != '\0') )
283 { 283 {
284 GNUNET_break (0); 284 GNUNET_break (0);
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index 53a21f996..4855efadb 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -317,7 +317,7 @@ process_ats_message (void *cls,
317{ 317{
318 struct GNUNET_ATS_SchedulingHandle *sh = cls; 318 struct GNUNET_ATS_SchedulingHandle *sh = cls;
319 const struct AddressSuggestionMessage *m; 319 const struct AddressSuggestionMessage *m;
320 const struct GNUNET_TRANSPORT_ATS_Information *atsi; 320 const struct GNUNET_ATS_Information *atsi;
321 const char *address; 321 const char *address;
322 const char *plugin_name; 322 const char *plugin_name;
323 uint16_t address_length; 323 uint16_t address_length;
@@ -345,15 +345,15 @@ process_ats_message (void *cls,
345 m = (const struct AddressSuggestionMessage*) msg; 345 m = (const struct AddressSuggestionMessage*) msg;
346 ats_count = ntohl (m->ats_count); 346 ats_count = ntohl (m->ats_count);
347 address_length = ntohs (m->address_length); 347 address_length = ntohs (m->address_length);
348 atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; 348 atsi = (const struct GNUNET_ATS_Information*) &m[1];
349 address = (const char*) &atsi[ats_count]; 349 address = (const char*) &atsi[ats_count];
350 plugin_name = &address[address_length]; 350 plugin_name = &address[address_length];
351 plugin_name_length = ntohs (m->plugin_name_length); 351 plugin_name_length = ntohs (m->plugin_name_length);
352 if ( (address_length + 352 if ( (address_length +
353 plugin_name_length + 353 plugin_name_length +
354 ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + 354 ats_count * sizeof (struct GNUNET_ATS_Information) +
355 sizeof (struct AddressSuggestionMessage) != ntohs (msg->size)) || 355 sizeof (struct AddressSuggestionMessage) != ntohs (msg->size)) ||
356 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)) || 356 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)) ||
357 (plugin_name[plugin_name_length - 1] != '\0') ) 357 (plugin_name[plugin_name_length - 1] != '\0') )
358 { 358 {
359 GNUNET_break (0); 359 GNUNET_break (0);
@@ -525,23 +525,23 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
525 const char *plugin_name, 525 const char *plugin_name,
526 const void *plugin_addr, size_t plugin_addr_len, 526 const void *plugin_addr, size_t plugin_addr_len,
527 struct Session *session, 527 struct Session *session,
528 const struct GNUNET_TRANSPORT_ATS_Information *ats, 528 const struct GNUNET_ATS_Information *ats,
529 uint32_t ats_count) 529 uint32_t ats_count)
530{ 530{
531 struct PendingMessage *p; 531 struct PendingMessage *p;
532 struct AddressUpdateMessage *m; 532 struct AddressUpdateMessage *m;
533 struct GNUNET_TRANSPORT_ATS_Information *am; 533 struct GNUNET_ATS_Information *am;
534 char *pm; 534 char *pm;
535 size_t namelen; 535 size_t namelen;
536 size_t msize; 536 size_t msize;
537 537
538 namelen = (plugin_name == NULL) ? 0 : strlen (plugin_name) + 1; 538 namelen = (plugin_name == NULL) ? 0 : strlen (plugin_name) + 1;
539 msize = sizeof (struct AddressUpdateMessage) + plugin_addr_len + 539 msize = sizeof (struct AddressUpdateMessage) + plugin_addr_len +
540 ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + namelen; 540 ats_count * sizeof (struct GNUNET_ATS_Information) + namelen;
541 if ( (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 541 if ( (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
542 (plugin_addr_len >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 542 (plugin_addr_len >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
543 (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 543 (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
544 (ats_count >= GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)) ) 544 (ats_count >= GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)) )
545 { 545 {
546 GNUNET_break (0); 546 GNUNET_break (0);
547 return; 547 return;
@@ -557,8 +557,8 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
557 m->address_length = htons (plugin_addr_len); 557 m->address_length = htons (plugin_addr_len);
558 m->plugin_name_length = htons (namelen); 558 m->plugin_name_length = htons (namelen);
559 m->session_id = htonl (get_session_id (sh, session)); 559 m->session_id = htonl (get_session_id (sh, session));
560 am = (struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; 560 am = (struct GNUNET_ATS_Information*) &m[1];
561 memcpy (am, ats, ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 561 memcpy (am, ats, ats_count * sizeof (struct GNUNET_ATS_Information));
562 pm = (char *) &am[ats_count]; 562 pm = (char *) &am[ats_count];
563 memcpy (pm, plugin_addr, plugin_addr_len); 563 memcpy (pm, plugin_addr, plugin_addr_len);
564 memcpy (&pm[plugin_addr_len], plugin_name, namelen); 564 memcpy (&pm[plugin_addr_len], plugin_name, namelen);
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 9c504b26c..2bcb9913a 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -46,7 +46,7 @@ struct ATS_Address
46 46
47 char * plugin; 47 char * plugin;
48 48
49 struct GNUNET_TRANSPORT_ATS_Information * ats; 49 struct GNUNET_ATS_Information * ats;
50 50
51 struct GNUNET_BANDWIDTH_Value32NBO bw_in; 51 struct GNUNET_BANDWIDTH_Value32NBO bw_in;
52 52
@@ -144,18 +144,18 @@ GAS_address_update (const struct GNUNET_PeerIdentity *peer,
144 const void *plugin_addr, size_t plugin_addr_len, 144 const void *plugin_addr, size_t plugin_addr_len,
145 struct GNUNET_SERVER_Client *session_client, 145 struct GNUNET_SERVER_Client *session_client,
146 uint32_t session_id, 146 uint32_t session_id,
147 const struct GNUNET_TRANSPORT_ATS_Information *atsi, 147 const struct GNUNET_ATS_Information *atsi,
148 uint32_t atsi_count) 148 uint32_t atsi_count)
149{ 149{
150 struct ATS_Address * aa; 150 struct ATS_Address * aa;
151 struct ATS_Address * old; 151 struct ATS_Address * old;
152 152
153 aa = GNUNET_malloc (sizeof (struct ATS_Address) + plugin_addr_len); 153 aa = GNUNET_malloc (sizeof (struct ATS_Address) + plugin_addr_len);
154 aa->ats = GNUNET_malloc(atsi_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 154 aa->ats = GNUNET_malloc(atsi_count * sizeof (struct GNUNET_ATS_Information));
155 aa->peer = *peer; 155 aa->peer = *peer;
156 aa->addr_len = plugin_addr_len; 156 aa->addr_len = plugin_addr_len;
157 aa->ats_count = atsi_count; 157 aa->ats_count = atsi_count;
158 memcpy (aa->ats, atsi, atsi_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 158 memcpy (aa->ats, atsi, atsi_count * sizeof (struct GNUNET_ATS_Information));
159 aa->addr = &aa[1]; 159 aa->addr = &aa[1];
160 memcpy (&aa[1], plugin_addr, plugin_addr_len); 160 memcpy (&aa[1], plugin_addr, plugin_addr_len);
161 aa->plugin = GNUNET_strdup (plugin_name); 161 aa->plugin = GNUNET_strdup (plugin_name);
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index fdb3df678..335876720 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -28,7 +28,6 @@
28#define GNUNET_SERVICE_ATS_ADDRESSES_H 28#define GNUNET_SERVICE_ATS_ADDRESSES_H
29 29
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_transport_service.h" // FIXME...
32#include "gnunet_ats_service.h" 31#include "gnunet_ats_service.h"
33#include "ats.h" 32#include "ats.h"
34 33
@@ -53,7 +52,7 @@ GAS_address_update (const struct GNUNET_PeerIdentity *peer,
53 const void *plugin_addr, size_t plugin_addr_len, 52 const void *plugin_addr, size_t plugin_addr_len,
54 struct GNUNET_SERVER_Client *session_client, 53 struct GNUNET_SERVER_Client *session_client,
55 uint32_t session_id, 54 uint32_t session_id,
56 const struct GNUNET_TRANSPORT_ATS_Information *atsi, 55 const struct GNUNET_ATS_Information *atsi,
57 uint32_t atsi_count); 56 uint32_t atsi_count);
58 57
59 58
diff --git a/src/ats/gnunet-service-ats_math.c b/src/ats/gnunet-service-ats_math.c
index 220fe522b..8d25e25c6 100644
--- a/src/ats/gnunet-service-ats_math.c
+++ b/src/ats/gnunet-service-ats_math.c
@@ -513,8 +513,8 @@ _dummy2 ()
513struct ATS_Handle * 513struct ATS_Handle *
514ats_init (double D, double U, double R, int v_b_min, int v_n_min, 514ats_init (double D, double U, double R, int v_b_min, int v_n_min,
515 int max_iterations, struct GNUNET_TIME_Relative max_duration, 515 int max_iterations, struct GNUNET_TIME_Relative max_duration,
516 GNUNET_TRANSPORT_ATS_AddressNotification address_not, 516 GNUNET_ATS_AddressNotification address_not,
517 GNUNET_TRANSPORT_ATS_ResultCallback res_cb) 517 GNUNET_ATS_ResultCallback res_cb)
518{ 518{
519 struct ATS_Handle *ats = NULL; 519 struct ATS_Handle *ats = NULL;
520 520
@@ -850,7 +850,7 @@ ats_create_problem (struct ATS_Handle *ats, struct ATS_internals *stat,
850 { 850 {
851 ia[array_index] = row_index; 851 ia[array_index] = row_index;
852 ja[array_index] = c2; 852 ja[array_index] = c2;
853 if (qm[c - 1].atis_index == GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY) 853 if (qm[c - 1].atis_index == GNUNET_ATS_QUALITY_NET_DELAY)
854 { 854 {
855 double v0 = 0, v1 = 0, v2 = 0; 855 double v0 = 0, v1 = 0, v2 = 0;
856 856
@@ -866,7 +866,7 @@ ats_create_problem (struct ATS_Handle *ats, struct ATS_internals *stat,
866 value = 100.0 / ((v0 + 2 * v1 + 3 * v2) / 6.0); 866 value = 100.0 / ((v0 + 2 * v1 + 3 * v2) / 6.0);
867 value = 1; 867 value = 1;
868 } 868 }
869 if (qm[c - 1].atis_index == GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE) 869 if (qm[c - 1].atis_index == GNUNET_ATS_QUALITY_NET_DISTANCE)
870 { 870 {
871 double v0 = 0, v1 = 0, v2 = 0; 871 double v0 = 0, v1 = 0, v2 = 0;
872 872
@@ -1243,7 +1243,7 @@ ats_update_problem_qm (struct ATS_Handle *ats)
1243 GNUNET_assert (ats->mechanisms[c2].addr != NULL); 1243 GNUNET_assert (ats->mechanisms[c2].addr != NULL);
1244 GNUNET_assert (ats->mechanisms[c2].peer != NULL); 1244 GNUNET_assert (ats->mechanisms[c2].peer != NULL);
1245 1245
1246 if (qm[c - 1].atis_index == GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY) 1246 if (qm[c - 1].atis_index == GNUNET_ATS_QUALITY_NET_DELAY)
1247 { 1247 {
1248 double v0 = 0, v1 = 0, v2 = 0; 1248 double v0 = 0, v1 = 0, v2 = 0;
1249 1249
@@ -1259,7 +1259,7 @@ ats_update_problem_qm (struct ATS_Handle *ats)
1259 value = 100.0 / ((v0 + 2 * v1 + 3 * v2) / 6.0); 1259 value = 100.0 / ((v0 + 2 * v1 + 3 * v2) / 6.0);
1260 //value = 1; 1260 //value = 1;
1261 } 1261 }
1262 if (qm[c - 1].atis_index == GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE) 1262 if (qm[c - 1].atis_index == GNUNET_ATS_QUALITY_NET_DISTANCE)
1263 { 1263 {
1264 double v0 = 0, v1 = 0, v2 = 0; 1264 double v0 = 0, v1 = 0, v2 = 0;
1265 1265
diff --git a/src/ats/gnunet-service-ats_math.h b/src/ats/gnunet-service-ats_math.h
index 4af1bdc4c..1324c30d0 100644
--- a/src/ats/gnunet-service-ats_math.h
+++ b/src/ats/gnunet-service-ats_math.h
@@ -67,13 +67,13 @@
67struct ATS_mechanism; 67struct ATS_mechanism;
68struct ATS_peer; 68struct ATS_peer;
69 69
70typedef void (*GNUNET_TRANSPORT_ATS_AddressNotification) (struct ATS_peer ** 70typedef void (*GNUNET_ATS_AddressNotification) (struct ATS_peer **
71 peers, int *c_p, 71 peers, int *c_p,
72 struct ATS_mechanism 72 struct ATS_mechanism
73 ** mechanisms, 73 ** mechanisms,
74 int *c_m); 74 int *c_m);
75 75
76typedef void (*GNUNET_TRANSPORT_ATS_ResultCallback) (void); 76typedef void (*GNUNET_ATS_ResultCallback) (void);
77 77
78enum ATS_problem_state 78enum ATS_problem_state
79{ 79{
@@ -211,9 +211,9 @@ struct ATS_Handle
211 * Callback functions 211 * Callback functions
212 */ 212 */
213 213
214 GNUNET_TRANSPORT_ATS_AddressNotification addr_notification; 214 GNUNET_ATS_AddressNotification addr_notification;
215 215
216 GNUNET_TRANSPORT_ATS_ResultCallback result_cb; 216 GNUNET_ATS_ResultCallback result_cb;
217 217
218 218
219 /** 219 /**
@@ -452,8 +452,8 @@ static struct ATS_quality_metric qm[] = {
452struct ATS_Handle * 452struct ATS_Handle *
453ats_init (double D, double U, double R, int v_b_min, int v_n_min, 453ats_init (double D, double U, double R, int v_b_min, int v_n_min,
454 int max_iterations, struct GNUNET_TIME_Relative max_duration, 454 int max_iterations, struct GNUNET_TIME_Relative max_duration,
455 GNUNET_TRANSPORT_ATS_AddressNotification address_not, 455 GNUNET_ATS_AddressNotification address_not,
456 GNUNET_TRANSPORT_ATS_ResultCallback res_cb); 456 GNUNET_ATS_ResultCallback res_cb);
457 457
458void 458void
459ats_shutdown (struct ATS_Handle *ats); 459ats_shutdown (struct ATS_Handle *ats);
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c
index 3a4acc641..103040ea8 100644
--- a/src/ats/gnunet-service-ats_performance.c
+++ b/src/ats/gnunet-service-ats_performance.c
@@ -151,7 +151,7 @@ void
151GAS_performance_notify_clients (const struct GNUNET_PeerIdentity *peer, 151GAS_performance_notify_clients (const struct GNUNET_PeerIdentity *peer,
152 const char *plugin_name, 152 const char *plugin_name,
153 const void *plugin_addr, size_t plugin_addr_len, 153 const void *plugin_addr, size_t plugin_addr_len,
154 const struct GNUNET_TRANSPORT_ATS_Information *atsi, 154 const struct GNUNET_ATS_Information *atsi,
155 uint32_t atsi_count, 155 uint32_t atsi_count,
156 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 156 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
157 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 157 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
@@ -159,14 +159,14 @@ GAS_performance_notify_clients (const struct GNUNET_PeerIdentity *peer,
159 struct PerformanceClient *pc; 159 struct PerformanceClient *pc;
160 struct PeerInformationMessage *msg; 160 struct PeerInformationMessage *msg;
161 size_t plugin_name_length = strlen (plugin_name) + 1; 161 size_t plugin_name_length = strlen (plugin_name) + 1;
162 size_t msize = sizeof (struct PeerInformationMessage) + atsi_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) 162 size_t msize = sizeof (struct PeerInformationMessage) + atsi_count * sizeof (struct GNUNET_ATS_Information)
163 + plugin_addr_len + plugin_name_length; 163 + plugin_addr_len + plugin_name_length;
164 char buf[msize]; 164 char buf[msize];
165 struct GNUNET_TRANSPORT_ATS_Information *atsp; 165 struct GNUNET_ATS_Information *atsp;
166 char *addrp; 166 char *addrp;
167 167
168 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); 168 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
169 GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 169 GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information));
170 msg = (struct PeerInformationMessage*) buf; 170 msg = (struct PeerInformationMessage*) buf;
171 msg->header.size = htons (msize); 171 msg->header.size = htons (msize);
172 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION); 172 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION);
@@ -176,8 +176,8 @@ GAS_performance_notify_clients (const struct GNUNET_PeerIdentity *peer,
176 msg->plugin_name_length = htons (plugin_name_length); 176 msg->plugin_name_length = htons (plugin_name_length);
177 msg->bandwidth_out = bandwidth_out; 177 msg->bandwidth_out = bandwidth_out;
178 msg->bandwidth_in = bandwidth_in; 178 msg->bandwidth_in = bandwidth_in;
179 atsp = (struct GNUNET_TRANSPORT_ATS_Information* ) &msg[1]; 179 atsp = (struct GNUNET_ATS_Information* ) &msg[1];
180 memcpy (atsp, atsi, sizeof (struct GNUNET_TRANSPORT_ATS_Information) * atsi_count); 180 memcpy (atsp, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count);
181 addrp = (char*) &atsp[atsi_count]; 181 addrp = (char*) &atsp[atsi_count];
182 memcpy (addrp, plugin_addr, plugin_addr_len); 182 memcpy (addrp, plugin_addr, plugin_addr_len);
183 strcpy (&addrp[plugin_addr_len], plugin_name); 183 strcpy (&addrp[plugin_addr_len], plugin_name);
diff --git a/src/ats/gnunet-service-ats_performance.h b/src/ats/gnunet-service-ats_performance.h
index 6dfd11202..5988bff44 100644
--- a/src/ats/gnunet-service-ats_performance.h
+++ b/src/ats/gnunet-service-ats_performance.h
@@ -28,7 +28,7 @@
28#define GNUNET_SERVICE_ATS_PERFORMANCE_H 28#define GNUNET_SERVICE_ATS_PERFORMANCE_H
29 29
30#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_transport_service.h" // FIXME 31#include "gnunet_ats_service.h"
32#include "ats.h" 32#include "ats.h"
33 33
34/** 34/**
@@ -69,7 +69,7 @@ void
69GAS_performance_notify_clients (const struct GNUNET_PeerIdentity *peer, 69GAS_performance_notify_clients (const struct GNUNET_PeerIdentity *peer,
70 const char *plugin_name, 70 const char *plugin_name,
71 const void *plugin_addr, size_t plugin_addr_len, 71 const void *plugin_addr, size_t plugin_addr_len,
72 const struct GNUNET_TRANSPORT_ATS_Information *atsi, 72 const struct GNUNET_ATS_Information *atsi,
73 uint32_t atsi_count, 73 uint32_t atsi_count,
74 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 74 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
75 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in); 75 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c
index ca4e86ca4..825f00085 100644
--- a/src/ats/gnunet-service-ats_scheduling.c
+++ b/src/ats/gnunet-service-ats_scheduling.c
@@ -155,7 +155,7 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe
155 const void *plugin_addr, size_t plugin_addr_len, 155 const void *plugin_addr, size_t plugin_addr_len,
156 struct GNUNET_SERVER_Client *session_client, 156 struct GNUNET_SERVER_Client *session_client,
157 uint32_t session_id, 157 uint32_t session_id,
158 const struct GNUNET_TRANSPORT_ATS_Information *atsi, 158 const struct GNUNET_ATS_Information *atsi,
159 uint32_t atsi_count, 159 uint32_t atsi_count,
160 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 160 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
161 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 161 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
@@ -163,14 +163,14 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe
163 struct SchedulingClient *sc; 163 struct SchedulingClient *sc;
164 struct AddressSuggestionMessage *msg; 164 struct AddressSuggestionMessage *msg;
165 size_t plugin_name_length = strlen (plugin_name) + 1; 165 size_t plugin_name_length = strlen (plugin_name) + 1;
166 size_t msize = sizeof (struct AddressSuggestionMessage) + atsi_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) 166 size_t msize = sizeof (struct AddressSuggestionMessage) + atsi_count * sizeof (struct GNUNET_ATS_Information)
167 + plugin_addr_len + plugin_name_length; 167 + plugin_addr_len + plugin_name_length;
168 char buf[msize]; 168 char buf[msize];
169 struct GNUNET_TRANSPORT_ATS_Information *atsp; 169 struct GNUNET_ATS_Information *atsp;
170 char *addrp; 170 char *addrp;
171 171
172 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); 172 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
173 GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 173 GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information));
174 msg = (struct AddressSuggestionMessage*) buf; 174 msg = (struct AddressSuggestionMessage*) buf;
175 msg->header.size = htons (msize); 175 msg->header.size = htons (msize);
176 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION); 176 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION);
@@ -181,8 +181,8 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe
181 /* session ID is set only if 'client' is the same... */ 181 /* session ID is set only if 'client' is the same... */
182 msg->bandwidth_out = bandwidth_out; 182 msg->bandwidth_out = bandwidth_out;
183 msg->bandwidth_in = bandwidth_in; 183 msg->bandwidth_in = bandwidth_in;
184 atsp = (struct GNUNET_TRANSPORT_ATS_Information* ) &msg[1]; 184 atsp = (struct GNUNET_ATS_Information* ) &msg[1];
185 memcpy (atsp, atsi, sizeof (struct GNUNET_TRANSPORT_ATS_Information) * atsi_count); 185 memcpy (atsp, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count);
186 addrp = (char*) &atsp[atsi_count]; 186 addrp = (char*) &atsp[atsi_count];
187 memcpy (addrp, plugin_addr, plugin_addr_len); 187 memcpy (addrp, plugin_addr, plugin_addr_len);
188 strcpy (&addrp[plugin_addr_len], plugin_name); 188 strcpy (&addrp[plugin_addr_len], plugin_name);
@@ -234,7 +234,7 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
234 234
235{ 235{
236 const struct AddressUpdateMessage * m; 236 const struct AddressUpdateMessage * m;
237 const struct GNUNET_TRANSPORT_ATS_Information *atsi; 237 const struct GNUNET_ATS_Information *atsi;
238 const char *address; 238 const char *address;
239 const char *plugin_name; 239 const char *plugin_name;
240 uint16_t address_length; 240 uint16_t address_length;
@@ -256,7 +256,7 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
256 ats_count = ntohl (m->ats_count); 256 ats_count = ntohl (m->ats_count);
257 address_length = ntohs (m->address_length); 257 address_length = ntohs (m->address_length);
258 plugin_name_length = ntohs (m->plugin_name_length); 258 plugin_name_length = ntohs (m->plugin_name_length);
259 atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; 259 atsi = (const struct GNUNET_ATS_Information*) &m[1];
260 address = (const char*) &atsi[ats_count]; 260 address = (const char*) &atsi[ats_count];
261 if (plugin_name_length != 0) 261 if (plugin_name_length != 0)
262 plugin_name = &address[address_length]; 262 plugin_name = &address[address_length];
@@ -264,9 +264,9 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
264 plugin_name = ""; 264 plugin_name = "";
265 if ( (address_length + 265 if ( (address_length +
266 plugin_name_length + 266 plugin_name_length +
267 ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + 267 ats_count * sizeof (struct GNUNET_ATS_Information) +
268 sizeof (struct AddressUpdateMessage) != ntohs (message->size)) || 268 sizeof (struct AddressUpdateMessage) != ntohs (message->size)) ||
269 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)) || 269 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)) ||
270 (plugin_name[plugin_name_length - 1] != '\0') ) 270 (plugin_name[plugin_name_length - 1] != '\0') )
271 { 271 {
272 GNUNET_break (0); 272 GNUNET_break (0);
diff --git a/src/ats/gnunet-service-ats_scheduling.h b/src/ats/gnunet-service-ats_scheduling.h
index 8d6fa977d..15eed7f85 100644
--- a/src/ats/gnunet-service-ats_scheduling.h
+++ b/src/ats/gnunet-service-ats_scheduling.h
@@ -70,7 +70,7 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe
70 const void *plugin_addr, size_t plugin_addr_len, 70 const void *plugin_addr, size_t plugin_addr_len,
71 struct GNUNET_SERVER_Client *session_client, 71 struct GNUNET_SERVER_Client *session_client,
72 uint32_t session_id, 72 uint32_t session_id,
73 const struct GNUNET_TRANSPORT_ATS_Information *atsi, 73 const struct GNUNET_ATS_Information *atsi,
74 uint32_t atsi_count, 74 uint32_t atsi_count,
75 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 75 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
76 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in); 76 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in);
diff --git a/src/ats/test_ats_api_bandwidth_consumption.c b/src/ats/test_ats_api_bandwidth_consumption.c
index 5952237f4..05a3e257a 100644
--- a/src/ats/test_ats_api_bandwidth_consumption.c
+++ b/src/ats/test_ats_api_bandwidth_consumption.c
@@ -62,7 +62,7 @@ struct Address
62 void * addr; 62 void * addr;
63 size_t addr_len; 63 size_t addr_len;
64 64
65 struct GNUNET_TRANSPORT_ATS_Information * ats; 65 struct GNUNET_ATS_Information * ats;
66 int ats_count; 66 int ats_count;
67 67
68 void *session; 68 void *session;
@@ -156,7 +156,7 @@ void performance_cb (void *cls,
156 GNUNET_BANDWIDTH_Value32NBO 156 GNUNET_BANDWIDTH_Value32NBO
157 bandwidth_in, 157 bandwidth_in,
158 const struct 158 const struct
159 GNUNET_TRANSPORT_ATS_Information 159 GNUNET_ATS_Information
160 * ats, 160 * ats,
161 uint32_t ats_count) 161 uint32_t ats_count)
162{ 162{
@@ -207,7 +207,7 @@ address_suggest_cb (void *cls,
207 GNUNET_BANDWIDTH_Value32NBO 207 GNUNET_BANDWIDTH_Value32NBO
208 bandwidth_in, 208 bandwidth_in,
209 const struct 209 const struct
210 GNUNET_TRANSPORT_ATS_Information 210 GNUNET_ATS_Information
211 * ats, 211 * ats,
212 uint32_t ats_count) 212 uint32_t ats_count)
213 213
diff --git a/src/ats/test_ats_api_scheduling.c b/src/ats/test_ats_api_scheduling.c
index dd4718c12..7dfd887fd 100644
--- a/src/ats/test_ats_api_scheduling.c
+++ b/src/ats/test_ats_api_scheduling.c
@@ -58,7 +58,7 @@ struct Address
58 void * addr; 58 void * addr;
59 size_t addr_len; 59 size_t addr_len;
60 60
61 struct GNUNET_TRANSPORT_ATS_Information * ats; 61 struct GNUNET_ATS_Information * ats;
62 int ats_count; 62 int ats_count;
63 63
64 void *session; 64 void *session;
@@ -73,7 +73,7 @@ struct PeerContext
73 73
74struct Address addr[2]; 74struct Address addr[2];
75struct PeerContext p[2]; 75struct PeerContext p[2];
76struct GNUNET_TRANSPORT_ATS_Information atsi[2]; 76struct GNUNET_ATS_Information atsi[2];
77 77
78static void 78static void
79stop_arm () 79stop_arm ()
@@ -133,7 +133,7 @@ address_suggest_cb (void *cls,
133 GNUNET_BANDWIDTH_Value32NBO 133 GNUNET_BANDWIDTH_Value32NBO
134 bandwidth_in, 134 bandwidth_in,
135 const struct 135 const struct
136 GNUNET_TRANSPORT_ATS_Information 136 GNUNET_ATS_Information
137 * ats, 137 * ats,
138 uint32_t ats_count) 138 uint32_t ats_count)
139 139
diff --git a/src/ats/test_ats_api_update_address.c b/src/ats/test_ats_api_update_address.c
index 54383c1d3..78011d492 100644
--- a/src/ats/test_ats_api_update_address.c
+++ b/src/ats/test_ats_api_update_address.c
@@ -73,7 +73,7 @@ struct AllocationRecord
73 /** 73 /**
74 * Performance information associated with this address (array). 74 * Performance information associated with this address (array).
75 */ 75 */
76 struct GNUNET_TRANSPORT_ATS_Information *ats; 76 struct GNUNET_ATS_Information *ats;
77 77
78 /** 78 /**
79 * Name of the plugin 79 * Name of the plugin
@@ -121,7 +121,7 @@ suggest_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
121 const char *plugin_name, const void *plugin_addr, 121 const char *plugin_name, const void *plugin_addr,
122 size_t plugin_addr_len, struct Session *session, 122 size_t plugin_addr_len, struct Session *session,
123 struct GNUNET_BANDWIDTH_Value32NBO bandwidth, 123 struct GNUNET_BANDWIDTH_Value32NBO bandwidth,
124 const struct GNUNET_TRANSPORT_ATS_Information *ats, 124 const struct GNUNET_ATS_Information *ats,
125 uint32_t ats_count) 125 uint32_t ats_count)
126{ 126{
127 struct ExpectedValues *ex = cls; 127 struct ExpectedValues *ex = cls;
@@ -179,7 +179,7 @@ check (void *cls, char *const *args, const char *cfgfile,
179 ar->session = NULL; 179 ar->session = NULL;
180 ar->plugin_addr = "address1"; 180 ar->plugin_addr = "address1";
181 ar->plugin_addr_len = strlen (ar->plugin_addr) + 1; 181 ar->plugin_addr_len = strlen (ar->plugin_addr) + 1;
182 ar->ats = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 182 ar->ats = GNUNET_malloc (sizeof (struct GNUNET_ATS_Information));
183 183
184 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Initial ATS information\n"); 184 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Initial ATS information\n");
185 ar->ats_count = 1; 185 ar->ats_count = 1;