summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-03-25 16:06:07 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-03-25 16:06:07 +0000
commit4596a20eb4c61cf84e3a88a881597ba05114d482 (patch)
tree4659b0eac3f0d4ee862516e59372c0c568b98ffd
parentcc67bae38c54cbaf2122ee3aa0762e7f2cb04edf (diff)
downloadgnunet-4596a20eb4c61cf84e3a88a881597ba05114d482.tar.gz
gnunet-4596a20eb4c61cf84e3a88a881597ba05114d482.zip
ats api change
-rw-r--r--src/ats-tool/gnunet-ats.c26
-rw-r--r--src/ats/ats_api_performance.c241
-rw-r--r--src/ats/gnunet-service-ats.c3
-rw-r--r--src/ats/gnunet-service-ats_performance.c160
-rw-r--r--src/ats/test_ats_api_performance.c74
-rw-r--r--src/ats/test_ats_api_performance_monitor.c21
-rw-r--r--src/ats/test_ats_simplistic_change_preference.c2
-rw-r--r--src/ats/test_ats_simplistic_pref_aging.c2
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c2
-rw-r--r--src/fs/gnunet-service-fs.c6
-rw-r--r--src/include/gnunet_ats_service.h42
-rw-r--r--src/include/gnunet_protocols.h7
12 files changed, 131 insertions, 455 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index 20ce9700b..68e765ca9 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -221,18 +221,12 @@ void transport_addr_to_str_cb (void *cls, const char *address)
221} 221}
222 222
223void ats_perf_cb (void *cls, 223void ats_perf_cb (void *cls,
224 const struct 224 const struct GNUNET_HELLO_Address *address,
225 GNUNET_HELLO_Address * 225 unsigned int active,
226 address, 226 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
227 struct 227 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
228 GNUNET_BANDWIDTH_Value32NBO 228 const struct GNUNET_ATS_Information *ats,
229 bandwidth_out, 229 uint32_t ats_count)
230 struct
231 GNUNET_BANDWIDTH_Value32NBO
232 bandwidth_in,
233 const struct
234 GNUNET_ATS_Information *
235 ats, uint32_t ats_count)
236{ 230{
237 struct PendingResolutions * pr; 231 struct PendingResolutions * pr;
238 232
@@ -373,7 +367,7 @@ void testservice_ats (void *cls,
373 } 367 }
374 if (op_list_all) 368 if (op_list_all)
375 { 369 {
376 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); 370 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL, NULL, NULL);
377 if (NULL == ph) 371 if (NULL == ph)
378 { 372 {
379 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n")); 373 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n"));
@@ -393,7 +387,7 @@ void testservice_ats (void *cls,
393 } 387 }
394 else if (op_list_used) 388 else if (op_list_used)
395 { 389 {
396 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); 390 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL, NULL, NULL);
397 if (NULL == ph) 391 if (NULL == ph)
398 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n")); 392 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n"));
399 393
@@ -410,7 +404,7 @@ void testservice_ats (void *cls,
410 } 404 }
411 else if (op_monitor) 405 else if (op_monitor)
412 { 406 {
413 ph = GNUNET_ATS_performance_init (cfg, ats_perf_cb, NULL); 407 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL, ats_perf_cb, NULL);
414 if (NULL == ph) 408 if (NULL == ph)
415 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n")); 409 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n"));
416 end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &end, NULL); 410 end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &end, NULL);
@@ -435,7 +429,7 @@ void testservice_ats (void *cls,
435 } 429 }
436 430
437 /* set */ 431 /* set */
438 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); 432 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL, NULL, NULL);
439 if (NULL == ph) 433 if (NULL == ph)
440 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n")); 434 fprintf (stderr, _("Cannot connect to ATS service, exiting...\n"));
441 435
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index ec0b52fe1..16495b604 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -159,20 +159,6 @@ struct GNUNET_ATS_AddressListHandle
159 159
160 160
161 161
162struct GNUNET_ATS_PerformanceMonitorHandle
163{
164 struct GNUNET_ATS_PerformanceMonitorHandle *next;
165 struct GNUNET_ATS_PerformanceMonitorHandle *prev;
166
167 struct GNUNET_ATS_PerformanceHandle * ph;
168
169 GNUNET_ATS_PerformanceMonitorCb moncb;
170 void *moncb_cls;
171
172 uint32_t id;
173};
174
175
176/** 162/**
177 * ATS Handle to obtain and/or modify performance information. 163 * ATS Handle to obtain and/or modify performance information.
178 */ 164 */
@@ -185,14 +171,24 @@ struct GNUNET_ATS_PerformanceHandle
185 const struct GNUNET_CONFIGURATION_Handle *cfg; 171 const struct GNUNET_CONFIGURATION_Handle *cfg;
186 172
187 /** 173 /**
188 * Callback to invoke on performance changes. 174 * Callback to invoke when an address has performance changes.
175 */
176 GNUNET_ATS_AddressInformationCallback addr_info_cb;
177
178 /**
179 * Closure for 'addr_info_cb'.
189 */ 180 */
190 GNUNET_ATS_AddressInformationCallback infocb; 181 void *addr_info_cb_cls;
191 182
192 /** 183 /**
193 * Closure for 'infocb'. 184 * Callback to invoke when a peer has performance changes.
194 */ 185 */
195 void *infocb_cls; 186 GNUNET_ATS_PerformanceMonitorCb perf_monitor_cb;
187
188 /**
189 * Closure for 'perf_monitor_cb'.
190 */
191 void *perf_monitor_cb_cls;
196 192
197 /** 193 /**
198 * Connection to ATS service. 194 * Connection to ATS service.
@@ -229,15 +225,6 @@ struct GNUNET_ATS_PerformanceHandle
229 */ 225 */
230 struct GNUNET_ATS_AddressListHandle *addresslist_tail; 226 struct GNUNET_ATS_AddressListHandle *addresslist_tail;
231 227
232 /**
233 * Head of linked list of pending performance monitors.
234 */
235 struct GNUNET_ATS_PerformanceMonitorHandle *monitor_head;
236
237 /**
238 * Tail of linked list of pending performance monitors.
239 */
240 struct GNUNET_ATS_PerformanceMonitorHandle *monitor_tail;
241 228
242 /** 229 /**
243 * Current request for transmission to ATS. 230 * Current request for transmission to ATS.
@@ -372,6 +359,7 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
372 uint16_t plugin_address_length; 359 uint16_t plugin_address_length;
373 uint16_t plugin_name_length; 360 uint16_t plugin_name_length;
374 uint32_t ats_count; 361 uint32_t ats_count;
362 int addr_active;
375 363
376 if (ntohs (msg->size) < sizeof (struct PeerInformationMessage)) 364 if (ntohs (msg->size) < sizeof (struct PeerInformationMessage))
377 { 365 {
@@ -383,6 +371,7 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
383 ats_count = ntohl (pi->ats_count); 371 ats_count = ntohl (pi->ats_count);
384 plugin_address_length = ntohs (pi->address_length); 372 plugin_address_length = ntohs (pi->address_length);
385 plugin_name_length = ntohs (pi->plugin_name_length); 373 plugin_name_length = ntohs (pi->plugin_name_length);
374 addr_active = ntohl (pi->address_active);
386 atsi = (const struct GNUNET_ATS_Information *) &pi[1]; 375 atsi = (const struct GNUNET_ATS_Information *) &pi[1];
387 plugin_address = (const char *) &atsi[ats_count]; 376 plugin_address = (const char *) &atsi[ats_count];
388 plugin_name = &plugin_address[plugin_address_length]; 377 plugin_name = &plugin_address[plugin_address_length];
@@ -396,17 +385,26 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
396 GNUNET_break (0); 385 GNUNET_break (0);
397 return GNUNET_SYSERR; 386 return GNUNET_SYSERR;
398 } 387 }
399 if (ph->infocb == NULL) 388
389 if (NULL != ph->addr_info_cb)
400 { 390 {
401 return GNUNET_OK; 391 address.peer = pi->peer;
402 } 392 address.address = plugin_address;
393 address.address_length = plugin_address_length;
394 address.transport_name = plugin_name;
403 395
404 address.peer = pi->peer; 396 ph->addr_info_cb (ph->addr_info_cb_cls, &address, addr_active, pi->bandwidth_out, pi->bandwidth_in,
405 address.address = plugin_address;
406 address.address_length = plugin_address_length;
407 address.transport_name = plugin_name;
408 ph->infocb (ph->infocb_cls, &address, pi->bandwidth_out, pi->bandwidth_in,
409 atsi, ats_count); 397 atsi, ats_count);
398 }
399 if ((NULL != ph->perf_monitor_cb) &&
400 (GNUNET_YES == addr_active))
401 {
402 ph->perf_monitor_cb (ph->perf_monitor_cb_cls,
403 &pi->peer,
404 pi->bandwidth_out,
405 pi->bandwidth_in,
406 atsi, ats_count);
407 }
410 return GNUNET_OK; 408 return GNUNET_OK;
411} 409}
412 410
@@ -539,8 +537,9 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph,
539 _("Received last message for %s \n"), "ATS_ADDRESSLIST_RESPONSE"); 537 _("Received last message for %s \n"), "ATS_ADDRESSLIST_RESPONSE");
540 bandwidth_zero.value__ = htonl (0); 538 bandwidth_zero.value__ = htonl (0);
541 if (NULL != alh->cb) 539 if (NULL != alh->cb)
542 alh->cb (ph->infocb_cls, 540 alh->cb (ph->addr_info_cb_cls,
543 NULL, 541 NULL,
542 GNUNET_NO,
544 bandwidth_zero, bandwidth_zero, 543 bandwidth_zero, bandwidth_zero,
545 NULL, 0); 544 NULL, 0);
546 GNUNET_CONTAINER_DLL_remove (ph->addresslist_head, ph->addresslist_tail, alh); 545 GNUNET_CONTAINER_DLL_remove (ph->addresslist_head, ph->addresslist_tail, alh);
@@ -556,71 +555,15 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph,
556 if ((GNUNET_YES == alh->all_addresses) || (GNUNET_YES == active)) 555 if ((GNUNET_YES == alh->all_addresses) || (GNUNET_YES == active))
557 { 556 {
558 if (NULL != alh->cb) 557 if (NULL != alh->cb)
559 alh->cb (ph->infocb_cls, 558 alh->cb (ph->addr_info_cb_cls,
560 &address, 559 &address,
560 active,
561 pi->bandwidth_out, pi->bandwidth_in, 561 pi->bandwidth_out, pi->bandwidth_in,
562 atsi, ats_count); 562 atsi, ats_count);
563 } 563 }
564 return GNUNET_OK; 564 return GNUNET_OK;
565} 565}
566 566
567/**
568 * We received a monitor response message. Validate and process it.
569 *
570 * @param ph our context with the callback
571 * @param msg the message
572 * @return GNUNET_OK if the message was well-formed
573 */
574static int
575process_mr_message (struct GNUNET_ATS_PerformanceHandle *ph,
576 const struct GNUNET_MessageHeader *msg)
577{
578 struct MonitorResponseMessage *mrm = (struct MonitorResponseMessage *) msg;
579 struct GNUNET_ATS_PerformanceMonitorHandle *cur;
580 struct GNUNET_ATS_Information *ats;
581 size_t msg_size;
582 uint32_t ats_count;
583 uint32_t id;
584
585 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
586 _("Received %s message\n"), "ATS_MONITOR_RESPONSE");
587
588 msg_size = ntohs (msg->size);
589 if (msg_size < sizeof (struct MonitorResponseMessage))
590 {
591 GNUNET_break (0);
592 return GNUNET_SYSERR;
593 }
594
595 ats_count = ntohl (mrm->ats_count);
596 if (msg_size != (sizeof (struct MonitorResponseMessage) +
597 ats_count * sizeof (struct GNUNET_ATS_Information)))
598 {
599 GNUNET_break (0);
600 return GNUNET_SYSERR;
601 }
602
603 id = ntohl (mrm->id);
604 /* Do work here */
605 for (cur = ph->monitor_head; NULL != cur; cur = cur->next)
606 {
607 if (id == cur->id)
608 break;
609 }
610 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
611 _("Received %s message for id %u\n"), "ATS_MONITOR_RESPONSE", id);
612 if (NULL == cur)
613 {
614 GNUNET_break (0);
615 return GNUNET_SYSERR;
616 }
617
618 ats = (struct GNUNET_ATS_Information *) &mrm[1];
619 cur->moncb (cur->moncb_cls, &mrm->peer, ats, ats_count);
620
621 return GNUNET_OK;
622}
623
624 567
625/** 568/**
626 * Type of a function to call when we receive a message 569 * Type of a function to call when we receive a message
@@ -650,10 +593,6 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
650 if (GNUNET_OK != process_ar_message (ph, msg)) 593 if (GNUNET_OK != process_ar_message (ph, msg))
651 goto reconnect; 594 goto reconnect;
652 break; 595 break;
653 case GNUNET_MESSAGE_TYPE_ATS_MONITOR_RESPONSE:
654 if (GNUNET_OK != process_mr_message (ph, msg))
655 goto reconnect;
656 break;
657 default: 596 default:
658 GNUNET_break (0); 597 GNUNET_break (0);
659 goto reconnect; 598 goto reconnect;
@@ -701,9 +640,8 @@ reconnect (struct GNUNET_ATS_PerformanceHandle *ph)
701 init->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_START); 640 init->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_START);
702 init->header.size = htons (sizeof (struct ClientStartMessage)); 641 init->header.size = htons (sizeof (struct ClientStartMessage));
703 init->start_flag = 642 init->start_flag =
704 htonl ((ph->infocb == 643 htonl (((NULL ==ph->addr_info_cb) && (NULL == ph->perf_monitor_cb)) ?
705 NULL) ? START_FLAG_PERFORMANCE_NO_PIC : 644 START_FLAG_PERFORMANCE_NO_PIC : START_FLAG_PERFORMANCE_WITH_PIC);
706 START_FLAG_PERFORMANCE_WITH_PIC);
707 GNUNET_CONTAINER_DLL_insert (ph->pending_head, ph->pending_tail, p); 645 GNUNET_CONTAINER_DLL_insert (ph->pending_head, ph->pending_tail, p);
708 } 646 }
709 do_transmit (ph); 647 do_transmit (ph);
@@ -715,100 +653,34 @@ reconnect (struct GNUNET_ATS_PerformanceHandle *ph)
715 * Get handle to access performance API of the ATS subsystem. 653 * Get handle to access performance API of the ATS subsystem.
716 * 654 *
717 * @param cfg configuration to use 655 * @param cfg configuration to use
718 * @param infocb function to call on allocation changes, can be NULL 656 * @param perf_monitor_cb callback called when performance characteristics for
719 * @param infocb_cls closure for infocb 657 * a peer change
658 * @param perf_monitor_cb closure for the perf_monitor_cb
659 * @param addr_info_cb callback called when performance characteristics for
660 * an address change
661 * @param addr_info_cb_cls closure for infocb
720 * @return ats performance context 662 * @return ats performance context
721 */ 663 */
722struct GNUNET_ATS_PerformanceHandle * 664struct GNUNET_ATS_PerformanceHandle *
723GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 665GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
724 GNUNET_ATS_AddressInformationCallback infocb, 666 GNUNET_ATS_PerformanceMonitorCb perf_monitor_cb,
725 void *infocb_cls) 667 void *perf_monitor_cb_cls,
668 GNUNET_ATS_AddressInformationCallback addr_info_cb,
669 void *addr_info_cb_cls)
726{ 670{
727 struct GNUNET_ATS_PerformanceHandle *ph; 671 struct GNUNET_ATS_PerformanceHandle *ph;
728 672
729 ph = GNUNET_malloc (sizeof (struct GNUNET_ATS_PerformanceHandle)); 673 ph = GNUNET_malloc (sizeof (struct GNUNET_ATS_PerformanceHandle));
730 ph->cfg = cfg; 674 ph->cfg = cfg;
731 ph->infocb = infocb; 675 ph->addr_info_cb = addr_info_cb;
732 ph->infocb_cls = infocb_cls; 676 ph->addr_info_cb_cls = addr_info_cb_cls;
677 ph->perf_monitor_cb = perf_monitor_cb;
678 ph->perf_monitor_cb_cls = perf_monitor_cb_cls;
733 ph->id = 0; 679 ph->id = 0;
734 reconnect (ph); 680 reconnect (ph);
735 return ph; 681 return ph;
736} 682}
737 683
738
739/**
740 * Start monitoring performance information
741 *
742 * @param ph performance handle to use
743 * @param monitor_cb function to call on performance changes
744 * @param monitor_cb_cls closure for infocb
745 * @return a performance monitor handle
746 */
747struct GNUNET_ATS_PerformanceMonitorHandle *
748GNUNET_ATS_performance_monitor_start (struct GNUNET_ATS_PerformanceHandle * ph,
749 GNUNET_ATS_PerformanceMonitorCb monitor_cb,
750 void * monitor_cb_cls)
751{
752 struct MonitorMessage *m;
753 struct PendingMessage *p;
754 GNUNET_assert (NULL != ph);
755
756 if (NULL == monitor_cb)
757 return NULL;
758
759 struct GNUNET_ATS_PerformanceMonitorHandle *phm =
760 GNUNET_malloc (sizeof (struct GNUNET_ATS_PerformanceMonitorHandle));
761
762 ph->monitor_id ++;
763 phm->id = ph->monitor_id;
764 phm->ph = ph;
765 phm->moncb = monitor_cb;
766 phm->moncb_cls = monitor_cb_cls;
767 GNUNET_CONTAINER_DLL_insert (ph->monitor_head, ph->monitor_tail, phm);
768
769 p = GNUNET_malloc (sizeof (struct PendingMessage) +
770 sizeof (struct MonitorMessage));
771 p->size = sizeof (struct MonitorMessage);
772 m = (struct MonitorMessage *) &p[1];
773 m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_MONITOR);
774 m->header.size = htons (sizeof (struct MonitorMessage));
775 m->id = htonl (phm->id);
776 m->op = htonl (GNUNET_YES);
777 GNUNET_CONTAINER_DLL_insert_tail (ph->pending_head, ph->pending_tail, p);
778 do_transmit (ph);
779
780 return phm;
781}
782
783
784/**
785 * Stop monitoring performance information
786 *
787 * @param phm performance monitor handle to use
788 */
789void
790GNUNET_ATS_performance_monitor_stop (struct GNUNET_ATS_PerformanceMonitorHandle * phm)
791{
792 struct MonitorMessage *m;
793 struct PendingMessage *p;
794
795 GNUNET_assert (NULL != phm);
796
797 p = GNUNET_malloc (sizeof (struct PendingMessage) +
798 sizeof (struct MonitorMessage));
799 p->size = sizeof (struct MonitorMessage);
800 m = (struct MonitorMessage *) &p[1];
801 m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_MONITOR);
802 m->header.size = htons (sizeof (struct MonitorMessage));
803 m->id = htonl (phm->id);
804 m->op = htonl (GNUNET_NO);
805 GNUNET_CONTAINER_DLL_insert_tail (phm->ph->pending_head, phm->ph->pending_tail, p);
806 do_transmit (phm->ph);
807
808 GNUNET_CONTAINER_DLL_remove (phm->ph->monitor_head, phm->ph->monitor_tail, phm);
809 GNUNET_free (phm);
810}
811
812/** 684/**
813 * Client is done using the ATS performance subsystem, release resources. 685 * Client is done using the ATS performance subsystem, release resources.
814 * 686 *
@@ -820,7 +692,6 @@ GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph)
820 struct PendingMessage *p; 692 struct PendingMessage *p;
821 struct GNUNET_ATS_ReservationContext *rc; 693 struct GNUNET_ATS_ReservationContext *rc;
822 struct GNUNET_ATS_AddressListHandle *alh; 694 struct GNUNET_ATS_AddressListHandle *alh;
823 struct GNUNET_ATS_PerformanceMonitorHandle *phm;
824 695
825 while (NULL != (p = ph->pending_head)) 696 while (NULL != (p = ph->pending_head))
826 { 697 {
@@ -840,11 +711,7 @@ GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph)
840 GNUNET_break (NULL == rc->rcb); 711 GNUNET_break (NULL == rc->rcb);
841 GNUNET_free (rc); 712 GNUNET_free (rc);
842 } 713 }
843 while (NULL != (phm = ph->monitor_head)) 714
844 {
845 GNUNET_CONTAINER_DLL_remove (ph->monitor_head, ph->monitor_tail, phm);
846 GNUNET_free (phm);
847 }
848 if (GNUNET_SCHEDULER_NO_TASK != ph->task) 715 if (GNUNET_SCHEDULER_NO_TASK != ph->task)
849 { 716 {
850 GNUNET_SCHEDULER_cancel (ph->task); 717 GNUNET_SCHEDULER_cancel (ph->task);
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c
index 12693f212..3218769a6 100644
--- a/src/ats/gnunet-service-ats.c
+++ b/src/ats/gnunet-service-ats.c
@@ -162,9 +162,6 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
162 {&GAS_handle_reset_backoff, NULL, 162 {&GAS_handle_reset_backoff, NULL,
163 GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF, 163 GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF,
164 sizeof (struct ResetBackoffMessage)}, 164 sizeof (struct ResetBackoffMessage)},
165 {&GAS_handle_monitor, NULL,
166 GNUNET_MESSAGE_TYPE_ATS_MONITOR,
167 sizeof (struct MonitorMessage)},
168 {NULL, NULL, 0, 0} 165 {NULL, NULL, 0, 0}
169 }; 166 };
170 GSA_server = server; 167 GSA_server = server;
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c
index 3be0bf0bf..8eb969dfd 100644
--- a/src/ats/gnunet-service-ats_performance.c
+++ b/src/ats/gnunet-service-ats_performance.c
@@ -31,16 +31,6 @@
31#include "gnunet-service-ats_reservations.h" 31#include "gnunet-service-ats_reservations.h"
32#include "ats.h" 32#include "ats.h"
33 33
34struct PerformanceMonitorClient
35{
36 struct PerformanceMonitorClient *next;
37 struct PerformanceMonitorClient *prev;
38
39 struct GNUNET_SERVER_Client *client;
40
41 uint32_t id;
42};
43
44/** 34/**
45 * We keep clients that are interested in performance in a linked list. 35 * We keep clients that are interested in performance in a linked list.
46 */ 36 */
@@ -138,18 +128,9 @@ void
138GAS_performance_remove_client (struct GNUNET_SERVER_Client *client) 128GAS_performance_remove_client (struct GNUNET_SERVER_Client *client)
139{ 129{
140 struct PerformanceClient *pc; 130 struct PerformanceClient *pc;
141 struct PerformanceMonitorClient *cur;
142 struct PerformanceMonitorClient *next;
143 pc = find_client (client); 131 pc = find_client (client);
144 if (NULL == pc) 132 if (NULL == pc)
145 return; 133 return;
146 next = pc->pm_head;
147 while (NULL != (cur = next))
148 {
149 next = cur->next;
150 GNUNET_CONTAINER_DLL_remove (pc->pm_head, pc->pm_tail, cur);
151 GNUNET_free (cur);
152 }
153 GNUNET_CONTAINER_DLL_remove (pc_head, pc_tail, pc); 134 GNUNET_CONTAINER_DLL_remove (pc_head, pc_tail, pc);
154 GNUNET_SERVER_client_drop (client); 135 GNUNET_SERVER_client_drop (client);
155 GNUNET_free (pc); 136 GNUNET_free (pc);
@@ -293,7 +274,9 @@ peerinfo_it (void *cls,
293 ntohl (bandwidth_in.value__)); 274 ntohl (bandwidth_in.value__));
294 GAS_performance_notify_client(pc, 275 GAS_performance_notify_client(pc,
295 id, 276 id,
296 plugin_name, plugin_addr, plugin_addr_len, 277 plugin_name,
278 plugin_addr,
279 plugin_addr_len,
297 active, 280 active,
298 atsi, atsi_count, 281 atsi, atsi_count,
299 bandwidth_out, bandwidth_in); 282 bandwidth_out, bandwidth_in);
@@ -529,6 +512,9 @@ GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer,
529 struct GNUNET_ATS_Information *ats, 512 struct GNUNET_ATS_Information *ats,
530 uint32_t ats_count) 513 uint32_t ats_count)
531{ 514{
515/* Notify here */
516
517#if 0
532 struct PerformanceClient *cur; 518 struct PerformanceClient *cur;
533 struct PerformanceMonitorClient *curm; 519 struct PerformanceMonitorClient *curm;
534 struct MonitorResponseMessage *mrm; 520 struct MonitorResponseMessage *mrm;
@@ -555,139 +541,7 @@ GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer,
555 GNUNET_YES); 541 GNUNET_YES);
556 } 542 }
557 GNUNET_free (mrm); 543 GNUNET_free (mrm);
558} 544#endif
559
560
561static void
562mon_peerinfo_it (void *cls,
563 const struct GNUNET_PeerIdentity *id,
564 const char *plugin_name,
565 const void *plugin_addr, size_t plugin_addr_len,
566 const int active,
567 const struct GNUNET_ATS_Information *atsi,
568 uint32_t atsi_count,
569 struct GNUNET_BANDWIDTH_Value32NBO
570 bandwidth_out,
571 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
572{
573 struct PerformanceMonitorClient *pmc = cls;
574 struct MonitorResponseMessage *mrm;
575 size_t msglen;
576
577 if (NULL == id)
578 return; /* last callback */
579
580 msglen = sizeof (struct MonitorResponseMessage) +
581 atsi_count * sizeof (struct GNUNET_ATS_Information);
582 mrm = GNUNET_malloc (msglen);
583
584 mrm->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_MONITOR_RESPONSE);
585 mrm->header.size = htons (msglen);
586 mrm->id = htonl(pmc->id);
587 mrm->ats_count = htonl (atsi_count);
588 mrm->peer = *id;
589 memcpy (&mrm[1], atsi, atsi_count * sizeof (struct GNUNET_ATS_Information));
590
591 /* Send initial information about peers to client */
592
593 GNUNET_SERVER_notification_context_unicast (nc,
594 pmc->client,
595 (struct GNUNET_MessageHeader *) mrm,
596 GNUNET_YES);
597 GNUNET_free (mrm);
598}
599
600/**
601 * Iterator for GAS_handle_monitor
602 *
603 * @param cls the performance monitoring client requesting information
604 * @param id result
605 */
606static void
607mon_peer_it (void *cls,
608 const struct GNUNET_PeerIdentity *id)
609{
610 struct PerformanceMonitorClient *pmc = cls;
611 if (NULL != id)
612 GAS_addresses_get_peer_info (GSA_addresses, id, &mon_peerinfo_it, pmc);
613}
614
615
616void
617GAS_handle_monitor (void *cls,
618 struct GNUNET_SERVER_Client *client,
619 const struct GNUNET_MessageHeader *message)
620{
621 struct PerformanceClient *pc;
622 struct PerformanceMonitorClient *pmc;
623 struct MonitorMessage *mm = (struct MonitorMessage *) message;
624 size_t msg_size;
625 uint32_t id;
626 uint32_t op;
627
628 pc = find_client (client);
629 if (NULL == pc)
630 {
631 GNUNET_break (0);
632 return;
633 }
634
635 msg_size = ntohs (message->size);
636 if (msg_size < sizeof (struct MonitorMessage))
637 {
638 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
639 return;
640 }
641
642 id = ntohl (mm->id);
643 op = ntohl (mm->op);
644
645 for (pmc = pc->pm_head; NULL != pmc; pmc = pmc->next)
646 if ((pmc->id == id) && (client == pmc->client))
647 break;
648
649 if (GNUNET_YES == op)
650 {
651 /* Start monitoring */
652 if (NULL != pmc)
653 {
654 GNUNET_break (0);
655 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
656 return; /* Duplicate*/
657 }
658 pmc = GNUNET_malloc (sizeof (struct PerformanceMonitorClient));
659 pmc->client = client;
660 pmc->id = id;
661 GNUNET_CONTAINER_DLL_insert (pc->pm_head, pc->pm_tail, pmc);
662 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
663 "Added performance monitoring client %p id %u\n",
664 client, id);
665 /* Return all values here */
666 GAS_addresses_iterate_peers (GSA_addresses, &mon_peer_it, pmc);
667
668 }
669 else if (GNUNET_NO == op)
670 {
671 /* Stop monitoring */
672 if (NULL == pmc)
673 {
674 GNUNET_break (0);
675 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
676 return; /* Not existing */
677 }
678 GNUNET_CONTAINER_DLL_remove (pc->pm_head, pc->pm_tail, pmc);
679 GNUNET_free (pmc);
680 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
681 "Removed performance monitoring client %p id %u\n",
682 client, id);
683 }
684 else
685 {
686 GNUNET_break (0);
687 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
688 return;
689 }
690 GNUNET_SERVER_receive_done (client, GNUNET_OK);
691} 545}
692 546
693 547
diff --git a/src/ats/test_ats_api_performance.c b/src/ats/test_ats_api_performance.c
index 64737d8ba..a49b33de1 100644
--- a/src/ats/test_ats_api_performance.c
+++ b/src/ats/test_ats_api_performance.c
@@ -129,18 +129,12 @@ static void
129test_performance_api (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); 129test_performance_api (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
130 130
131void all_active_addresses_peer_cb (void *cls, 131void all_active_addresses_peer_cb (void *cls,
132 const struct 132 const struct GNUNET_HELLO_Address *address,
133 GNUNET_HELLO_Address * 133 unsigned int active,
134 address, 134 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
135 struct 135 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
136 GNUNET_BANDWIDTH_Value32NBO 136 const struct GNUNET_ATS_Information *ats,
137 bandwidth_out, 137 uint32_t ats_count)
138 struct
139 GNUNET_BANDWIDTH_Value32NBO
140 bandwidth_in,
141 const struct
142 GNUNET_ATS_Information *
143 ats, uint32_t ats_count)
144{ 138{
145 static int cb = 0; 139 static int cb = 0;
146 int fail = GNUNET_NO; 140 int fail = GNUNET_NO;
@@ -198,18 +192,12 @@ void all_active_addresses_peer_cb (void *cls,
198} 192}
199 193
200void all_active_addresses_cb (void *cls, 194void all_active_addresses_cb (void *cls,
201 const struct 195 const struct GNUNET_HELLO_Address *address,
202 GNUNET_HELLO_Address * 196 unsigned int active,
203 address, 197 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
204 struct 198 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
205 GNUNET_BANDWIDTH_Value32NBO 199 const struct GNUNET_ATS_Information *ats,
206 bandwidth_out, 200 uint32_t ats_count)
207 struct
208 GNUNET_BANDWIDTH_Value32NBO
209 bandwidth_in,
210 const struct
211 GNUNET_ATS_Information *
212 ats, uint32_t ats_count)
213{ 201{
214 static int cb = 0; 202 static int cb = 0;
215 int fail = GNUNET_NO; 203 int fail = GNUNET_NO;
@@ -279,18 +267,12 @@ void all_active_addresses_cb (void *cls,
279 267
280 268
281void all_addresses_peer_cb (void *cls, 269void all_addresses_peer_cb (void *cls,
282 const struct 270 const struct GNUNET_HELLO_Address *address,
283 GNUNET_HELLO_Address * 271 unsigned int active,
284 address, 272 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
285 struct 273 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
286 GNUNET_BANDWIDTH_Value32NBO 274 const struct GNUNET_ATS_Information *ats,
287 bandwidth_out, 275 uint32_t ats_count)
288 struct
289 GNUNET_BANDWIDTH_Value32NBO
290 bandwidth_in,
291 const struct
292 GNUNET_ATS_Information *
293 ats, uint32_t ats_count)
294{ 276{
295 static int cb = 0; 277 static int cb = 0;
296 int fail = GNUNET_NO; 278 int fail = GNUNET_NO;
@@ -334,18 +316,12 @@ void all_addresses_peer_cb (void *cls,
334} 316}
335 317
336void all_addresses_cb (void *cls, 318void all_addresses_cb (void *cls,
337 const struct 319 const struct GNUNET_HELLO_Address *address,
338 GNUNET_HELLO_Address * 320 unsigned int active,
339 address, 321 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
340 struct 322 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
341 GNUNET_BANDWIDTH_Value32NBO 323 const struct GNUNET_ATS_Information *ats,
342 bandwidth_out, 324 uint32_t ats_count)
343 struct
344 GNUNET_BANDWIDTH_Value32NBO
345 bandwidth_in,
346 const struct
347 GNUNET_ATS_Information *
348 ats, uint32_t ats_count)
349{ 325{
350 static int cb = 0; 326 static int cb = 0;
351 327
@@ -404,7 +380,7 @@ static void
404test_performance_api (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 380test_performance_api (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
405{ 381{
406 if (NULL == ph) 382 if (NULL == ph)
407 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); 383 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL, NULL, NULL);
408 if (NULL == ph) 384 if (NULL == ph)
409 { 385 {
410 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to initialize performance handle\n"); 386 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to initialize performance handle\n");
diff --git a/src/ats/test_ats_api_performance_monitor.c b/src/ats/test_ats_api_performance_monitor.c
index 44159aa09..9682b8dc9 100644
--- a/src/ats/test_ats_api_performance_monitor.c
+++ b/src/ats/test_ats_api_performance_monitor.c
@@ -42,8 +42,6 @@ static struct GNUNET_ATS_SchedulingHandle *sh;
42 42
43static struct GNUNET_ATS_PerformanceHandle *ph; 43static struct GNUNET_ATS_PerformanceHandle *ph;
44 44
45static struct GNUNET_ATS_PerformanceMonitorHandle *phm;
46
47static struct GNUNET_HELLO_Address addr; 45static struct GNUNET_HELLO_Address addr;
48 46
49static struct GNUNET_ATS_Information atsi[ATS_COUNT]; 47static struct GNUNET_ATS_Information atsi[ATS_COUNT];
@@ -91,12 +89,6 @@ end_now (int res)
91 89
92 cleanup_addresses (); 90 cleanup_addresses ();
93 91
94 if (NULL != phm)
95 {
96 GNUNET_ATS_performance_monitor_stop (phm);
97 phm = NULL;
98 }
99
100 if (NULL != ph) 92 if (NULL != ph)
101 { 93 {
102 GNUNET_ATS_performance_done (ph); 94 GNUNET_ATS_performance_done (ph);
@@ -129,9 +121,6 @@ next_stage (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
129 { 121 {
130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stop performance monitoring\n"); 122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stop performance monitoring\n");
131 123
132 GNUNET_ATS_performance_monitor_stop (phm);
133 phm = NULL;
134
135 stage_task = GNUNET_SCHEDULER_add_delayed (SHUTDOWN_CORRECT, &next_stage, NULL); 124 stage_task = GNUNET_SCHEDULER_add_delayed (SHUTDOWN_CORRECT, &next_stage, NULL);
136 stage_counter++; 125 stage_counter++;
137 return; 126 return;
@@ -151,8 +140,10 @@ static void end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
151 140
152static void 141static void
153perf_mon_cb (void *cls, 142perf_mon_cb (void *cls,
154 struct GNUNET_PeerIdentity *peer, 143 const struct GNUNET_PeerIdentity *peer,
155 struct GNUNET_ATS_Information *ats, 144 const struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
145 const struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
146 const struct GNUNET_ATS_Information *ats,
156 uint32_t ats_count) 147 uint32_t ats_count)
157{ 148{
158 static int stage_counter = 0; 149 static int stage_counter = 0;
@@ -273,11 +264,9 @@ run (void *cls,
273 264
274 setup_addresses (); 265 setup_addresses ();
275 266
276 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); 267 ph = GNUNET_ATS_performance_init (cfg, &perf_mon_cb, &ret, NULL, NULL);
277 GNUNET_assert (NULL != ph); 268 GNUNET_assert (NULL != ph);
278 269
279 phm = GNUNET_ATS_performance_monitor_start (ph, &perf_mon_cb, &ret);
280 GNUNET_assert (NULL != phm);
281 270
282 stage_task = GNUNET_SCHEDULER_add_delayed (SHUTDOWN_CORRECT, &next_stage, NULL); 271 stage_task = GNUNET_SCHEDULER_add_delayed (SHUTDOWN_CORRECT, &next_stage, NULL);
283} 272}
diff --git a/src/ats/test_ats_simplistic_change_preference.c b/src/ats/test_ats_simplistic_change_preference.c
index 793d0cb4b..0cf22fb3c 100644
--- a/src/ats/test_ats_simplistic_change_preference.c
+++ b/src/ats/test_ats_simplistic_change_preference.c
@@ -318,7 +318,7 @@ run (void *cls,
318 return; 318 return;
319 } 319 }
320 320
321 perf_ats = GNUNET_ATS_performance_init (cfg, NULL, NULL); 321 perf_ats = GNUNET_ATS_performance_init (cfg, NULL, NULL, NULL, NULL);
322 if (perf_ats == NULL) 322 if (perf_ats == NULL)
323 { 323 {
324 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS performance!\n"); 324 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS performance!\n");
diff --git a/src/ats/test_ats_simplistic_pref_aging.c b/src/ats/test_ats_simplistic_pref_aging.c
index 2681b87f5..14b45f91c 100644
--- a/src/ats/test_ats_simplistic_pref_aging.c
+++ b/src/ats/test_ats_simplistic_pref_aging.c
@@ -368,7 +368,7 @@ run (void *cls,
368 } 368 }
369 369
370 /* Connect to ATS performance */ 370 /* Connect to ATS performance */
371 perf_ats = GNUNET_ATS_performance_init(cfg, NULL, NULL); 371 perf_ats = GNUNET_ATS_performance_init(cfg, NULL, NULL, NULL, NULL);
372 if (sched_ats == NULL) 372 if (sched_ats == NULL)
373 { 373 {
374 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS scheduling!\n"); 374 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS scheduling!\n");
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 06e13d0b1..78547ee4b 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -2077,7 +2077,7 @@ GDS_NEIGHBOURS_init ()
2077 bucket_size = (unsigned int) temp_config_num; 2077 bucket_size = (unsigned int) temp_config_num;
2078 log_route_details_stderr = 2078 log_route_details_stderr =
2079 (NULL != getenv("GNUNET_DHT_ROUTE_DEBUG")) ? GNUNET_YES : GNUNET_NO; 2079 (NULL != getenv("GNUNET_DHT_ROUTE_DEBUG")) ? GNUNET_YES : GNUNET_NO;
2080 atsAPI = GNUNET_ATS_performance_init (GDS_cfg, NULL, NULL); 2080 atsAPI = GNUNET_ATS_performance_init (GDS_cfg, NULL, NULL, NULL, NULL);
2081 coreAPI = 2081 coreAPI =
2082 GNUNET_CORE_connect (GDS_cfg, NULL, &core_init, &handle_core_connect, 2082 GNUNET_CORE_connect (GDS_cfg, NULL, &core_init, &handle_core_connect,
2083 &handle_core_disconnect, NULL, GNUNET_NO, NULL, 2083 &handle_core_disconnect, NULL, GNUNET_NO, NULL,
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 0f1f0ddbc..6a7d135bf 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -243,6 +243,7 @@ GSF_test_get_load_too_high_ (uint32_t priority)
243static void 243static void
244update_latencies (void *cls, 244update_latencies (void *cls,
245 const struct GNUNET_HELLO_Address *address, 245 const struct GNUNET_HELLO_Address *address,
246 unsigned int active,
246 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 247 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
247 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 248 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
248 const struct GNUNET_ATS_Information *ats, 249 const struct GNUNET_ATS_Information *ats,
@@ -251,7 +252,8 @@ update_latencies (void *cls,
251 unsigned int i; 252 unsigned int i;
252 struct GNUNET_TIME_Relative latency; 253 struct GNUNET_TIME_Relative latency;
253 254
254 // FIXME: if (GNUNET_YES != current_address) return; 255 if (GNUNET_YES != active)
256 return;
255 for (i = 0; i < ats_count; i++) 257 for (i = 0; i < ats_count; i++)
256 { 258 {
257 if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type)) 259 if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type))
@@ -690,7 +692,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
690 GSF_plan_init (); 692 GSF_plan_init ();
691 GSF_pending_request_init_ (); 693 GSF_pending_request_init_ ();
692 GSF_connected_peer_init_ (); 694 GSF_connected_peer_init_ ();
693 GSF_ats = GNUNET_ATS_performance_init (GSF_cfg, &update_latencies, NULL); 695 GSF_ats = GNUNET_ATS_performance_init (GSF_cfg, NULL, NULL, &update_latencies, NULL);
694 GSF_push_init_ (); 696 GSF_push_init_ ();
695 GSF_put_init_ (); 697 GSF_put_init_ ();
696 if ((GNUNET_OK != GNUNET_FS_indexing_init (cfg, GSF_dsh)) || 698 if ((GNUNET_OK != GNUNET_FS_indexing_init (cfg, GSF_dsh)) ||
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
index 1e5643794..6f6f9ee9e 100644
--- a/src/include/gnunet_ats_service.h
+++ b/src/include/gnunet_ats_service.h
@@ -707,9 +707,11 @@ struct GNUNET_ATS_PerformanceHandle;
707 */ 707 */
708typedef void 708typedef void
709(*GNUNET_ATS_PerformanceMonitorCb) (void *cls, 709(*GNUNET_ATS_PerformanceMonitorCb) (void *cls,
710 struct GNUNET_PeerIdentity *peer, 710 const struct GNUNET_PeerIdentity *peer,
711 struct GNUNET_ATS_Information *ats, 711 const struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
712 uint32_t ats_count); 712 const struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
713 const struct GNUNET_ATS_Information *ats,
714 uint32_t ats_count);
713 715
714 716
715/** 717/**
@@ -717,24 +719,20 @@ typedef void
717 * 719 *
718 * @param cls closure 720 * @param cls closure
719 * @param address the address 721 * @param address the address
722 * @param address_active is this address actively used to maintain a connection
723 * to a peer
720 * @param bandwidth_out assigned outbound bandwidth for the connection 724 * @param bandwidth_out assigned outbound bandwidth for the connection
721 * @param bandwidth_in assigned inbound bandwidth for the connection 725 * @param bandwidth_in assigned inbound bandwidth for the connection
722 * @param ats performance data for the address (as far as known) 726 * @param ats performance data for the address (as far as known)
723 * @param ats_count number of performance records in 'ats' 727 * @param ats_count number of performance records in 'ats'
724 */ 728 */
725typedef void (*GNUNET_ATS_AddressInformationCallback) (void *cls, 729typedef void (*GNUNET_ATS_AddressInformationCallback) (void *cls,
726 const struct 730 const struct GNUNET_HELLO_Address *address,
727 GNUNET_HELLO_Address * 731 unsigned int address_active,
728 address, 732 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
729 struct 733 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
730 GNUNET_BANDWIDTH_Value32NBO 734 const struct GNUNET_ATS_Information *ats,
731 bandwidth_out, 735 uint32_t ats_count);
732 struct
733 GNUNET_BANDWIDTH_Value32NBO
734 bandwidth_in,
735 const struct
736 GNUNET_ATS_Information *
737 ats, uint32_t ats_count);
738 736
739/** 737/**
740 * Handle for an address listing operation 738 * Handle for an address listing operation
@@ -746,14 +744,20 @@ struct GNUNET_ATS_AddressListHandle;
746 * Get handle to access performance API of the ATS subsystem. 744 * Get handle to access performance API of the ATS subsystem.
747 * 745 *
748 * @param cfg configuration to use 746 * @param cfg configuration to use
749 * @param infocb function to call on performance changes, can be NULL 747 * @param perf_monitor_cb callback called when performance characteristics for
750 * @param infocb_cls closure for infocb 748 * a peer change
749 * @param perf_monitor_cb closure for the perf_monitor_cb
750 * @param addr_info_cb callback called when performance characteristics for
751 * an address change
752 * @param addr_info_cb_cls closure for infocb
751 * @return ats performance context 753 * @return ats performance context
752 */ 754 */
753struct GNUNET_ATS_PerformanceHandle * 755struct GNUNET_ATS_PerformanceHandle *
754GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 756GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
755 GNUNET_ATS_AddressInformationCallback infocb, 757 GNUNET_ATS_PerformanceMonitorCb perf_monitor_cb,
756 void *infocb_cls); 758 void *perf_monitor_cb_cls,
759 GNUNET_ATS_AddressInformationCallback addr_info_cb,
760 void *addr_info_cb_cls);
757 761
758 762
759/** 763/**
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 21dfdfdf8..7f8d02be9 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1149,13 +1149,6 @@ extern "C"
1149 */ 1149 */
1150#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE 355 1150#define GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE 355
1151 1151
1152/**
1153 * Type of the 'struct AddressListRequestMessage' sent by client to ATS
1154 * to request information about addresses
1155 */
1156#define GNUNET_MESSAGE_TYPE_ATS_MONITOR 356
1157
1158#define GNUNET_MESSAGE_TYPE_ATS_MONITOR_RESPONSE 357
1159 1152
1160 1153
1161/******************************************************************************* 1154/*******************************************************************************