aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-12 10:54:28 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-12 10:54:28 +0000
commit3d016df6e9f16a224637ae1f525acdcbbce9fbed (patch)
treec198a1c8a918412d018f446d98ee553a3a1dac68 /src
parent180f2e637029d045e3c72dc3e13fddb1f9f30141 (diff)
downloadgnunet-3d016df6e9f16a224637ae1f525acdcbbce9fbed.tar.gz
gnunet-3d016df6e9f16a224637ae1f525acdcbbce9fbed.zip
initial ATS service refactoring
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/ats/Makefile.am38
-rw-r--r--src/ats/ats_api.c (renamed from src/transport/gnunet-service-transport_ats-new.c)100
-rw-r--r--src/include/gnunet_ats_service.h (renamed from src/transport/gnunet-service-transport_ats-new.h)96
-rw-r--r--src/transport/Makefile.am2
-rw-r--r--src/transport/gnunet-service-transport-new.c8
-rw-r--r--src/transport/gnunet-service-transport.h2
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c14
-rw-r--r--src/transport/gnunet-service-transport_validation.c6
9 files changed, 155 insertions, 112 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ac08a16a9..044983d60 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,6 +17,7 @@ SUBDIRS = \
17 datacache \ 17 datacache \
18 datastore \ 18 datastore \
19 template \ 19 template \
20 ats \
20 nat \ 21 nat \
21 fragmentation \ 22 fragmentation \
22 transport \ 23 transport \
diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am
new file mode 100644
index 000000000..39aa3f87b
--- /dev/null
+++ b/src/ats/Makefile.am
@@ -0,0 +1,38 @@
1INCLUDES = -I$(top_srcdir)/src/include
2
3if MINGW
4 WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
5endif
6
7if USE_COVERAGE
8 AM_CFLAGS = -fprofile-arcs -ftest-coverage
9endif
10
11lib_LTLIBRARIES = libgnunetats.la
12
13libgnunetats_la_SOURCES = \
14 ats_api.c
15
16
17#bin_PROGRAMS = \
18# gnunet-service-ats
19
20#gnunet_service_ats_SOURCES = \
21# gnunet-service-ats.c
22#gnunet_service_ats_LDADD = \
23# $(top_builddir)/src/util/libgnunetutil.la \
24# $(GN_LIBINTL)
25
26
27#check_PROGRAMS = \
28# test_ats_api
29
30#if ENABLE_TEST_RUN
31#TESTS = $(check_PROGRAMS)
32#endif
33
34#test_ats_api_SOURCES = \
35# test_ats_api.c
36#test_ats_api_LDADD = \
37# $(top_builddir)/src/util/libgnunetutil.la
38
diff --git a/src/transport/gnunet-service-transport_ats-new.c b/src/ats/ats_api.c
index 3a8bc7497..8609ac5a5 100644
--- a/src/transport/gnunet-service-transport_ats-new.c
+++ b/src/ats/ats_api.c
@@ -18,14 +18,18 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file transport/gnunet-service-transport_ats-new.c 21 * @file ats/ats_api.c
22 * @brief automatic transport selection API 22 * @brief automatic transport selection API
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * @author Matthias Wachs 24 * @author Matthias Wachs
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet-service-transport_ats-new.h" 27#include "gnunet_ats_service.h"
28 28
29// NOTE: this implementation is simply supposed
30// to implement a simplistic strategy in-process;
31// in the future, we plan to replace it with a real
32// service implementation
29 33
30/** 34/**
31 * Allocation record for a peer's address. 35 * Allocation record for a peer's address.
@@ -84,13 +88,13 @@ struct AllocationRecord
84/** 88/**
85 * Opaque handle to stop incremental validation address callbacks. 89 * Opaque handle to stop incremental validation address callbacks.
86 */ 90 */
87struct GST_AtsSuggestionContext 91struct GNUNET_ATS_SuggestionContext
88{ 92{
89 93
90 /** 94 /**
91 * Function to call with our final suggestion. 95 * Function to call with our final suggestion.
92 */ 96 */
93 GST_AtsAddressSuggestionCallback cb; 97 GNUNET_ATS_AddressSuggestionCallback cb;
94 98
95 /** 99 /**
96 * Closure for 'cb'. 100 * Closure for 'cb'.
@@ -100,7 +104,7 @@ struct GST_AtsSuggestionContext
100 /** 104 /**
101 * Global ATS handle. 105 * Global ATS handle.
102 */ 106 */
103 struct GST_AtsHandle *atc; 107 struct GNUNET_ATS_Handle *atc;
104 108
105 /** 109 /**
106 * Which peer are we monitoring? 110 * Which peer are we monitoring?
@@ -113,7 +117,7 @@ struct GST_AtsSuggestionContext
113/** 117/**
114 * Handle to the ATS subsystem. 118 * Handle to the ATS subsystem.
115 */ 119 */
116struct GST_AtsHandle 120struct GNUNET_ATS_Handle
117{ 121{
118 /** 122 /**
119 * Configuration. 123 * Configuration.
@@ -137,7 +141,7 @@ struct GST_AtsHandle
137 struct GNUNET_CONTAINER_MultiHashMap *peers; 141 struct GNUNET_CONTAINER_MultiHashMap *peers;
138 142
139 /** 143 /**
140 * Map of PeerIdentities to 'struct GST_AtsSuggestionContext's. 144 * Map of PeerIdentities to 'struct GNUNET_ATS_SuggestionContext's.
141 */ 145 */
142 struct GNUNET_CONTAINER_MultiHashMap *notify_map; 146 struct GNUNET_CONTAINER_MultiHashMap *notify_map;
143 147
@@ -177,7 +181,7 @@ count_connections (void *cls,
177 181
178struct SetBandwidthContext 182struct SetBandwidthContext
179{ 183{
180 struct GST_AtsHandle *atc; 184 struct GNUNET_ATS_Handle *atc;
181 struct GNUNET_BANDWIDTH_Value32NBO bw; 185 struct GNUNET_BANDWIDTH_Value32NBO bw;
182}; 186};
183 187
@@ -226,14 +230,14 @@ set_bw_connections (void *cls,
226/** 230/**
227 * Task run to update bandwidth assignments. 231 * Task run to update bandwidth assignments.
228 * 232 *
229 * @param cls the 'struct GST_AtsHandle' 233 * @param cls the 'struct GNUNET_ATS_Handle'
230 * @param tc scheduler context 234 * @param tc scheduler context
231 */ 235 */
232static void 236static void
233update_bandwidth_task (void *cls, 237update_bandwidth_task (void *cls,
234 const struct GNUNET_SCHEDULER_TaskContext *tc) 238 const struct GNUNET_SCHEDULER_TaskContext *tc)
235{ 239{
236 struct GST_AtsHandle *atc = cls; 240 struct GNUNET_ATS_Handle *atc = cls;
237 unsigned int ac; 241 unsigned int ac;
238 struct SetBandwidthContext bwc; 242 struct SetBandwidthContext bwc;
239 243
@@ -257,7 +261,7 @@ update_bandwidth_task (void *cls,
257 * @param change which allocation record changed? 261 * @param change which allocation record changed?
258 */ 262 */
259static void 263static void
260update_bandwidth_assignment (struct GST_AtsHandle *atc, 264update_bandwidth_assignment (struct GNUNET_ATS_Handle *atc,
261 struct AllocationRecord *change) 265 struct AllocationRecord *change)
262{ 266{
263 /* FIXME: based on the 'change', update the LP-problem... */ 267 /* FIXME: based on the 'change', update the LP-problem... */
@@ -270,7 +274,7 @@ update_bandwidth_assignment (struct GST_AtsHandle *atc,
270/** 274/**
271 * Function called with feasbile addresses we might want to suggest. 275 * Function called with feasbile addresses we might want to suggest.
272 * 276 *
273 * @param cls the 'struct GST_AtsSuggestionContext' 277 * @param cls the 'struct GNUNET_ATS_SuggestionContext'
274 * @param key identity of the peer 278 * @param key identity of the peer
275 * @param value a 'struct AllocationRecord' for the peer 279 * @param value a 'struct AllocationRecord' for the peer
276 * @return GNUNET_NO if we're done, GNUNET_YES if we did not suggest an address yet 280 * @return GNUNET_NO if we're done, GNUNET_YES if we did not suggest an address yet
@@ -280,7 +284,7 @@ suggest_address (void *cls,
280 const GNUNET_HashCode *key, 284 const GNUNET_HashCode *key,
281 void *value) 285 void *value)
282{ 286{
283 struct GST_AtsSuggestionContest *asc = cls; 287 struct GNUNET_ATS_SuggestionContest *asc = cls;
284 struct AllocationRecord *ar = value; 288 struct AllocationRecord *ar = value;
285 289
286 // FIXME... 290 // FIXME...
@@ -297,15 +301,15 @@ suggest_address (void *cls,
297 * @param cb function to call with the address 301 * @param cb function to call with the address
298 * @param cb_cls closure for cb 302 * @param cb_cls closure for cb
299 */ 303 */
300struct GST_AtsSuggestionContext * 304struct GNUNET_ATS_SuggestionContext *
301GST_ats_suggest_address (struct GST_AtsHandle *atc, 305GNUNET_ATS_suggest_address (struct GNUNET_ATS_Handle *atc,
302 const struct GNUNET_PeerIdentity *peer, 306 const struct GNUNET_PeerIdentity *peer,
303 GST_AtsAddressSuggestionCallback cb, 307 GNUNET_ATS_AddressSuggestionCallback cb,
304 void *cb_cls) 308 void *cb_cls)
305{ 309{
306 struct GST_AtsSuggestionContext *asc; 310 struct GNUNET_ATS_SuggestionContext *asc;
307 311
308 asc = GNUNET_malloc (sizeof (struct GST_AtsSuggestionContext)); 312 asc = GNUNET_malloc (sizeof (struct GNUNET_ATS_SuggestionContext));
309 asc->cb = cb; 313 asc->cb = cb;
310 asc->cb_cls = cb_cls; 314 asc->cb_cls = cb_cls;
311 asc->atc = atc; 315 asc->atc = atc;
@@ -333,7 +337,7 @@ GST_ats_suggest_address (struct GST_AtsHandle *atc,
333 * @param asc handle of the request to cancel 337 * @param asc handle of the request to cancel
334 */ 338 */
335void 339void
336GST_ats_suggest_address_cancel (struct GST_AtsSuggestionContext *asc) 340GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc)
337{ 341{
338 GNUNET_assert (GNUNET_OK == 342 GNUNET_assert (GNUNET_OK ==
339 GNUNET_CONTAINER_multihashmap_remove (asc->atc->notify_map, 343 GNUNET_CONTAINER_multihashmap_remove (asc->atc->notify_map,
@@ -351,14 +355,14 @@ GST_ats_suggest_address_cancel (struct GST_AtsSuggestionContext *asc)
351 * @param alloc_cb_cls closure for 'alloc_cb' 355 * @param alloc_cb_cls closure for 'alloc_cb'
352 * @return ats context 356 * @return ats context
353 */ 357 */
354struct GST_AtsHandle * 358struct GNUNET_ATS_Handle *
355GST_ats_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 359GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
356 GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb, 360 GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
357 void *alloc_cb_cls) 361 void *alloc_cb_cls)
358{ 362{
359 struct GST_AtsHandle *atc; 363 struct GNUNET_ATS_Handle *atc;
360 364
361 atc = GNUNET_malloc (sizeof (struct GST_AtsHandle)); 365 atc = GNUNET_malloc (sizeof (struct GNUNET_ATS_Handle));
362 atc->cfg = cfg; 366 atc->cfg = cfg;
363 atc->alloc_cb = alloc_cb; 367 atc->alloc_cb = alloc_cb;
364 atc->alloc_cb_cls = alloc_cb_cls; 368 atc->alloc_cb_cls = alloc_cb_cls;
@@ -399,7 +403,7 @@ destroy_allocation_record (void *cls,
399 * @param atc handle 403 * @param atc handle
400 */ 404 */
401void 405void
402GST_ats_shutdown (struct GST_AtsHandle *atc) 406GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc)
403{ 407{
404 if (GNUNET_SCHEDULER_NO_TASK != atc->ba_task) 408 if (GNUNET_SCHEDULER_NO_TASK != atc->ba_task)
405 { 409 {
@@ -425,7 +429,7 @@ struct UpdateSessionContext
425 /** 429 /**
426 * Ats handle. 430 * Ats handle.
427 */ 431 */
428 struct GST_AtsHandle *atc; 432 struct GNUNET_ATS_Handle *atc;
429 433
430 /** 434 /**
431 * Allocation record with new information. 435 * Allocation record with new information.
@@ -536,7 +540,7 @@ disconnect_peer (void *cls,
536 const GNUNET_HashCode *key, 540 const GNUNET_HashCode *key,
537 void *value) 541 void *value)
538{ 542{
539 struct GST_AtsHandle *atc = cls; 543 struct GNUNET_ATS_Handle *atc = cls;
540 struct AllocationRecord *ar = value; 544 struct AllocationRecord *ar = value;
541 545
542 if (GNUNET_YES == ar->connected) 546 if (GNUNET_YES == ar->connected)
@@ -564,15 +568,15 @@ disconnect_peer (void *cls,
564 * @param ats_count number of performance records in 'ats' 568 * @param ats_count number of performance records in 'ats'
565 */ 569 */
566void 570void
567GST_ats_peer_connect (struct GST_AtsHandle *atc, 571GNUNET_ATS_peer_connect (struct GNUNET_ATS_Handle *atc,
568 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key, 572 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
569 const struct GNUNET_PeerIdentity *peer, 573 const struct GNUNET_PeerIdentity *peer,
570 const char *plugin_name, 574 const char *plugin_name,
571 struct Session *session, 575 struct Session *session,
572 const void *plugin_addr, 576 const void *plugin_addr,
573 size_t plugin_addr_len, 577 size_t plugin_addr_len,
574 const struct GNUNET_TRANSPORT_ATS_Information *ats, 578 const struct GNUNET_TRANSPORT_ATS_Information *ats,
575 uint32_t ats_count) 579 uint32_t ats_count)
576{ 580{
577 struct AllocationRecord *ar; 581 struct AllocationRecord *ar;
578 struct UpdateSessionContext usc; 582 struct UpdateSessionContext usc;
@@ -615,7 +619,7 @@ GST_ats_peer_connect (struct GST_AtsHandle *atc,
615 * @param peer identity of the new peer 619 * @param peer identity of the new peer
616 */ 620 */
617void 621void
618GST_ats_peer_disconnect (struct GST_AtsHandle *atc, 622GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_Handle *atc,
619 const struct GNUNET_PeerIdentity *peer) 623 const struct GNUNET_PeerIdentity *peer)
620{ 624{
621 (void) GNUNET_CONTAINER_multihashmap_get_multiple (atc->peers, 625 (void) GNUNET_CONTAINER_multihashmap_get_multiple (atc->peers,
@@ -633,7 +637,7 @@ struct SessionDestroyContext
633 /** 637 /**
634 * Ats handle. 638 * Ats handle.
635 */ 639 */
636 struct GST_AtsHandle *atc; 640 struct GNUNET_ATS_Handle *atc;
637 641
638 /** 642 /**
639 * Session being destroyed. 643 * Session being destroyed.
@@ -685,7 +689,7 @@ destroy_session (void *cls,
685 * @param session session handle that is no longer valid 689 * @param session session handle that is no longer valid
686 */ 690 */
687void 691void
688GST_ats_session_destroyed (struct GST_AtsHandle *atc, 692GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc,
689 const struct GNUNET_PeerIdentity *peer, 693 const struct GNUNET_PeerIdentity *peer,
690 const struct Session *session) 694 const struct Session *session)
691{ 695{
@@ -713,7 +717,7 @@ notify_valid (void *cls,
713 void *value) 717 void *value)
714{ 718{
715 struct AllocationRecord *ar = cls; 719 struct AllocationRecord *ar = cls;
716 struct GST_AtsSuggestionContext *asc = value; 720 struct GNUNET_ATS_SuggestionContext *asc = value;
717 721
718 asc->cb (asc->cb_cls, 722 asc->cb (asc->cb_cls,
719 &ar->public_key, 723 &ar->public_key,
@@ -745,15 +749,15 @@ notify_valid (void *cls,
745 * @param ats_count number of performance records in 'ats' 749 * @param ats_count number of performance records in 'ats'
746 */ 750 */
747void 751void
748GST_ats_address_update (struct GST_AtsHandle *atc, 752GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc,
749 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key, 753 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
750 const struct GNUNET_PeerIdentity *peer, 754 const struct GNUNET_PeerIdentity *peer,
751 const char *plugin_name, 755 const char *plugin_name,
752 struct Session *session, 756 struct Session *session,
753 const void *plugin_addr, 757 const void *plugin_addr,
754 size_t plugin_addr_len, 758 size_t plugin_addr_len,
755 const struct GNUNET_TRANSPORT_ATS_Information *ats, 759 const struct GNUNET_TRANSPORT_ATS_Information *ats,
756 uint32_t ats_count) 760 uint32_t ats_count)
757{ 761{
758 struct AllocationRecord *ar; 762 struct AllocationRecord *ar;
759 struct UpdateSessionContext usc; 763 struct UpdateSessionContext usc;
diff --git a/src/transport/gnunet-service-transport_ats-new.h b/src/include/gnunet_ats_service.h
index ed72dd171..da54b24be 100644
--- a/src/transport/gnunet-service-transport_ats-new.h
+++ b/src/include/gnunet_ats_service.h
@@ -18,18 +18,18 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20/** 20/**
21 * @file transport/gnunet-service-transport_ats-new.h 21 * @file include/gnunet_ats_service.h
22 * @brief automatic transport selection and outbound bandwidth determination 22 * @brief automatic transport selection and outbound bandwidth determination
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * @author Matthias Wachs 24 * @author Matthias Wachs
25 * 25 *
26 * TODO: 26 * TODO:
27 * - turn into service 27 * - move GNUNET_TRANSPORT_ATS* in here and rename...
28 * - extend API to express communication preferences to ATS 28 * - extend API to express communication preferences to ATS
29 * (to be called DIRECTLY from apps, not from transport/core!) 29 * (to be called DIRECTLY from apps, not from transport/core!)
30 */ 30 */
31#ifndef GNUNET_SERVICE_TRANSPORT_ATS_H 31#ifndef GNUNET_ATS_SERVICE_H
32#define GNUNET_SERVICE_TRANSPORT_ATS_H 32#define GNUNET_ATS_SERVICE_H
33 33
34#include "gnunet_constants.h" 34#include "gnunet_constants.h"
35#include "gnunet_util_lib.h" 35#include "gnunet_util_lib.h"
@@ -40,7 +40,7 @@
40/** 40/**
41 * Handle to the ATS subsystem. 41 * Handle to the ATS subsystem.
42 */ 42 */
43struct GST_AtsHandle; 43struct GNUNET_ATS_Handle;
44 44
45 45
46/** 46/**
@@ -75,10 +75,10 @@ typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification)(void *cls,
75 * @param alloc_cb_cls closure for 'alloc_cb' 75 * @param alloc_cb_cls closure for 'alloc_cb'
76 * @return ats context 76 * @return ats context
77 */ 77 */
78struct GST_AtsHandle * 78struct GNUNET_ATS_Handle *
79GST_ats_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 79GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
80 GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb, 80 GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
81 void *alloc_cb_cls); 81 void *alloc_cb_cls);
82 82
83 83
84/** 84/**
@@ -87,7 +87,7 @@ GST_ats_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
87 * @param atc handle 87 * @param atc handle
88 */ 88 */
89void 89void
90GST_ats_shutdown (struct GST_AtsHandle *atc); 90GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc);
91 91
92 92
93/** 93/**
@@ -102,20 +102,20 @@ GST_ats_shutdown (struct GST_AtsHandle *atc);
102 * @param ats performance data for the address (as far as known) 102 * @param ats performance data for the address (as far as known)
103 * @param ats_count number of performance records in 'ats' 103 * @param ats_count number of performance records in 'ats'
104 */ 104 */
105typedef void (*GST_AtsAddressSuggestionCallback)(void *cls, 105typedef void (*GNUNET_ATS_AddressSuggestionCallback)(void *cls,
106 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key, 106 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
107 const struct GNUNET_PeerIdentity *peer, 107 const struct GNUNET_PeerIdentity *peer,
108 const char *plugin_name, 108 const char *plugin_name,
109 const void *plugin_addr, 109 const void *plugin_addr,
110 size_t plugin_addr_len, 110 size_t plugin_addr_len,
111 const struct GNUNET_TRANSPORT_ATS_Information *ats, 111 const struct GNUNET_TRANSPORT_ATS_Information *ats,
112 uint32_t ats_count); 112 uint32_t ats_count);
113 113
114 114
115/** 115/**
116 * Handle to cancel suggestion request. 116 * Handle to cancel suggestion request.
117 */ 117 */
118struct GST_AtsSuggestionContext; 118struct GNUNET_ATS_SuggestionContext;
119 119
120 120
121/** 121/**
@@ -127,11 +127,11 @@ struct GST_AtsSuggestionContext;
127 * @param cb function to call with the address 127 * @param cb function to call with the address
128 * @param cb_cls closure for cb 128 * @param cb_cls closure for cb
129 */ 129 */
130struct GST_AtsSuggestionContext * 130struct GNUNET_ATS_SuggestionContext *
131GST_ats_suggest_address (struct GST_AtsHandle *atc, 131GNUNET_ATS_suggest_address (struct GNUNET_ATS_Handle *atc,
132 const struct GNUNET_PeerIdentity *peer, 132 const struct GNUNET_PeerIdentity *peer,
133 GST_AtsAddressSuggestionCallback cb, 133 GNUNET_ATS_AddressSuggestionCallback cb,
134 void *cb_cls); 134 void *cb_cls);
135 135
136 136
137/** 137/**
@@ -140,7 +140,7 @@ GST_ats_suggest_address (struct GST_AtsHandle *atc,
140 * @param asc handle of the request to cancel 140 * @param asc handle of the request to cancel
141 */ 141 */
142void 142void
143GST_ats_suggest_address_cancel (struct GST_AtsSuggestionContext *asc); 143GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc);
144 144
145 145
146/** 146/**
@@ -159,15 +159,15 @@ GST_ats_suggest_address_cancel (struct GST_AtsSuggestionContext *asc);
159 * @param ats_count number of performance records in 'ats' 159 * @param ats_count number of performance records in 'ats'
160 */ 160 */
161void 161void
162GST_ats_peer_connect (struct GST_AtsHandle *atc, 162GNUNET_ATS_peer_connect (struct GNUNET_ATS_Handle *atc,
163 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key, 163 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
164 const struct GNUNET_PeerIdentity *peer, 164 const struct GNUNET_PeerIdentity *peer,
165 const char *plugin_name, 165 const char *plugin_name,
166 struct Session *session, 166 struct Session *session,
167 const void *plugin_addr, 167 const void *plugin_addr,
168 size_t plugin_addr_len, 168 size_t plugin_addr_len,
169 const struct GNUNET_TRANSPORT_ATS_Information *ats, 169 const struct GNUNET_TRANSPORT_ATS_Information *ats,
170 uint32_t ats_count); 170 uint32_t ats_count);
171 171
172 172
173/** 173/**
@@ -179,8 +179,8 @@ GST_ats_peer_connect (struct GST_AtsHandle *atc,
179 * @param peer identity of the peer 179 * @param peer identity of the peer
180 */ 180 */
181void 181void
182GST_ats_peer_disconnect (struct GST_AtsHandle *atc, 182GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_Handle *atc,
183 const struct GNUNET_PeerIdentity *peer); 183 const struct GNUNET_PeerIdentity *peer);
184 184
185 185
186/** 186/**
@@ -191,9 +191,9 @@ GST_ats_peer_disconnect (struct GST_AtsHandle *atc,
191 * @param session session handle that is no longer valid 191 * @param session session handle that is no longer valid
192 */ 192 */
193void 193void
194GST_ats_session_destroyed (struct GST_AtsHandle *atc, 194GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc,
195 const struct GNUNET_PeerIdentity *peer, 195 const struct GNUNET_PeerIdentity *peer,
196 const struct Session *session); 196 const struct Session *session);
197 197
198 198
199/** 199/**
@@ -215,15 +215,15 @@ GST_ats_session_destroyed (struct GST_AtsHandle *atc,
215 * @param ats_count number of performance records in 'ats' 215 * @param ats_count number of performance records in 'ats'
216 */ 216 */
217void 217void
218GST_ats_address_update (struct GST_AtsHandle *atc, 218GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc,
219 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key, 219 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
220 const struct GNUNET_PeerIdentity *peer, 220 const struct GNUNET_PeerIdentity *peer,
221 const char *plugin_name, 221 const char *plugin_name,
222 struct Session *session, 222 struct Session *session,
223 const void *plugin_addr, 223 const void *plugin_addr,
224 size_t plugin_addr_len, 224 size_t plugin_addr_len,
225 const struct GNUNET_TRANSPORT_ATS_Information *ats, 225 const struct GNUNET_TRANSPORT_ATS_Information *ats,
226 uint32_t ats_count); 226 uint32_t ats_count);
227 227
228 228
229#endif 229#endif
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index b9ab214e0..372ff115e 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -153,7 +153,6 @@ gnunet_service_transport_LDADD = \
153 153
154gnunet_service_transport_new_SOURCES = \ 154gnunet_service_transport_new_SOURCES = \
155 gnunet-service-transport-new.c gnunet-service-transport.h \ 155 gnunet-service-transport-new.c gnunet-service-transport.h \
156 gnunet-service-transport_ats-new.h gnunet-service-transport_ats-new.c \
157 gnunet-service-transport_blacklist.h gnunet-service-transport_blacklist.c \ 156 gnunet-service-transport_blacklist.h gnunet-service-transport_blacklist.c \
158 gnunet-service-transport_clients.h gnunet-service-transport_clients.c \ 157 gnunet-service-transport_clients.h gnunet-service-transport_clients.c \
159 gnunet-service-transport_hello.h gnunet-service-transport_hello.c \ 158 gnunet-service-transport_hello.h gnunet-service-transport_hello.c \
@@ -161,6 +160,7 @@ gnunet_service_transport_new_SOURCES = \
161 gnunet-service-transport_plugins.h gnunet-service-transport_plugins.c \ 160 gnunet-service-transport_plugins.h gnunet-service-transport_plugins.c \
162 gnunet-service-transport_validation.h gnunet-service-transport_validation.c 161 gnunet-service-transport_validation.h gnunet-service-transport_validation.c
163gnunet_service_transport_new_LDADD = \ 162gnunet_service_transport_new_LDADD = \
163 $(top_builddir)/src/ats/libgnunetats.la \
164 $(top_builddir)/src/hello/libgnunethello.la \ 164 $(top_builddir)/src/hello/libgnunethello.la \
165 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ 165 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
166 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 166 $(top_builddir)/src/statistics/libgnunetstatistics.la \
diff --git a/src/transport/gnunet-service-transport-new.c b/src/transport/gnunet-service-transport-new.c
index 968145b1e..cd1901a27 100644
--- a/src/transport/gnunet-service-transport-new.c
+++ b/src/transport/gnunet-service-transport-new.c
@@ -28,8 +28,8 @@
28#include "gnunet_statistics_service.h" 28#include "gnunet_statistics_service.h"
29#include "gnunet_transport_service.h" 29#include "gnunet_transport_service.h"
30#include "gnunet_peerinfo_service.h" 30#include "gnunet_peerinfo_service.h"
31#include "gnunet_ats_service.h"
31#include "gnunet-service-transport.h" 32#include "gnunet-service-transport.h"
32#include "gnunet-service-transport_ats-new.h"
33#include "gnunet-service-transport_blacklist.h" 33#include "gnunet-service-transport_blacklist.h"
34#include "gnunet-service-transport_clients.h" 34#include "gnunet-service-transport_clients.h"
35#include "gnunet-service-transport_hello.h" 35#include "gnunet-service-transport_hello.h"
@@ -72,7 +72,7 @@ struct GNUNET_CRYPTO_RsaPrivateKey *GST_my_private_key;
72/** 72/**
73 * ATS handle. 73 * ATS handle.
74 */ 74 */
75struct GST_AtsHandle *GST_ats; 75struct GNUNET_ATS_Handle *GST_ats;
76 76
77 77
78/** 78/**
@@ -133,7 +133,7 @@ shutdown_task (void *cls,
133{ 133{
134 GST_validation_stop (); 134 GST_validation_stop ();
135 GST_neighbours_stop (); 135 GST_neighbours_stop ();
136 GST_ats_shutdown (GST_ats); GST_ats = NULL; 136 GNUNET_ATS_shutdown (GST_ats); GST_ats = NULL;
137 GST_clients_stop (); 137 GST_clients_stop ();
138 GST_blacklist_stop (); 138 GST_blacklist_stop ();
139 GST_plugins_unload (); 139 GST_plugins_unload ();
@@ -221,7 +221,7 @@ run (void *cls,
221 NULL, // FIXME... 221 NULL, // FIXME...
222 NULL, // FIXME... 222 NULL, // FIXME...
223 NULL); // FIXME... 223 NULL); // FIXME...
224 GST_ats = GST_ats_init (GST_cfg, 224 GST_ats = GNUNET_ATS_init (GST_cfg,
225 NULL, // FIXME... 225 NULL, // FIXME...
226 NULL); // FIXME... 226 NULL); // FIXME...
227 GST_neighbours_start (NULL, // FIXME... 227 GST_neighbours_start (NULL, // FIXME...
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h
index 69cb20e7b..17fcaa0ae 100644
--- a/src/transport/gnunet-service-transport.h
+++ b/src/transport/gnunet-service-transport.h
@@ -63,7 +63,7 @@ extern struct GNUNET_CRYPTO_RsaPrivateKey *GST_my_private_key;
63/** 63/**
64 * ATS handle. 64 * ATS handle.
65 */ 65 */
66extern struct GST_AtsHandle *GST_ats; 66extern struct GNUNET_ATS_Handle *GST_ats;
67 67
68 68
69#endif 69#endif
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index cff2bb595..2d23ebfa1 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -24,7 +24,7 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet-service-transport_ats-new.h" 27#include "gnunet_ats_service.h"
28#include "gnunet-service-transport_neighbours.h" 28#include "gnunet-service-transport_neighbours.h"
29#include "gnunet-service-transport_validation.h" 29#include "gnunet-service-transport_validation.h"
30#include "gnunet-service-transport.h" 30#include "gnunet-service-transport.h"
@@ -129,7 +129,7 @@ struct NeighbourMapEntry
129 * Context for address suggestion. 129 * Context for address suggestion.
130 * NULL after we are connected. 130 * NULL after we are connected.
131 */ 131 */
132 struct GST_AtsSuggestionContext *asc; 132 struct GNUNET_ATS_SuggestionContext *asc;
133 133
134 /** 134 /**
135 * Performance data for the peer. 135 * Performance data for the peer.
@@ -341,7 +341,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
341 } 341 }
342 if (NULL != n->asc) 342 if (NULL != n->asc)
343 { 343 {
344 GST_ats_suggest_address_cancel (n->asc); 344 GNUNET_ATS_suggest_address_cancel (n->asc);
345 n->asc = NULL; 345 n->asc = NULL;
346 } 346 }
347 GNUNET_array_grow (n->ats, 347 GNUNET_array_grow (n->ats,
@@ -486,10 +486,10 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
486 } 486 }
487 if (n->asc != NULL) 487 if (n->asc != NULL)
488 return; /* already trying */ 488 return; /* already trying */
489 n->asc = GST_ats_suggest_address (GST_ats, 489 n->asc = GNUNET_ATS_suggest_address (GST_ats,
490 target, 490 target,
491 &try_connect_using_address, 491 &try_connect_using_address,
492 n); 492 n);
493} 493}
494 494
495 495
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 1a619a901..2b03e3805 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -27,9 +27,9 @@
27#include "gnunet-service-transport_validation.h" 27#include "gnunet-service-transport_validation.h"
28#include "gnunet-service-transport_plugins.h" 28#include "gnunet-service-transport_plugins.h"
29#include "gnunet-service-transport_hello.h" 29#include "gnunet-service-transport_hello.h"
30#include "gnunet-service-transport_ats-new.h"
31#include "gnunet-service-transport.h" 30#include "gnunet-service-transport.h"
32#include "gnunet_hello_lib.h" 31#include "gnunet_hello_lib.h"
32#include "gnunet_ats_service.h"
33#include "gnunet_peerinfo_service.h" 33#include "gnunet_peerinfo_service.h"
34#include "gnunet_signatures.h" 34#include "gnunet_signatures.h"
35 35
@@ -418,7 +418,7 @@ add_valid_address (void *cls,
418 ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); 418 ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen);
419 ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, 419 ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until,
420 expiration); 420 expiration);
421 GST_ats_address_update (GST_ats, 421 GNUNET_ATS_address_update (GST_ats,
422 &public_key, 422 &public_key,
423 &pid, 423 &pid,
424 tname, 424 tname,
@@ -1037,7 +1037,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
1037 1037
1038 /* validity achieved, remember it! */ 1038 /* validity achieved, remember it! */
1039 ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); 1039 ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION);
1040 GST_ats_address_update (GST_ats, 1040 GNUNET_ATS_address_update (GST_ats,
1041 &ve->public_key, 1041 &ve->public_key,
1042 &ve->pid, 1042 &ve->pid,
1043 ve->transport_name, 1043 ve->transport_name,