gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35797 - in gnunet/src: ats include
Date: Fri, 22 May 2015 17:04:17 +0200

Author: grothoff
Date: 2015-05-22 17:04:17 +0200 (Fri, 22 May 2015)
New Revision: 35797

Modified:
   gnunet/src/ats/ats.h
   gnunet/src/ats/ats_api_performance.c
   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_plugins.c
   gnunet/src/include/gnunet_ats_service.h
Log:
-do pass local_address_info flag from/to ATS also for performance monitor

Modified: gnunet/src/ats/ats.h
===================================================================
--- gnunet/src/ats/ats.h        2015-05-22 14:38:37 UTC (rev 35796)
+++ gnunet/src/ats/ats.h        2015-05-22 15:04:17 UTC (rev 35797)
@@ -328,6 +328,12 @@
    */
   struct GNUNET_ATS_PropertiesNBO properties;
 
+  /**
+   * Local-only information of the address, see
+   * `enum GNUNET_HELLO_AddressInfo`.
+   */
+  uint32_t address_local_info GNUNET_PACKED;
+
   /* followed by:
    * - char address[address_length]
    * - char plugin_name[plugin_name_length] (including '\0'-termination).

Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c        2015-05-22 14:38:37 UTC (rev 
35796)
+++ gnunet/src/ats/ats_api_performance.c        2015-05-22 15:04:17 UTC (rev 
35797)
@@ -409,6 +409,7 @@
     GNUNET_ATS_properties_ntoh (&prop,
                                 &pi->properties);
     address.peer = pi->peer;
+    address.local_info = (enum GNUNET_HELLO_AddressInfo) ntohl 
(pi->address_local_info);
     address.address = plugin_address;
     address.address_length = plugin_address_length;
     address.transport_name = plugin_name;

Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c       2015-05-22 14:38:37 UTC 
(rev 35796)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c       2015-05-22 15:04:17 UTC 
(rev 35797)
@@ -37,7 +37,6 @@
 struct GNUNET_CONTAINER_MultiPeerMap *GSA_addresses;
 
 
-
 /**
  * Update statistic on number of addresses.
  */
@@ -71,6 +70,7 @@
                                       addr->addr_len,
                                       GNUNET_NO,
                                       NULL,
+                                      addr->local_address_info,
                                       GNUNET_BANDWIDTH_ZERO,
                                       GNUNET_BANDWIDTH_ZERO);
   GNUNET_free (addr->plugin);
@@ -257,6 +257,7 @@
                                      new_address->addr_len,
                                      new_address->active,
                                      &new_address->properties,
+                                      new_address->local_address_info,
                                      GNUNET_BANDWIDTH_value_init 
(new_address->assigned_bw_out),
                                      GNUNET_BANDWIDTH_value_init 
(new_address->assigned_bw_in));
 }
@@ -304,6 +305,7 @@
                                       aa->addr_len,
                                       aa->active,
                                       prop,
+                                      aa->local_address_info,
                                       GNUNET_BANDWIDTH_value_init 
(aa->assigned_bw_out),
                                       GNUNET_BANDWIDTH_value_init 
(aa->assigned_bw_in));
 
@@ -448,6 +450,7 @@
               addr->addr_len,
               addr->active,
               &addr->properties,
+              addr->local_address_info,
               GNUNET_BANDWIDTH_value_init (addr->assigned_bw_out),
               GNUNET_BANDWIDTH_value_init (addr->assigned_bw_in));
   return GNUNET_OK;
@@ -494,6 +497,7 @@
          NULL, NULL, NULL, 0,
          GNUNET_NO,
          NULL,
+         GNUNET_HELLO_ADDRESS_INFO_NONE,
          GNUNET_BANDWIDTH_ZERO,
          GNUNET_BANDWIDTH_ZERO);
 }
@@ -534,6 +538,7 @@
  * @param plugin_addr_len length of @a plugin_addr
  * @param active #GNUNET_YES if this address is actively used
  * @param prop performance information
+ * @param local_address_info flags for the address
  * @param bandwidth_out current outbound bandwidth assigned to address
  * @param bandwidth_in current inbound bandwidth assigned to address
  */
@@ -545,6 +550,7 @@
                    size_t plugin_addr_len,
                    int active,
                    const struct GNUNET_ATS_Properties *prop,
+                   enum GNUNET_HELLO_AddressInfo local_address_info,
                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 
@@ -585,6 +591,7 @@
     memset (&msg->properties,
             0,
             sizeof (struct GNUNET_ATS_Properties));
