gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33662 - in gnunet/src: ats ats-tool include util


From: gnunet
Subject: [GNUnet-SVN] r33662 - in gnunet/src: ats ats-tool include util
Date: Mon, 16 Jun 2014 09:58:28 +0200

Author: grothoff
Date: 2014-06-16 09:58:28 +0200 (Mon, 16 Jun 2014)
New Revision: 33662

Modified:
   gnunet/src/ats-tool/gnunet-ats.c
   gnunet/src/ats/gnunet-service-ats.c
   gnunet/src/include/gnunet_ats_service.h
   gnunet/src/util/strings.c
Log:
-doxygen, indentation

Modified: gnunet/src/ats/gnunet-service-ats.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats.c 2014-06-16 06:16:10 UTC (rev 33661)
+++ gnunet/src/ats/gnunet-service-ats.c 2014-06-16 07:58:28 UTC (rev 33662)
@@ -44,7 +44,7 @@
 struct GAS_Addresses_Handle *GSA_addresses;
 
 /**
- * We have received a 'ClientStartMessage' from a client.  Find out which
+ * We have received a `struct ClientStartMessage` from a client.  Find out 
which
  * type of client it is and notify the respective subsystem.
  *
  * @param cls closure, unused

Modified: gnunet/src/ats-tool/gnunet-ats.c
===================================================================
--- gnunet/src/ats-tool/gnunet-ats.c    2014-06-16 06:16:10 UTC (rev 33661)
+++ gnunet/src/ats-tool/gnunet-ats.c    2014-06-16 07:58:28 UTC (rev 33662)
@@ -200,7 +200,7 @@
              "Failed to convert address for peer `%s' plugin `%s' length %lu 
to string \n",
              GNUNET_i2s (&pr->address->peer),
              pr->address->transport_name,
-             pr->address->address_length );
+             pr->address->address_length);
     return;
   }
 
@@ -215,9 +215,9 @@
     if ((GNUNET_YES == receive_done) && (0 == pending))
     {
       /* All messages received and no resolutions pending*/
-      if (end_task != GNUNET_SCHEDULER_NO_TASK )
+      if (end_task != GNUNET_SCHEDULER_NO_TASK)
         GNUNET_SCHEDULER_cancel (end_task);
-      end_task = GNUNET_SCHEDULER_add_now (end, NULL );
+      end_task = GNUNET_SCHEDULER_add_now (end, NULL);
     }
 
     return;
@@ -309,6 +309,19 @@
 }
 
 
+
+/**
+ * Signature of a function that is called with QoS information about an 
address.
+ *
+ * @param cls closure (NULL)
+ * @param address the address, NULL if ATS service was disconnected
+ * @param address_active is this address actively used to maintain a connection
+          to a peer
+ * @param bandwidth_out assigned outbound bandwidth for the connection
+ * @param bandwidth_in assigned inbound bandwidth for the connection
+ * @param ats performance data for the address (as far as known)
+ * @param ats_count number of performance records in @a ats
+ */
 static void
 ats_perf_mon_cb(void *cls,
                 const struct GNUNET_HELLO_Address *address,
@@ -342,15 +355,18 @@
   if (GNUNET_NO == verbose)
   {
     struct AddressFindCtx actx;
+    struct ATSAddress *a;
 
     actx.src = address;
     actx.res = NULL;
 
-    GNUNET_CONTAINER_multipeermap_iterate (addresses, find_address_it, &actx);
-    if ((actx.res != NULL))
+    GNUNET_CONTAINER_multipeermap_iterate (addresses,
+                                           &find_address_it,
+                                           &actx);
+    if ((NULL != actx.res))
     {
       if ((bandwidth_in.value__ == actx.res->bandwidth_in.value__) &&
-          (bandwidth_out.value__ == actx.res->bandwidth_out.value__) )
+          (bandwidth_out.value__ == actx.res->bandwidth_out.value__))
       {
         return; /* Nothing to do here */
       }
@@ -360,12 +376,14 @@
         actx.res->bandwidth_out = bandwidth_out;
       }
     }
