-indentation, doxygen, etc.
authorChristian Grothoff <christian@grothoff.org>
Tue, 27 Oct 2015 13:42:08 +0000 (13:42 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 27 Oct 2015 13:42:08 +0000 (13:42 +0000)
src/testbed/gnunet-service-testbed_connectionpool.c
src/testbed/gnunet-service-testbed_oc.c
src/testbed/testbed_api.c
src/testbed/testbed_api_topology.c

index 1067bc00eb78caad5d978b03ace1df215c0564ab..0f65edf15a9118a146bf85438ac6a01f14da4753 100644 (file)
@@ -568,12 +568,12 @@ core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer)
 
 
 /**
- * Function called after GNUNET_CORE_connect has succeeded (or failed
+ * Function called after #GNUNET_CORE_connect() has succeeded (or failed
  * for good).  Note that the private key of the peer is intentionally
  * not exposed here; if you need it, your process should try to read
  * the private key file directly (which should work if you are
  * authorized...).  Implementations of this function must not call
- * GNUNET_CORE_disconnect (other than by scheduling a new task to
+ * #GNUNET_CORE_disconnect() (other than by scheduling a new task to
  * do this later).
  *
  * @param cls the #PooledConnection object
@@ -816,7 +816,9 @@ GST_connection_pool_get_handle (unsigned int peer_id,
     }
     else
     {
-      GNUNET_CONTAINER_DLL_insert_tail (head_not_pooled, tail_not_pooled, entry);
+      GNUNET_CONTAINER_DLL_insert_tail (head_not_pooled,
+                                        tail_not_pooled,
+                                        entry);
     }
     entry->cfg = GNUNET_CONFIGURATION_dup (cfg);
   }
@@ -829,13 +831,16 @@ GST_connection_pool_get_handle (unsigned int peer_id,
   gh->connect_notify_cb = connect_notify_cb;
   gh->connect_notify_cb_cls = connect_notify_cb_cls;
   gh->service = service;
-  GNUNET_CONTAINER_DLL_insert (entry->head_waiting, entry->tail_waiting, gh);
+  GNUNET_CONTAINER_DLL_insert (entry->head_waiting,
+                               entry->tail_waiting,
+                               gh);
   if (NULL != handle)
   {
     if (NULL == entry->notify_task)
     {
       if (NULL != search_waiting (entry, entry->head_waiting))
-        entry->notify_task = GNUNET_SCHEDULER_add_now (&connection_ready, entry);
+        entry->notify_task = GNUNET_SCHEDULER_add_now (&connection_ready,
+                                                       entry);
     }
     return gh;
   }
@@ -845,19 +850,22 @@ GST_connection_pool_get_handle (unsigned int peer_id,
   case GST_CONNECTIONPOOL_SERVICE_TRANSPORT:
     if (NULL != entry->op_transport)
       return gh;                /* Operation pending */
-    op = GNUNET_TESTBED_operation_create_ (entry, &opstart_get_handle_transport,
+    op = GNUNET_TESTBED_operation_create_ (entry,
+                                           &opstart_get_handle_transport,
                                            &oprelease_get_handle_transport);
     entry->op_transport = op;
     break;
   case GST_CONNECTIONPOOL_SERVICE_CORE:
     if (NULL != entry->op_core)
       return gh;                /* Operation pending */
-    op = GNUNET_TESTBED_operation_create_ (entry, &opstart_get_handle_core,
+    op = GNUNET_TESTBED_operation_create_ (entry,
+                                           &opstart_get_handle_core,
                                            &oprelease_get_handle_core);
     entry->op_core = op;
     break;
   }
-  GNUNET_TESTBED_operation_queue_insert_ (GST_opq_openfds, op);
+  GNUNET_TESTBED_operation_queue_insert_ (GST_opq_openfds,
+                                          op);
   GNUNET_TESTBED_operation_begin_wait_ (op);
   return gh;
 }
index 1d57499f79c558d9af28f40253e42ac29850afba..bb3a04e933fb27c0eb8b7ba02ec608beb8e25778 100644 (file)
@@ -65,7 +65,7 @@ struct TryConnectContext
   /**
    * The task handle
    */
-  struct GNUNET_SCHEDULER_Task * task;
+  struct GNUNET_SCHEDULER_Task *task;
 
   /**
    * The id of the operation which is resposible for this context
@@ -131,7 +131,7 @@ struct LocalPeer2Context
 struct RemotePeer2Context
 {
   /**
-   * Controller of peer 2; If OCC_TYPE_REMOTE_LATERAL is the type of overlay
+   * Controller of peer 2; If #OCC_TYPE_REMOTE_LATERAL is the type of overlay
    * connection then this can be NULL until the connection to the controller is
    * established
    */
