gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33672 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r33672 - gnunet/src/ats
Date: Mon, 16 Jun 2014 11:34:22 +0200

Author: grothoff
Date: 2014-06-16 11:34:22 +0200 (Mon, 16 Jun 2014)
New Revision: 33672

Modified:
   gnunet/src/ats/gnunet-service-ats_addresses.c
   gnunet/src/ats/gnunet-service-ats_addresses.h
   gnunet/src/ats/gnunet-service-ats_performance.c
   gnunet/src/ats/gnunet-service-ats_performance.h
   gnunet/src/ats/gnunet-service-ats_scheduling.h
Log:
do not use session_id in GAS_performance_notify_all_clients, needs to be 
'active'; also indentation/doxygen

Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c       2014-06-16 08:38:55 UTC 
(rev 33671)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c       2014-06-16 09:34:22 UTC 
(rev 33672)
@@ -465,6 +465,7 @@
   GNUNET_free(addr);
 }
 
+
 /**
  * Create a ATS_address with the given information
  *
@@ -473,16 +474,16 @@
  * @param plugin_addr address
  * @param plugin_addr_len address length
  * @param local_address_info additional local info for the address
- * @param session_id session
+ * @param session_id session identifier, can be 0
  * @return the ATS_Address
  */
 static struct ATS_Address *
 create_address (const struct GNUNET_PeerIdentity *peer,
-    const char *plugin_name,
-    const void *plugin_addr,
-    size_t plugin_addr_len,
-    uint32_t local_address_info,
-    uint32_t session_id)
+                const char *plugin_name,
+                const void *plugin_addr,
+                size_t plugin_addr_len,
+                uint32_t local_address_info,
+                uint32_t session_id)
 {
   struct ATS_Address *aa = NULL;
   int c1;
@@ -496,13 +497,6 @@
   aa->plugin = GNUNET_strdup (plugin_name);
   aa->session_id = session_id;
   aa->local_address_info = local_address_info;
-  aa->active = GNUNET_NO;
-  aa->used = GNUNET_NO;
-  aa->solver_information = NULL;
-  aa->atsi = NULL;
-  aa->atsi_count = 0;
-  aa->assigned_bw_in = GNUNET_BANDWIDTH_value_init (0);
-  aa->assigned_bw_out = GNUNET_BANDWIDTH_value_init (0);
 
   for (c1 = 0; c1 < GNUNET_ATS_QualityPropertiesCount; c1++)
   {
@@ -787,29 +781,39 @@
                                                        new_address,
                                                        
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
 
-    GNUNET_STATISTICS_set (handle->stat, "# addresses",
-        GNUNET_CONTAINER_multipeermap_size (handle->addresses), GNUNET_NO);
+    GNUNET_STATISTICS_set (handle->stat,
+                           "# addresses",
+                           GNUNET_CONTAINER_multipeermap_size 
(handle->addresses),
+                           GNUNET_NO);
 
-    GNUNET_log(GNUNET_ERROR_TYPE_INFO,
-        "Adding new address %p for peer `%s', length %u, session id %u, %s\n",
-        new_address,
-        GNUNET_i2s (peer),
-        plugin_addr_len, session_id,
-        GNUNET_ATS_print_network_type (addr_net));
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Adding new address %p for peer `%s', length %u, session id 
%u, %s\n",
+                new_address,
+                GNUNET_i2s (peer),
+                plugin_addr_len,
+                session_id,
+                GNUNET_ATS_print_network_type (addr_net));
 
     /* Tell solver about new address */
     handle->env.sf.s_add (handle->solver, new_address, addr_net);
 
     handle->env.sf.s_bulk_start (handle->solver);
-    GAS_normalization_normalize_property (handle->addresses, new_address, atsi,
-        atsi_count);
+    GAS_normalization_normalize_property (handle->addresses,
+                                          new_address,
+                                          atsi,
+                                          atsi_count);
     handle->env.sf.s_bulk_stop (handle->solver);
 
     /* Notify performance clients about new address */
-    GAS_performance_notify_all_clients (&new_address->peer, 
new_address->plugin,
-        new_address->addr, new_address->addr_len, new_address->session_id,
-        new_address->atsi, new_address->atsi_count,
-        new_address->assigned_bw_out, new_address->assigned_bw_in);
+    GAS_performance_notify_all_clients (&new_address->peer,
+                                        new_address->plugin,
+                                        new_address->addr,
+                                        new_address->addr_len,
+                                        new_address->active,
+                                        new_address->atsi,
+                                        new_address->atsi_count,
+                                        new_address->assigned_bw_out,
+                                        new_address->assigned_bw_in);
     return;
   }
 
@@ -845,10 +849,14 @@
   {
     /* Notify performance clients about properties */
     GAS_performance_notify_all_clients (&existing_address->peer,
-        existing_address->plugin, existing_address->addr,
-        existing_address->addr_len, existing_address->session_id,
-        existing_address->atsi, existing_address->atsi_count,
-        existing_address->assigned_bw_out, existing_address->assigned_bw_in);
+                                        existing_address->plugin,
+                                        existing_address->addr,
+                                        existing_address->addr_len,
+                                        existing_address->active,
+                                        existing_address->atsi,
+                                        existing_address->atsi_count,
+                                        existing_address->assigned_bw_out,
+                                        existing_address->assigned_bw_in);
 
     for (c1 = 0; c1 < atsi_delta_count; c1++)
     {
@@ -909,14 +917,14 @@
  */
 void
 GAS_addresses_update (struct GAS_Addresses_Handle *handle,
-    const struct GNUNET_PeerIdentity *peer,
-    const char *plugin_name,
-    const void *plugin_addr,
-    size_t plugin_addr_len,
-    uint32_t local_address_info,
-    uint32_t session_id,
-    const struct GNUNET_ATS_Information *atsi,
-    uint32_t atsi_count)
+                      const struct GNUNET_PeerIdentity *peer,
+                      const char *plugin_name,
+                      const void *plugin_addr,
+                      size_t plugin_addr_len,
+                      uint32_t local_address_info,
+                      uint32_t session_id,
+                      const struct GNUNET_ATS_Information *atsi,
+                      uint32_t atsi_count)
 {
   struct ATS_Address *aa;
   struct GNUNET_ATS_Information *atsi_delta;
@@ -937,8 +945,10 @@
   if (NULL == aa->solver_information)
     return;
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s' address \n",
-      "ADDRESS UPDATE", GNUNET_i2s (peer), aa);
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+             "Received `%s' for peer `%s' address \n",
+             "ADDRESS UPDATE",
+             GNUNET_i2s (peer), aa);
 
   /* Update address */
   aa->t_last_activity = GNUNET_TIME_absolute_get();
@@ -947,15 +957,19 @@
     /* Session changed */
     prev_session = aa->session_id;
     aa->session_id = session_id;
-    handle->env.sf.s_address_update_session (handle->solver, aa, prev_session,
-        aa->session_id);
+    handle->env.sf.s_address_update_session (handle->solver,
+                                             aa,
+                                             prev_session,
+                                             aa->session_id);
   }
 
   atsi_delta = NULL;
   atsi_delta_count = 0;