-    struct ATSAddress *a = GNUNET_new (struct ATSAddress);
+    a = GNUNET_new (struct ATSAddress);
     a->address = GNUNET_HELLO_address_copy(address);
     a->bandwidth_in = bandwidth_in;
     a->bandwidth_out = bandwidth_out;
-    GNUNET_CONTAINER_multipeermap_put (addresses, &address->peer, a,
-        GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+    GNUNET_CONTAINER_multipeermap_put (addresses,
+                                       &address->peer,
+                                       a,
+                                       
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
   }
 
   pr = GNUNET_malloc (sizeof (struct PendingResolutions) +
@@ -379,9 +397,10 @@
   pr->bandwidth_in = bandwidth_in;
   pr->bandwidth_out = bandwidth_out;
   pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address,
-      resolve_addresses_numeric,
-      GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
-      transport_addr_to_str_cb, pr);
+                                                     resolve_addresses_numeric,
+                                                     
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
+                                                     &transport_addr_to_str_cb,
+                                                     pr);
   GNUNET_CONTAINER_DLL_insert (head, tail, pr);
   results++;
   pending++;
@@ -407,9 +426,9 @@
     if (0 == pending)
     {
       /* All messages received and no resolutions pending*/
-      if (end_task != GNUNET_SCHEDULER_NO_TASK )
+      if (end_task != GNUNET_SCHEDULER_NO_TASK)
         GNUNET_SCHEDULER_cancel (end_task);
-      end_task = GNUNET_SCHEDULER_add_now (end, NULL );
+      end_task = GNUNET_SCHEDULER_add_now (end, NULL);
     }
     return;
   }
@@ -550,21 +569,21 @@
   }
   if (op_list_all)
   {
-    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL );
+    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
     if (NULL == ph)
     {
       fprintf (stderr,
-               _("Cannot connect to ATS service, exiting...\n") );
+               _("Cannot connect to ATS service, exiting...\n"));
       return;
     }
 
     alh = GNUNET_ATS_performance_list_addresses (ph,
-        (NULL == pid_str) ? NULL : &pid, GNUNET_YES, ats_perf_cb, NULL );
+        (NULL == pid_str) ? NULL : &pid, GNUNET_YES, ats_perf_cb, NULL);
     if (NULL == alh)
     {
       fprintf (stderr,
-               _("Cannot issue request to ATS service, exiting...\n") );
-      end_task = GNUNET_SCHEDULER_add_now (&end, NULL );
+               _("Cannot issue request to ATS service, exiting...\n"));
+      end_task = GNUNET_SCHEDULER_add_now (&end, NULL);
       return;
     }
     end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -573,18 +592,18 @@
   }
   else if (op_list_used)
   {
-    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL );
+    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
     if (NULL == ph)
       fprintf (stderr,
-               _("Cannot connect to ATS service, exiting...\n") );
+               _("Cannot connect to ATS service, exiting...\n"));
 
     alh = GNUNET_ATS_performance_list_addresses (ph,
-        (NULL == pid_str) ? NULL : &pid, GNUNET_NO, ats_perf_cb, NULL );
+        (NULL == pid_str) ? NULL : &pid, GNUNET_NO, ats_perf_cb, NULL);
     if (NULL == alh)
     {
       fprintf (stderr,
-               _("Cannot issue request to ATS service, exiting...\n") );
-      end_task = GNUNET_SCHEDULER_add_now (&end, NULL );
+               _("Cannot issue request to ATS service, exiting...\n"));
+      end_task = GNUNET_SCHEDULER_add_now (&end, NULL);
       return;
     }
     end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -593,10 +612,10 @@
   }
   else if (op_monitor)
   {
-    ph = GNUNET_ATS_performance_init (cfg, &ats_perf_mon_cb, NULL );
+    ph = GNUNET_ATS_performance_init (cfg, &ats_perf_mon_cb, NULL);
     if (NULL == ph)
       fprintf (stderr,
-               _("Cannot connect to ATS service, exiting...\n") );
+               _("Cannot connect to ATS service, exiting...\n"));
     end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
                                              &end,
                                              NULL);
