traffic report is not used
authorChristian Grothoff <christian@grothoff.org>
Sat, 13 Aug 2011 10:37:53 +0000 (10:37 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 13 Aug 2011 10:37:53 +0000 (10:37 +0000)
src/include/gnunet_constants.h
src/include/gnunet_transport_plugin.h
src/transport/gnunet-service-transport-new.c
src/transport/gnunet-service-transport_plugins.c
src/transport/gnunet-service-transport_plugins.h

index 4fcdc0dbb567fe4aa2d08e1e432c8eadd6eaf5e6..da408bf55e778067cf7f3d812f94dd0cb90ed013 100644 (file)
@@ -49,7 +49,7 @@ extern "C"
  * After how long do we consider a connection to a peer dead
  * if we don't receive messages from the peer?
  */
-#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3)
+#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
 
 /**
  * After how long do we consider a connection to a peer dead
index 99f695264131b0c500bbf2fc008e0f155e14f564..fdd298e7f9e7aac00f58609c7d4b0f2d1f9d7cd2 100644 (file)
@@ -230,12 +230,6 @@ struct GNUNET_TRANSPORT_PluginEnvironment
    */
   GNUNET_TRANSPORT_AddressNotification notify_address;
 
-  /**
-   * Inform service about traffic received, get information
-   * about when we might be willing to receive more.
-   */
-  GNUNET_TRANSPORT_TrafficReport traffic_report;
-
   /**
    * Function that must be called by the plugin when a non-NULL
    * session handle stops being valid (is destroyed).
index cd1901a274c86d0ea77c4f36339c9b78fd910f6d..7b9ffe2ee67289ec5c1b3fdf009db1c813771ece 100644 (file)
@@ -94,6 +94,47 @@ process_hello_update (void *cls,
 }
 
 
+
+/**
+ * Function called by the transport for each received message.
+ * This function should also be called with "NULL" for the
+ * message to signal that the other peer disconnected.
+ *
+ * @param cls closure
+ * @param peer (claimed) identity of the other peer
+ * @param message the message, NULL if we only care about
+ *                learning about the delay until we should receive again -- FIXME!
+ * @param distance in overlay hops; use 1 unless DV (or 0 if message == NULL)
+ * @param session identifier used for this session (NULL for plugins
+ *                that do not offer bi-directional communication to the sender
+ *                using the same "connection")
+ * @param sender_address binary address of the sender (if we established the
+ *                connection or are otherwise sure of it; should be NULL
+ *                for inbound TCP/UDP connections since it it not clear
+ *                that we could establish ourselves a connection to that
+ *                IP address and get the same system)
+ * @param sender_address_len number of bytes in sender_address
+ * @return how long the plugin should wait until receiving more data
+ *         (plugins that do not support this, can ignore the return value)
+ */
+static struct GNUNET_TIME_Relative 
+plugin_env_receive_callback (void *cls,
+                            const struct
+                            GNUNET_PeerIdentity *
+                            peer,
+                            const struct
+                            GNUNET_MessageHeader *
+                            message,
+                            const struct GNUNET_TRANSPORT_ATS_Information *ats,
+                            uint32_t ats_count,
+                            struct Session *session,
+                            const char *sender_address,
+                            uint16_t sender_address_len)
+{
+  return GNUNET_TIME_UNIT_ZERO;
+}
+
+
 /**
  * Function that will be called for each address the transport
  * is aware that it might be reachable under.  Update our HELLO.
@@ -120,6 +161,50 @@ plugin_env_address_change_notification (void *cls,
 }
 
 
+/**
+ * Function that will be called whenever the plugin internally
+ * cleans up a session pointer and hence the service needs to
+ * discard all of those sessions as well.  Plugins that do not
+ * use sessions can simply omit calling this function and always
+ * use NULL wherever a session pointer is needed.  This function
+ * should be called BEFORE a potential "TransmitContinuation"
+ * from the "TransmitFunction".
+ * 
+ * @param cls closure
+ * @param peer which peer was the session for 
+ * @param session which session is being destoyed
+ */
+static void
+plugin_env_session_end (void *cls,
+                       const struct GNUNET_PeerIdentity *peer,
+                       struct Session *session)
+{
+}
+
+
+/**
+ * Function called whenever the plugin has to notify ATS about costs for using this transport
+ *
+ * The cost will be passed as struct GNUNET_TRANSPORT_ATS_Cost_Information[]
+ * This array is 0-terminated, so the last element will be a pair:
+ * ((cost->cost_type==GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR) && cost->cost_value==0))
+ *
+ * @param cls closure
+ * @param peer peer
+ * @param addr peer address
+ * @param addrlen address length
+ * @param cost pointer to the first element of struct GNUNET_TRANSPORT_ATS_Cost_Information[]
+ */
+static void 
+plugin_env_cost_notification (void *cls,
+                             const struct GNUNET_PeerIdentity *peer,
+                             const void *addr,
+                             uint16_t addrlen,
+                             struct GNUNET_TRANSPORT_ATS_Information * cost)
+{
+}
+
+
 /**
  * Function called when the service shuts down.  Unloads our plugins
  * and cancels pending validations.
@@ -216,11 +301,10 @@ run (void *cls,
   /* start subsystems */
   GST_hello_start (&process_hello_update, NULL);
   GST_blacklist_start (server);
-  GST_plugins_load (NULL,  // FIXME...
+  GST_plugins_load (&plugin_env_receive_callback,
                    &plugin_env_address_change_notification, 
-                   NULL, // FIXME...
-                   NULL, // FIXME...
-                   NULL); // FIXME...
+                   &plugin_env_session_end,
+                   &plugin_env_cost_notification);
   GST_ats = GNUNET_ATS_init (GST_cfg,
                          NULL, // FIXME...
                          NULL); // FIXME...
index bbc8d4183673ba585d7fc49d7c46258f23fec8e9..bacafa5f30b781ba438660d442b9e7f6c45b6c64 100644 (file)
@@ -94,7 +94,6 @@ static struct TransportPlugin *plugins_tail;
 void 
 GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
                  GNUNET_TRANSPORT_AddressNotification address_cb,
-                 GNUNET_TRANSPORT_TrafficReport traffic_cb,
                  GNUNET_TRANSPORT_SessionEnd session_end_cb,
                  GNUNET_TRANSPORT_CostReport cost_cb)
 {
index f4a6857a216e787b47e3b8003ae67577c4e8d03e..ee93918c795e33e160b32fcc1abf4696832ca617 100644 (file)
@@ -47,7 +47,6 @@
 void 
 GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
                  GNUNET_TRANSPORT_AddressNotification address_cb,
-                 GNUNET_TRANSPORT_TrafficReport traffic_cb,
                  GNUNET_TRANSPORT_SessionEnd session_end_cb,
                  GNUNET_TRANSPORT_CostReport cost_cb);