-  if (GNUNET_YES
-      == disassemble_ats_information (aa, atsi, atsi_count, &atsi_delta,
-          &atsi_delta_count))
+  if (GNUNET_YES ==
+      disassemble_ats_information (aa, atsi,
+                                   atsi_count,
+                                   &atsi_delta,
+                                   &atsi_delta_count))
   {
     /* ATS properties changed */
     for (c1 = 0; c1 < atsi_delta_count; c1++)
@@ -970,31 +984,49 @@
     }
 
     /* Notify performance clients about updated address */
-    GAS_performance_notify_all_clients (&aa->peer, aa->plugin, aa->addr,
-        aa->addr_len, aa->session_id, aa->atsi, aa->atsi_count,
-        aa->assigned_bw_out, aa->assigned_bw_in);
-
+    GAS_performance_notify_all_clients (&aa->peer,
+                                        aa->plugin,
+                                        aa->addr,
+                                        aa->addr_len,
+                                        aa->active,
+                                        aa->atsi,
+                                        aa->atsi_count,
+                                        aa->assigned_bw_out,
+                                        aa->assigned_bw_in);
     handle->env.sf.s_bulk_start (handle->solver);
-    GAS_normalization_normalize_property (handle->addresses, aa, atsi,
-        atsi_count);
+    GAS_normalization_normalize_property (handle->addresses,
+                                          aa,
+                                          atsi,
+                                          atsi_count);
     handle->env.sf.s_bulk_stop (handle->solver);
   }
-  GNUNET_free_non_null(atsi_delta);
+  GNUNET_free_non_null (atsi_delta);
 }
 
+
+/**
+ * Closure for #destroy_by_session_id().
+ */
 struct DestroyContext
 {
+  /**
+   * FIXME.
+   */
   struct ATS_Address *aa;
 
+  /**
+   * FIXME.
+   */
   struct GAS_Addresses_Handle *handle;
 
   /**
-   * GNUNET_NO  : full address
-   * GNUNET_YES : just session
+   * #GNUNET_NO  : full address
+   * #GNUNET_YES : just session
    */
   int result;
 };
 