@@ -145,7 +145,7 @@ struct RemotePeer2Context
 
   /**
    * Notification handle acquire to connect to a remote controller.  Only used
-   * if the type of overlay connection is OCC_TYPE_REMOTE_LATERAL.
+   * if the type of overlay connection is #OCC_TYPE_REMOTE_LATERAL.
    */
   struct NeighbourConnectNotification *ncn;
 
@@ -250,17 +250,17 @@ struct OverlayConnectContext
    * The id of the task for sending HELLO of peer 2 to peer 1 and ask peer 1 to
    * connect to peer 2
    */
-  struct GNUNET_SCHEDULER_Task * send_hello_task;
+  struct GNUNET_SCHEDULER_Task *send_hello_task;
 
   /**
    * The id of the overlay connect timeout task
    */
-  struct GNUNET_SCHEDULER_Task * timeout_task;
+  struct GNUNET_SCHEDULER_Task *timeout_task;
 
   /**
    * The id of the cleanup task
    */
-  struct GNUNET_SCHEDULER_Task * cleanup_task;
+  struct GNUNET_SCHEDULER_Task *cleanup_task;
 
   /**
    * The type of this context information
@@ -321,12 +321,12 @@ struct RemoteOverlayConnectCtx
   /**
    * Task for offering HELLO of A to B and doing try_connect
    */
-  struct GNUNET_SCHEDULER_Task * attempt_connect_task_id;
+  struct GNUNET_SCHEDULER_Task *attempt_connect_task_id;
 
   /**
    * Task to timeout RequestOverlayConnect
    */
-  struct GNUNET_SCHEDULER_Task * timeout_rocc_task_id;
+  struct GNUNET_SCHEDULER_Task *timeout_rocc_task_id;
 
   /**
    * The id of the operation responsible for creating this context
@@ -833,7 +833,8 @@ send_hello_thru_rocc (struct OverlayConnectContext *occ)
  * @param tc the TaskContext from scheduler
  */
 static void
-send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+send_hello (void *cls,
+            const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct OverlayConnectContext *occ = cls;
   struct LocalPeer2Context *lp2c;
@@ -879,7 +880,8 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * @param ignore_ peer identity which is ignored in this callback
  */
 static void
-p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
+p2_transport_connect_cache_callback (void *cls,
+                                     struct GNUNET_CORE_Handle *ch,
                                      struct GNUNET_TRANSPORT_Handle *th,
                                      const struct GNUNET_PeerIdentity *ignore_)
 {
@@ -888,7 +890,8 @@ p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
   GNUNET_assert (OCC_TYPE_LOCAL == occ->type);
   if (NULL == th)
   {
-    GNUNET_asprintf (&occ->emsg, "0x%llx: Cannot connect to TRANSPORT of %s",
+    GNUNET_asprintf (&occ->emsg,
+                     "0x%llx: Cannot connect to TRANSPORT of %s",
                      occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
     GNUNET_SCHEDULER_cancel (occ->timeout_task);
     occ->timeout_task =
@@ -896,8 +899,10 @@ p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
     return;
   }
   occ->p2ctx.local.tcc.th_ = th;
-  GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while offering HELLO to %s",
-                   occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
+  GNUNET_asprintf (&occ->emsg,
+                   "0x%llx: Timeout while offering HELLO to %s",
+                   occ->op_id,
+                   GNUNET_i2s (&occ->other_peer_identity));
   occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ);
 }
 
@@ -929,8 +934,10 @@ p2_transport_connect (struct OverlayConnectContext *occ)
                                         occ, NULL, NULL, NULL);
     return;
   }
-  GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while offering HELLO to %s",
-                   occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
+  GNUNET_asprintf (&occ->emsg,
+                   "0x%llx: Timeout while offering HELLO to %s",
+                   occ->op_id,
+                   GNUNET_i2s (&occ->other_peer_identity));
   occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ);
 }
 
@@ -944,7 +951,8 @@ p2_transport_connect (struct OverlayConnectContext *occ)
  * @return
  */
 static int