@@ -607,13 +626,13 @@
     if (NULL == type_str)
     {
       fprintf (stderr,
-               _("No preference type given!\n") );
+               _("No preference type given!\n"));
       return;
     }
     if (NULL == pid_str)
     {
       fprintf (stderr,
-               _("No peer given!\n") );
+               _("No peer given!\n"));
       return;
     }
 
@@ -629,15 +648,15 @@
       type = GNUNET_ATS_PREFERENCE_BANDWIDTH;
     else
     {
-      FPRINTF (stderr, "%s", _("Valid type required\n") );
+      FPRINTF (stderr, "%s", _("Valid type required\n"));
       return;
     }
 
     /* set */
-    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL );
+    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
     if (NULL == ph)
       fprintf (stderr,
-               _("Cannot connect to ATS service, exiting...\n") );
+               _("Cannot connect to ATS service, exiting...\n"));
 
     GNUNET_ATS_performance_change_preference (ph, &pid, type, (double) value,
                                               GNUNET_ATS_PREFERENCE_END);
@@ -728,7 +747,7 @@
                             &run, NULL);
   GNUNET_free_non_null(pid_str);
   GNUNET_free_non_null(type_str);
-  GNUNET_free((void * ) argv);
+  GNUNET_free((void *) argv);
 
   if (GNUNET_OK == res)
     return ret;

Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h     2014-06-16 06:16:10 UTC (rev 
33661)
+++ gnunet/src/include/gnunet_ats_service.h     2014-06-16 07:58:28 UTC (rev 
33662)
@@ -570,13 +570,14 @@
  *
  * @param cfg configuration to use
  * @param suggest_cb notification to call whenever the suggestation changed
- * @param suggest_cb_cls closure for 'suggest_cb'
+ * @param suggest_cb_cls closure for @a suggest_cb
  * @return ats context
  */
 struct GNUNET_ATS_SchedulingHandle *
 GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
     GNUNET_ATS_AddressSuggestionCallback suggest_cb, void *suggest_cb_cls);
 
+
 /**
  * Client is done with ATS scheduling, release resources.
  *
@@ -585,6 +586,7 @@
 void
 GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh);
 
+
 /**
  * We would like to reset the address suggestion block time for this
  * peer
@@ -604,7 +606,7 @@
  * @param sh handle
  * @param peer identity of the peer we need an address for
  * @param cont the continuation to indicate success to call with the address
- * @param cont_cls the cls for the continuation
+ * @param cont_cls the closure for the @a cont
  * @return suggestion handle
  */
 struct GNUNET_ATS_SuggestHandle *
@@ -647,10 +649,10 @@
 
 /**
  * Returns where the address is located: LAN or WAN or ...
- * @param sh the GNUNET_ATS_SchedulingHandle handle
+ * @param sh the `struct GNUNET_ATS_SchedulingHandle` handle
  * @param addr address
  * @param addrlen address length
- * @return location as GNUNET_ATS_Information
+ * @return location as `struct GNUNET_ATS_Information`
  */
 struct GNUNET_ATS_Information
 GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh,
@@ -762,7 +764,7 @@
  * @param bandwidth_out assigned outbound bandwidth for the connection
  * @param bandwidth_in assigned inbound bandwidth for the connection
  * @param ats performance data for the address (as far as known)