+
 /**
  * Delete an address
  *
@@ -1004,8 +1036,8 @@
  *
  * @param cls unused
  * @param key unused
- * @param value the 'struct ATS_Address'
- * @return GNUNET_OK (continue to iterate)
+ * @param value the `struct ATS_Address *`
+ * @return #GNUNET_OK (continue to iterate)
  */
 static int
 destroy_by_session_id (void *cls,
@@ -1028,15 +1060,17 @@
         && (0 == memcmp (des->addr, aa->addr, aa->addr_len)))
     {
 
-      GNUNET_log(GNUNET_ERROR_TYPE_INFO,
-          "Deleting full address for peer `%s' session %u %p\n",
-          GNUNET_i2s (&aa->peer), aa->session_id, aa);
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Deleting full address for peer `%s' session %u %p\n",
+                  GNUNET_i2s (&aa->peer),
+                  aa->session_id,
+                  aa);
 
       /* Notify solver about deletion */
-      GNUNET_assert(
-          GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove 
(handle->addresses,
-                                                             &aa->peer,
-                                                             aa));
+      GNUNET_assert (GNUNET_YES ==
+                     GNUNET_CONTAINER_multipeermap_remove (handle->addresses,
+                                                           &aa->peer,
+                                                           aa));
       handle->env.sf.s_del (handle->solver, aa, GNUNET_NO);
       free_address (aa);
       dc->result = GNUNET_NO;
@@ -1051,24 +1085,27 @@
 
     if ((aa->session_id != 0) && (0 != strcmp (des->plugin, aa->plugin)))
     {
-      GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-          "Different plugins during removal: `%s' vs `%s' \n", des->plugin,
-          aa->plugin);
-      GNUNET_break(0);
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Different plugins during removal: `%s' vs `%s' \n",
+                  des->plugin,
+                  aa->plugin);
+      GNUNET_break (0);
       return GNUNET_OK;
     }
     if (GNUNET_HELLO_ADDRESS_INFO_INBOUND ==
         (aa->local_address_info && GNUNET_HELLO_ADDRESS_INFO_INBOUND))
     {
       /* Inbound connection died, delete full address */
-      GNUNET_log(GNUNET_ERROR_TYPE_INFO,
-          "Deleting inbound address for peer `%s': `%s' session %u\n",
-          GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id);
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Deleting inbound address for peer `%s': `%s' session %u\n",
+                  GNUNET_i2s (&aa->peer),
+                  aa->plugin,
+                  aa->session_id);
 
       /* Notify solver about deletion */
-      GNUNET_assert(
-          GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove 
(handle->addresses,
-                                                             &aa->peer, aa));
+      GNUNET_assert(GNUNET_YES ==
+                    GNUNET_CONTAINER_multipeermap_remove (handle->addresses,
+                                                          &aa->peer, aa));
       handle->env.sf.s_del (handle->solver, aa, GNUNET_NO);
       free_address (aa);
       dc->result = GNUNET_NO;
@@ -1078,8 +1115,9 @@
     {
       /* Session died */
       GNUNET_log(GNUNET_ERROR_TYPE_INFO,
-          "Deleting session for peer `%s': `%s' %u\n", GNUNET_i2s (&aa->peer),
-          aa->plugin, aa->session_id);
+                 "Deleting session for peer `%s': `%s' %u\n",
+                 GNUNET_i2s (&aa->peer),
+                 aa->plugin, aa->session_id);
       /* Notify solver to delete session */
       handle->env.sf.s_del (handle->solver, aa, GNUNET_YES);
       aa->session_id = 0;
@@ -1104,15 +1142,16 @@
  */
 void
 GAS_addresses_destroy (struct GAS_Addresses_Handle *handle,
-    const struct GNUNET_PeerIdentity *peer,
-    const char *plugin_name,
-    const void *plugin_addr,
-    size_t plugin_addr_len,
-    uint32_t local_address_info,
-    uint32_t session_id)
+                       const struct GNUNET_PeerIdentity *peer,
+                       const char *plugin_name,
+                       const void *plugin_addr,
+                       size_t plugin_addr_len,
+                       uint32_t local_address_info,
+                       uint32_t session_id)
 {
   struct ATS_Address *ea;
   struct DestroyContext dc;
+
   if (GNUNET_NO == handle->running)
     return;
 
@@ -1122,36 +1161,45 @@
   if (ea == NULL )
   {
     GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-        "Tried to destroy unknown address for peer `%s' `%s' session id %u\n",
-        GNUNET_i2s (peer), plugin_name, session_id);
+               "Tried to destroy unknown address for peer `%s' `%s' session id 
%u\n",
+               GNUNET_i2s (peer),
+               plugin_name,
+               session_id);
     return;
   }
 
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-      "Received `%s' for peer `%s' address %p session %u\n", "ADDRESS DESTROY",
-      GNUNET_i2s (peer), ea, session_id);
+             "Received `%s' for peer `%s' address %p session %u\n", "ADDRESS 
DESTROY",
+             GNUNET_i2s (peer),
+             ea,
+             session_id);
 
   GNUNET_break(0 < strlen (plugin_name));
   dc.handle = handle;