-test_address (void *cls, const struct GNUNET_HELLO_Address *address,
+test_address (void *cls,
+              const struct GNUNET_HELLO_Address *address,
               struct GNUNET_TIME_Absolute expiration)
 {
   int *empty = cls;
@@ -963,7 +971,8 @@ test_address (void *cls, const struct GNUNET_HELLO_Address *address,
  * @param hello our updated HELLO
  */
 static void
-hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello)
+hello_update_cb (void *cls,
+                 const struct GNUNET_MessageHeader *hello)
 {
   struct OverlayConnectContext *occ = cls;
   int empty;
@@ -972,15 +981,18 @@ hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello)
   msize = ntohs (hello->size);
   empty = GNUNET_YES;
   (void) GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *)
-                                         hello, GNUNET_NO, &test_address,
+                                         hello, GNUNET_NO,
+                                         &test_address,
                                          &empty);
   if (GNUNET_YES == empty)
   {
-    LOG_DEBUG ("0x%llx: HELLO of %s is empty\n", occ->op_id,
+    LOG_DEBUG ("0x%llx: HELLO of %s is empty\n",
+               occ->op_id,
                GNUNET_i2s (&occ->peer_identity));
     return;
   }
-  LOG_DEBUG ("0x%llx: Received HELLO of %s\n", occ->op_id,
+  LOG_DEBUG ("0x%llx: Received HELLO of %s\n",
+             occ->op_id,
              GNUNET_i2s (&occ->peer_identity));
   occ->hello = GNUNET_malloc (msize);
   GST_cache_add_hello (occ->peer->id, hello);
@@ -1015,8 +1027,10 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
   occ->emsg = NULL;
   if (NULL == th)
   {
-    GNUNET_asprintf (&occ->emsg, "0x%llx: Cannot connect to TRANSPORT of %s",
-                     occ->op_id, GNUNET_i2s (&occ->peer_identity));
+    GNUNET_asprintf (&occ->emsg,
+                     "0x%llx: Cannot connect to TRANSPORT of %s",
+                     occ->op_id,
+                     GNUNET_i2s (&occ->peer_identity));
     GNUNET_SCHEDULER_cancel (occ->timeout_task);
     occ->timeout_task =
         GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
@@ -1026,9 +1040,12 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
   GNUNET_assert (NULL != occ->cgh_p1th);
   occ->p1th_ = th;
   GNUNET_asprintf (&occ->emsg,
-                   "0x%llx: Timeout while acquiring HELLO of peer %4s",
-                   occ->op_id, GNUNET_i2s (&occ->peer_identity));
-  occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p1th_, &hello_update_cb, occ);
+                   "0x%llx: Timeout while acquiring HELLO of peer %s",
+                   occ->op_id,
+                   GNUNET_i2s (&occ->peer_identity));
+  occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p1th_,
+                                         &hello_update_cb,
+                                         occ);
 }
 
 
@@ -1041,7 +1058,8 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
  * @param my_identity the identity of our peer
  */
 static void
-occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch,
+occ_cache_get_handle_core_cb (void *cls,
+                              struct GNUNET_CORE_Handle *ch,
                               struct GNUNET_TRANSPORT_Handle *th,
                               const struct GNUNET_PeerIdentity *my_identity)
 {
@@ -1054,7 +1072,9 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch,
   {
     GNUNET_asprintf (&occ->emsg,
                      "0x%llx: Failed to connect to CORE of peer with "
-                     "id: %u", occ->op_id, occ->peer->id);
+                     "id: %u",
+                     occ->op_id,
+                     occ->peer->id);
     GNUNET_SCHEDULER_cancel (occ->timeout_task);
     occ->timeout_task =
         GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
@@ -1073,7 +1093,8 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch,
   }
   memcpy (&occ->peer_identity, my_identity,
           sizeof (struct GNUNET_PeerIdentity));
-  LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n", occ->op_id,
+  LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n",
+             occ->op_id,
              GNUNET_i2s (&occ->peer_identity));
   /* Lookup for HELLO in hello cache */
   if (NULL != (hello = GST_cache_lookup_hello (occ->peer->id)))
@@ -1105,7 +1126,8 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch,
  * @param msg the peer create success message
  */
 static void
-overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg)
+overlay_connect_get_config (void *cls,
+                            const struct GNUNET_MessageHeader *msg)
 {
   struct OverlayConnectContext *occ = cls;
   struct RemotePeer2Context *rp2c;
@@ -1123,19 +1145,22 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg)
   }
   cmsg =
       (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg;
-  memcpy (&occ->other_peer_identity, &cmsg->peer_identity,
-          sizeof (struct GNUNET_PeerIdentity));
+  occ->other_peer_identity = cmsg->peer_identity;
   GNUNET_free_non_null (occ->emsg);
   GNUNET_asprintf (&occ->emsg,
                    "0x%llx: Timeout while connecting to CORE of peer with "
-                   "id: %u", occ->op_id, occ->peer->id);
+                   "id: %u",
+                   occ->op_id,
+                   occ->peer->id);
   occ->cgh_ch =
       GST_connection_pool_get_handle (occ->peer->id,
                                       occ->peer->details.local.cfg,
                                       GST_CONNECTIONPOOL_SERVICE_CORE,
-                                      occ_cache_get_handle_core_cb, occ,
+                                      occ_cache_get_handle_core_cb,
+                                      occ,
                                       &occ->other_peer_identity,
-                                      &overlay_connect_notify, occ);
+                                      &overlay_connect_notify,
+                                      occ);
   return;
 }
 