+  msg->address_local_info = htonl ((uint32_t) local_address_info);
   addrp = (char *) &msg[1];
   if (NULL != plugin_addr)
     memcpy (addrp, plugin_addr, plugin_addr_len);
@@ -616,6 +623,7 @@
  * @param plugin_addr_len length of @a plugin_addr
  * @param active is address actively used
  * @param prop performance information
+ * @param local_address_info additional local info for the address
  * @param bandwidth_out current outbound bandwidth assigned to address
  * @param bandwidth_in current inbound bandwidth assigned to address
  */
@@ -627,6 +635,7 @@
                       size_t plugin_addr_len,
                       int active,
                       const struct GNUNET_ATS_Properties *prop,
+                      enum GNUNET_HELLO_AddressInfo local_address_info,
                       struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
                       struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
@@ -658,6 +667,7 @@
                      plugin_addr, plugin_addr_len,
                      active,
                      prop,
+                     local_address_info,
                      bandwidth_out,
                      bandwidth_in);
 }
@@ -712,6 +722,7 @@
                      NULL, NULL, NULL,
                      0, GNUNET_NO,
                      NULL,
+                     GNUNET_HELLO_ADDRESS_INFO_NONE,
                      GNUNET_BANDWIDTH_ZERO,
                      GNUNET_BANDWIDTH_ZERO);
   GNUNET_SERVER_receive_done (client,

Modified: gnunet/src/ats/gnunet-service-ats_addresses.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.h       2015-05-22 14:38:37 UTC 
(rev 35796)
+++ gnunet/src/ats/gnunet-service-ats_addresses.h       2015-05-22 15:04:17 UTC 
(rev 35797)
@@ -301,9 +301,8 @@
 
   /**
    * Field to store local flags.
-   * FIXME: `enum GNUNET_HELLO_AddressInfo`?
    */
-  uint32_t local_address_info;
+  enum GNUNET_HELLO_AddressInfo local_address_info;
 
   /**
    * ATS performance information for this address, size of the @e atsi array.
@@ -443,6 +442,7 @@
  * @param plugin_addr_len length of @a plugin_addr
  * @param address_active is address actively used
  * @param atsi ats performance information
+ * @param local_address_info flags for the address
  * @param bandwidth_out current outbound bandwidth assigned to address
  * @param bandwidth_in current inbound bandwidth assigned to address
  */
@@ -454,6 +454,7 @@
                                  size_t plugin_addr_len,
                                  const int address_active,
                                  const struct GNUNET_ATS_Properties *prop,
+                                 enum GNUNET_HELLO_AddressInfo 
local_address_info,
                                  struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
                                  struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in);
 

Modified: gnunet/src/ats/gnunet-service-ats_performance.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.c     2015-05-22 14:38:37 UTC 
(rev 35796)
+++ gnunet/src/ats/gnunet-service-ats_performance.c     2015-05-22 15:04:17 UTC 
(rev 35797)
@@ -22,6 +22,9 @@
  * @brief ats service, interaction with 'performance' API
  * @author Matthias Wachs
  * @author Christian Grothoff
+ *
+ * TODO:
+ * - simplify functions by passing a `struct GNUNET_HELLO_Address`
  */
 #include "platform.h"
 #include "gnunet-service-ats.h"
@@ -55,6 +58,7 @@
  *        #GNUNET_NO if the address is not actively used;
  *        #GNUNET_SYSERR if this address is no longer available for ATS
  * @param prop performance data for the address
+ * @param local_address_info information about the local flags for the address
  * @param bandwidth_out assigned outbound bandwidth
  * @param bandwidth_in assigned inbound bandwidth
  */
@@ -66,6 +70,7 @@
                size_t plugin_addr_len,
                int active,
                const struct GNUNET_ATS_Properties *prop,
+               enum GNUNET_HELLO_AddressInfo local_address_info,
                struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
                struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
@@ -98,6 +103,7 @@
     memset (&msg->properties,
             0,
             sizeof (struct GNUNET_ATS_Properties));
+  msg->address_local_info = htonl (local_address_info);
   addrp = (char *) &msg[1];
   memcpy (addrp, plugin_addr, plugin_addr_len);
   strcpy (&addrp[plugin_addr_len], plugin_name);
@@ -138,6 +144,7 @@
  *        #GNUNET_NO if the address is not actively used;
  *        #GNUNET_SYSERR if this address is no longer available for ATS
  * @param prop performance data for the address