-  dc.aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len,
-      local_address_info, session_id);
-
+  dc.aa = create_address (peer,
+                          plugin_name,
+                          plugin_addr,
+                          plugin_addr_len,
+                          local_address_info, session_id);
   GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses,
                                              peer,
                                              &destroy_by_session_id, &dc);
-  GNUNET_STATISTICS_set (handle->stat, "# addresses",
-      GNUNET_CONTAINER_multipeermap_size (handle->addresses), GNUNET_NO);
+  GNUNET_STATISTICS_set (handle->stat,
+                         "# addresses",
+                         GNUNET_CONTAINER_multipeermap_size 
(handle->addresses),
+                         GNUNET_NO);
   free_address (dc.aa);
 }
 
+
 /**
  * Notification about active use of an address.
- * in_use == GNUNET_YES:
+ * in_use == #GNUNET_YES:
  *     This address is used to maintain an active connection with a peer.
- * in_use == GNUNET_NO:
+ * in_use == #GNUNET_NO:
  *     This address is no longer used to maintain an active connection with a 
peer.
  *
- * Note: can only be called with in_use == GNUNET_NO if called with GNUNET_YES
+ * Note: can only be called with in_use == #GNUNET_NO if called with 
#GNUNET_YES
  * before
  *
  * @param handle the address handle to use
@@ -1161,52 +1209,64 @@
  * @param plugin_addr_len length of the plugin address
  * @param local_address_info the local address for the address
  * @param session_id session id, can be 0
- * @param in_use GNUNET_YES if GNUNET_NO
- * @return GNUNET_SYSERR on failure (address unknown ...)
+ * @param in_use #GNUNET_YES if #GNUNET_NO FIXME
+ * @return #GNUNET_SYSERR on failure (address unknown ...)
  */
 int
 GAS_addresses_in_use (struct GAS_Addresses_Handle *handle,
-    const struct GNUNET_PeerIdentity *peer, const char *plugin_name,
-    const void *plugin_addr, size_t plugin_addr_len,
-    uint32_t local_address_info,
-    uint32_t session_id,
-    int in_use)
+                      const struct GNUNET_PeerIdentity *peer,
+                      const char *plugin_name,
+                      const void *plugin_addr,
+                      size_t plugin_addr_len,
+                      uint32_t local_address_info,
+                      uint32_t session_id,
+                      int in_use)
 {
   struct ATS_Address *ea;
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n",
-      "ADDRESS IN USE", GNUNET_i2s (peer));
 
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+             "Received `%s' for peer `%s'\n",
+             "ADDRESS IN USE",
+             GNUNET_i2s (peer));
   if (GNUNET_NO == handle->running)
     return GNUNET_SYSERR;
-
-  ea = find_exact_address (handle, peer, plugin_name, plugin_addr,
-      plugin_addr_len, local_address_info, session_id);
+  ea = find_exact_address (handle,
+                           peer, plugin_name,
+                           plugin_addr,
+                           plugin_addr_len,
+                           local_address_info,
+                           session_id);
   if (NULL == ea)
   {
-    GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
-        "Trying to set unknown address `%s' `%s' `%u' to %s \n",
-        GNUNET_i2s (peer), plugin_name, session_id,
-        (GNUNET_NO == in_use) ? "NO" : "YES");
-    GNUNET_break(0);
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Trying to set unknown address `%s' `%s' `%u' to %s \n",
+                GNUNET_i2s (peer),
+                plugin_name,
+                session_id,
+                (GNUNET_NO == in_use) ? "NO" : "YES");
+    GNUNET_break (0);
     return GNUNET_SYSERR;
   }
   if (ea->used == in_use)
   {
-    GNUNET_break(0);
+    GNUNET_break (0);
     GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
-        "Address in use called multiple times for peer `%s': %s -> %s \n",
-        GNUNET_i2s (peer), (GNUNET_NO == ea->used) ? "NO" : "YES",
-        (GNUNET_NO == in_use) ? "NO" : "YES");
+               "Address in use called multiple times for peer `%s': %s -> %s 
\n",
+               GNUNET_i2s (peer),
+               (GNUNET_NO == ea->used) ? "NO" : "YES",
+               (GNUNET_NO == in_use) ? "NO" : "YES");
     return GNUNET_SYSERR;
   }
-
   /* Tell solver about update */
   ea->used = in_use;
   ea->t_last_activity = GNUNET_TIME_absolute_get();
-  handle->env.sf.s_address_update_inuse (handle->solver, ea, ea->used);
+  handle->env.sf.s_address_update_inuse (handle->solver,
+                                         ea,
+                                         ea->used);
   return GNUNET_OK;
 }
 