@@ -1162,12 +1187,13 @@ host_registration_comp (void *cls, const char *emsg)
  * @param cls pointer 2 pointer of RegisteredHostContext
  * @param key current key code
  * @param value value in the hash map
- * @return GNUNET_YES if we should continue to
+ * @return #GNUNET_YES if we should continue to
  *         iterate,
- *         GNUNET_NO if not.
+ *         #GNUNET_NO if not.
  */
 static int
-reghost_match_iterator (void *cls, const struct GNUNET_HashCode *key,
+reghost_match_iterator (void *cls,
+                        const struct GNUNET_HashCode *key,
                         void *value)
 {
   struct RegisteredHostContext **rh = cls;
@@ -1345,7 +1371,8 @@ forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg,
  * @param c handle to the controller connection
  */
 static void
-p2_controller_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c)
+p2_controller_connect_cb (void *cls,
+                          struct GNUNET_TESTBED_Controller *c)
 {
   struct OverlayConnectContext *occ = cls;
   struct RemotePeer2Context *rp2c;
@@ -1369,19 +1396,22 @@ p2_controller_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c)
   GNUNET_free_non_null (occ->emsg);
   GNUNET_asprintf (&occ->emsg,
                    "0x%llx: Timeout while getting peer identity of peer "
-                   "with id: %u", occ->op_id, occ->other_peer_id);
+                   "with id: %u",
+                   occ->op_id,
+                   occ->other_peer_id);
 }
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT messages
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT messages
  *
  * @param cls NULL
  * @param client identification of the client
  * @param message the actual message
  */
 void
-GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
+GST_handle_overlay_connect (void *cls,
+                            struct GNUNET_SERVER_Client *client,
                             const struct GNUNET_MessageHeader *message)
 {
   const struct GNUNET_TESTBED_OverlayConnectMessage *msg;
@@ -1413,19 +1443,23 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
   peer = GST_peer_list[p1];
   operation_id = GNUNET_ntohll (msg->operation_id);
   LOG_DEBUG
-      ("Received overlay connect for peers %u and %u with op id: 0x%llx\n", p1,
-       p2, operation_id);
+      ("Received overlay connect for peers %u and %u with op id: 0x%llx\n",
+       p1,
+       p2,
+       operation_id);
   peer2_host_id = ntohl (msg->peer2_host_id);
   if (GNUNET_YES == peer->is_remote)
   {
-    if (!VALID_HOST_ID (peer2_host_id))
+    if (! VALID_HOST_ID (peer2_host_id))
     {
       GNUNET_break (0);
-      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+      GNUNET_SERVER_receive_done (client,
+                                  GNUNET_SYSERR);
       return;
     }
     forward_overlay_connect (msg, client);
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
+    GNUNET_SERVER_receive_done (client,
+                                GNUNET_OK);
     return;
   }
   p2n = NULL;
@@ -1441,7 +1475,8 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
         LOG (GNUNET_ERROR_TYPE_WARNING,
              "0x%llx: Peer %u's host not in our neighbours list\n",
              operation_id, p2);
-        GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+        GNUNET_SERVER_receive_done (client,
+                                    GNUNET_SYSERR);
         GNUNET_free (occ);
         return;
       }
@@ -1455,7 +1490,9 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
     occ->type = OCC_TYPE_REMOTE_SLAVE;
     occ->p2ctx.remote.p2c = GST_peer_list[p2]->details.remote.slave->controller;
   }
-  GNUNET_CONTAINER_DLL_insert_tail (occq_head, occq_tail, occ);
+  GNUNET_CONTAINER_DLL_insert_tail (occq_head,
+                                    occq_tail,
+                                    occ);
   GNUNET_SERVER_client_keep (client);
   occ->client = client;
   occ->other_peer_id = p2;
@@ -1464,13 +1501,18 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
   occ->op_id = operation_id;
   GNUNET_assert (NULL == occ->timeout_task);
   occ->timeout_task =