+ * @param local_address_info information about the local flags for the address
  * @param bandwidth_out assigned outbound bandwidth
  * @param bandwidth_in assigned inbound bandwidth
  */
@@ -148,6 +155,7 @@
                                     size_t plugin_addr_len,
                                     int active,
                                     const struct GNUNET_ATS_Properties *prop,
+                                    enum GNUNET_HELLO_AddressInfo 
local_address_info,
                                     struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
                                     struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in)
 {
@@ -158,6 +166,7 @@
                  plugin_addr_len,
                  active,
                  prop,
+                 local_address_info,
                  bandwidth_out,
                  bandwidth_in);
   GNUNET_STATISTICS_update (GSA_stats,
@@ -177,6 +186,7 @@
  * @param plugin_addr_len length of @a plugin_addr
  * @param active is address actively used
  * @param prop performance information
+ * @param local_address_info information about the local flags for the address
  * @param bandwidth_out current outbound bandwidth assigned to address
  * @param bandwidth_in current inbound bandwidth assigned to address
  */
@@ -188,6 +198,7 @@
              size_t plugin_addr_len,
              int active,
              const struct GNUNET_ATS_Properties *prop,
+             enum GNUNET_HELLO_AddressInfo local_address_info,
              struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
              struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
 {
@@ -208,6 +219,7 @@
                  plugin_addr_len,
                  active,
                  prop,
+                 local_address_info,
                  bandwidth_out,
                  bandwidth_in);
 }

Modified: gnunet/src/ats/gnunet-service-ats_performance.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.h     2015-05-22 14:38:37 UTC 
(rev 35796)
+++ gnunet/src/ats/gnunet-service-ats_performance.h     2015-05-22 15:04:17 UTC 
(rev 35797)
@@ -45,6 +45,7 @@
  *        #GNUNET_NO if the address is not actively used;
  *        #GNUNET_SYSERR if this address is no longer available for ATS
  * @param prop performance data for the address
+ * @param local_address_info information about the local flags for the address
  * @param bandwidth_out assigned outbound bandwidth
  * @param bandwidth_in assigned inbound bandwidth
  */
@@ -55,6 +56,7 @@
                                     size_t plugin_addr_len,
                                     int active,
                                     const struct GNUNET_ATS_Properties *prop,
+                                    enum GNUNET_HELLO_AddressInfo 
local_address_info,
                                     struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
                                     struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in);
 

Modified: gnunet/src/ats/gnunet-service-ats_plugins.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_plugins.c 2015-05-22 14:38:37 UTC (rev 
35796)
+++ gnunet/src/ats/gnunet-service-ats_plugins.c 2015-05-22 15:04:17 UTC (rev 
35797)
@@ -217,6 +217,7 @@
                                      address->addr_len,
                                      address->active,
                                      &address->properties,
+                                      address->local_address_info,
                                      GNUNET_BANDWIDTH_value_init 
(address->assigned_bw_out),
                                      GNUNET_BANDWIDTH_value_init 
(address->assigned_bw_in));
 

Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h     2015-05-22 14:38:37 UTC (rev 
35796)
+++ gnunet/src/include/gnunet_ats_service.h     2015-05-22 15:04:17 UTC (rev 
35797)
@@ -106,6 +106,12 @@
 {
 
   /**
+   * Delay.  Time between when the time packet is sent and the packet
+   * arrives.  FOREVER if we did not measure yet.
+   */
+  struct GNUNET_TIME_Relative delay;
+
+  /**
    * Actual traffic on this connection from this peer to the other peer.
    * Includes transport overhead.
    *
@@ -122,12 +128,6 @@
   uint32_t utilization_in;
 
   /**
-   * Which network scope does the respective address belong to?
-   * This property does not change.
-   */
-  enum GNUNET_ATS_Network_Type scope;
-
-  /**
    * Distance on network layer (required for distance-vector routing)
    * in hops.  Zero for direct connections (i.e. plain TCP/UDP).
    */
@@ -134,10 +134,10 @@
   unsigned int distance;
 
   /**
-   * Delay.  Time between when the time packet is sent and the packet
-   * arrives.  FOREVER if we did not measure yet.
+   * Which network scope does the respective address belong to?
+   * This property does not change.
    */
-  struct GNUNET_TIME_Relative delay;
+  enum GNUNET_ATS_Network_Type scope;
 
 };
 




reply via email to

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