+
 /**
  * Cancel address suggestions for a peer
  *
@@ -1744,6 +1804,7 @@
   return GNUNET_ATS_NetworkTypeCount;
 }
 
+
 /**
  * Callback for solver to notify about assignment changes
  *
@@ -1751,22 +1812,28 @@
  * @param address the address with changes
  */
 static void
-bandwidth_changed_cb (void *cls, struct ATS_Address *address)
+bandwidth_changed_cb (void *cls,
+                      struct ATS_Address *address)
 {
   struct GAS_Addresses_Handle *handle = cls;
   struct GAS_Addresses_Suggestion_Requests *cur;
 
   GNUNET_assert(handle != NULL);
   GNUNET_assert(address != NULL);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Bandwidth assignment changed for peer %s \n",
+              GNUNET_i2s (&address->peer));
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-      "Bandwidth assignment changed for peer %s \n",
-      GNUNET_i2s (&address->peer));
-
   /* Notify performance clients about changes to address */
-  GAS_performance_notify_all_clients (&address->peer, address->plugin,
-      address->addr, address->addr_len, address->session_id, address->atsi,
-      address->atsi_count, address->assigned_bw_out, address->assigned_bw_in);
+  GAS_performance_notify_all_clients (&address->peer,
+                                      address->plugin,
+                                      address->addr,
+                                      address->addr_len,
+                                      address->active,
+                                      address->atsi,
+                                      address->atsi_count,
+                                      address->assigned_bw_out,
+                                      address->assigned_bw_in);
   cur = handle->pending_requests_head;
   while (NULL != cur)
   {

Modified: gnunet/src/ats/gnunet-service-ats_addresses.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.h       2014-06-16 08:38:55 UTC 
(rev 33671)
+++ gnunet/src/ats/gnunet-service-ats_addresses.h       2014-06-16 09:34:22 UTC 
(rev 33672)
@@ -287,6 +287,7 @@
   double norm;
 };
 
+
 /**
  * Address with additional information
  */
@@ -308,7 +309,7 @@
   struct GNUNET_PeerIdentity peer;
 
   /**
-   * Session ID, 0 if no session is given
+   * Session ID, can be 0
    */
   uint32_t session_id;
 
@@ -433,7 +434,7 @@
  * @param plugin_addr plugin address
  * @param plugin_addr_len length of the plugin address
  * @param local_address_info the local address for the address
- * @param session_id session id, can be 0
+ * @param session_id session id, can be 0.
  * @param atsi performance information for this address
  * @param atsi_count number of performance information contained in @a atsi
  */

Modified: gnunet/src/ats/gnunet-service-ats_performance.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.c     2014-06-16 08:38:55 UTC 
(rev 33671)
+++ gnunet/src/ats/gnunet-service-ats_performance.c     2014-06-16 09:34:22 UTC 
(rev 33672)
@@ -114,6 +114,7 @@
   return NULL;
 }
 
+
 /**
  * Unregister a client (which may have been a performance client,
  * but this is not assured).
@@ -133,6 +134,7 @@
   GNUNET_free (pc);
 }
 
+
 /**
  * Transmit the given performance information to all performance
  * clients.
@@ -152,7 +154,8 @@
 GAS_performance_notify_client (struct PerformanceClient *pc,
                                const struct GNUNET_PeerIdentity *peer,
                                const char *plugin_name,
-                               const void *plugin_addr, size_t plugin_addr_len,
+                               const void *plugin_addr,
+                               size_t plugin_addr_len,
                                int active,
                                const struct GNUNET_ATS_Information *atsi,
                                uint32_t atsi_count,
@@ -195,7 +198,9 @@
   addrp = (char *) &atsp[atsi_count];
   memcpy (addrp, plugin_addr, plugin_addr_len);
   strcpy (&addrp[plugin_addr_len], plugin_name);
-  GNUNET_SERVER_notification_context_unicast (nc, pc->client, &msg->header,
+  GNUNET_SERVER_notification_context_unicast (nc,
+                                              pc->client,
+                                              &msg->header,
                                               GNUNET_YES);
 }
 
@@ -207,23 +212,23 @@
  * @param peer peer for which this is an address suggestion
  * @param plugin_name 0-termintated string specifying the transport plugin
  * @param plugin_addr binary address for the plugin to use
- * @param plugin_addr_len number of bytes in plugin_addr
+ * @param plugin_addr_len number of bytes in @a plugin_addr
  * @param active is this address active
  * @param atsi performance data for the address
- * @param atsi_count number of performance records in 'ats'
+ * @param atsi_count number of performance records in @a atsi
  * @param bandwidth_out assigned outbound bandwidth
  * @param bandwidth_in assigned inbound bandwidth
  */
 void
 GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
                                     const char *plugin_name,
-                                    const void *plugin_addr, size_t 
plugin_addr_len,
+                                    const void *plugin_addr,
+                                    size_t plugin_addr_len,
                                     int active,
