aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ats/gnunet-service-ats_addresses.c9
-rw-r--r--src/ats/gnunet-service-ats_connectivity.c6
-rw-r--r--src/ats/gnunet-service-ats_connectivity.h8
-rw-r--r--src/ats/gnunet-service-ats_normalization.h4
-rw-r--r--src/ats/gnunet-service-ats_plugins.c12
-rw-r--r--src/ats/gnunet-service-ats_plugins.h6
-rw-r--r--src/include/gnunet_ats_plugin.h19
7 files changed, 38 insertions, 26 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index a1d47e3b9..c4d7f2da9 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -572,10 +572,13 @@ GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
572 GNUNET_i2s (peer), 572 GNUNET_i2s (peer),
573 session_id); 573 session_id);
574 /* Tell solver about new address */ 574 /* Tell solver about new address */
575 GAS_plugin_solver_lock ();
575 GAS_plugin_new_address (new_address, 576 GAS_plugin_new_address (new_address,
576 addr_net, 577 addr_net);
577 atsi, 578 GAS_normalization_update_property (new_address,
578 atsi_count); 579 atsi,
580 atsi_count);
581 GAS_plugin_solver_unlock ();
579 /* Notify performance clients about new address */ 582 /* Notify performance clients about new address */
580 GAS_performance_notify_all_clients (&new_address->peer, 583 GAS_performance_notify_all_clients (&new_address->peer,
581 new_address->plugin, 584 new_address->plugin,
diff --git a/src/ats/gnunet-service-ats_connectivity.c b/src/ats/gnunet-service-ats_connectivity.c
index 7f353c71f..3546f72dc 100644
--- a/src/ats/gnunet-service-ats_connectivity.c
+++ b/src/ats/gnunet-service-ats_connectivity.c
@@ -54,11 +54,13 @@ static struct GNUNET_CONTAINER_MultiPeerMap *connection_requests;
54 * Is the given peer in the list of peers for which we 54 * Is the given peer in the list of peers for which we
55 * have an address request? 55 * have an address request?
56 * 56 *
57 * @param cls unused, NULL
57 * @param peer peer to query for 58 * @param peer peer to query for
58 * @return #GNUNET_YES if so, #GNUNET_NO if not 59 * @return #GNUNET_YES if so, #GNUNET_NO if not
59 */ 60 */
60int 61unsigned int
61GAS_connectivity_has_peer (const struct GNUNET_PeerIdentity *peer) 62GAS_connectivity_has_peer (void *cls,
63 const struct GNUNET_PeerIdentity *peer)
62{ 64{
63 return GNUNET_CONTAINER_multipeermap_contains (connection_requests, 65 return GNUNET_CONTAINER_multipeermap_contains (connection_requests,
64 peer); 66 peer);
diff --git a/src/ats/gnunet-service-ats_connectivity.h b/src/ats/gnunet-service-ats_connectivity.h
index e677c054d..305ff5b6c 100644
--- a/src/ats/gnunet-service-ats_connectivity.h
+++ b/src/ats/gnunet-service-ats_connectivity.h
@@ -22,8 +22,6 @@
22 * @brief ats service, interaction with 'connecivity' API 22 * @brief ats service, interaction with 'connecivity' API
23 * @author Matthias Wachs 23 * @author Matthias Wachs
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 * TODO: will need API to query connectivity requests!
27 */ 25 */
28#ifndef GNUNET_SERVICE_ATS_CONNECTIVITY_H 26#ifndef GNUNET_SERVICE_ATS_CONNECTIVITY_H
29#define GNUNET_SERVICE_ATS_CONNECTIVITY_H 27#define GNUNET_SERVICE_ATS_CONNECTIVITY_H
@@ -33,11 +31,13 @@
33 * Is the given peer in the list of peers for which we 31 * Is the given peer in the list of peers for which we
34 * have an address request? 32 * have an address request?
35 * 33 *
34 * @param cls unused, NULL
36 * @param peer peer to query for 35 * @param peer peer to query for
37 * @return #GNUNET_YES if so, #GNUNET_NO if not 36 * @return #GNUNET_YES if so, #GNUNET_NO if not
38 */ 37 */
39int 38unsigned int
40GAS_connectivity_has_peer (const struct GNUNET_PeerIdentity *peer); 39GAS_connectivity_has_peer (void *cls,
40 const struct GNUNET_PeerIdentity *peer);
41 41
42 42
43/** 43/**
diff --git a/src/ats/gnunet-service-ats_normalization.h b/src/ats/gnunet-service-ats_normalization.h
index 614824d09..2ce9d726f 100644
--- a/src/ats/gnunet-service-ats_normalization.h
+++ b/src/ats/gnunet-service-ats_normalization.h
@@ -43,8 +43,8 @@
43 */ 43 */
44void 44void
45GAS_normalization_update_property (struct ATS_Address *address, 45GAS_normalization_update_property (struct ATS_Address *address,
46 const struct GNUNET_ATS_Information *atsi, 46 const struct GNUNET_ATS_Information *atsi,
47 uint32_t atsi_count); 47 uint32_t atsi_count);
48 48
49 49
50/** 50/**
diff --git a/src/ats/gnunet-service-ats_plugins.c b/src/ats/gnunet-service-ats_plugins.c
index b44934999..64ef53e55 100644
--- a/src/ats/gnunet-service-ats_plugins.c
+++ b/src/ats/gnunet-service-ats_plugins.c
@@ -427,6 +427,7 @@ GAS_plugin_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
427 env.info_cb = &solver_info_cb; 427 env.info_cb = &solver_info_cb;
428 env.bandwidth_changed_cb = &bandwidth_changed_cb; 428 env.bandwidth_changed_cb = &bandwidth_changed_cb;
429 env.get_preferences = &GAS_preference_get_by_peer; 429 env.get_preferences = &GAS_preference_get_by_peer;
430 env.get_connectivity = &GAS_connectivity_has_peer;
430 env.cfg = cfg; 431 env.cfg = cfg;
431 env.stats = GSA_stats; 432 env.stats = GSA_stats;
432 env.addresses = GSA_addresses; 433 env.addresses = GSA_addresses;
@@ -473,23 +474,14 @@ GAS_plugin_done ()
473 * 474 *
474 * @param new_address the new address 475 * @param new_address the new address
475 * @param addr_net network scope the address is in 476 * @param addr_net network scope the address is in
476 * @param atsi performance data for the address
477 * @param atsi_count size of the @a atsi array
478 */ 477 */
479void 478void
480GAS_plugin_new_address (struct ATS_Address *new_address, 479GAS_plugin_new_address (struct ATS_Address *new_address,
481 enum GNUNET_ATS_Network_Type addr_net, 480 enum GNUNET_ATS_Network_Type addr_net)
482 const struct GNUNET_ATS_Information *atsi,
483 uint32_t atsi_count)
484{ 481{
485 sf->s_add (sf->cls, 482 sf->s_add (sf->cls,
486 new_address, 483 new_address,
487 addr_net); 484 addr_net);
488 sf->s_bulk_start (sf->cls);
489 GAS_normalization_update_property (new_address,
490 atsi,
491 atsi_count);
492 sf->s_bulk_stop (sf->cls);
493} 485}
494 486
495 487
diff --git a/src/ats/gnunet-service-ats_plugins.h b/src/ats/gnunet-service-ats_plugins.h
index b2567ac26..7d76f6431 100644
--- a/src/ats/gnunet-service-ats_plugins.h
+++ b/src/ats/gnunet-service-ats_plugins.h
@@ -83,14 +83,10 @@ GAS_plugin_notify_property_changed (struct ATS_Address *address,
83 * 83 *
84 * @param new_address the new address 84 * @param new_address the new address
85 * @param addr_net network scope the address is in 85 * @param addr_net network scope the address is in
86 * @param atsi performance data for the address
87 * @param atsi_count size of the @a atsi array
88 */ 86 */
89void 87void
90GAS_plugin_new_address (struct ATS_Address *new_address, 88GAS_plugin_new_address (struct ATS_Address *new_address,
91 enum GNUNET_ATS_Network_Type addr_net, 89 enum GNUNET_ATS_Network_Type addr_net);
92 const struct GNUNET_ATS_Information *atsi,
93 uint32_t atsi_count);
94 90
95 91
96/** 92/**
diff --git a/src/include/gnunet_ats_plugin.h b/src/include/gnunet_ats_plugin.h
index 5fdc33f71..ec564bb82 100644
--- a/src/include/gnunet_ats_plugin.h
+++ b/src/include/gnunet_ats_plugin.h
@@ -402,6 +402,20 @@ typedef const double *
402 402
403 403
404/** 404/**
405 * Callback to call from solver to obtain application connectivity
406 * preferences for a peer.
407 *
408 * @param cls the cls
409 * @param id the peer id
410 * @return 0 if connectivity is not desired, non-null if address
411 * suggestions are requested
412 */
413typedef unsigned int
414(*GAS_get_connectivity) (void *cls,
415 const struct GNUNET_PeerIdentity *id);
416
417
418/**
405 * The ATS plugin will pass a pointer to a struct 419 * The ATS plugin will pass a pointer to a struct
406 * of this type as to the initialization function 420 * of this type as to the initialization function
407 * of the ATS plugins. 421 * of the ATS plugins.
@@ -439,6 +453,11 @@ struct GNUNET_ATS_PluginEnvironment
439 GAS_get_preferences get_preferences; 453 GAS_get_preferences get_preferences;
440 454
441 /** 455 /**
456 * ATS addresses function to obtain preference values
457 */
458 GAS_get_connectivity get_connectivity;
459
460 /**
442 * Callback for solver to call with status information, 461 * Callback for solver to call with status information,
443 * can be NULL 462 * can be NULL
444 */ 463 */