- * @param ats_count number of performance records in 'ats'
+ * @param ats_count number of performance records in @a ats
  */
 typedef void
 (*GNUNET_ATS_AddressInformationCallback) (void *cls,
@@ -778,19 +780,22 @@
  */
 struct GNUNET_ATS_AddressListHandle;
 
+
 /**
  * Get handle to access performance API of the ATS subsystem.
  *
  * @param cfg configuration to use
  * @param addr_info_cb callback called when performance characteristics for
  *     an address change
- * @param addr_info_cb_cls closure for infocb
+ * @param addr_info_cb_cls closure for @a addr_info_cb
  * @return ats performance context
  */
 struct GNUNET_ATS_PerformanceHandle *
 GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-    GNUNET_ATS_AddressInformationCallback addr_info_cb, void 
*addr_info_cb_cls);
+    GNUNET_ATS_AddressInformationCallback addr_info_cb,
+                             void *addr_info_cb_cls);
 
+
 /**
  * Get information about addresses known to the ATS subsystem.
  *
@@ -809,15 +814,16 @@
     const struct GNUNET_PeerIdentity *peer, int all,
     GNUNET_ATS_AddressInformationCallback infocb, void *infocb_cls);
 
+
 /**
  * Cancel a pending address listing operation
  *
- * @param handle the GNUNET_ATS_AddressListHandle handle to cancel
+ * @param handle the `struct GNUNET_ATS_AddressListHandle` handle to cancel
  */
 void
-GNUNET_ATS_performance_list_addresses_cancel (
-    struct GNUNET_ATS_AddressListHandle *handle);
+GNUNET_ATS_performance_list_addresses_cancel (struct 
GNUNET_ATS_AddressListHandle *handle);
 
+
 /**
  * Client is done using the ATS performance subsystem, release resources.
  *
@@ -826,6 +832,7 @@
 void
 GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph);
 
+
 /**
  * Function called with reservation result.
  *
@@ -841,11 +848,13 @@
     const struct GNUNET_PeerIdentity * peer, int32_t amount,
     struct GNUNET_TIME_Relative res_delay);
 
+
 /**
  * Context that can be used to cancel a peer information request.
  */
 struct GNUNET_ATS_ReservationContext;
 
+
 /**
  * Reserve inbound bandwidth from the given peer.  ATS will look at
  * the current amount of traffic we receive from the peer and ensure
@@ -865,6 +874,7 @@
     const struct GNUNET_PeerIdentity *peer, int32_t amount,
     GNUNET_ATS_ReservationCallback rcb, void *rcb_cls);
 
+
 /**
  * Cancel request for reserving bandwidth.
  *
@@ -926,6 +936,7 @@
 const char *
 GNUNET_ATS_print_preference_type (uint32_t type);
 
+
 /**
  * Change preferences for the given peer. Preference changes are forgotten if 
peers
  * disconnect.
@@ -935,10 +946,10 @@
  * @param ... 0-terminated specification of the desired changes
  */
 void
-GNUNET_ATS_performance_change_preference (
-    struct GNUNET_ATS_PerformanceHandle *ph,
-    const struct GNUNET_PeerIdentity *peer, ...);
+GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle 
*ph,
+                                          const struct GNUNET_PeerIdentity 
*peer, ...);
 
+
 /**
  * Application feedback on how good preference requirements are fulfilled
  * for the preferences included in the given time scope [now - scope .. now]

Modified: gnunet/src/util/strings.c
===================================================================
--- gnunet/src/util/strings.c   2014-06-16 06:16:10 UTC (rev 33661)
+++ gnunet/src/util/strings.c   2014-06-16 07:58:28 UTC (rev 33662)
@@ -430,7 +430,8 @@
   free (encoded_string);
   return ret;
  fail:
-  LOG (GNUNET_ERROR_TYPE_WARNING, _("Character sets requested were 
`%s'->`%s'\n"),
+  LOG (GNUNET_ERROR_TYPE_WARNING,
+       _("Character sets requested were `%s'->`%s'\n"),
        "UTF-8", output_charset);
   ret = GNUNET_malloc (len + 1);
   memcpy (ret, input, len);




reply via email to

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