-      GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_overlay_connect, occ);
+      GNUNET_SCHEDULER_add_delayed (GST_timeout,
+                                    &timeout_overlay_connect,
+                                    occ);
   switch (occ->type)
   {
   case OCC_TYPE_REMOTE_LATERAL:
     GNUNET_asprintf (&occ->emsg,
                      "0x%llx: Timeout while acquiring connection to peer %u's "
-                     "host: %u\n", occ->op_id, occ->other_peer_id, peer2_host_id);
+                     "host: %u\n",
+                     occ->op_id,
+                     occ->other_peer_id,
+                     peer2_host_id);
     occ->p2ctx.remote.ncn =
         GST_neighbour_get_connection (p2n, &p2_controller_connect_cb, occ);
     break;
@@ -1484,7 +1526,9 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
                                       &occ->other_peer_identity);
     GNUNET_asprintf (&occ->emsg,
                      "0x%llx: Timeout while connecting to CORE of peer with "
-                     "id: %u", occ->op_id, occ->peer->id);
+                     "id: %u",
+                     occ->op_id,
+                     occ->peer->id);
     occ->cgh_ch =
         GST_connection_pool_get_handle (occ->peer->id,
                                         occ->peer->details.local.cfg,
@@ -1537,13 +1581,15 @@ cleanup_rocc (struct RemoteOverlayConnectCtx *rocc)
  * @param tc the TaskContext from scheduler
  */
 static void
-timeout_rocc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+timeout_rocc_task (void *cls,
+                   const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct RemoteOverlayConnectCtx *rocc = cls;
 
   GNUNET_assert (rocc->timeout_rocc_task_id != NULL);
   rocc->timeout_rocc_task_id = NULL;
-  LOG_DEBUG ("0x%llx: rocc timed out\n", rocc->op_id);
+  LOG_DEBUG ("0x%llx: rocc timed out\n",
+             rocc->op_id);
   cleanup_rocc (rocc);
 }
 
@@ -1561,11 +1607,13 @@ cache_transport_peer_connect_notify (void *cls,
 {
   struct RemoteOverlayConnectCtx *rocc = cls;
 
-  LOG_DEBUG ("0x%llx: Request Overlay connect notify\n", rocc->op_id);
+  LOG_DEBUG ("0x%llx: Request Overlay connect notify\n",
+             rocc->op_id);
   GNUNET_assert (0 ==
                  memcmp (new_peer, &rocc->a_id,
                          sizeof (struct GNUNET_PeerIdentity)));
-  LOG_DEBUG ("0x%llx: Peer %4s connected\n", rocc->op_id,
+  LOG_DEBUG ("0x%llx: Peer %4s connected\n",
+             rocc->op_id,
              GNUNET_i2s (&rocc->a_id));
   cleanup_rocc (rocc);
 }
@@ -1579,7 +1627,8 @@ cache_transport_peer_connect_notify (void *cls,
  * @param tc the TaskContext from scheduler
  */
 static void
-attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+attempt_connect_task (void *cls,
+                      const struct GNUNET_SCHEDULER_TaskContext *tc);
 
 
 /**
@@ -1587,8 +1636,8 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
  *
  * @param cls the overlay connect context
  * @param tc the scheduler task context; if tc->reason =
- *          GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
- *          GNUNET_SCHEDULER_REASON_READ_READY is succeeded
+ *          #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if
+ *          #GNUNET_SCHEDULER_REASON_READ_READY is succeeded
  */
 static void
 rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -1672,7 +1721,9 @@ rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch,
       GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, rocc->tcc.pid))
   {
     LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n",
-               rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id);
+               rocc->op_id,
+               GNUNET_i2s (&rocc->a_id),
+               rocc->peer->id);
     cleanup_rocc (rocc);
     return;
   }
@@ -1682,7 +1733,7 @@ rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT messages
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_REQUEST_CONNECT messages
  *
  * @param cls NULL
  * @param client identification of the client
@@ -1751,7 +1802,10 @@ GST_handle_remote_overlay_connect (void *cls,
   GNUNET_TESTING_peer_get_identity (peer->details.local.peer, &pid);
   (void) strncpy (pid_str, GNUNET_i2s (&pid), 15);
   LOG_DEBUG ("0x%llx: Remote overlay connect %4s to peer %4s with hello size: %u\n",
-             rocc->op_id, pid_str, GNUNET_i2s (&rocc->a_id), hsize);
+             rocc->op_id,
+             pid_str,
+             GNUNET_i2s (&rocc->a_id),
+             hsize);
   rocc->peer = peer;
   rocc->peer->reference_cnt++;
   rocc->hello = GNUNET_malloc (hsize);
@@ -1767,7 +1821,9 @@ GST_handle_remote_overlay_connect (void *cls,
                                       &cache_transport_peer_connect_notify,
                                       rocc);
   rocc->timeout_rocc_task_id =
