gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35160 - in gnunet/src: ats include


From: gnunet
Subject: [GNUnet-SVN] r35160 - in gnunet/src: ats include
Date: Sun, 8 Feb 2015 16:34:37 +0100

Author: grothoff
Date: 2015-02-08 16:34:37 +0100 (Sun, 08 Feb 2015)
New Revision: 35160

Modified:
   gnunet/src/ats/gnunet-service-ats_addresses.c
   gnunet/src/ats/gnunet-service-ats_connectivity.c
   gnunet/src/ats/gnunet-service-ats_connectivity.h
   gnunet/src/ats/gnunet-service-ats_normalization.h
   gnunet/src/ats/gnunet-service-ats_plugins.c
   gnunet/src/ats/gnunet-service-ats_plugins.h
   gnunet/src/include/gnunet_ats_plugin.h
Log:
expose connectivity desire of clients to ATS plugins

Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c       2015-02-08 15:24:10 UTC 
(rev 35159)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c       2015-02-08 15:34:37 UTC 
(rev 35160)
@@ -572,10 +572,13 @@
              GNUNET_i2s (peer),
              session_id);
   /* Tell solver about new address */
+  GAS_plugin_solver_lock ();
   GAS_plugin_new_address (new_address,
-                         addr_net,
-                         atsi,
-                         atsi_count);
+                         addr_net);
+  GAS_normalization_update_property (new_address,
+                                     atsi,
+                                     atsi_count);
+  GAS_plugin_solver_unlock ();
   /* Notify performance clients about new address */
   GAS_performance_notify_all_clients (&new_address->peer,
                                      new_address->plugin,

Modified: gnunet/src/ats/gnunet-service-ats_connectivity.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_connectivity.c    2015-02-08 15:24:10 UTC 
(rev 35159)
+++ gnunet/src/ats/gnunet-service-ats_connectivity.c    2015-02-08 15:34:37 UTC 
(rev 35160)
@@ -54,11 +54,13 @@
  * Is the given peer in the list of peers for which we
  * have an address request?
  *
+ * @param cls unused, NULL
  * @param peer peer to query for
  * @return #GNUNET_YES if so, #GNUNET_NO if not
  */
-int
-GAS_connectivity_has_peer (const struct GNUNET_PeerIdentity *peer)
+unsigned int
+GAS_connectivity_has_peer (void *cls,
+                           const struct GNUNET_PeerIdentity *peer)
 {
   return GNUNET_CONTAINER_multipeermap_contains (connection_requests,
                                                  peer);

Modified: gnunet/src/ats/gnunet-service-ats_connectivity.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_connectivity.h    2015-02-08 15:24:10 UTC 
(rev 35159)
+++ gnunet/src/ats/gnunet-service-ats_connectivity.h    2015-02-08 15:34:37 UTC 
(rev 35160)
@@ -22,8 +22,6 @@
  * @brief ats service, interaction with 'connecivity' API
  * @author Matthias Wachs
  * @author Christian Grothoff
- *
- * TODO: will need API to query connectivity requests!
  */
 #ifndef GNUNET_SERVICE_ATS_CONNECTIVITY_H
 #define GNUNET_SERVICE_ATS_CONNECTIVITY_H
@@ -33,11 +31,13 @@
  * Is the given peer in the list of peers for which we
  * have an address request?
  *
+ * @param cls unused, NULL
  * @param peer peer to query for
  * @return #GNUNET_YES if so, #GNUNET_NO if not
  */
-int
-GAS_connectivity_has_peer (const struct GNUNET_PeerIdentity *peer);
+unsigned int
+GAS_connectivity_has_peer (void *cls,
+                           const struct GNUNET_PeerIdentity *peer);
 
 
 /**

Modified: gnunet/src/ats/gnunet-service-ats_normalization.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_normalization.h   2015-02-08 15:24:10 UTC 
(rev 35159)
+++ gnunet/src/ats/gnunet-service-ats_normalization.h   2015-02-08 15:34:37 UTC 
(rev 35160)
@@ -43,8 +43,8 @@
  */
 void
 GAS_normalization_update_property (struct ATS_Address *address,
-                                     const struct GNUNET_ATS_Information *atsi,
-                                     uint32_t atsi_count);
+                                   const struct GNUNET_ATS_Information *atsi,
+                                   uint32_t atsi_count);
 
 
 /**

Modified: gnunet/src/ats/gnunet-service-ats_plugins.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_plugins.c 2015-02-08 15:24:10 UTC (rev 
35159)
+++ gnunet/src/ats/gnunet-service-ats_plugins.c 2015-02-08 15:34:37 UTC (rev 
35160)
@@ -427,6 +427,7 @@
   env.info_cb = &solver_info_cb;
   env.bandwidth_changed_cb = &bandwidth_changed_cb;
   env.get_preferences = &GAS_preference_get_by_peer;
+  env.get_connectivity = &GAS_connectivity_has_peer;
   env.cfg = cfg;
   env.stats = GSA_stats;
   env.addresses = GSA_addresses;
@@ -473,23 +474,14 @@
  *
  * @param new_address the new address
  * @param addr_net network scope the address is in
- * @param atsi performance data for the address
- * @param atsi_count size of the @a atsi array
  */
 void
 GAS_plugin_new_address (struct ATS_Address *new_address,
-                       enum GNUNET_ATS_Network_Type addr_net,
-                       const struct GNUNET_ATS_Information *atsi,
-                       uint32_t atsi_count)
+                       enum GNUNET_ATS_Network_Type addr_net)
 {
   sf->s_add (sf->cls,
              new_address,
              addr_net);
-  sf->s_bulk_start (sf->cls);
-  GAS_normalization_update_property (new_address,
-                                       atsi,
-                                       atsi_count);
-  sf->s_bulk_stop (sf->cls);
 }
 
 