-                                const struct GNUNET_ATS_Information *atsi,
-                                uint32_t atsi_count,
-                                struct GNUNET_BANDWIDTH_Value32NBO
-                                bandwidth_out,
-                                struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in)
+                                    const struct GNUNET_ATS_Information *atsi,
+                                    uint32_t atsi_count,
+                                    struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
+                                    struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in)
 {
   struct PerformanceClient *pc;
 
@@ -232,7 +237,9 @@
     {
         GAS_performance_notify_client (pc,
                                        peer,
-                                       plugin_name, plugin_addr, 
plugin_addr_len,
+                                       plugin_name,
+                                       plugin_addr,
+                                       plugin_addr_len,
                                        active,
                                        atsi, atsi_count,
                                        bandwidth_out, bandwidth_in);
@@ -243,6 +250,21 @@
 }
 
 
+
+/**
+ * Iterator for called from #GAS_addresses_get_peer_info()
+ *
+ * @param p_it_cls closure with the `struct PerformanceClient *`
+ * @param id the peer id
+ * @param plugin_name plugin name
+ * @param plugin_addr address
+ * @param plugin_addr_len length of @a plugin_addr
+ * @param address_active is address actively used
+ * @param atsi ats performance information
+ * @param atsi_count number of ats performance elements in @a atsi
+ * @param bandwidth_out current outbound bandwidth assigned to address
+ * @param bandwidth_in current inbound bandwidth assigned to address
+ */
 static void
 peerinfo_it (void *cls,
              const struct GNUNET_PeerIdentity *id,
@@ -251,15 +273,14 @@
              const int active,
              const struct GNUNET_ATS_Information *atsi,
              uint32_t atsi_count,
-             struct GNUNET_BANDWIDTH_Value32NBO
-             bandwidth_out,
+             struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
              struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
   struct PerformanceClient *pc = cls;
+
   GNUNET_assert (NULL != pc);
   if (NULL == id)
     return;
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Callback for peer `%s' plugin `%s' BW out %u, BW in %u \n",
               GNUNET_i2s (id),
@@ -278,7 +299,7 @@
 
 
 /**
- * Iterator for GAS_performance_add_client
+ * Iterator for #GAS_performance_add_client()
  *
  * @param cls the client requesting information
  * @param id result
@@ -288,13 +309,18 @@
          const struct GNUNET_PeerIdentity *id)
 {
   struct PerformanceClient *pc = cls;
+
   if (NULL != id)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for peer `%s'\n", 
GNUNET_i2s (id));
-    GAS_addresses_get_peer_info (GSA_addresses, id, &peerinfo_it, pc);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Callback for peer `%s'\n",
+                GNUNET_i2s (id));
+    GAS_addresses_get_peer_info (GSA_addresses, id,
+                                 &peerinfo_it, pc);
   }
 }
 
+
 /**
  * Register a new performance client.
  *
@@ -312,27 +338,33 @@
   pc->client = client;
   pc->flag = flag;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding performance client %s PIC\n",
-      (flag == START_FLAG_PERFORMANCE_WITH_PIC) ? "with" : "without");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Adding performance client %s PIC\n",
+              (flag == START_FLAG_PERFORMANCE_WITH_PIC) ? "with" : "without");
 
   GNUNET_SERVER_notification_context_add (nc, client);
   GNUNET_CONTAINER_DLL_insert (pc_head, pc_tail, pc);
 
   /* Send information about clients */
-  GAS_addresses_iterate_peers (GSA_addresses, &peer_it, pc);
+  GAS_addresses_iterate_peers (GSA_addresses,
+                               &peer_it,
+                               pc);
 }
 
 
-static void transmit_req_addr (struct AddressIteration *ai,
-    const struct GNUNET_PeerIdentity *id,
-    const char *plugin_name,
-    const void *plugin_addr, size_t plugin_addr_len,
-    const int active,
-    const struct GNUNET_ATS_Information *atsi,
-    uint32_t atsi_count,
-    struct GNUNET_BANDWIDTH_Value32NBO
-    bandwidth_out,
-    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
+/**
+ * FIXME.
+ */
+static void
+transmit_req_addr (struct AddressIteration *ai,
+                   const struct GNUNET_PeerIdentity *id,
+                   const char *plugin_name,
+                   const void *plugin_addr, size_t plugin_addr_len,
+                   const int active,
+                   const struct GNUNET_ATS_Information *atsi,
+                   uint32_t atsi_count,
+                   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+                   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 
 {
   struct GNUNET_ATS_Information *atsp;
@@ -379,6 +411,21 @@
                                               GNUNET_NO);
 }
 
+
+/**
+ * Iterator for #GAS_addresses_get_peer_info()
+ *
+ * @param p_it_cls closure with our `struct AddressIteration *`
+ * @param id the peer id
+ * @param plugin_name plugin name
+ * @param plugin_addr address
+ * @param plugin_addr_len length of @a plugin_addr
+ * @param address_active is address actively used
+ * @param atsi ats performance information
+ * @param atsi_count number of ats performance elements in @a atsi
+ * @param bandwidth_out current outbound bandwidth assigned to address
+ * @param bandwidth_in current inbound bandwidth assigned to address
+ */
 static void
 req_addr_peerinfo_it (void *cls,
              const struct GNUNET_PeerIdentity *id,
@@ -400,9 +447,9 @@
 
   if ((NULL == id) && (NULL == plugin_name) && (NULL == plugin_addr))
   {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Address iteration done\n");
-      return;
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Address iteration done\n");
+    return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Callback for  %s peer `%s' plugin `%s' BW out %u, BW in %u\n",
@@ -437,23 +484,26 @@
 /**
  * Iterator for GAS_handle_request_address_list
  *
- * @param cls the client requesting information
+ * @param cls the client requesting information, a `struct AddressIteration *`
  * @param id result
  */
 static void
 req_addr_peer_it (void *cls,
-         const struct GNUNET_PeerIdentity *id)
+                  const struct GNUNET_PeerIdentity *id)
 {
   struct AddressIteration *ai = cls;
-  if (NULL != id)
+
+  if (NULL == id)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for peer `%s'\n", 
GNUNET_i2s (id));
-    GAS_addresses_get_peer_info (GSA_addresses, id, &req_addr_peerinfo_it, ai);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Peer iteration done\n");
+    return;
   }
-  else
-  {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer iteration done\n");
-  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Callback for peer `%s'\n",
+              GNUNET_i2s (id));
+  GAS_addresses_get_peer_info (GSA_addresses, id,
+                               &req_addr_peerinfo_it, ai);
 }
 
 
@@ -474,13 +524,13 @@
   struct GNUNET_PeerIdentity allzeros;
   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_zero;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "ADDRESSLIST_REQUEST");
-
   if (NULL == (pc = find_client(client)))
   {
-      GNUNET_break (0);
-      return;
+    GNUNET_break (0);
+    return;
   }
 
   ai.all = ntohl (alrm->all);
@@ -489,28 +539,40 @@
 
   memset (&allzeros, '\0', sizeof (struct GNUNET_PeerIdentity));
   bandwidth_zero.value__ = htonl (0);
-  if (0 == memcmp (&alrm->peer, &allzeros, sizeof (struct 
GNUNET_PeerIdentity)))
+  if (0 == memcmp (&alrm->peer,
+                   &allzeros,
+                   sizeof (struct GNUNET_PeerIdentity)))
   {
-      /* Return addresses for all peers */
-      GAS_addresses_iterate_peers (GSA_addresses, &req_addr_peer_it, &ai);
-      transmit_req_addr (&ai, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0, 
bandwidth_zero, bandwidth_zero);
+    /* Return addresses for all peers */
+    GAS_addresses_iterate_peers (GSA_addresses, &req_addr_peer_it, &ai);
+    transmit_req_addr (&ai, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0,
+                       bandwidth_zero, bandwidth_zero);
   }
   else
   {
-      /* Return addresses for a specific peer */
-      GAS_addresses_get_peer_info (GSA_addresses, &alrm->peer, 
&req_addr_peerinfo_it, &ai);
-      transmit_req_addr (&ai, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0, 
bandwidth_zero, bandwidth_zero);
+    /* Return addresses for a specific peer */
+    GAS_addresses_get_peer_info (GSA_addresses,
+                                 &alrm->peer,
+                                 &req_addr_peerinfo_it, &ai);
+    transmit_req_addr (&ai, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0,
+                       bandwidth_zero, bandwidth_zero);
   }
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
 
+/**
+ * FIXME.
+ */
 void
 GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer,
-    const char *plugin_name, const void *plugin_addr, size_t plugin_addr_len,
-    const int active, struct GNUNET_ATS_Information *ats, uint32_t ats_count,
-    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
+                               const char *plugin_name,
+                               const void *plugin_addr, size_t plugin_addr_len,
+                               const int active,
+                               struct GNUNET_ATS_Information *ats,
+                               uint32_t ats_count,
+                               struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
+                               struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
   /* Notify here */
   GAS_performance_notify_all_clients (peer, plugin_name, plugin_addr,
@@ -571,7 +633,8 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "RESERVATION_REQUEST");
   amount = (int32_t) ntohl (msg->amount);
   res_delay = GAS_reservations_reserve (&msg->peer, amount);
@@ -582,7 +645,8 @@
   result.amount = htonl (amount);
   result.peer = msg->peer;
   result.res_delay = GNUNET_TIME_relative_hton (res_delay);
-  GNUNET_STATISTICS_update (GSA_stats, "# reservation requests processed", 1,
+  GNUNET_STATISTICS_update (GSA_stats,
+                            "# reservation requests processed", 1,
                             GNUNET_NO);
   GNUNET_SERVER_notification_context_unicast (nc, client, &result.header,
                                               GNUNET_NO);
@@ -627,7 +691,8 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  GNUNET_STATISTICS_update (GSA_stats, "# preference change requests 
processed",
+  GNUNET_STATISTICS_update (GSA_stats,
+                            "# preference change requests processed",
                             1, GNUNET_NO);
   pi = (const struct PreferenceInformation *) &msg[1];
   for (i = 0; i < nump; i++)
@@ -659,7 +724,8 @@
   uint32_t nump;
   uint32_t i;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "PREFERENCE_FEEDBACK");
   msize = ntohs (message->size);
   if (msize < sizeof (struct FeedbackPreferenceMessage))
@@ -678,7 +744,8 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  GNUNET_STATISTICS_update (GSA_stats, "# preference feedbacks requests 
processed",
+  GNUNET_STATISTICS_update (GSA_stats,
+                            "# preference feedbacks requests processed",
                             1, GNUNET_NO);
   pi = (const struct PreferenceInformation *) &msg[1];
   for (i = 0; i < nump; i++)

Modified: gnunet/src/ats/gnunet-service-ats_performance.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.h     2014-06-16 08:38:55 UTC 
(rev 33671)
+++ gnunet/src/ats/gnunet-service-ats_performance.h     2014-06-16 09:34:22 UTC 
(rev 33672)
@@ -52,18 +52,19 @@
 GAS_performance_remove_client (struct GNUNET_SERVER_Client *client);
 
 
+/**
+ * FIXME.
+ */
 void
 GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer,
-                                                                               
                                         const char *plugin_name,
-                                                                               
                                         const void *plugin_addr,
-                                                                               
                                         size_t plugin_addr_len,
-                                                                               
                                         const int active,
-                                                                               
                                         struct GNUNET_ATS_Information *ats,
-                                                                               
                                         uint32_t ats_count,
-                                                                               
                                         struct GNUNET_BANDWIDTH_Value32NBO
-                                                                               
                                         bandwidth_out,
-                                                                               
                                         struct GNUNET_BANDWIDTH_Value32NBO
-                                                                               
                                         bandwidth_in);
+                               const char *plugin_name,
+                               const void *plugin_addr,
+                               size_t plugin_addr_len,
+                               const int active,
+                               struct GNUNET_ATS_Information *ats,
+                               uint32_t ats_count,
+                               struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
+                               struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in);
 
 
 
@@ -77,21 +78,20 @@
  * @param plugin_addr_len number of bytes in plugin_addr
  * @param active is this address active
  * @param atsi performance data for the address
- * @param atsi_count number of performance records in 'ats'
+ * @param atsi_count number of performance records in @a atsi
  * @param bandwidth_out assigned outbound bandwidth
  * @param bandwidth_in assigned inbound bandwidth
  */
 void
 GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
-                                const char *plugin_name,
-                                const void *plugin_addr, size_t 
plugin_addr_len,
-                                const int active,
-                                const struct GNUNET_ATS_Information *atsi,
-                                uint32_t atsi_count,
-                                struct GNUNET_BANDWIDTH_Value32NBO
-                                bandwidth_out,
-                                struct GNUNET_BANDWIDTH_Value32NBO
-                                bandwidth_in);
+                                    const char *plugin_name,
+                                    const void *plugin_addr,
+                                    size_t plugin_addr_len,
+                                    const int active,
+                                    const struct GNUNET_ATS_Information *atsi,
+                                    uint32_t atsi_count,
+                                    struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
+                                    struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in);
 
 
 /**

Modified: gnunet/src/ats/gnunet-service-ats_scheduling.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_scheduling.h      2014-06-16 08:38:55 UTC 
(rev 33671)
+++ gnunet/src/ats/gnunet-service-ats_scheduling.h      2014-06-16 09:34:22 UTC 
(rev 33672)
@@ -70,11 +70,11 @@
  * @param peer peer for which this is an address suggestion
  * @param plugin_name 0-termintated string specifying the transport plugin
  * @param plugin_addr binary address for the plugin to use
- * @param plugin_addr_len number of bytes in plugin_addr
+ * @param plugin_addr_len number of bytes in @a plugin_addr
  * @param session_id session ID to use
  * @param local_address_info the local address for the address
  * @param atsi performance data for the address
- * @param atsi_count number of performance records in 'ats'
+ * @param atsi_count number of performance records in @a atsi
  * @param bandwidth_out assigned outbound bandwidth
  * @param bandwidth_in assigned inbound bandwidth
  */




reply via email to

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