-      GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_rocc_task, rocc);
+      GNUNET_SCHEDULER_add_delayed (GST_timeout,
+                                    &timeout_rocc_task,
+                                    rocc);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
index a3bb3777e73a480a7804436961f5f9e186ad80dc..ab9afd83e6ac475992244d8a7445bae2b2bad4d9 100644 (file)
@@ -484,12 +484,12 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS message from
  * controller (testbed service)
  *
  * @param c the controller handle
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -543,12 +543,12 @@ handle_peer_create_success (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -624,12 +624,12 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -699,7 +699,7 @@ handle_peer_conevent (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG message from
  * controller (testbed service)
  *
  * @param c the controller handler
@@ -771,12 +771,12 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -931,12 +931,12 @@ GNUNET_TESTBED_generate_slavegetconfig_msg_ (uint64_t op_id, uint32_t slave_id)
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
  * (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -978,12 +978,12 @@ handle_slave_config (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
  * (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -1558,8 +1558,7 @@ opc_free_iterator (void *cls, uint32_t key, void *value)
  * @param c handle to controller to stop
  */
 void
-GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller
-                                      *c)
+GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller *c)
 {
   struct MessageQueue *mq_entry;
 
@@ -1899,11 +1898,11 @@ GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
 /**
  * Generates configuration by uncompressing configuration in given message. The
  * given message should be of the following types:
- * GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION,
- * GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION,
- * GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST,
- * GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS,
- * GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT,
  *
  * @param msg the message containing compressed configuration
  * @return handle to the parsed configuration; NULL upon error while parsing the message
index 1bfc9955de21203b4404e8cff4a9da5a926f1e6b..1f67176cd192841a29834c6b97fccc099cf0cf36 100644 (file)
@@ -217,12 +217,12 @@ struct TopologyContext
    * The type of this context
    */
   enum {
-    
+
     /**
      * Type for underlay topology
      */
     TOPOLOGYCONTEXT_TYPE_UNDERLAY = 0,
-    
+
     /**
      * Type for overlay topology
      */
@@ -475,7 +475,7 @@ make_link (unsigned int offset, uint32_t A, uint32_t B,
     {
       struct TopologyContextOverlay *overlay;
       struct OverlayLink *olink;
-      
+
       overlay = &tc->u.overlay;
       GNUNET_assert (offset < tc->link_array_size);
       olink = &overlay->link_array[offset];
@@ -490,7 +490,7 @@ make_link (unsigned int offset, uint32_t A, uint32_t B,
     {
       struct TopologyContextUnderlay *underlay;
       struct UnderlayLink *ulink;
-      
+
       underlay = &tc->u.underlay;
       GNUNET_assert (offset < tc->link_array_size);
       ulink = &underlay->link_array[offset];
@@ -518,7 +518,7 @@ gen_topo_line (struct TopologyContext *tc)
   case TOPOLOGYCONTEXT_TYPE_OVERLAY:
     {
       struct TopologyContextOverlay *overlay;
-      
+
       overlay = &tc->u.overlay;
       overlay->link_array =
           GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
@@ -527,7 +527,7 @@ gen_topo_line (struct TopologyContext *tc)
   case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
     {
       struct TopologyContextUnderlay *underlay;
-      
+
       underlay = &tc->u.underlay;
       underlay->link_array =
           GNUNET_malloc (sizeof (struct UnderlayLink) * tc->link_array_size);
@@ -564,7 +564,7 @@ gen_topo_ring (struct TopologyContext *tc)
   case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
     {
       struct TopologyContextUnderlay *underlay;
-      
+
       underlay = &tc->u.underlay;
       underlay->link_array =
           GNUNET_realloc (underlay->link_array, sizeof (struct UnderlayLink) *
@@ -656,7 +656,7 @@ gen_topo_2dtorus (struct TopologyContext *tc)
   case TOPOLOGYCONTEXT_TYPE_OVERLAY:
     {
       struct TopologyContextOverlay *overlay;
-      
+
       overlay = &tc->u.overlay;
       overlay->link_array =
           GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
@@ -714,11 +714,13 @@ gen_topo_2dtorus (struct TopologyContext *tc)
  *
  * @param tc the topology context
  * @param links the number of random links to establish
- * @param append GNUNET_YES to add links to existing link array; GNUNET_NO to
+ * @param append #GNUNET_YES to add links to existing link array; #GNUNET_NO to
  *          create a new link array
  */
 static void
-gen_topo_random (struct TopologyContext *tc, unsigned int links, int append)
+gen_topo_random (struct TopologyContext *tc,
+                 unsigned int links,
+                 int append)
 {
   unsigned int cnt;
   unsigned int index;
@@ -802,7 +804,9 @@ gen_topo_random (struct TopologyContext *tc, unsigned int links, int append)
  *   network
  */
 static void
-gen_topo_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m)
+gen_topo_scale_free (struct TopologyContext *tc,
+                     uint16_t cap,
+                     uint8_t m)
 {
   unsigned int *deg;
   unsigned int *etab;
@@ -903,9 +907,9 @@ gen_topo_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m)
   case TOPOLOGYCONTEXT_TYPE_OVERLAY:
     {
       struct TopologyContextOverlay *overlay;
-      
+
       overlay = &tc->u.overlay;
-      overlay->link_array = 
+      overlay->link_array =
           GNUNET_realloc (overlay->link_array, sizeof (struct OverlayLink) * tc->link_array_size);
     }
     break;
@@ -929,7 +933,8 @@ gen_topo_scale_free (struct TopologyContext *tc, uint16_t cap, uint8_t m)
  * @param filename the filename of the file containing topology data
  */
 static void
-gen_topo_from_file (struct TopologyContext *tc, const char *filename)
+gen_topo_from_file (struct TopologyContext *tc,
+                    const char *filename)
 {
   char *data;
   char *end;
@@ -957,20 +962,24 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
   status = GNUNET_SYSERR;
   if (GNUNET_YES != GNUNET_DISK_file_test (filename))
   {
-    LOG (GNUNET_ERROR_TYPE_ERROR, _("Topology file %s not found\n"), filename);
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         _("Topology file %s not found\n"),
+         filename);
     return;
   }
   if (GNUNET_OK !=
       GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
   {
-    LOG (GNUNET_ERROR_TYPE_ERROR, _("Topology file %s has no data\n"),
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         _("Topology file %s has no data\n"),
          filename);
     return;
   }
   data = GNUNET_malloc (fs);
   if (fs != GNUNET_DISK_fn_read (filename, data, fs))
   {
-    LOG (GNUNET_ERROR_TYPE_ERROR, _("Topology file %s cannot be read\n"),
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         _("Topology file %s cannot be read\n"),
          filename);
     goto _exit;
   }
@@ -1048,9 +1057,9 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
         case TOPOLOGYCONTEXT_TYPE_OVERLAY:
           {
             struct TopologyContextOverlay *overlay;
-            
+
             overlay = &tc->u.overlay;
-            overlay->link_array = 
+            overlay->link_array =
                 GNUNET_realloc (overlay->link_array,
                                 sizeof (struct OverlayLink) * tc->link_array_size);
           }
@@ -1058,7 +1067,7 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
         case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
           {
             struct TopologyContextUnderlay *underlay;
-            
+
             underlay = &tc->u.underlay;
             underlay->link_array =
                 GNUNET_realloc (underlay->link_array,
@@ -1071,7 +1080,8 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
       }
       else
         LOG (GNUNET_ERROR_TYPE_WARNING,
-             _("Ignoring to connect peer %u to peer %u\n"), peer_id,
+             _("Ignoring to connect peer %u to peer %u\n"),
+             peer_id,
              other_peer_id);
       while (('\n' != data[offset]) && ('|' != data[offset]) && (offset < fs))
         offset++;
@@ -1091,14 +1101,15 @@ _exit:
   GNUNET_free (data);
   if (GNUNET_OK != status)
   {
-    LOG (GNUNET_ERROR_TYPE_WARNING, "Removing link data read from the file\n");
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         "Removing link data read from the file\n");
     tc->link_array_size = 0;
     switch (tc->type)
     {
     case TOPOLOGYCONTEXT_TYPE_OVERLAY:
       {
         struct TopologyContextOverlay *overlay;
-        
+
         overlay = &tc->u.overlay;
         GNUNET_free_non_null (overlay->link_array);
         overlay->link_array = NULL;
@@ -1107,7 +1118,7 @@ _exit:
     case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
       {
         struct TopologyContextUnderlay *underlay;
-        
+
         underlay = &tc->u.underlay;
         GNUNET_free_non_null (underlay->link_array);
         underlay->link_array = NULL;
@@ -1129,7 +1140,7 @@ gen_topo_clique (struct TopologyContext *tc)
   unsigned int cnt;
   unsigned int offset;
   unsigned int neighbour;
-  
+
   tc->link_array_size = tc->num_peers * (tc->num_peers - 1);
   switch (tc->type)
   {
@@ -1138,8 +1149,8 @@ gen_topo_clique (struct TopologyContext *tc)
       struct TopologyContextOverlay *overlay;
 
       overlay = &tc->u.overlay;
-      overlay->link_array = GNUNET_malloc (sizeof (struct OverlayLink) *
-                                           tc->link_array_size);
+      overlay->link_array = GNUNET_new_array (tc->link_array_size,
+                                              struct OverlayLink);
     }
     break;
   case TOPOLOGYCONTEXT_TYPE_UNDERLAY:
@@ -1147,8 +1158,8 @@ gen_topo_clique (struct TopologyContext *tc)
       struct TopologyContextUnderlay *underlay;
 
       underlay = &tc->u.underlay;
-      underlay->link_array = GNUNET_malloc (sizeof (struct UnderlayLink) *
-                                            tc->link_array_size);
+      underlay->link_array = GNUNET_new_array (tc->link_array_size,
+                                               struct UnderlayLink);
     }
   }
   offset = 0;
@@ -1169,8 +1180,8 @@ gen_topo_clique (struct TopologyContext *tc)
  * Configure overall network topology to have a particular shape.
  *
  * @param op_cls closure argument to give with the operation event
- * @param num_peers number of peers in 'peers'
- * @param peers array of 'num_peers' with the peers to configure
+ * @param num_peers number of peers in @a peers
+ * @param peers array of @a num_peers with the peers to configure
  * @param topo desired underlay topology to use
  * @param ap topology-specific options
  * @return handle to the operation, NULL if configuring the topology
@@ -1194,8 +1205,8 @@ GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls,
  * Configure overall network topology to have a particular shape.
  *
  * @param op_cls closure argument to give with the operation event
- * @param num_peers number of peers in 'peers'
- * @param peers array of 'num_peers' with the peers to configure
+ * @param num_peers number of peers in @a peers
+ * @param peers array of @a num_peers with the peers to configure
  * @param topo desired underlay topology to use
  * @param ... topology-specific options
  * @return handle to the operation, NULL if configuring the topology
@@ -1220,8 +1231,8 @@ GNUNET_TESTBED_underlay_configure_topology (void *op_cls,
  *
  * @param op_cls closure argument to give with the peer connect operation events
  *          generated through this function
- * @param num_peers number of peers in 'peers'
- * @param peers array of 'num_peers' with the peers to configure
+ * @param num_peers number of peers in @a peers
+ * @param peers array of @a num_peers with the peers to configure
  * @param max_connections the maximums number of overlay connections that will
  *          be made to achieve the given topology
  * @param comp_cb the completion callback to call when the topology generation
@@ -1339,7 +1350,8 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
   GNUNET_TESTBED_operation_queue_insert_
       (c->opq_parallel_topology_config_operations, op);
   GNUNET_TESTBED_operation_begin_wait_ (op);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Generated %u connections\n",
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Generated %u connections\n",
        tc->link_array_size);
   if (NULL != max_connections)
     *max_connections = tc->link_array_size;
@@ -1399,8 +1411,8 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
  * @param topology where to write the retrieved topology
  * @param topology_string The string to attempt to
  *        get a configuration value from
- * @return GNUNET_YES if topology string matched a
- *         known topology, GNUNET_NO if not
+ * @return #GNUNET_YES if topology string matched a
+ *         known topology, #GNUNET_NO if not
  */
 int
 GNUNET_TESTBED_topology_get_ (enum GNUNET_TESTBED_TopologyOption *topology,
@@ -1444,14 +1456,14 @@ GNUNET_TESTBED_topology_to_str_ (enum GNUNET_TESTBED_TopologyOption topology)
  *          generated
  * @param proc the underlay link processor callback.  Will be called for each
  *          underlay link generated unless a previous call to this callback
- *          returned GNUNET_SYSERR.  Cannot be NULL.
- * @param cls closure for proc
+ *          returned #GNUNET_SYSERR.  Cannot be NULL.
+ * @param cls closure for @a proc
  * @param ... variable arguments denoting the topology and its parameters.  They
  *          should start with the type of topology to generate followed by their
  *          options.
- * @return GNUNET_OK if underlay link generation is successful; GNUNET_SYSERR
+ * @return #GNUNET_OK if underlay link generation is successful; #GNUNET_SYSERR
  *          upon error in generating the underlay or if any calls to the
- *          underlay link processor returned GNUNET_SYSERR
+ *          underlay link processor returned #GNUNET_SYSERR
  */
 int
 GNUNET_TESTBED_underlay_construct_ (int num_peers,
@@ -1466,7 +1478,7 @@ GNUNET_TESTBED_underlay_construct_ (int num_peers,
   enum GNUNET_TESTBED_TopologyOption topology;
   unsigned int cnt;
   int ret;
-  
+
   GNUNET_assert (NULL != proc);
   ret = GNUNET_OK;
   memset (&tc, 0, sizeof (tc));