Added cost_report to plugin environment for ATS
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 28 Sep 2010 15:53:26 +0000 (15:53 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 28 Sep 2010 15:53:26 +0000 (15:53 +0000)
src/transport/plugin_transport.h

index 546b2ad7f717a42a4613be14b7b8dc51345c923f..57e446193b51c21369fb80560604bae17fe0db30 100644 (file)
@@ -35,6 +35,8 @@
 #include "gnunet_scheduler_lib.h"
 #include "gnunet_statistics_service.h"
 #include "gnunet_transport_service.h"
+#include "transport_selection.h"
+
 
 /**
  * Opaque pointer that plugins can use to distinguish specific
@@ -158,6 +160,23 @@ typedef struct GNUNET_TIME_Relative (*GNUNET_TRANSPORT_TrafficReport) (void *cls
                                                                       size_t amount_recved);
 
 
+/**
+ * Function called whenever the plugin has to notify ATS about costs for using this transport
+ *
+ * The cost will be passed as struct GNUNET_ATS_Cost_Information[]
+ * This array is 0-terminated, so the last element will be a pair:
+ * ((cost->cost_type==GNUNET_ATS_ARRAY_TERMINATOR) && cost->cost_value==0))
+ *
+ * @param cls closure
+ * @param peer peer
+ * @param cost pointer to the first element of struct GNUNET_ATS_Cost_Information[]
+ */
+typedef void (*GNUNET_TRANSPORT_CostReport) (void *cls,
+                                                                                        const struct GNUNET_PeerIdentity *peer,
+                                             const void *addr,
+                                             uint16_t addrlen,
+                                                                                        struct GNUNET_ATS_Cost_Information * cost);
+
 /**
  * The transport service will pass a pointer to a struct
  * of this type as the first and only argument to the
@@ -221,6 +240,11 @@ struct GNUNET_TRANSPORT_PluginEnvironment
    */
   GNUNET_TRANSPORT_SessionEnd session_end;
 
+  /**
+   * Inform service about costs for using this transport plugin
+   */
+  GNUNET_TRANSPORT_CostReport cost_report;
+
   /**
    * What is the maximum number of connections that this transport
    * should allow?  Transports that do not have sessions (such as