Modified: gnunet/src/ats/gnunet-service-ats_plugins.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_plugins.h 2015-02-08 15:24:10 UTC (rev 
35159)
+++ gnunet/src/ats/gnunet-service-ats_plugins.h 2015-02-08 15:34:37 UTC (rev 
35160)
@@ -83,14 +83,10 @@
  *
  * @param new_address the new address
  * @param addr_net network scope the address is in
- * @param atsi performance data for the address
- * @param atsi_count size of the @a atsi array
  */
 void
 GAS_plugin_new_address (struct ATS_Address *new_address,
-                       enum GNUNET_ATS_Network_Type addr_net,
-                       const struct GNUNET_ATS_Information *atsi,
-                       uint32_t atsi_count);
+                       enum GNUNET_ATS_Network_Type addr_net);
 
 
 /**

Modified: gnunet/src/include/gnunet_ats_plugin.h
===================================================================
--- gnunet/src/include/gnunet_ats_plugin.h      2015-02-08 15:24:10 UTC (rev 
35159)
+++ gnunet/src/include/gnunet_ats_plugin.h      2015-02-08 15:34:37 UTC (rev 
35160)
@@ -402,6 +402,20 @@
 
 
 /**
+ * Callback to call from solver to obtain application connectivity
+ * preferences for a peer.
+ *
+ * @param cls the cls
+ * @param id the peer id
+ * @return 0 if connectivity is not desired, non-null if address
+ *      suggestions are requested
+ */
+typedef unsigned int
+(*GAS_get_connectivity) (void *cls,
+                         const struct GNUNET_PeerIdentity *id);
+
+
+/**
  * The ATS plugin will pass a pointer to a struct
  * of this type as to the initialization function
  * of the ATS plugins.
@@ -439,6 +453,11 @@
   GAS_get_preferences get_preferences;
 
   /**
+   * ATS addresses function to obtain preference values
+   */
+  GAS_get_connectivity get_connectivity;
+
+  /**
    * Callback for solver to call with status information,
    * can be NULL
    */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]