ATS API cleanup: remove 2nd callback type with virtually identical signature
authorChristian Grothoff <christian@grothoff.org>
Thu, 13 Oct 2011 08:28:15 +0000 (08:28 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 13 Oct 2011 08:28:15 +0000 (08:28 +0000)
src/ats/ats_api.c
src/ats/ats_api.h
src/include/gnunet_ats_service.h

index b5467cdb36321e65df553eeb8bf525abf6c873c2..ef2fa1bedb580e966d6a2c5bd083d403c525aa09 100644 (file)
@@ -152,9 +152,12 @@ set_bw_connections (void *cls, const GNUNET_HashCode * key, void *value)
     if (NULL != sbc->atc->alloc_cb)
       sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls,
                           (const struct GNUNET_PeerIdentity *) key,
-                          ar->plugin_name, ar->session, ar->plugin_addr,
-                          ar->plugin_addr_len, ar->bandwidth_out,
-                          ar->bandwidth_in);
+                          ar->plugin_name, ar->plugin_addr,
+                          ar->plugin_addr_len, 
+                         ar->session,
+                         ar->bandwidth_out,
+                          ar->bandwidth_in,
+                         NULL, 0);
   }
   else if (ntohl (ar->bandwidth_out.value__) > 0)
   {
@@ -163,9 +166,9 @@ set_bw_connections (void *cls, const GNUNET_HashCode * key, void *value)
     if (NULL != sbc->atc->alloc_cb)
       sbc->atc->alloc_cb (sbc->atc->alloc_cb_cls,
                           (const struct GNUNET_PeerIdentity *) key,
-                          ar->plugin_name, ar->session, ar->plugin_addr,
-                          ar->plugin_addr_len, ar->bandwidth_out,
-                          ar->bandwidth_in);
+                          ar->plugin_name, ar->plugin_addr,
+                          ar->plugin_addr_len, ar->session, ar->bandwidth_out,
+                          ar->bandwidth_in, NULL, 0);
   }
   else
     LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -331,7 +334,7 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc)
  */
 struct GNUNET_ATS_Handle *
 GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                 GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
+                 GNUNET_ATS_AddressSuggestionCallback alloc_cb,
                  void *alloc_cb_cls)
 {
   struct GNUNET_ATS_Handle *atc;
index c3ae248851036c9a0745f5a79840f27d71af6e9b..a2c248cd8a74c216550a7665e738428d50bab562 100644 (file)
@@ -101,7 +101,7 @@ struct GNUNET_ATS_Handle
   /**
    * Function to call when the allocation changes.
    */
-  GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb;
+  GNUNET_ATS_AddressSuggestionCallback alloc_cb;
 
   /**
    * Closure for 'alloc_cb'.
index 33539bdaf572830ebc6749d2ceab097915bbfe13..7131784112e47cd4c8022f5ef4565d06c4ce3a79 100644 (file)
 struct GNUNET_ATS_Handle;
 
 
-/**
- * Signature of a function called by ATS to notify the callee that the
- * assigned bandwidth or address for a given peer was changed.  If the
- * callback is called with address/bandwidth assignments of zero, the
- * ATS disconnect function will still be called once the disconnect
- * actually happened.
- *
- * @param cls closure
- * @param peer identity of the peer
- * @param plugin_name name of the transport plugin, NULL to disconnect
- * @param session session to use (if available)
- * @param plugin_addr address to use (if available)
- * @param plugin_addr_len number of bytes in addr
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
- */
-typedef void (*GNUNET_TRANSPORT_ATS_AllocationNotification) (void *cls,
-                                                             const struct
-                                                             GNUNET_PeerIdentity
-                                                             * peer,
-                                                             const char
-                                                             *plugin_name,
-                                                             struct Session *
-                                                             session,
-                                                             const void
-                                                             *plugin_addr,
-                                                             size_t
-                                                             plugin_addr_len,
-                                                             struct
-                                                             GNUNET_BANDWIDTH_Value32NBO
-                                                             bandwidth_out,
-                                                             struct
-                                                             GNUNET_BANDWIDTH_Value32NBO
-                                                             bandwidth_in);
-
-
-/**
- * Initialize the ATS subsystem.
- *
- * @param cfg configuration to use
- * @param alloc_cb notification to call whenever the allocation changed
- * @param alloc_cb_cls closure for 'alloc_cb'
- * @return ats context
- */
-struct GNUNET_ATS_Handle *
-GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                 GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
-                 void *alloc_cb_cls);
-
-
-/**
- * Shutdown the ATS subsystem.
- *
- * @param atc handle
- */
-void
-GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc);
-
-
 /**
  * Signature of a function that takes an address suggestion
  *
@@ -135,6 +76,29 @@ typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
                                                       uint32_t ats_count);
 
 
+/**
+ * Initialize the ATS subsystem.
+ *
+ * @param cfg configuration to use
+ * @param alloc_cb notification to call whenever the allocation changed
+ * @param alloc_cb_cls closure for 'alloc_cb'
+ * @return ats context
+ */
+struct GNUNET_ATS_Handle *
+GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                 GNUNET_ATS_AddressSuggestionCallback alloc_cb,
+                 void *alloc_cb_cls);
+
+
+/**
+ * Shutdown the ATS subsystem.
+ *
+ * @param atc handle
+ */
+void
+GNUNET_ATS_shutdown (struct GNUNET_ATS_Handle *atc);
+
+
 /**
  * Handle to cancel suggestion request.
  */