aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-01-25 15:28:08 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-01-25 15:28:08 +0000
commit30c5c323f28ade8a1e7c6c593778793e44accb3a (patch)
tree845955ec895d221338b44f0cadce7932932e78cc /src/testbed
parent43d558efd13a3245e65efd0acdc9c4ba59cd2bee (diff)
- indent
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-helper-testbed.c23
-rw-r--r--src/testbed/gnunet-service-testbed.c256
-rw-r--r--src/testbed/gnunet-service-testbed.h46
-rw-r--r--src/testbed/gnunet-service-testbed_hc.c24
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c358
-rw-r--r--src/testbed/gnunet-testbed-profiler.c60
-rw-r--r--src/testbed/gnunet_mpi_test.c35
-rw-r--r--src/testbed/ll_master.c16
-rw-r--r--src/testbed/ll_monitor.c4
-rw-r--r--src/testbed/standard_deviation.c20
-rw-r--r--src/testbed/test_testbed_api.c32
-rw-r--r--src/testbed/test_testbed_api_2peers_1controller.c19
-rw-r--r--src/testbed/test_testbed_api_3peers_3controllers.c188
-rw-r--r--src/testbed/test_testbed_api_controllerlink.c66
-rw-r--r--src/testbed/test_testbed_api_hosts.c3
-rw-r--r--src/testbed/test_testbed_api_operations.c39
-rw-r--r--src/testbed/test_testbed_api_test.c28
-rw-r--r--src/testbed/test_testbed_api_testbed_run.c9
-rw-r--r--src/testbed/test_testbed_api_topology.c21
-rw-r--r--src/testbed/test_testbed_api_topology_clique.c21
-rw-r--r--src/testbed/testbed.h6
-rw-r--r--src/testbed/testbed_api.c377
-rw-r--r--src/testbed/testbed_api.h36
-rw-r--r--src/testbed/testbed_api_hosts.c37
-rw-r--r--src/testbed/testbed_api_operations.c19
-rw-r--r--src/testbed/testbed_api_operations.h5
-rw-r--r--src/testbed/testbed_api_peers.c36
-rw-r--r--src/testbed/testbed_api_peers.h10
-rw-r--r--src/testbed/testbed_api_services.c35
-rw-r--r--src/testbed/testbed_api_statistics.c4
-rw-r--r--src/testbed/testbed_api_test.c17
-rw-r--r--src/testbed/testbed_api_testbed.c221
-rw-r--r--src/testbed/testbed_api_topology.c270
-rw-r--r--src/testbed/testbed_api_topology.h8
-rw-r--r--src/testbed/testbed_helper.h7
35 files changed, 1146 insertions, 1210 deletions
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c
index 8f94d5ce57..7d0bf873d2 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -252,7 +252,7 @@ tokenizer_cb (void *cls, void *client,
uint16_t trusted_ip_size;
uint16_t hostname_size;
uint16_t msize;
-
+
msize = ntohs (message->size);
if ((sizeof (struct GNUNET_TESTBED_HelperInit) >= msize) ||
(GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT != ntohs (message->type)))
@@ -265,8 +265,7 @@ tokenizer_cb (void *cls, void *client,
trusted_ip = (char *) &msg[1];
if ('\0' != trusted_ip[trusted_ip_size])
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Trusted IP cannot be empty -- exiting\n");
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Trusted IP cannot be empty -- exiting\n");
goto error;
}
hostname_size = ntohs (msg->hostname_size);
@@ -276,7 +275,7 @@ tokenizer_cb (void *cls, void *client,
GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- exiting\n");
goto error;
- }
+ }
ul_config_size = (uLongf) ntohs (msg->config_size);
config = GNUNET_malloc (ul_config_size);
xconfig_size =
@@ -284,8 +283,8 @@ tokenizer_cb (void *cls, void *client,
sizeof (struct GNUNET_TESTBED_HelperInit));
if (Z_OK !=
uncompress ((Bytef *) config, &ul_config_size,
- (const Bytef *) (trusted_ip + trusted_ip_size + 1 + hostname_size),
- (uLongf) xconfig_size))
+ (const Bytef *) (trusted_ip + trusted_ip_size + 1 +
+ hostname_size), (uLongf) xconfig_size))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"Error while uncompressing config -- exiting\n");
@@ -306,11 +305,12 @@ tokenizer_cb (void *cls, void *client,
if (0 != hostname_size)
{
hostname = GNUNET_malloc (hostname_size + 1);
- (void) strncpy (hostname, ((char *) &msg[1]) + trusted_ip_size + 1, hostname_size);
+ (void) strncpy (hostname, ((char *) &msg[1]) + trusted_ip_size + 1,
+ hostname_size);
hostname[hostname_size] = '\0';
}
- test_system = GNUNET_TESTING_system_create ("testbed-helper", trusted_ip,
- hostname);
+ test_system =
+ GNUNET_TESTING_system_create ("testbed-helper", trusted_ip, hostname);
GNUNET_free_non_null (hostname);
hostname = NULL;
GNUNET_assert (NULL != test_system);
@@ -333,9 +333,8 @@ tokenizer_cb (void *cls, void *client,
testbed =
GNUNET_OS_start_process (PIPE_CONTROL,
GNUNET_OS_INHERIT_STD_ERR /*verbose? */ , NULL,
- NULL,
- binary,
- "gnunet-service-testbed", "-c", config, NULL);
+ NULL, binary, "gnunet-service-testbed", "-c",
+ config, NULL);
GNUNET_free (binary);
GNUNET_free (config);
if (NULL == testbed)
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index e767413eed..56bac51c9d 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -226,7 +226,7 @@ transmit_ready_notify (void *cls, size_t size, void *buf)
*/
void
GST_queue_message (struct GNUNET_SERVER_Client *client,
- struct GNUNET_MessageHeader *msg)
+ struct GNUNET_MessageHeader *msg)
{
struct MessageQueue *mq_entry;
uint16_t type;
@@ -324,7 +324,8 @@ static void
slave_list_add (struct Slave *slave)
{
if (slave->host_id >= GST_slave_list_size)
- array_grow_large_enough (GST_slave_list, GST_slave_list_size, slave->host_id);
+ array_grow_large_enough (GST_slave_list, GST_slave_list_size,
+ slave->host_id);
GNUNET_assert (NULL == GST_slave_list[slave->host_id]);
GST_slave_list[slave->host_id] = slave;
}
@@ -361,7 +362,8 @@ peer_list_remove (struct Peer *peer)
while (GST_peer_list_size >= LIST_GROW_STEP)
{
for (id = GST_peer_list_size - 1;
- (id >= GST_peer_list_size - LIST_GROW_STEP) && (id != UINT32_MAX); id--)
+ (id >= GST_peer_list_size - LIST_GROW_STEP) && (id != UINT32_MAX);
+ id--)
if (NULL != GST_peer_list[id])
break;
if (id != ((GST_peer_list_size - LIST_GROW_STEP) - 1))
@@ -371,7 +373,8 @@ peer_list_remove (struct Peer *peer)
if (orig_size == GST_peer_list_size)
return;
GST_peer_list =
- GNUNET_realloc (GST_peer_list, sizeof (struct Peer *) * GST_peer_list_size);
+ GNUNET_realloc (GST_peer_list,
+ sizeof (struct Peer *) * GST_peer_list_size);
}
@@ -422,7 +425,7 @@ route_message (uint32_t host_id, const struct GNUNET_MessageHeader *msg)
*/
void
GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client,
- uint64_t operation_id, const char *emsg)
+ uint64_t operation_id, const char *emsg)
{
struct GNUNET_TESTBED_OperationFailureEventMessage *msg;
uint16_t msize;
@@ -471,7 +474,7 @@ send_operation_success_msg (struct GNUNET_SERVER_Client *client,
* @param cls the handle to the slave at which the registration is completed
* @param emsg the error message; NULL if host registration is successful
*/
-static void
+static void
hr_completion (void *cls, const char *emsg);
@@ -485,18 +488,16 @@ static void
register_next_host (struct Slave *slave)
{
struct HostRegistration *hr;
-
+
hr = slave->hr_dll_head;
GNUNET_assert (NULL != hr);
GNUNET_assert (NULL == slave->rhandle);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Registering host %u at %u\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Registering host %u at %u\n",
GNUNET_TESTBED_host_get_id_ (hr->host),
GNUNET_TESTBED_host_get_id_ (GST_host_list[slave->host_id]));
- slave->rhandle = GNUNET_TESTBED_register_host (slave->controller,
- hr->host,
- hr_completion,
- slave);
+ slave->rhandle =
+ GNUNET_TESTBED_register_host (slave->controller, hr->host, hr_completion,
+ slave);
}
@@ -506,7 +507,7 @@ register_next_host (struct Slave *slave)
* @param cls the handle to the slave at which the registration is completed
* @param emsg the error message; NULL if host registration is successful
*/
-static void
+static void
hr_completion (void *cls, const char *emsg)
{
struct Slave *slave = cls;
@@ -515,13 +516,10 @@ hr_completion (void *cls, const char *emsg)
slave->rhandle = NULL;
hr = slave->hr_dll_head;
GNUNET_assert (NULL != hr);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Registering host %u at %u successful\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Registering host %u at %u successful\n",
GNUNET_TESTBED_host_get_id_ (hr->host),
GNUNET_TESTBED_host_get_id_ (GST_host_list[slave->host_id]));
- GNUNET_CONTAINER_DLL_remove (slave->hr_dll_head,
- slave->hr_dll_tail,
- hr);
+ GNUNET_CONTAINER_DLL_remove (slave->hr_dll_head, slave->hr_dll_tail, hr);
if (NULL != hr->cb)
hr->cb (hr->cb_cls, emsg);
GNUNET_free (hr);
@@ -534,16 +532,15 @@ hr_completion (void *cls, const char *emsg)
* Adds a host registration's request to a slave's registration queue
*
* @param slave the slave controller at which the given host has to be
- * registered
+ * registered
* @param cb the host registration completion callback
* @param cb_cls the closure for the host registration completion callback
* @param host the host which has to be registered
*/
void
GST_queue_host_registration (struct Slave *slave,
- GNUNET_TESTBED_HostRegistrationCompletion cb,
- void *cb_cls,
- struct GNUNET_TESTBED_Host *host)
+ GNUNET_TESTBED_HostRegistrationCompletion cb,
+ void *cb_cls, struct GNUNET_TESTBED_Host *host)
{
struct HostRegistration *hr;
int call_register;
@@ -557,9 +554,7 @@ GST_queue_host_registration (struct Slave *slave,
hr->cb_cls = cb_cls;
hr->host = host;
call_register = (NULL == slave->hr_dll_head) ? GNUNET_YES : GNUNET_NO;
- GNUNET_CONTAINER_DLL_insert_tail (slave->hr_dll_head,
- slave->hr_dll_tail,
- hr);
+ GNUNET_CONTAINER_DLL_insert_tail (slave->hr_dll_head, slave->hr_dll_tail, hr);
if (GNUNET_YES == call_register)
register_next_host (slave);
}
@@ -606,7 +601,7 @@ lcf_proc_cc (void *cls, const char *emsg)
}
return;
- registration_error:
+registration_error:
LOG (GNUNET_ERROR_TYPE_WARNING, "Host registration failed with message: %s\n",
emsg);
lcf->state = FINISHED;
@@ -622,7 +617,7 @@ lcf_proc_cc (void *cls, const char *emsg)
*/
void
GST_forwarded_operation_reply_relay (void *cls,
- const struct GNUNET_MessageHeader *msg)
+ const struct GNUNET_MessageHeader *msg)
{
struct ForwardedOperationContext *fopc = cls;
struct GNUNET_MessageHeader *dup_msg;
@@ -648,7 +643,7 @@ GST_forwarded_operation_reply_relay (void *cls,
*/
void
GST_forwarded_operation_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct ForwardedOperationContext *fopc = cls;
@@ -730,12 +725,12 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
case INIT:
if (GNUNET_NO ==
- GNUNET_TESTBED_is_host_registered_ (GST_host_list[lcf->delegated_host_id],
+ GNUNET_TESTBED_is_host_registered_ (GST_host_list
+ [lcf->delegated_host_id],
lcf->gateway->controller))
{
- GST_queue_host_registration (lcf->gateway,
- lcf_proc_cc, lcf,
- GST_host_list[lcf->delegated_host_id]);
+ GST_queue_host_registration (lcf->gateway, lcf_proc_cc, lcf,
+ GST_host_list[lcf->delegated_host_id]);
}
else
{
@@ -748,9 +743,8 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_TESTBED_is_host_registered_ (GST_host_list[lcf->slave_host_id],
lcf->gateway->controller))
{
- GST_queue_host_registration (lcf->gateway,
- lcf_proc_cc, lcf,
- GST_host_list[lcf->slave_host_id]);
+ GST_queue_host_registration (lcf->gateway, lcf_proc_cc, lcf,
+ GST_host_list[lcf->slave_host_id]);
}
else
{
@@ -802,7 +796,7 @@ slave_event_callback (void *cls,
struct RegisteredHostContext *rhc;
struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_TESTBED_Operation *old_op;
-
+
/* We currently only get here when working on RegisteredHostContexts */
GNUNET_assert (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type);
rhc = event->details.operation_finished.op_cls;
@@ -814,11 +808,8 @@ slave_event_callback (void *cls,
old_op = rhc->sub_op;
rhc->state = RHC_LINK;
rhc->sub_op =
- GNUNET_TESTBED_controller_link (rhc,
- rhc->gateway->controller,
- rhc->reg_host,
- rhc->host,
- cfg,
+ GNUNET_TESTBED_controller_link (rhc, rhc->gateway->controller,
+ rhc->reg_host, rhc->host, cfg,
GNUNET_NO);
GNUNET_TESTBED_operation_done (old_op);
break;
@@ -866,8 +857,8 @@ slave_status_callback (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
}
slave->controller =
GNUNET_TESTBED_controller_connect (cfg, GST_host_list[slave->host_id],
- event_mask,
- &slave_event_callback, slave);
+ event_mask, &slave_event_callback,
+ slave);
if (NULL != slave->controller)
{
send_operation_success_msg (lcc->client, lcc->operation_id);
@@ -876,14 +867,14 @@ slave_status_callback (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
else
{
GST_send_operation_fail_msg (lcc->client, lcc->operation_id,
- "Could not connect to delegated controller");
+ "Could not connect to delegated controller");
GNUNET_TESTBED_controller_stop (slave->controller_proc);
GST_slave_list[slave->host_id] = NULL;
GNUNET_free (slave);
slave = NULL;
}
- clean_lcc:
+clean_lcc:
if (NULL != lcc)
{
if (NULL != lcc->client)
@@ -944,15 +935,13 @@ handle_init (void *cls, struct GNUNET_SERVER_Client *client,
GST_context->master_ip = GNUNET_strdup (controller_hostname);
LOG_DEBUG ("Our IP: %s\n", GST_context->master_ip);
GST_context->system =
- GNUNET_TESTING_system_create ("testbed", GST_context->master_ip, hostname);
+ GNUNET_TESTING_system_create ("testbed", GST_context->master_ip,
+ hostname);
host =
GNUNET_TESTBED_host_create_with_id (GST_context->host_id,
- GST_context->master_ip,
- NULL,
- 0);
+ GST_context->master_ip, NULL, 0);
host_list_add (host);
- LOG_DEBUG ("Created master context with host ID: %u\n",
- GST_context->host_id);
+ LOG_DEBUG ("Created master context with host ID: %u\n", GST_context->host_id);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -987,8 +976,9 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
if (0 != username_length)
username_length++;
/* msg must contain hostname */
- GNUNET_assert (msize > (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
- username_length + 1));
+ GNUNET_assert (msize >
+ (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
+ username_length + 1));
if (0 != username_length)
GNUNET_assert ('\0' == username[username_length - 1]);
hostname = username + username_length;
@@ -1025,8 +1015,7 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
}
else
{
- LOG_DEBUG ("Added host %u at %u\n",
- host_id, GST_context->host_id);
+ LOG_DEBUG ("Added host %u at %u\n", host_id, GST_context->host_id);
reply = GNUNET_malloc (reply_size);
}
reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM);
@@ -1173,15 +1162,16 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
(NULL == GST_host_list[delegated_host_id]))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "Delegated host %u not registered with us\n", delegated_host_id);
+ "Delegated host %u not registered with us\n", delegated_host_id);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
slave_host_id = ntohl (msg->slave_host_id);
- if ((slave_host_id >= GST_host_list_size) || (NULL == GST_host_list[slave_host_id]))
+ if ((slave_host_id >= GST_host_list_size) ||
+ (NULL == GST_host_list[slave_host_id]))
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Slave host %u not registered with us\n",
- slave_host_id);
+ slave_host_id);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
@@ -1192,7 +1182,7 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
return;
}
- if (slave_host_id == GST_context->host_id) /* Link from us */
+ if (slave_host_id == GST_context->host_id) /* Link from us */
{
struct Slave *slave;
struct LinkControllersContext *lcc;
@@ -1249,14 +1239,14 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
{
slave->controller =
GNUNET_TESTBED_controller_connect (cfg, GST_host_list[slave->host_id],
- event_mask,
- &slave_event_callback, slave);
+ event_mask, &slave_event_callback,
+ slave);
slave->cfg = cfg;
if (NULL != slave->controller)
send_operation_success_msg (client, GNUNET_ntohll (msg->operation_id));
else
GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Could not connect to delegated controller");
+ "Could not connect to delegated controller");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1266,9 +1256,9 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
lcc->client = client;
slave->lcc = lcc;
slave->controller_proc =
- GNUNET_TESTBED_controller_start (GST_context->master_ip,
- GST_host_list[slave->host_id], cfg,
- &slave_status_callback, slave);
+ GNUNET_TESTBED_controller_start (GST_context->master_ip,
+ GST_host_list[slave->host_id], cfg,
+ &slave_status_callback, slave);
GNUNET_CONFIGURATION_destroy (cfg);
new_route = GNUNET_malloc (sizeof (struct Route));
new_route->dest = delegated_host_id;
@@ -1314,11 +1304,11 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
- if ((delegated_host_id < route_list_size)
- && (NULL != route_list[delegated_host_id]))
+ if ((delegated_host_id < route_list_size) &&
+ (NULL != route_list[delegated_host_id]))
{
- GNUNET_break_op (0); /* Are you trying to link delegated host twice
- with is subordinate flag set to GNUNET_YES? */
+ GNUNET_break_op (0); /* Are you trying to link delegated host twice
+ * with is subordinate flag set to GNUNET_YES? */
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
@@ -1463,7 +1453,7 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
if (UINT32_MAX == peer_id)
{
GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Cannot create peer with given ID");
+ "Cannot create peer with given ID");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1502,16 +1492,13 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
return;
}
GNUNET_free (config);
- GNUNET_CONFIGURATION_set_value_number (cfg,
- "TESTBED",
- "PEERID",
- (unsigned long long) peer_id);
+ GNUNET_CONFIGURATION_set_value_number (cfg, "TESTBED", "PEERID",
+ (unsigned long long) peer_id);
peer = GNUNET_malloc (sizeof (struct Peer));
peer->is_remote = GNUNET_NO;
peer->details.local.cfg = cfg;
peer->id = peer_id;
- LOG_DEBUG ("Creating peer with id: %u\n",
- (unsigned int) peer->id);
+ LOG_DEBUG ("Creating peer with id: %u\n", (unsigned int) peer->id);
peer->details.local.peer =
GNUNET_TESTING_peer_configure (GST_context->system,
peer->details.local.cfg, peer->id,
@@ -1559,10 +1546,11 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_SERVER_client_keep (client);
fo_ctxt->client = client;
fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id);
- fo_ctxt->cls = peer; //GST_slave_list[route->dest]->controller;
+ fo_ctxt->cls = peer; //GST_slave_list[route->dest]->controller;
fo_ctxt->type = OP_PEER_CREATE;
fo_ctxt->opc =
- GNUNET_TESTBED_forward_operation_msg_ (GST_slave_list [route->dest]->controller,
+ GNUNET_TESTBED_forward_operation_msg_ (GST_slave_list
+ [route->dest]->controller,
fo_ctxt->operation_id,
&msg->header,
peer_create_success_cb, fo_ctxt);
@@ -1599,7 +1587,7 @@ handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client,
LOG (GNUNET_ERROR_TYPE_ERROR,
"Asked to destroy a non existent peer with id: %u\n", peer_id);
GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Peer doesn't exist");
+ "Peer doesn't exist");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1612,12 +1600,12 @@ handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client,
fopc->client = client;
fopc->cls = peer;
fopc->type = OP_PEER_DESTROY;
- fopc->operation_id = GNUNET_ntohll (msg->operation_id);
- fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller,
+ fopc->operation_id = GNUNET_ntohll (msg->operation_id);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
+ slave->controller,
fopc->operation_id, &msg->header,
- &peer_destroy_success_cb,
- fopc);
+ &peer_destroy_success_cb, fopc);
fopc->timeout_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
fopc);
@@ -1672,7 +1660,8 @@ handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
fopc->operation_id = GNUNET_ntohll (msg->operation_id);
fopc->type = OP_PEER_START;
fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller,
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
+ slave->controller,
fopc->operation_id, &msg->header,
&GST_forwarded_operation_reply_relay,
fopc);
@@ -1686,7 +1675,7 @@ handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
if (GNUNET_OK != GNUNET_TESTING_peer_start (peer->details.local.peer))
{
GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Failed to start");
+ "Failed to start");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1726,21 +1715,23 @@ handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
if ((peer_id >= GST_peer_list_size) || (NULL == GST_peer_list[peer_id]))
{
GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Peer not found");
+ "Peer not found");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
peer = GST_peer_list[peer_id];
if (GNUNET_YES == peer->is_remote)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Forwarding PEER_STOP for peer %u\n", peer_id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Forwarding PEER_STOP for peer %u\n",
+ peer_id);
fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
GNUNET_SERVER_client_keep (client);
fopc->client = client;
fopc->operation_id = GNUNET_ntohll (msg->operation_id);
fopc->type = OP_PEER_STOP;
fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller,
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
+ slave->controller,
fopc->operation_id, &msg->header,
&GST_forwarded_operation_reply_relay,
fopc);
@@ -1755,7 +1746,7 @@ handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Stopping peer %u failed\n", peer_id);
GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Peer not running");
+ "Peer not running");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1799,7 +1790,7 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
if ((peer_id >= GST_peer_list_size) || (NULL == GST_peer_list[peer_id]))
{
GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Peer not found");
+ "Peer not found");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1807,7 +1798,7 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
if (GNUNET_YES == peer->is_remote)
{
struct ForwardedOperationContext *fopc;
-
+
LOG_DEBUG ("Forwarding PEER_GET_CONFIG for peer: %u\n", peer_id);
fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
GNUNET_SERVER_client_keep (client);
@@ -1815,14 +1806,15 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
fopc->operation_id = GNUNET_ntohll (msg->operation_id);
fopc->type = OP_PEER_INFO;
fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller,
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
+ slave->controller,
fopc->operation_id, &msg->header,
&GST_forwarded_operation_reply_relay,
fopc);
fopc->timeout_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
fopc);
- GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
+ GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1858,10 +1850,10 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
*/
static void
handle_slave_get_config (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_TESTBED_SlaveGetConfigurationMessage *msg;
- struct Slave *slave;
+ struct Slave *slave;
struct GNUNET_TESTBED_SlaveConfiguration *reply;
char *config;
char *xconfig;
@@ -1885,14 +1877,14 @@ handle_slave_get_config (void *cls, struct GNUNET_SERVER_Client *client,
if (NULL == slave->cfg)
{
GST_send_operation_fail_msg (client, op_id,
- "Configuration not found (slave not started by me)");
+ "Configuration not found (slave not started by me)");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
config = GNUNET_CONFIGURATION_serialize (slave->cfg, &config_size);
- xconfig_size = GNUNET_TESTBED_compress_config_ (config, config_size,
- &xconfig);
- GNUNET_free (config);
+ xconfig_size =
+ GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
+ GNUNET_free (config);
reply_size = xconfig_size + sizeof (struct GNUNET_TESTBED_SlaveConfiguration);
GNUNET_break (reply_size <= UINT16_MAX);
GNUNET_break (config_size <= UINT16_MAX);
@@ -1941,9 +1933,8 @@ ss_map_free_iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
* iterate,
* GNUNET_NO if not.
*/
-static int
-reghost_free_iterator (void *cls,
- const struct GNUNET_HashCode * key,
+static int
+reghost_free_iterator (void *cls, const struct GNUNET_HashCode *key,
void *value)
{
struct Slave *slave = cls;
@@ -1951,19 +1942,17 @@ reghost_free_iterator (void *cls,
struct ForwardedOverlayConnectContext *focc;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (slave->reghost_map,
- key, value));
+ GNUNET_CONTAINER_multihashmap_remove (slave->reghost_map, key,
+ value));
while (NULL != (focc = rhc->focc_dll_head))
{
- GNUNET_CONTAINER_DLL_remove (rhc->focc_dll_head,
- rhc->focc_dll_tail,
- focc);
+ GNUNET_CONTAINER_DLL_remove (rhc->focc_dll_head, rhc->focc_dll_tail, focc);
GST_cleanup_focc (focc);
}
if (NULL != rhc->sub_op)
GNUNET_TESTBED_operation_done (rhc->sub_op);
if (NULL != rhc->client)
- GNUNET_SERVER_client_drop (rhc->client);
+ GNUNET_SERVER_client_drop (rhc->client);
GNUNET_free (value);
return GNUNET_YES;
}
@@ -2037,12 +2026,12 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (NULL != GST_peer_list[id])
{
/* If destroy flag is set it means that this peer should have been
- destroyed by a context which we destroy before */
+ * destroyed by a context which we destroy before */
GNUNET_break (GNUNET_NO == GST_peer_list[id]->destroy_flag);
/* counter should be zero as we free all contexts before */
- GNUNET_break (0 == GST_peer_list[id]->reference_cnt);
- if ( (GNUNET_NO == GST_peer_list[id]->is_remote)
- && (GNUNET_YES == GST_peer_list[id]->details.local.is_running))
+ GNUNET_break (0 == GST_peer_list[id]->reference_cnt);
+ if ((GNUNET_NO == GST_peer_list[id]->is_remote) &&
+ (GNUNET_YES == GST_peer_list[id]->details.local.is_running))
GNUNET_TESTING_peer_kill (GST_peer_list[id]->details.local.peer);
}
for (id = 0; id < GST_peer_list_size; id++)
@@ -2050,8 +2039,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
if (GNUNET_NO == GST_peer_list[id]->is_remote)
{
- if (GNUNET_YES == GST_peer_list[id]->details.local.is_running)
- GNUNET_TESTING_peer_wait (GST_peer_list[id]->details.local.peer);
+ if (GNUNET_YES == GST_peer_list[id]->details.local.is_running)
+ GNUNET_TESTING_peer_wait (GST_peer_list[id]->details.local.peer);
GNUNET_TESTING_peer_destroy (GST_peer_list[id]->details.local.peer);
GNUNET_CONFIGURATION_destroy (GST_peer_list[id]->details.local.cfg);
}
@@ -2073,22 +2062,23 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (NULL != GST_slave_list[id])
{
struct HostRegistration *hr_entry;
-
+
while (NULL != (hr_entry = GST_slave_list[id]->hr_dll_head))
{
GNUNET_CONTAINER_DLL_remove (GST_slave_list[id]->hr_dll_head,
- GST_slave_list[id]->hr_dll_tail,
- hr_entry);
+ GST_slave_list[id]->hr_dll_tail, hr_entry);
GNUNET_free (hr_entry);
}
if (NULL != GST_slave_list[id]->rhandle)
GNUNET_TESTBED_cancel_registration (GST_slave_list[id]->rhandle);
- (void) GNUNET_CONTAINER_multihashmap_iterate (GST_slave_list[id]->reghost_map,
- reghost_free_iterator,
- GST_slave_list[id]);
+ (void)
+ GNUNET_CONTAINER_multihashmap_iterate (GST_slave_list
+ [id]->reghost_map,
+ reghost_free_iterator,
+ GST_slave_list[id]);
GNUNET_CONTAINER_multihashmap_destroy (GST_slave_list[id]->reghost_map);
if (NULL != GST_slave_list[id]->cfg)
- GNUNET_CONFIGURATION_destroy (GST_slave_list[id]->cfg);
+ GNUNET_CONFIGURATION_destroy (GST_slave_list[id]->cfg);
if (NULL != GST_slave_list[id]->controller)
GNUNET_TESTBED_controller_disconnect (GST_slave_list[id]->controller);
if (NULL != GST_slave_list[id]->controller_proc)
@@ -2106,14 +2096,14 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GST_context = NULL;
}
if (NULL != transmit_handle)
- GNUNET_SERVER_notify_transmit_ready_cancel (transmit_handle);
+ GNUNET_SERVER_notify_transmit_ready_cancel (transmit_handle);
while (NULL != (mq_entry = mq_head))
{
GNUNET_free (mq_entry->msg);
GNUNET_SERVER_client_drop (mq_entry->client);
- GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry);
+ GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry);
GNUNET_free (mq_entry);
- }
+ }
GNUNET_free_non_null (hostname);
GNUNET_CONFIGURATION_destroy (our_config);
/* Free hello cache */
@@ -2185,21 +2175,21 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
char *logfile;
unsigned long long num;
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename (cfg,
- "TESTBED",
- "LOG_FILE",
- &logfile))
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_filename (cfg, "TESTBED", "LOG_FILE",
+ &logfile))
{
GNUNET_break (GNUNET_OK == GNUNET_log_setup ("testbed", "DEBUG", logfile));
GNUNET_free (logfile);
}
- GNUNET_assert (GNUNET_OK ==
+ GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
"HELLO_CACHE_SIZE",
&num));
GST_cache_init ((unsigned int) num);
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string
- (cfg, "testbed", "HOSTNAME", &hostname));
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg, "testbed",
+ "HOSTNAME", &hostname));
our_config = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_SERVER_add_handlers (server, message_handlers);
GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL);
diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h
index b3e9171444..6165c91e55 100644
--- a/src/testbed/gnunet-service-testbed.h
+++ b/src/testbed/gnunet-service-testbed.h
@@ -96,7 +96,7 @@ struct ForwardedOperationContext
* The prev pointer for DLL
*/
struct ForwardedOperationContext *prev;
-
+
/**
* The generated operation context
*/
@@ -240,7 +240,7 @@ struct Slave
struct Peer
{
-
+
union
{
struct
@@ -255,7 +255,7 @@ struct Peer
* peer is configured with
*/
struct GNUNET_CONFIGURATION_Handle *cfg;
-
+
/**
* Is the peer running
*/
@@ -329,7 +329,7 @@ struct Context
* The TESTING system handle for starting peers locally
*/
struct GNUNET_TESTING_System *system;
-
+
/**
* Our host id according to this context
*/
@@ -389,12 +389,12 @@ struct ForwardedOverlayConnectContext
* the id of peer 1
*/
uint32_t peer1;
-
+
/**
* The id of peer 2
*/
uint32_t peer2;
-
+
/**
* Id of the host where peer2 is running
*/
@@ -447,11 +447,12 @@ struct RegisteredHostContext
* Tail of the ForwardedOverlayConnectContext DLL
*/
struct ForwardedOverlayConnectContext *focc_dll_tail;
-
+
/**
* Enumeration of states for this context
*/
- enum RHCState {
+ enum RHCState
+ {
/**
* The initial state
@@ -473,7 +474,6 @@ struct RegisteredHostContext
* State where we attempt to do the overlay connection again
*/
RHC_OL_CONNECT
-
} state;
};
@@ -493,12 +493,12 @@ enum LCFContextState
* Delegated host has been registered at the forwarding controller
*/
DELEGATED_HOST_REGISTERED,
-
+
/**
* The slave host has been registred at the forwarding controller
*/
SLAVE_HOST_REGISTERED,
-
+
/**
* The context has been finished (may have error)
*/
@@ -639,7 +639,7 @@ extern unsigned int GST_slave_list_size;
*/
void
GST_queue_message (struct GNUNET_SERVER_Client *client,
- struct GNUNET_MessageHeader *msg);
+ struct GNUNET_MessageHeader *msg);
/**
@@ -669,7 +669,7 @@ GST_hello_cache_lookup (const struct GNUNET_PeerIdentity *id);
*/
void
GST_hello_cache_add (const struct GNUNET_PeerIdentity *id,
- const struct GNUNET_MessageHeader *hello);
+ const struct GNUNET_MessageHeader *hello);
/**
@@ -709,23 +709,22 @@ GST_find_dest_route (uint32_t host_id);
*/
void
GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
+ const struct GNUNET_MessageHeader *message);
/**
* Adds a host registration's request to a slave's registration queue
*
* @param slave the slave controller at which the given host has to be
- * registered
+ * registered
* @param cb the host registration completion callback
* @param cb_cls the closure for the host registration completion callback
* @param host the host which has to be registered
*/
void
GST_queue_host_registration (struct Slave *slave,
- GNUNET_TESTBED_HostRegistrationCompletion cb,
- void *cb_cls,
- struct GNUNET_TESTBED_Host *host);
+ GNUNET_TESTBED_HostRegistrationCompletion cb,
+ void *cb_cls, struct GNUNET_TESTBED_Host *host);
/**
@@ -736,7 +735,7 @@ GST_queue_host_registration (struct Slave *slave,
*/
void
GST_forwarded_operation_reply_relay (void *cls,
- const struct GNUNET_MessageHeader *msg);
+ const struct GNUNET_MessageHeader *msg);
/**
@@ -747,7 +746,7 @@ GST_forwarded_operation_reply_relay (void *cls,
*/
void
GST_forwarded_operation_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
+ const struct GNUNET_SCHEDULER_TaskContext *tc);
/**
@@ -759,7 +758,7 @@ GST_forwarded_operation_timeout (void *cls,
*/
void
GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client,
- uint64_t operation_id, const char *emsg);
+ uint64_t operation_id, const char *emsg);
/**
@@ -771,9 +770,8 @@ GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client,
*/
void
GST_handle_overlay_request_connect (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader
- *message);
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message);
/**
diff --git a/src/testbed/gnunet-service-testbed_hc.c b/src/testbed/gnunet-service-testbed_hc.c
index ac430fb1eb..4637f59afc 100644
--- a/src/testbed/gnunet-service-testbed_hc.c
+++ b/src/testbed/gnunet-service-testbed_hc.c
@@ -45,7 +45,7 @@ struct HelloCacheEntry
* The key for this entry
*/
struct GNUNET_HashCode key;
-
+
/**
* The HELLO message
*/
@@ -106,9 +106,8 @@ static void
GST_hello_cache_remove (struct HelloCacheEntry *entry)
{
GNUNET_CONTAINER_DLL_remove (lru_hcache_head, lru_hcache_tail, entry);
- GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (hello_cache,
- &entry->key,
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_CONTAINER_multihashmap_remove (hello_cache, &entry->key,
entry));
GNUNET_free (entry->hello);
GNUNET_free (entry);
@@ -124,10 +123,10 @@ GST_hello_cache_remove (struct HelloCacheEntry *entry)
*/
void
GST_hello_cache_add (const struct GNUNET_PeerIdentity *id,
- const struct GNUNET_MessageHeader *hello)
+ const struct GNUNET_MessageHeader *hello)
{
struct HelloCacheEntry *entry;
-
+
if (NULL == hello_cache)
return;
entry = GNUNET_CONTAINER_multihashmap_get (hello_cache, &id->hashPubKey);
@@ -140,11 +139,10 @@ GST_hello_cache_add (const struct GNUNET_PeerIdentity *id,
GNUNET_assert (NULL != lru_hcache_head);
GST_hello_cache_remove (lru_hcache_head);
}
- GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put
- (hello_cache,
- &entry->key,
- entry,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_put (hello_cache, &entry->key,
+ entry,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
}
else
{
@@ -180,8 +178,8 @@ void
GST_cache_clear ()
{
if (NULL != hello_cache)
- GNUNET_assert
- (GNUNET_CONTAINER_multihashmap_size (hello_cache) <= hello_cache_size);
+ GNUNET_assert (GNUNET_CONTAINER_multihashmap_size (hello_cache) <=
+ hello_cache_size);
while (NULL != lru_hcache_head)
GST_hello_cache_remove (lru_hcache_head);
if (NULL != hello_cache)
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index f5811194b6..000e670b60 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -80,7 +80,7 @@ struct OverlayConnectContext
* The prev pointer for maintaining a DLL
*/
struct OverlayConnectContext *prev;
-
+
/**
* The client which has requested for overlay connection
*/
@@ -202,7 +202,7 @@ struct RequestOverlayConnectContext
* The peer handle of peer B
*/
struct Peer *peer;
-
+
/**
* Peer A's HELLO
*/
@@ -227,12 +227,12 @@ struct RequestOverlayConnectContext
* Task for offering HELLO of A to B and doing try_connect
*/
GNUNET_SCHEDULER_TaskIdentifier attempt_connect_task_id;
-
+
/**
* Task to timeout RequestOverlayConnect
*/
GNUNET_SCHEDULER_TaskIdentifier timeout_rocc_task_id;
-
+
/**
* The id of the operation responsible for creating this context
*/
@@ -289,13 +289,13 @@ forwarded_overlay_connect_timeout (void *cls,
struct ForwardedOperationContext *fopc = cls;
struct RegisteredHostContext *rhc;
struct ForwardedOverlayConnectContext *focc;
-
+
rhc = fopc->cls;
focc = rhc->focc_dll_head;
GNUNET_CONTAINER_DLL_remove (rhc->focc_dll_head, rhc->focc_dll_tail, focc);
GST_cleanup_focc (focc);
- LOG_DEBUG ("Overlay linking between peers %u and %u failed\n",
- focc->peer1, focc->peer2);
+ LOG_DEBUG ("Overlay linking between peers %u and %u failed\n", focc->peer1,
+ focc->peer2);
GST_forwarded_operation_timeout (cls, tc);
if (NULL != rhc->focc_dll_head)
GST_process_next_focc (rhc);
@@ -317,7 +317,7 @@ forwarded_overlay_connect_listener (void *cls,
struct ForwardedOperationContext *fopc = cls;
struct RegisteredHostContext *rhc;
struct ForwardedOverlayConnectContext *focc;
-
+
rhc = fopc->cls;
GST_forwarded_operation_reply_relay (cls, msg);
focc = rhc->focc_dll_head;
@@ -344,7 +344,7 @@ GST_process_next_focc (struct RegisteredHostContext *rhc)
GNUNET_assert (RHC_OL_CONNECT == rhc->state);
fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
GNUNET_SERVER_client_keep (rhc->client);
- fopc->client = rhc->client;
+ fopc->client = rhc->client;
fopc->operation_id = focc->operation_id;
fopc->cls = rhc;
fopc->type = OP_OVERLAY_CONNECT;
@@ -405,13 +405,13 @@ cleanup_occ (struct OverlayConnectContext *occ)
GNUNET_TRANSPORT_disconnect (occ->tcc.th);
GST_peer_list[occ->other_peer_id]->reference_cnt--;
}
- if ((GNUNET_YES == occ->peer->destroy_flag)
- && (0 == occ->peer->reference_cnt))
+ if ((GNUNET_YES == occ->peer->destroy_flag) &&
+ (0 == occ->peer->reference_cnt))
GST_destroy_peer (occ->peer);
- if ((NULL == occ->peer2_controller)
- && (GNUNET_YES == GST_peer_list[occ->other_peer_id]->destroy_flag)
- && (0 == GST_peer_list[occ->other_peer_id]->reference_cnt))
- GST_destroy_peer (GST_peer_list[occ->other_peer_id]);
+ if ((NULL == occ->peer2_controller) &&
+ (GNUNET_YES == GST_peer_list[occ->other_peer_id]->destroy_flag) &&
+ (0 == GST_peer_list[occ->other_peer_id]->reference_cnt))
+ GST_destroy_peer (GST_peer_list[occ->other_peer_id]);
GNUNET_CONTAINER_DLL_remove (occq_head, occq_tail, occ);
GNUNET_free (occ);
}
@@ -427,7 +427,7 @@ static void
do_cleanup_occ (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct OverlayConnectContext *occ = cls;
-
+
occ->cleanup_task = GNUNET_SCHEDULER_NO_TASK;
cleanup_occ (occ);
}
@@ -447,8 +447,8 @@ timeout_overlay_connect (void *cls,
occ->timeout_task = GNUNET_SCHEDULER_NO_TASK;
LOG (GNUNET_ERROR_TYPE_WARNING,
- "0x%llx: Timeout while connecting peers %u and %u\n",
- occ->op_id, occ->peer_id, occ->other_peer_id);
+ "0x%llx: Timeout while connecting peers %u and %u\n", occ->op_id,
+ occ->peer_id, occ->other_peer_id);
GST_send_operation_fail_msg (occ->client, occ->op_id, occ->emsg);
cleanup_occ (occ);
}
@@ -485,7 +485,7 @@ overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer,
sizeof (struct GNUNET_PeerIdentity)))
{
/* LOG_DEBUG ("Unexpected peer %4s connected when expecting peer %4s\n", */
- /* new_peer_str, other_peer_str); */
+ /* new_peer_str, other_peer_str); */
GNUNET_free (new_peer_str);
GNUNET_free (other_peer_str);
return;
@@ -542,17 +542,18 @@ try_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
* @param result GNUNET_OK if message was transmitted to transport service
* GNUNET_SYSERR if message was not transmitted to transport service
*/
-static void
+static void
try_connect_cb (void *cls, const int result)
{
struct TryConnectContext *tcc = cls;
tcc->tch = NULL;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == tcc->task);
- tcc->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_MILLISECONDS,
- 500 + pow(2, ++tcc->retries)),
- &try_connect_task, tcc);
+ tcc->task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MILLISECONDS,
+ 500 + pow (2, ++tcc->retries)),
+ &try_connect_task, tcc);
}
@@ -569,13 +570,14 @@ try_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
tcc->task = GNUNET_SCHEDULER_NO_TASK;
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
- return;
+ return;
GNUNET_assert (NULL == tcc->tch);
GNUNET_assert (NULL != tcc->pid);
GNUNET_assert (NULL != tcc->th);
- LOG_DEBUG ("0x%llx: Trail %u to connect to peer %s\n", tcc->op_id, tcc->retries,
- GNUNET_i2s(tcc->pid));
- tcc->tch = GNUNET_TRANSPORT_try_connect (tcc->th, tcc->pid, &try_connect_cb, tcc);
+ LOG_DEBUG ("0x%llx: Trail %u to connect to peer %s\n", tcc->op_id,
+ tcc->retries, GNUNET_i2s (tcc->pid));
+ tcc->tch =
+ GNUNET_TRANSPORT_try_connect (tcc->th, tcc->pid, &try_connect_cb, tcc);
}
@@ -617,9 +619,8 @@ occ_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (GNUNET_SCHEDULER_REASON_READ_READY != tc->reason)
return;
GNUNET_free_non_null (occ->emsg);
- GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while try connect",
- occ->op_id);
- occ->tcc.pid = &occ->peer_identity;
+ GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while try connect", occ->op_id);
+ occ->tcc.pid = &occ->peer_identity;
occ->tcc.op_id = occ->op_id;
occ->tcc.task = GNUNET_SCHEDULER_add_now (&try_connect_task, &occ->tcc);
}
@@ -650,11 +651,9 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
uint16_t hello_size;
LOG_DEBUG ("0x%llx: Offering HELLO of %s (size: %u) to %s via Remote "
- "Overlay Request\n",
- occ->op_id,
- GNUNET_i2s (&occ->peer_identity),
- ntohs (occ->hello->size),
- other_peer_str);
+ "Overlay Request\n", occ->op_id,
+ GNUNET_i2s (&occ->peer_identity), ntohs (occ->hello->size),
+ other_peer_str);
hello_size = ntohs (occ->hello->size);
msize = sizeof (struct GNUNET_TESTBED_RequestConnectMessage) + hello_size;
msg = GNUNET_malloc (msize);
@@ -663,31 +662,30 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
msg->peer = htonl (occ->other_peer_id);
msg->operation_id = GNUNET_htonll (occ->op_id);
(void) memcpy (&msg->peer_identity, &occ->peer_identity,
- sizeof (struct GNUNET_PeerIdentity));
+ sizeof (struct GNUNET_PeerIdentity));
memcpy (msg->hello, occ->hello, hello_size);
GNUNET_TESTBED_queue_message_ (occ->peer2_controller, &msg->header);
}
else
{
- LOG_DEBUG ("0x%llx: Offering HELLO of %s to %s\n",
- occ->op_id,
- GNUNET_i2s (&occ->peer_identity), other_peer_str);
- occ->ohh = GNUNET_TRANSPORT_offer_hello (occ->tcc.th,
- occ->hello,
- occ_hello_sent_cb,
- occ);
+ LOG_DEBUG ("0x%llx: Offering HELLO of %s to %s\n", occ->op_id,
+ GNUNET_i2s (&occ->peer_identity), other_peer_str);
+ occ->ohh =
+ GNUNET_TRANSPORT_offer_hello (occ->tcc.th, occ->hello,
+ occ_hello_sent_cb, occ);
if (NULL == occ->ohh)
{
GNUNET_break (0);
occ->send_hello_task =
- GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
- 100 + GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_WEAK, 500)),
- &send_hello, occ);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MILLISECONDS,
+ 100 +
+ GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_WEAK, 500)),
+ &send_hello, occ);
}
}
- GNUNET_free (other_peer_str);
+ GNUNET_free (other_peer_str);
}
@@ -708,15 +706,16 @@ p2_transport_connect (struct OverlayConnectContext *occ)
{
GST_peer_list[occ->other_peer_id]->reference_cnt++;
occ->tcc.th =
- GNUNET_TRANSPORT_connect (GST_peer_list[occ->other_peer_id]->details.local.cfg,
- &occ->other_peer_identity, NULL, NULL, NULL,
- NULL);
+ GNUNET_TRANSPORT_connect (GST_peer_list[occ->other_peer_id]->
+ details.local.cfg, &occ->other_peer_identity,
+ NULL, NULL, NULL, NULL);
if (NULL == occ->tcc.th)
{
GNUNET_asprintf (&occ->emsg, "0x%llx: Cannot connect to TRANSPORT of %s",
- occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
+ occ->op_id, GNUNET_i2s (&occ->other_peer_identity));
GNUNET_SCHEDULER_cancel (occ->timeout_task);
- occ->timeout_task = GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
+ occ->timeout_task =
+ GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
return;
}
}
@@ -767,12 +766,12 @@ hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello)
&empty);
if (GNUNET_YES == empty)
{
- LOG_DEBUG ("0x%llx: HELLO of %s is empty\n",
- occ->op_id, GNUNET_i2s (&occ->peer_identity));
+ 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, GNUNET_i2s (&occ->peer_identity));
+ LOG_DEBUG ("0x%llx: Received HELLO of %s\n", occ->op_id,
+ GNUNET_i2s (&occ->peer_identity));
occ->hello = GNUNET_malloc (msize);
GST_hello_cache_add (&occ->peer_identity, hello);
memcpy (occ->hello, hello, msize);
@@ -816,13 +815,13 @@ core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server,
occ->emsg = NULL;
memcpy (&occ->peer_identity, my_identity,
sizeof (struct GNUNET_PeerIdentity));
- LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n",
- occ->op_id, GNUNET_i2s (&occ->peer_identity));
+ 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_hello_cache_lookup (&occ->peer_identity)))
{
- LOG_DEBUG ("0x%llx: HELLO of peer %s found in cache\n",
- occ->op_id, GNUNET_i2s (&occ->peer_identity));
+ LOG_DEBUG ("0x%llx: HELLO of peer %s found in cache\n", occ->op_id,
+ GNUNET_i2s (&occ->peer_identity));
occ->hello = GNUNET_copy_message (hello);
p2_transport_connect (occ);
return;
@@ -837,14 +836,14 @@ core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server,
"0x%llx: Cannot connect to TRANSPORT of peer %4s",
occ->op_id, GNUNET_i2s (&occ->peer_identity));
goto error_return;
- }
+ }
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);
return;
-
- error_return:
+
+error_return:
GNUNET_SCHEDULER_cancel (occ->timeout_task);
occ->timeout_task = GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
return;
@@ -864,6 +863,7 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg)
{
struct OverlayConnectContext *occ = cls;
const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *cmsg;
+
const struct GNUNET_CORE_MessageHandler no_handlers[] = {
{NULL, 0, 0}
};
@@ -871,10 +871,10 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg)
occ->opc = NULL;
if (GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG != ntohs (msg->type))
goto error_return;
- cmsg = (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *)
- msg;
+ cmsg =
+ (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg;
memcpy (&occ->other_peer_identity, &cmsg->peer_identity,
- sizeof (struct GNUNET_PeerIdentity));
+ sizeof (struct GNUNET_PeerIdentity));
GNUNET_free_non_null (occ->emsg);
GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while connecting to CORE",
occ->op_id);
@@ -887,10 +887,9 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg)
goto error_return;
return;
- error_return:
+error_return:
GNUNET_SCHEDULER_cancel (occ->timeout_task);
- occ->timeout_task =
- GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
+ occ->timeout_task = GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
}
@@ -900,7 +899,7 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg)
* @param cls the RegisteredHostContext
* @param emsg the error message; NULL if host registration is successful
*/
-static void
+static void
registeredhost_registration_completion (void *cls, const char *emsg)
{
struct RegisteredHostContext *rhc = cls;
@@ -912,25 +911,23 @@ registeredhost_registration_completion (void *cls, const char *emsg)
peer2_host_id = GNUNET_TESTBED_host_get_id_ (rhc->reg_host);
GNUNET_assert (RHC_INIT == rhc->state);
GNUNET_assert (NULL == rhc->sub_op);
- if ((NULL == rhc->gateway2)
- || ((peer2_host_id < GST_slave_list_size) /* Check if we have the needed config */
- && (NULL != GST_slave_list[peer2_host_id])))
+ if ((NULL == rhc->gateway2) || ((peer2_host_id < GST_slave_list_size) /* Check if we have the needed config */
+ && (NULL != GST_slave_list[peer2_host_id])))
{
rhc->state = RHC_LINK;
- cfg = (NULL == rhc->gateway2) ? our_config : GST_slave_list[peer2_host_id]->cfg;
+ cfg =
+ (NULL ==
+ rhc->gateway2) ? our_config : GST_slave_list[peer2_host_id]->cfg;
rhc->sub_op =
- GNUNET_TESTBED_controller_link (rhc,
- rhc->gateway->controller,
- rhc->reg_host,
- rhc->host,
- cfg,
+ GNUNET_TESTBED_controller_link (rhc, rhc->gateway->controller,
+ rhc->reg_host, rhc->host, cfg,
GNUNET_NO);
return;
}
rhc->state = RHC_GET_CFG;
- rhc->sub_op = GNUNET_TESTBED_get_slave_config (rhc,
- rhc->gateway2->controller,
- rhc->reg_host);
+ rhc->sub_op =
+ GNUNET_TESTBED_get_slave_config (rhc, rhc->gateway2->controller,
+ rhc->reg_host);
}
@@ -944,9 +941,8 @@ registeredhost_registration_completion (void *cls, const char *emsg)
* iterate,
* GNUNET_NO if not.
*/
-static int
-reghost_match_iterator (void *cls,
- const struct GNUNET_HashCode * key,
+static int
+reghost_match_iterator (void *cls, const struct GNUNET_HashCode *key,
void *value)
{
struct RegisteredHostContext **rh = cls;
@@ -992,9 +988,10 @@ hash_hosts (struct GNUNET_TESTBED_Host *reg_host,
*/
void
GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+ const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_OverlayConnectMessage *msg;
+
const struct GNUNET_CORE_MessageHandler no_handlers[] = {
{NULL, 0, 0}
};
@@ -1003,11 +1000,11 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
struct GNUNET_TESTBED_Controller *peer2_controller;
uint64_t operation_id;
uint32_t p1;
- uint32_t p2;
+ uint32_t p2;
uint32_t peer2_host_id;
- if (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)
- != ntohs (message->size))
+ if (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage) !=
+ ntohs (message->size))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -1024,9 +1021,10 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
}
peer = GST_peer_list[p1];
peer2_host_id = ntohl (msg->peer2_host_id);
- 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);
+ 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);
if (GNUNET_YES == peer->is_remote)
{
struct ForwardedOperationContext *fopc;
@@ -1037,20 +1035,20 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
route_to_peer2_host = NULL;
route_to_peer1_host = NULL;
route_to_peer2_host = GST_find_dest_route (peer2_host_id);
- if ((NULL != route_to_peer2_host)
- || (peer2_host_id == GST_context->host_id))
+ if ((NULL != route_to_peer2_host) ||
+ (peer2_host_id == GST_context->host_id))
{
/* Peer 2 either below us OR with us */
- route_to_peer1_host =
- GST_find_dest_route
- (GST_peer_list[p1]->details.remote.remote_host_id);
+ route_to_peer1_host =
+ GST_find_dest_route (GST_peer_list[p1]->details.
+ remote.remote_host_id);
/* Because we get this message only if we know where peer 1 is */
GNUNET_assert (NULL != route_to_peer1_host);
- if ((peer2_host_id == GST_context->host_id)
- || (route_to_peer2_host->dest != route_to_peer1_host->dest))
+ if ((peer2_host_id == GST_context->host_id) ||
+ (route_to_peer2_host->dest != route_to_peer1_host->dest))
{
/* Peer2 is either with us OR peer1 and peer2 can be reached through
- different gateways */
+ * different gateways */
struct GNUNET_HashCode hash;
struct RegisteredHostContext *rhc;
int skip_focc;
@@ -1064,36 +1062,42 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
GNUNET_assert (NULL != rhc->reg_host);
GNUNET_assert (NULL != rhc->host);
rhc->gateway = peer->details.remote.slave;
- rhc->gateway2 = (NULL == route_to_peer2_host) ? NULL :
+ rhc->gateway2 =
+ (NULL ==
+ route_to_peer2_host) ? NULL :
GST_slave_list[route_to_peer2_host->dest];
rhc->state = RHC_INIT;
GNUNET_SERVER_client_keep (client);
rhc->client = client;
hash = hash_hosts (rhc->reg_host, rhc->host);
skip_focc = GNUNET_NO;
- if ((GNUNET_NO ==
- GNUNET_CONTAINER_multihashmap_contains
- (peer->details.remote.slave->reghost_map, &hash))
- || (GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_get_multiple
- (peer->details.remote.slave->reghost_map, &hash,
- reghost_match_iterator, &rhc)))
+ if ((GNUNET_NO ==
+ GNUNET_CONTAINER_multihashmap_contains (peer->details.
+ remote.slave->reghost_map,
+ &hash)) ||
+ (GNUNET_SYSERR !=
+ GNUNET_CONTAINER_multihashmap_get_multiple (peer->details.remote.
+ slave->reghost_map,
+ &hash,
+ reghost_match_iterator,
+ &rhc)))
{
/* create and add a new registerd host context */
/* add the focc to its queue */
- GNUNET_CONTAINER_multihashmap_put
- (peer->details.remote.slave->reghost_map,
- &hash, rhc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+ GNUNET_CONTAINER_multihashmap_put (peer->details.remote.
+ slave->reghost_map, &hash, rhc,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
GNUNET_assert (NULL != GST_host_list[peer2_host_id]);
GST_queue_host_registration (peer->details.remote.slave,
- registeredhost_registration_completion,
- rhc,
- GST_host_list[peer2_host_id]);
+ registeredhost_registration_completion,
+ rhc, GST_host_list[peer2_host_id]);
}
- else {
+ else
+ {
/* rhc is now set to the existing one from the hash map by
- reghost_match_iterator() */
+ * reghost_match_iterator() */
/* if queue is empty then ignore creating focc and proceed with
- normal forwarding */
+ * normal forwarding */
if (RHC_OL_CONNECT == rhc->state)
skip_focc = GNUNET_YES;
}
@@ -1108,8 +1112,7 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
focc->orig_msg = GNUNET_copy_message (message);
focc->operation_id = operation_id;
GNUNET_CONTAINER_DLL_insert_tail (rhc->focc_dll_head,
- rhc->focc_dll_tail,
- focc);
+ rhc->focc_dll_tail, focc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1120,14 +1123,15 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
fopc->client = client;
fopc->operation_id = operation_id;
fopc->type = OP_OVERLAY_CONNECT;
- fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller,
- operation_id, message,
- &GST_forwarded_operation_reply_relay,
- fopc);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
+ slave->controller, operation_id,
+ message,
+ &GST_forwarded_operation_reply_relay,
+ fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
- fopc);
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
+ fopc);
GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
@@ -1135,20 +1139,20 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
peer2_controller = NULL;
if ((p2 >= GST_peer_list_size) || (NULL == GST_peer_list[p2]))
- {
- if ((peer2_host_id >= GST_slave_list_size)
- || (NULL ==GST_slave_list[peer2_host_id]))
+ {
+ if ((peer2_host_id >= GST_slave_list_size) ||
+ (NULL == GST_slave_list[peer2_host_id]))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"0x%llx: Configuration of peer2's controller missing for connecting peers"
- "%u and %u\n", operation_id, p1, p2);
+ "%u and %u\n", operation_id, p1, p2);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
peer2_controller = GST_slave_list[peer2_host_id]->controller;
if (NULL == peer2_controller)
{
- GNUNET_break (0); /* What's going on? */
+ GNUNET_break (0); /* What's going on? */
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
@@ -1172,27 +1176,27 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
{
struct GNUNET_TESTBED_PeerGetConfigurationMessage cmsg;
- cmsg.header.size =
- htons (sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage));
+ cmsg.header.size =
+ htons (sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage));
cmsg.header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG);
cmsg.peer_id = msg->peer2;
cmsg.operation_id = msg->operation_id;
- occ->opc =
- GNUNET_TESTBED_forward_operation_msg_ (occ->peer2_controller,
- occ->op_id, &cmsg.header,
- &overlay_connect_get_config,
- occ);
+ occ->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (occ->peer2_controller,
+ occ->op_id, &cmsg.header,
+ &overlay_connect_get_config,
+ occ);
GNUNET_asprintf (&occ->emsg,
"0x%llx: Timeout while getting peer identity of peer "
"with id: %u", occ->op_id, occ->other_peer_id);
occ->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &timeout_overlay_connect, occ);
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_overlay_connect, occ);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
- GNUNET_TESTING_peer_get_identity (GST_peer_list[occ->other_peer_id]->details.local.peer,
- &occ->other_peer_identity);
+ GNUNET_TESTING_peer_get_identity (GST_peer_list[occ->other_peer_id]->
+ details.local.peer,
+ &occ->other_peer_identity);
/* Connect to the core of 1st peer and wait for the 2nd peer to connect */
occ->emsg = GNUNET_strdup ("Timeout while connecting to CORE");
GNUNET_asprintf (&occ->emsg,
@@ -1204,12 +1208,11 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
&overlay_connect_notify, NULL, NULL, GNUNET_NO, NULL,
GNUNET_NO, no_handlers);
if (NULL == occ->ch)
- occ->timeout_task =
- GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
+ occ->timeout_task =
+ GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
else
occ->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &timeout_overlay_connect, occ);
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_overlay_connect, occ);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -1236,8 +1239,8 @@ cleanup_rocc (struct RequestOverlayConnectContext *rocc)
GNUNET_SCHEDULER_cancel (rocc->tcc.task);
GNUNET_TRANSPORT_disconnect (rocc->tcc.th);
rocc->peer->reference_cnt--;
- if ((GNUNET_YES == rocc->peer->destroy_flag)
- && (0 == rocc->peer->reference_cnt))
+ if ((GNUNET_YES == rocc->peer->destroy_flag) &&
+ (0 == rocc->peer->reference_cnt))
GST_destroy_peer (rocc->peer);
GNUNET_free_non_null (rocc->hello);
GNUNET_CONTAINER_DLL_remove (roccq_head, roccq_tail, rocc);
@@ -1255,7 +1258,7 @@ static void
timeout_rocc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct RequestOverlayConnectContext *rocc = cls;
-
+
GNUNET_assert (rocc->timeout_rocc_task_id != GNUNET_SCHEDULER_NO_TASK);
rocc->timeout_rocc_task_id = GNUNET_SCHEDULER_NO_TASK;
LOG_DEBUG ("0x%llx: rocc timed out\n", rocc->op_id);
@@ -1272,9 +1275,9 @@ timeout_rocc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param ats performance data
* @param ats_count number of entries in ats (excluding 0-termination)
*/
-static void
+static void
transport_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer,
- const struct GNUNET_ATS_Information * ats,
+ const struct GNUNET_ATS_Information *ats,
uint32_t ats_count)
{
struct RequestOverlayConnectContext *rocc = cls;
@@ -1311,7 +1314,7 @@ static void
rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct RequestOverlayConnectContext *rocc = cls;
-
+
rocc->ohh = NULL;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == rocc->attempt_connect_task_id);
LOG_DEBUG ("0x%llx: HELLO of peer %4s sent to local peer with id: %u\n",
@@ -1320,8 +1323,7 @@ rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_break (0);
rocc->attempt_connect_task_id =
- GNUNET_SCHEDULER_add_now (&attempt_connect_task,
- rocc);
+ GNUNET_SCHEDULER_add_now (&attempt_connect_task, rocc);
return;
}
if (GNUNET_SCHEDULER_REASON_READ_READY != tc->reason)
@@ -1346,15 +1348,17 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
rocc->attempt_connect_task_id = GNUNET_SCHEDULER_NO_TASK;
LOG_DEBUG ("0x%llx: Offering HELLO of peer %4s to local peer with id: %u\n",
rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id);
- rocc->ohh = GNUNET_TRANSPORT_offer_hello (rocc->tcc.th, rocc->hello,
- rocc_hello_sent_cb, rocc);
+ rocc->ohh =
+ GNUNET_TRANSPORT_offer_hello (rocc->tcc.th, rocc->hello,
+ rocc_hello_sent_cb, rocc);
if (NULL == rocc->ohh)
- rocc->attempt_connect_task_id =
- GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
- 100 + GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_WEAK, 500)),
- &attempt_connect_task, rocc);
+ rocc->attempt_connect_task_id =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MILLISECONDS,
+ 100 +
+ GNUNET_CRYPTO_random_u32
+ (GNUNET_CRYPTO_QUALITY_WEAK, 500)),
+ &attempt_connect_task, rocc);
}
@@ -1367,9 +1371,8 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
*/
void
GST_handle_overlay_request_connect (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader
- *message)
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_RequestConnectMessage *msg;
struct RequestOverlayConnectContext *rocc;
@@ -1377,16 +1380,16 @@ GST_handle_overlay_request_connect (void *cls,
uint32_t peer_id;
uint16_t msize;
uint16_t hsize;
-
+
msize = ntohs (message->size);
if (sizeof (struct GNUNET_TESTBED_RequestConnectMessage) >= msize)
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
- }
+ }
msg = (const struct GNUNET_TESTBED_RequestConnectMessage *) message;
- if ((NULL == msg->hello) ||
+ if ((NULL == msg->hello) ||
(GNUNET_MESSAGE_TYPE_HELLO != ntohs (msg->hello->type)))
{
GNUNET_break (0);
@@ -1401,7 +1404,8 @@ GST_handle_overlay_request_connect (void *cls,
return;
}
peer_id = ntohl (msg->peer);
- if ((peer_id >= GST_peer_list_size) || (NULL == (peer = GST_peer_list[peer_id])))
+ if ((peer_id >= GST_peer_list_size) ||
+ (NULL == (peer = GST_peer_list[peer_id])))
{
GNUNET_break_op (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -1410,7 +1414,7 @@ GST_handle_overlay_request_connect (void *cls,
if (GNUNET_YES == peer->is_remote)
{
struct GNUNET_MessageHeader *msg2;
-
+
msg2 = GNUNET_copy_message (message);
GNUNET_TESTBED_queue_message_ (peer->details.remote.slave->controller,
msg2);
@@ -1424,15 +1428,13 @@ GST_handle_overlay_request_connect (void *cls,
sizeof (struct GNUNET_PeerIdentity));
LOG_DEBUG ("Received request for overlay connection with op_id: 0x%llx "
"from local peer %u to peer %4s with hello size: %u\n",
- rocc->op_id,
- peer_id,
- GNUNET_i2s (&rocc->a_id),
- hsize);
+ rocc->op_id, peer_id, GNUNET_i2s (&rocc->a_id), hsize);
rocc->peer = peer;
rocc->peer->reference_cnt++;
rocc->tcc.op_id = rocc->op_id;
- rocc->tcc.th = GNUNET_TRANSPORT_connect (rocc->peer->details.local.cfg, NULL, rocc,
- NULL, &transport_connect_notify, NULL);
+ rocc->tcc.th =
+ GNUNET_TRANSPORT_connect (rocc->peer->details.local.cfg, NULL, rocc, NULL,
+ &transport_connect_notify, NULL);
if (NULL == rocc->tcc.th)
{
GNUNET_break (0);
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index e5282a5e0a..ebb82dfcf3 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -21,7 +21,7 @@
/**
* @file testbed/gnunet-testbed-profiler.c
* @brief Profiling driver for the testbed.
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
@@ -107,7 +107,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_SCHEDULER_cancel (abort_task);
if (NULL != cfg)
GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
+ GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
}
@@ -168,7 +168,7 @@ controller_event_cb (void *cls,
if (++cont_fails > num_cont_fails)
{
printf ("\nAborting due to very high failure rate\n");
- print_overlay_links_summary ();
+ print_overlay_links_summary ();
GNUNET_SCHEDULER_cancel (abort_task);
abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
return;
@@ -176,15 +176,15 @@ controller_event_cb (void *cls,
}
break;
case GNUNET_TESTBED_ET_CONNECT:
- {
- if (0 != cont_fails)
- cont_fails--;
- if (0 == established_links)
- printf ("Establishing links. Please wait\n");
- printf (".");
- fflush (stdout);
- established_links++;
- }
+ {
+ if (0 != cont_fails)
+ cont_fails--;
+ if (0 == established_links)
+ printf ("Establishing links. Please wait\n");
+ printf (".");
+ fflush (stdout);
+ established_links++;
+ }
break;
default:
GNUNET_break (0);
@@ -199,9 +199,8 @@ controller_event_cb (void *cls,
* @param num_peers number of peers in 'peers'
* @param peers handle to peers run in the testbed
*/
-static void test_run (void *cls,
- unsigned int num_peers,
- struct GNUNET_TESTBED_Peer **peers)
+static void
+test_run (void *cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers)
{
result = GNUNET_OK;
fprintf (stdout, "\n");
@@ -241,13 +240,10 @@ run (void *cls, char *const *args, const char *cfgfile,
event_mask = 0;
event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
- GNUNET_TESTBED_run (args[0], cfg,
- num_peers, event_mask,
- controller_event_cb, NULL,
- &test_run, NULL);
+ GNUNET_TESTBED_run (args[0], cfg, num_peers, event_mask, controller_event_cb,
+ NULL, &test_run, NULL);
abort_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &do_abort,
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_abort,
NULL);
}
@@ -261,24 +257,24 @@ int
main (int argc, char *const *argv)
{
static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- { 'p', "num-peers", "COUNT",
- gettext_noop ("create COUNT number of peers"),
- GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers },
- { 'e', "num-errors", "COUNT",
- gettext_noop ("tolerate COUNT number of continious timeout failures"),
- GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails },
+ {'p', "num-peers", "COUNT",
+ gettext_noop ("create COUNT number of peers"),
+ GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers},
+ {'e', "num-errors", "COUNT",
+ gettext_noop ("tolerate COUNT number of continious timeout failures"),
+ GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails},
GNUNET_GETOPT_OPTION_END
};
int ret;
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
- return 2;
+ return 2;
result = GNUNET_SYSERR;
ret =
- GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler [OPTIONS] hosts-file",
- _("Profiler for testbed"),
- options, &run, NULL);
- GNUNET_free ((void*) argv);
+ GNUNET_PROGRAM_run (argc, argv,
+ "gnunet-testbed-profiler [OPTIONS] hosts-file",
+ _("Profiler for testbed"), options, &run, NULL);
+ GNUNET_free ((void *) argv);
if (GNUNET_OK != ret)
return ret;
if (GNUNET_OK != result)
diff --git a/src/testbed/gnunet_mpi_test.c b/src/testbed/gnunet_mpi_test.c
index e08144a3cb..fded9e2c28 100644
--- a/src/testbed/gnunet_mpi_test.c
+++ b/src/testbed/gnunet_mpi_test.c
@@ -8,7 +8,8 @@
#define LOG(kind,...) \
GNUNET_log_from (kind, "gnunet-mpi-test", __VA_ARGS__)
-int main (int argc, char *argv[])
+int
+main (int argc, char *argv[])
{
char *msg;
char *filename;
@@ -44,16 +45,16 @@ int main (int argc, char *argv[])
GNUNET_break (0);
goto finalize;
}
- pid = getpid();
+ pid = getpid ();
(void) GNUNET_asprintf (&filename, "%d-%d.mpiout", (int) pid, rank);
msg_size = GNUNET_asprintf (&msg, "My rank is: %d\n", rank);
printf ("%s", msg);
- if (msg_size == GNUNET_DISK_fn_write (filename,
- msg, msg_size,
- GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_GROUP_READ
- | GNUNET_DISK_PERM_USER_WRITE
- | GNUNET_DISK_PERM_GROUP_WRITE))
+ if (msg_size ==
+ GNUNET_DISK_fn_write (filename, msg, msg_size,
+ GNUNET_DISK_PERM_USER_READ |
+ GNUNET_DISK_PERM_GROUP_READ |
+ GNUNET_DISK_PERM_USER_WRITE |
+ GNUNET_DISK_PERM_GROUP_WRITE))
ret = GNUNET_OK;
GNUNET_free (filename);
GNUNET_free (msg);
@@ -62,26 +63,26 @@ int main (int argc, char *argv[])
GNUNET_break (0);
goto finalize;
}
-
+
ret = GNUNET_SYSERR;
argv2 = GNUNET_malloc (sizeof (char *) * (argc));
for (cnt = 1; cnt < argc; cnt++)
argv2[cnt - 1] = argv[cnt];
- proc = GNUNET_OS_start_process_vap (GNUNET_NO,
- GNUNET_OS_INHERIT_STD_ALL,
- NULL,
- NULL,
- argv2[0], argv2);
+ proc =
+ GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
+ NULL, argv2[0], argv2);
if (NULL == proc)
{
printf ("Cannot exec\n");
GNUNET_free (argv2);
goto finalize;
}
- do {
+ do
+ {
(void) sleep (1);
ret = GNUNET_OS_process_status (proc, &proc_status, &code);
- } while (GNUNET_NO == ret);
+ }
+ while (GNUNET_NO == ret);
GNUNET_free (argv2);
GNUNET_assert (GNUNET_NO != ret);
if (GNUNET_OK == ret)
@@ -97,7 +98,7 @@ int main (int argc, char *argv[])
else
GNUNET_break (0);
- finalize:
+finalize:
(void) MPI_Finalize ();
if (GNUNET_OK == ret)
return 0;
diff --git a/src/testbed/ll_master.c b/src/testbed/ll_master.c
index 23d121582f..98cef42fa7 100644
--- a/src/testbed/ll_master.c
+++ b/src/testbed/ll_master.c
@@ -21,7 +21,7 @@
/**
* @file testbed/ll_master.c
* @brief The load level master. Creates child processes through LoadLeveler
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
@@ -56,12 +56,10 @@ run (void *cls, char *const *args, const char *cfgfile,
{
fprintf (stderr, _("Job command file not given. Exiting\n"));
return;
- }
- ret = llsubmit (args[0],
- NULL, //char *monitor_program,
- NULL, //char *monitor_arg,
- &job_info,
- LL_JOB_VERSION);
+ }
+ ret = llsubmit (args[0], NULL, //char *monitor_program,
+ NULL, //char *monitor_arg,
+ &job_info, LL_JOB_VERSION);
if (0 != ret)
return;
status = GNUNET_OK;
@@ -86,8 +84,8 @@ main (int argc, char **argv)
status = GNUNET_SYSERR;
ret =
GNUNET_PROGRAM_run (argc, argv, "ll-master",
- "LoadLeveler master process for starting child processes", options,
- &run, NULL);
+ "LoadLeveler master process for starting child processes",
+ options, &run, NULL);
if (GNUNET_OK != ret)
return 1;
return (GNUNET_OK == status) ? 0 : 1;
diff --git a/src/testbed/ll_monitor.c b/src/testbed/ll_monitor.c
index 6956550564..3a43b490b2 100644
--- a/src/testbed/ll_monitor.c
+++ b/src/testbed/ll_monitor.c
@@ -23,7 +23,7 @@
* @brief The load level monitor process. This is called whenever a job event
* happens. This file is called with the following syntax:
* "monitor_program job_id user_arg state exit_status"
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
@@ -63,7 +63,7 @@ main (int argc, char **argv)
PRINTF ("\t Exit status: %s \n", exit_status);
if (-1 == asprintf (&outfile, "job-%s.status", job_id))
- return 1;
+ return 1;
out = fopen (outfile, "a");
if (NULL == out)
return 1;
diff --git a/src/testbed/standard_deviation.c b/src/testbed/standard_deviation.c
index 4bdd6cef29..f233a7174c 100644
--- a/src/testbed/standard_deviation.c
+++ b/src/testbed/standard_deviation.c
@@ -32,7 +32,7 @@ struct SDEntry
* DLL prev pointer
*/
struct SDEntry *prev;
-
+
/**
* The value to store
*/
@@ -46,12 +46,12 @@ struct SDHandle
* DLL head for storing entries
*/
struct SDEntry *head;
-
+
/**
* DLL tail for storing entries
*/
struct SDEntry *tail;
-
+
/**
* Squared sum of data values
*/
@@ -76,7 +76,7 @@ struct SDHandle
* Number of data values; also the length of DLL containing SDEntries
*/
unsigned int cnt;
-
+
/**
* max number of entries we can have in the DLL
*/
@@ -88,7 +88,7 @@ struct SDHandle *
SD_init (unsigned int max_cnt)
{
struct SDHandle *h;
-
+
GNUNET_assert (1 < max_cnt);
h = GNUNET_malloc (sizeof (struct SDHandle));
h->max_cnt = max_cnt;
@@ -99,7 +99,7 @@ void
SD_destroy (struct SDHandle *h)
{
struct SDEntry *entry;
-
+
while (NULL != (entry = h->head))
{
GNUNET_CONTAINER_DLL_remove (h->head, h->tail, entry);
@@ -121,8 +121,8 @@ SD_add_data (struct SDHandle *h, unsigned int amount)
entry = h->head;
GNUNET_CONTAINER_DLL_remove (h->head, h->tail, entry);
h->sum -= entry->amount;
- h->sqsum -= ((unsigned long) entry->amount) *
- ((unsigned long) entry->amount);
+ h->sqsum -=
+ ((unsigned long) entry->amount) * ((unsigned long) entry->amount);
h->cnt--;
}
GNUNET_assert (h->cnt < h->max_cnt);
@@ -172,8 +172,8 @@ SD_deviation_factor (struct SDHandle *h, unsigned int amount)
int
main ()
{
- struct SDHandle * h = SD_init (20);
-
+ struct SDHandle *h = SD_init (20);
+
SD_add_data (h, 40);
SD_add_data (h, 30);
SD_add_data (h, 40);
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c
index 310b2f36c6..c5c4486698 100644
--- a/src/testbed/test_testbed_api.c
+++ b/src/testbed/test_testbed_api.c
@@ -218,9 +218,9 @@ dht_disconnect_adapter (void *cls, void *op_result)
* @param emsg error message in case the operation has failed; will be NULL if
* operation has executed successfully.
*/
-static void
+static void
service_connect_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
- void *ca_result, const char *emsg)
+ void *ca_result, const char *emsg)
{
switch (sub_test)
{
@@ -229,8 +229,8 @@ service_connect_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
GNUNET_assert (NULL == emsg);
GNUNET_assert (NULL == cls);
GNUNET_assert (ca_result == dht_handle);
- GNUNET_TESTBED_operation_done (operation); /* This results in call to
- * disconnect adapter */
+ GNUNET_TESTBED_operation_done (operation); /* This results in call to
+ * disconnect adapter */
break;
default:
GNUNET_assert (0);
@@ -248,10 +248,10 @@ service_connect_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
* @param emsg error message if the operation has failed; will be NULL if the
* operation is successfull
*/
-static void
+static void
peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op,
- const struct GNUNET_TESTBED_PeerInformation *pinfo,
- const char *emsg)
+ const struct GNUNET_TESTBED_PeerInformation *pinfo,
+ const char *emsg)
{
switch (sub_test)
{
@@ -300,7 +300,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
GNUNET_assert (NULL == event->details.operation_finished.op_cls);
GNUNET_assert (NULL == event->details.operation_finished.emsg);
GNUNET_assert (NULL != dht_handle);
- GNUNET_assert (event->details.operation_finished.generic == dht_handle);
+ GNUNET_assert (event->details.operation_finished.generic == dht_handle);
break;
default:
GNUNET_assert (0);
@@ -313,10 +313,10 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
GNUNET_assert (OTHER == sub_test);
GNUNET_TESTBED_operation_done (operation);
operation =
- GNUNET_TESTBED_service_connect (NULL, peer, "dht",
- &service_connect_comp_cb, NULL,
- &dht_connect_adapter,
- &dht_disconnect_adapter, NULL);
+ GNUNET_TESTBED_service_connect (NULL, peer, "dht",
+ &service_connect_comp_cb, NULL,
+ &dht_connect_adapter,
+ &dht_disconnect_adapter, NULL);
GNUNET_assert (NULL != operation);
break;
case GNUNET_TESTBED_ET_PEER_STOP:
@@ -325,10 +325,10 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
result = GNUNET_YES;
sub_test = PEER_GETCONFIG;
GNUNET_TESTBED_operation_done (operation);
- operation =
- GNUNET_TESTBED_peer_get_information (peer,
- GNUNET_TESTBED_PIT_CONFIGURATION,
- &peerinfo_cb, NULL);
+ operation =
+ GNUNET_TESTBED_peer_get_information (peer,
+ GNUNET_TESTBED_PIT_CONFIGURATION,
+ &peerinfo_cb, NULL);
break;
default:
GNUNET_assert (0); /* We should never reach this state */
diff --git a/src/testbed/test_testbed_api_2peers_1controller.c b/src/testbed/test_testbed_api_2peers_1controller.c
index 084df10073..d5616c233f 100644
--- a/src/testbed/test_testbed_api_2peers_1controller.c
+++ b/src/testbed/test_testbed_api_2peers_1controller.c
@@ -227,7 +227,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param emsg error message in case the operation has failed; will be NULL if
* operation has executed successfully.
*/
-static void
+static void
op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg);
@@ -242,8 +242,9 @@ do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
delayed_connect_task = GNUNET_SCHEDULER_NO_TASK;
FAIL_TEST (NULL == common_operation);
- common_operation = GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL,
- peer1.peer, peer2.peer);
+ common_operation =
+ GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer1.peer,
+ peer2.peer);
}
@@ -255,11 +256,11 @@ do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param emsg error message in case the operation has failed; will be NULL if
* operation has executed successfully.
*/
-static void
+static void
op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
{
FAIL_TEST (common_operation == op);
- switch(result)
+ switch (result)
{
case PEERS_STARTED:
FAIL_TEST (NULL == peer1.operation);
@@ -336,7 +337,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
result = PEERS_STARTED;
common_operation =
GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer1.peer,
- peer2.peer);
+ peer2.peer);
}
break;
case GNUNET_TESTBED_ET_PEER_STOP:
@@ -366,14 +367,14 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
FAIL_TEST (NULL == peer2.operation);
FAIL_TEST (NULL != common_operation);
FAIL_TEST ((event->details.peer_connect.peer1 == peer1.peer) &&
- (event->details.peer_connect.peer2 == peer2.peer));
+ (event->details.peer_connect.peer2 == peer2.peer));
GNUNET_TESTBED_operation_done (common_operation);
common_operation = NULL;
result = PEERS_CONNECTED;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
delayed_connect_task =
- GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
- &do_delayed_connect, NULL);
+ GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3), &do_delayed_connect,
+ NULL);
break;
case PEERS_CONNECTED:
FAIL_TEST (NULL == peer1.operation);
diff --git a/src/testbed/test_testbed_api_3peers_3controllers.c b/src/testbed/test_testbed_api_3peers_3controllers.c
index 2f08fb475d..47ad81021d 100644
--- a/src/testbed/test_testbed_api_3peers_3controllers.c
+++ b/src/testbed/test_testbed_api_3peers_3controllers.c
@@ -31,7 +31,7 @@
* A
* / \
* / \
- * B === C
+ * B === C
* A is the master controller and B, C are slave controllers. B links to C
* laterally.
* Peers are mapped to controllers in the following relations:
@@ -320,7 +320,7 @@ abort_test ()
* @param emsg error message in case the operation has failed; will be NULL if
* operation has executed successfully.
*/
-static void
+static void
op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg);
@@ -337,11 +337,12 @@ do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (NULL != common_operation)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
- common_operation = GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL,
- peer1.peer, peer2.peer);
+ common_operation =
+ GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer1.peer,
+ peer2.peer);
}
@@ -353,33 +354,32 @@ do_delayed_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param emsg error message in case the operation has failed; will be NULL if
* operation has executed successfully.
*/
-static void
+static void
op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
{
if (common_operation != op)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
-
- switch(result)
+
+ switch (result)
{
case PEER3_STARTED:
case PEERS_2_3_CONNECTED:
- case PEERS_1_2_CONNECTED:
+ case PEERS_1_2_CONNECTED:
break;
default:
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
- if ((NULL != peer1.operation) ||
- (NULL != peer2.operation) ||
+ if ((NULL != peer1.operation) || (NULL != peer2.operation) ||
(NULL != peer3.operation))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
}
@@ -400,12 +400,10 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
switch (result)
{
case CONTROLLER1_UP:
- if ((NULL == peer1.operation) ||
- (NULL == peer) ||
- (NULL != peer1.peer))
+ if ((NULL == peer1.operation) || (NULL == peer) || (NULL != peer1.peer))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
peer1.peer = peer;
@@ -414,12 +412,10 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
peer1.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL);
break;
case CONTROLLER2_UP:
- if ((NULL == peer2.operation) ||
- (NULL == peer) ||
- (NULL != peer2.peer))
+ if ((NULL == peer2.operation) || (NULL == peer) || (NULL != peer2.peer))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
peer2.peer = peer;
@@ -428,12 +424,10 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
peer2.operation = GNUNET_TESTBED_peer_start (NULL, peer, NULL, NULL);
break;
case CONTROLLER3_UP:
- if ((NULL == peer3.operation) ||
- (NULL == peer) ||
- (NULL != peer3.peer))
+ if ((NULL == peer3.operation) || (NULL == peer) || (NULL != peer3.peer))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
peer3.peer = peer;
@@ -443,9 +437,9 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
break;
default:
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
- }
+ }
}
@@ -462,20 +456,20 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
switch (event->type)
{
case GNUNET_TESTBED_ET_OPERATION_FINISHED:
- if ((NULL != event->details.operation_finished.op_cls)
- || (NULL != event->details.operation_finished.emsg))
+ if ((NULL != event->details.operation_finished.op_cls) ||
+ (NULL != event->details.operation_finished.emsg))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
switch (result)
- {
+ {
case PEERS_STOPPED:
if (NULL != event->details.operation_finished.generic)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
if (event->details.operation_finished.operation == peer1.operation)
@@ -499,7 +493,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
else
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
if ((NULL == peer1.peer) && (NULL == peer2.peer) && (NULL == peer3.peer))
@@ -513,7 +507,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
(NULL == common_operation))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
GNUNET_TESTBED_operation_done (common_operation);
@@ -525,7 +519,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
if (NULL == peer2.operation)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
break;
@@ -534,7 +528,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
(NULL == common_operation))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
GNUNET_TESTBED_operation_done (common_operation);
@@ -546,24 +540,24 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
if (NULL == peer3.operation)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
break;
default:
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
break;
- case GNUNET_TESTBED_ET_PEER_START:
+ case GNUNET_TESTBED_ET_PEER_START:
switch (result)
{
case PEER1_CREATED:
if (event->details.peer_start.host != host)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
peer1.is_running = GNUNET_YES;
@@ -571,14 +565,14 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
peer1.operation = NULL;
result = PEER1_STARTED;
common_operation =
- GNUNET_TESTBED_controller_link (NULL, controller1, neighbour1, NULL, cfg,
- GNUNET_YES);
+ GNUNET_TESTBED_controller_link (NULL, controller1, neighbour1, NULL,
+ cfg, GNUNET_YES);
break;
case PEER2_CREATED:
if (event->details.peer_start.host != neighbour1)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
peer2.is_running = GNUNET_YES;
@@ -588,16 +582,16 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
if (NULL != common_operation)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
common_operation =
- GNUNET_TESTBED_controller_link (NULL, controller1, neighbour2, NULL, cfg,
- GNUNET_YES);
+ GNUNET_TESTBED_controller_link (NULL, controller1, neighbour2, NULL,
+ cfg, GNUNET_YES);
if (NULL == common_operation)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
break;
@@ -605,7 +599,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
if (event->details.peer_start.host != neighbour2)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
peer3.is_running = GNUNET_YES;
@@ -618,15 +612,15 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
break;
default:
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
- }
+ }
break;
case GNUNET_TESTBED_ET_PEER_STOP:
if (PEERS_CONNECTED_2 != result)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
if (event->details.peer_stop.peer == peer1.peer)
@@ -647,11 +641,10 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
else
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
- if ((GNUNET_NO == peer1.is_running) &&
- (GNUNET_NO == peer2.is_running) &&
+ if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running) &&
(GNUNET_NO == peer3.is_running))
{
result = PEERS_STOPPED;
@@ -661,13 +654,11 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
}
break;
case GNUNET_TESTBED_ET_CONNECT:
- if ((NULL != peer1.operation) ||
- (NULL != peer2.operation) ||
- (NULL != peer3.operation) ||
- (NULL == common_operation))
+ if ((NULL != peer1.operation) || (NULL != peer2.operation) ||
+ (NULL != peer3.operation) || (NULL == common_operation))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
switch (result)
@@ -677,38 +668,38 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
(event->details.peer_connect.peer2 != peer1.peer))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
GNUNET_TESTBED_operation_done (common_operation);
common_operation = NULL;
result = PEERS_1_2_CONNECTED;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
- common_operation =
+ common_operation =
GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer2.peer,
- peer3.peer);
+ peer3.peer);
break;
case PEERS_1_2_CONNECTED:
if ((event->details.peer_connect.peer1 != peer2.peer) ||
(event->details.peer_connect.peer2 != peer3.peer))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
GNUNET_TESTBED_operation_done (common_operation);
common_operation = NULL;
result = PEERS_2_3_CONNECTED;
delayed_connect_task =
- GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
- &do_delayed_connect, NULL);
+ GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3), &do_delayed_connect,
+ NULL);
break;
case PEERS_2_3_CONNECTED:
if ((event->details.peer_connect.peer1 != peer1.peer) ||
(event->details.peer_connect.peer2 != peer2.peer))
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
GNUNET_TESTBED_operation_done (common_operation);
@@ -721,13 +712,13 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
break;
default:
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
break;
default:
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
}
@@ -749,16 +740,16 @@ registration_comp (void *cls, const char *emsg)
if (NULL == neighbour2)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
reg_handle =
- GNUNET_TESTBED_register_host (controller1, neighbour2, &registration_comp,
- neighbour2);
+ GNUNET_TESTBED_register_host (controller1, neighbour2,
+ &registration_comp, neighbour2);
if (NULL == reg_handle)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
return;
@@ -766,7 +757,7 @@ registration_comp (void *cls, const char *emsg)
if (cls != neighbour2)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
peer1.operation =
@@ -775,7 +766,7 @@ registration_comp (void *cls, const char *emsg)
if (NULL == peer1.operation)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
}
@@ -791,15 +782,16 @@ registration_comp (void *cls, const char *emsg)
* GNUNET_TESTBED_controller_stop() shouldn't be called in this case
*/
static void
-status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int status)
+status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config,
+ int status)
{
uint64_t event_mask;
-
+
if (GNUNET_OK != status)
{
GNUNET_break (0);
cp1 = NULL;
- abort_test();
+ abort_test ();
return;
}
event_mask = 0;
@@ -811,12 +803,12 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int stat
{
case INIT:
controller1 =
- GNUNET_TESTBED_controller_connect (config, host, event_mask, &controller_cb,
- NULL);
+ GNUNET_TESTBED_controller_connect (config, host, event_mask,
+ &controller_cb, NULL);
if (NULL == controller1)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
result = CONTROLLER1_UP;
@@ -824,24 +816,24 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int stat
if (NULL == neighbour1)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
reg_handle =
- GNUNET_TESTBED_register_host (controller1, neighbour1, &registration_comp,
- neighbour1);
+ GNUNET_TESTBED_register_host (controller1, neighbour1,
+ &registration_comp, neighbour1);
if (NULL == reg_handle)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
break;
default:
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
- }
+ }
}
@@ -855,8 +847,9 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int stat
* given to GNUNET_TESTBED_is_host_habitable() is NULL
* @param status GNUNET_YES if it is habitable; GNUNET_NO if not
*/
-static void
-host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host, int status)
+static void
+host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host,
+ int status)
{
hc_handle = NULL;
if (GNUNET_NO == status)
@@ -871,8 +864,8 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host, int statu
result = SKIP;
return;
}
- cp1 = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
- NULL);
+ cp1 =
+ GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb, NULL);
}
@@ -892,12 +885,13 @@ run (void *cls, char *const *args, const char *cfgfile,
if (NULL == host)
{
GNUNET_break (0);
- abort_test();
+ abort_test ();
return;
}
- if (NULL == (hc_handle = GNUNET_TESTBED_is_host_habitable (host, config,
- &host_habitable_cb,
- NULL)))
+ if (NULL ==
+ (hc_handle =
+ GNUNET_TESTBED_is_host_habitable (host, config, &host_habitable_cb,
+ NULL)))
{
GNUNET_TESTBED_host_destroy (host);
host = NULL;
@@ -923,8 +917,8 @@ int
main (int argc, char **argv)
{
char *const argv2[] = { "test_testbed_api_3peers_3controllers",
- "-c", "test_testbed_api.conf",
- NULL
+ "-c", "test_testbed_api.conf",
+ NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c
index 10235b8845..eadc6c9ff2 100644
--- a/src/testbed/test_testbed_api_controllerlink.c
+++ b/src/testbed/test_testbed_api_controllerlink.c
@@ -28,12 +28,12 @@
/**
* The controller architecture we try to achieve in this test case:
*
- * Master Controller
+ * Master Controller
* // \\
* // \\
* Slave Controller 1---------Slave Controller 3
- * ||
- * ||
+ * ||
+ * ||
* Slave Controller 2
*/
@@ -64,7 +64,7 @@ enum Stage
* Initial stage
*/
INIT,
-
+
/**
* Master controller has started
*/
@@ -314,8 +314,8 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
/**
* Calls abort now
*
- * @param
- * @return
+ * @param
+ * @return
*/
static void
do_abort_now (void *cls)
@@ -376,7 +376,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
case SLAVE1_LINK_SUCCESS:
result = SLAVE1_PEER_CREATE_SUCCESS;
slave1_peer = peer;
- GNUNET_TESTBED_operation_done (op);
+ GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (NULL, slave1_peer, NULL, NULL);
break;
case SLAVE2_LINK_SUCCESS:
@@ -448,7 +448,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
result = SLAVE2_LINK_SUCCESS;
- op = GNUNET_TESTBED_peer_create (mc, slave2, cfg, peer_create_cb, NULL);
+ op = GNUNET_TESTBED_peer_create (mc, slave2, cfg, peer_create_cb, NULL);
GNUNET_assert (NULL != op);
break;
case MASTER_PEER_CREATE_SUCCESS:
@@ -469,7 +469,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
GNUNET_TESTBED_operation_done (op);
result = SLAVE1_PEER_START_SUCCESS;
op = GNUNET_TESTBED_controller_link (NULL, mc, slave2, slave, cfg,
- GNUNET_YES);
+ GNUNET_YES);
break;
case SLAVE2_PEER_CREATE_SUCCESS:
GNUNET_assert (GNUNET_TESTBED_ET_PEER_STOP == event->type);
@@ -529,7 +529,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
op = NULL;
result = SLAVE3_STARTED;
op = GNUNET_TESTBED_get_slave_config (NULL, mc, slave3);
- GNUNET_assert (NULL != op);
+ GNUNET_assert (NULL != op);
break;
case SLAVE3_STARTED:
GNUNET_assert (NULL != event);
@@ -540,22 +540,23 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
cfg3 = GNUNET_CONFIGURATION_dup (event->details.operation_finished.generic);
GNUNET_TESTBED_operation_done (op);
result = SLAVE3_GET_CONFIG_SUCCESS;
- op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, slave, cfg3, GNUNET_NO);
+ op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, slave, cfg3,
+ GNUNET_NO);
break;
case SLAVE3_GET_CONFIG_SUCCESS:
result = SLAVE3_LINK_SUCCESS;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_destroy (master_peer);
break;
- case SLAVE3_LINK_SUCCESS:
- check_operation_success (event);
- result = SUCCESS;
- GNUNET_TESTBED_operation_done (op);
- op = NULL;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 3),
- &do_shutdown, NULL);
- break;
+ case SLAVE3_LINK_SUCCESS:
+ check_operation_success (event);
+ result = SUCCESS;
+ GNUNET_TESTBED_operation_done (op);
+ op = NULL;
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 3), &do_shutdown,
+ NULL);
+ break;
default:
GNUNET_assert (0);
}
@@ -588,7 +589,8 @@ registration_cont (void *cls, const char *emsg)
GNUNET_assert (NULL != mc);
result = SLAVE2_REGISTERED;
GNUNET_assert (NULL != cfg);
- op = GNUNET_TESTBED_controller_link (NULL, mc, slave, NULL, cfg, GNUNET_YES);
+ op = GNUNET_TESTBED_controller_link (NULL, mc, slave, NULL, cfg,
+ GNUNET_YES);
GNUNET_assert (NULL != op);
break;
case SLAVE2_PEER_DESTROY_SUCCESS:
@@ -596,7 +598,8 @@ registration_cont (void *cls, const char *emsg)
GNUNET_assert (NULL != mc);
GNUNET_assert (NULL == op);
result = SLAVE3_REGISTERED;
- op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, NULL, cfg, GNUNET_YES);
+ op = GNUNET_TESTBED_controller_link (NULL, mc, slave3, NULL, cfg,
+ GNUNET_YES);
GNUNET_assert (NULL != op);
break;
default:
@@ -634,7 +637,7 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config,
op = GNUNET_TESTBED_peer_create (mc, host, cfg, peer_create_cb, NULL);
GNUNET_assert (NULL != op);
break;
- default:
+ default:
GNUNET_break (0);
cp = NULL;
do_abort_now (NULL);
@@ -652,8 +655,9 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config,
* given to GNUNET_TESTBED_is_host_habitable() is NULL
* @param status GNUNET_YES if it is habitable; GNUNET_NO if not
*/
-static void
-host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host, int status)
+static void
+host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host,
+ int status)
{
hc_handle = NULL;
if (GNUNET_NO == status)
@@ -669,7 +673,7 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *_host, int statu
return;
}
cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
- NULL);
+ NULL);
}
@@ -687,9 +691,10 @@ run (void *cls, char *const *args, const char *cfgfile,
{
host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
GNUNET_assert (NULL != host);
- if (NULL == (hc_handle = GNUNET_TESTBED_is_host_habitable (host, config,
- &host_habitable_cb,
- NULL)))
+ if (NULL ==
+ (hc_handle =
+ GNUNET_TESTBED_is_host_habitable (host, config, &host_habitable_cb,
+ NULL)))
{
GNUNET_TESTBED_host_destroy (host);
host = NULL;
@@ -700,7 +705,7 @@ run (void *cls, char *const *args, const char *cfgfile,
result = SKIP;
return;
}
- cfg = GNUNET_CONFIGURATION_dup (config);
+ cfg = GNUNET_CONFIGURATION_dup (config);
abort_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 5), &do_abort,
@@ -742,4 +747,3 @@ main (int argc, char **argv)
}
/* end of test_testbed_api_controllerlink.c */
-
diff --git a/src/testbed/test_testbed_api_hosts.c b/src/testbed/test_testbed_api_hosts.c
index 12f0b61c74..51284eaabd 100644
--- a/src/testbed/test_testbed_api_hosts.c
+++ b/src/testbed/test_testbed_api_hosts.c
@@ -98,8 +98,7 @@ run (void *cls, char *const *args, const char *cfgfile,
GNUNET_assert (0 == GNUNET_TESTBED_host_get_id_ (host));
GNUNET_assert (host == GNUNET_TESTBED_host_lookup_by_id_ (0));
hosts = NULL;
- num_hosts = GNUNET_TESTBED_hosts_load_from_file ("sample_hosts.txt",
- &hosts);
+ num_hosts = GNUNET_TESTBED_hosts_load_from_file ("sample_hosts.txt", &hosts);
GNUNET_assert (15 == num_hosts);
GNUNET_assert (NULL != hosts);
status = GNUNET_YES;
diff --git a/src/testbed/test_testbed_api_operations.c b/src/testbed/test_testbed_api_operations.c
index 2320c4d1bf..24f23be230 100644
--- a/src/testbed/test_testbed_api_operations.c
+++ b/src/testbed/test_testbed_api_operations.c
@@ -60,7 +60,7 @@ struct GNUNET_TESTBED_Operation *op2;
* This operation should go into both queues and should consume 2 units of
* resources on both queues. Since op2 needs a resource from both queues and is
* queues before this operation, it will be blocked until op2 is released even
- * though q1 has
+ * though q1 has
*/
struct GNUNET_TESTBED_Operation *op3;
@@ -145,7 +145,7 @@ enum Test
* op4 has started
*/
TEST_OP4_STARTED,
-
+
/**
* op4 has released
*/
@@ -258,39 +258,42 @@ start_cb (void *cls)
GNUNET_assert (&op1 == cls);
result = TEST_OP1_STARTED;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task);
- step_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
+ step_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
break;
case TEST_PAUSE:
GNUNET_assert (&op2 == cls);
result = TEST_OP2_STARTED;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task);
- step_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
+ step_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
break;
case TEST_OP2_RELEASED:
GNUNET_assert (&op3 == cls);
result = TEST_OP3_STARTED;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task);
- step_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
+ step_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
break;
case TEST_OP3_RELEASED:
GNUNET_assert (&op4 == cls);
result = TEST_OP4_STARTED;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == step_task);
- step_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step,
- NULL);
+ step_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
break;
case TEST_OP4_RELEASED:
+ {
+ static int nops;
+
+ nops++;
+ if (nops == 3)
{
- static int nops;
-
- nops++;
- if (nops == 3)
- {
- result = TEST_OP5_6_7_STARTED;
- GNUNET_TESTBED_operation_release_ (op5);
- op5 = NULL;
- }
+ result = TEST_OP5_6_7_STARTED;
+ GNUNET_TESTBED_operation_release_ (op5);
+ op5 = NULL;
}
+ }
break;
default:
GNUNET_assert (0);
@@ -316,8 +319,8 @@ release_cb (void *cls)
GNUNET_assert (&op1 == cls);
result = TEST_OP1_RELEASED;
op1 = NULL;
- step_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step,
- NULL);
+ step_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &step, NULL);
break;
case TEST_OP2_STARTED:
GNUNET_assert (&op2 == cls);
diff --git a/src/testbed/test_testbed_api_test.c b/src/testbed/test_testbed_api_test.c
index e4cee9ab0f..705f52fa35 100644
--- a/src/testbed/test_testbed_api_test.c
+++ b/src/testbed/test_testbed_api_test.c
@@ -74,7 +74,7 @@ static int result;
*/
static void
do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
+{
shutdown_task = GNUNET_SCHEDULER_NO_TASK;
if (GNUNET_SCHEDULER_NO_TASK != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
@@ -111,7 +111,7 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
abort_task = GNUNET_SCHEDULER_NO_TASK;
if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
- GNUNET_SCHEDULER_cancel (shutdown_task);
+ GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task = GNUNET_SCHEDULER_add_now (do_shutdown, NULL);
}
@@ -125,10 +125,10 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param emsg error message if the operation has failed; will be NULL if the
* operation is successfull
*/
-static void
+static void
peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op_,
- const struct GNUNET_TESTBED_PeerInformation *pinfo,
- const char *emsg)
+ const struct GNUNET_TESTBED_PeerInformation *pinfo,
+ const char *emsg)
{
FAIL_TEST (op == op_);
FAIL_TEST (NULL == cb_cls);
@@ -150,7 +150,7 @@ peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op_,
* @param emsg error message in case the operation has failed; will be NULL if
* operation has executed successfully.
*/
-static void
+static void
op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op_, const char *emsg)
{
FAIL_TEST (NULL == cls);
@@ -162,8 +162,8 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op_, const char *emsg)
}
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_get_information (peers[0],
- GNUNET_TESTBED_PIT_IDENTITY,
- &peerinfo_cb, NULL);
+ GNUNET_TESTBED_PIT_IDENTITY,
+ &peerinfo_cb, NULL);
}
@@ -181,11 +181,11 @@ controller_event_cb (void *cls,
{
case GNUNET_TESTBED_ET_CONNECT:
FAIL_TEST (event->details.peer_connect.peer1 == peers[0]);
- FAIL_TEST (event->details.peer_connect.peer2 == peers[1]);
+ FAIL_TEST (event->details.peer_connect.peer2 == peers[1]);
break;
default:
FAIL_TEST (0);
- }
+ }
}
@@ -208,7 +208,8 @@ test_master (void *cls, unsigned int num_peers,
for (peer = 0; peer < num_peers; peer++)
FAIL_TEST (NULL != peers_[peer]);
peers = peers_;
- op = GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peers[0], peers[1]);
+ op = GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peers[0],
+ peers[1]);
abort_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 3), &do_abort,
@@ -229,9 +230,8 @@ main (int argc, char **argv)
event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
(void) GNUNET_TESTBED_test_run ("test_testbed_api_test",
- "test_testbed_api.conf",
- NUM_PEERS, event_mask, &controller_event_cb,
- NULL,
+ "test_testbed_api.conf", NUM_PEERS,
+ event_mask, &controller_event_cb, NULL,
&test_master, NULL);
if (GNUNET_OK != result)
return 1;
diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c
index d41e33772e..9cad74a7b3 100644
--- a/src/testbed/test_testbed_api_testbed_run.c
+++ b/src/testbed/test_testbed_api_testbed_run.c
@@ -70,7 +70,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
if (GNUNET_SCHEDULER_NO_TASK != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
- GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
+ GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
}
@@ -97,7 +97,8 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
* @param peers handle to peers run in the testbed
*/
static void
-test_master (void *cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers_)
+test_master (void *cls, unsigned int num_peers,
+ struct GNUNET_TESTBED_Peer **peers_)
{
result = GNUNET_OK;
GNUNET_assert (NULL != peers[0]);
@@ -201,8 +202,8 @@ main (int argc, char **argv)
#endif
if (0 != strcmp ("run", testname))
{
- GNUNET_asprintf (&config_filename,
- "test_testbed_api_testbed_run_%s.conf", testname);
+ GNUNET_asprintf (&config_filename, "test_testbed_api_testbed_run_%s.conf",
+ testname);
}
else
config_filename = GNUNET_strdup ("test_testbed_api.conf");
diff --git a/src/testbed/test_testbed_api_topology.c b/src/testbed/test_testbed_api_topology.c
index d3ce82895e..a63ae1b1a1 100644
--- a/src/testbed/test_testbed_api_topology.c
+++ b/src/testbed/test_testbed_api_topology.c
@@ -102,7 +102,7 @@ controller_event_cb (void *cls,
break;
default:
GNUNET_break (0);
- if ((GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type) &&
+ if ((GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type) &&
(NULL != event->details.operation_finished.emsg))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"An operation failed with error: %s\n",
@@ -110,7 +110,7 @@ controller_event_cb (void *cls,
result = GNUNET_SYSERR;
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
- }
+ }
}
@@ -135,12 +135,14 @@ test_master (void *cls, unsigned int num_peers,
peers = peers_;
overlay_connects = 0;
op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL,
- GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
- NUM_PEERS, GNUNET_TESTBED_TOPOLOGY_OPTION_END);
+ GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
+ NUM_PEERS,
+ GNUNET_TESTBED_TOPOLOGY_OPTION_END);
GNUNET_assert (NULL != op);
- shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 300),
- do_shutdown, NULL);
+ shutdown_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 300),
+ do_shutdown, NULL);
}
@@ -157,9 +159,8 @@ main (int argc, char **argv)
event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
(void) GNUNET_TESTBED_test_run ("test_testbed_api_test",
- "test_testbed_api.conf",
- NUM_PEERS, event_mask, &controller_event_cb,
- NULL,
+ "test_testbed_api.conf", NUM_PEERS,
+ event_mask, &controller_event_cb, NULL,
&test_master, NULL);
if (GNUNET_OK != result)
return 1;
diff --git a/src/testbed/test_testbed_api_topology_clique.c b/src/testbed/test_testbed_api_topology_clique.c
index 0304fe33ea..eb6254b104 100644
--- a/src/testbed/test_testbed_api_topology_clique.c
+++ b/src/testbed/test_testbed_api_topology_clique.c
@@ -105,7 +105,7 @@ controller_event_cb (void *cls,
result = GNUNET_SYSERR;
GNUNET_SCHEDULER_cancel (shutdown_task);
shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
- }
+ }
}
@@ -129,16 +129,16 @@ test_master (void *cls, unsigned int num_peers,
GNUNET_assert (NULL != peers_[peer]);
peers = peers_;
overlay_connects = 0;
- op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers,
- NULL,
+ op = GNUNET_TESTBED_overlay_configure_topology (NULL, NUM_PEERS, peers, NULL,
GNUNET_TESTBED_TOPOLOGY_CLIQUE,
- /* GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, */
- /* NUM_PEERS, */
+ /* GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, */
+ /* NUM_PEERS, */
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
GNUNET_assert (NULL != op);
- shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 300),
- do_shutdown, NULL);
+ shutdown_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 300),
+ do_shutdown, NULL);
}
@@ -155,9 +155,8 @@ main (int argc, char **argv)
event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
(void) GNUNET_TESTBED_test_run ("test_testbed_api_test",
- "test_testbed_api.conf",
- NUM_PEERS, event_mask, &controller_event_cb,
- NULL,
+ "test_testbed_api.conf", NUM_PEERS,
+ event_mask, &controller_event_cb, NULL,
&test_master, NULL);
if (GNUNET_OK != result)
return 1;
diff --git a/src/testbed/testbed.h b/src/testbed/testbed.h
index 1e0cd2b4e8..04e63dcb39 100644
--- a/src/testbed/testbed.h
+++ b/src/testbed/testbed.h
@@ -30,7 +30,6 @@
#include "gnunet_util_lib.h"
GNUNET_NETWORK_STRUCT_BEGIN
-
/**
* Initial message from a client to a testing control service.
*/
@@ -430,12 +429,12 @@ struct GNUNET_TESTBED_RequestConnectMessage
* Identity of A
*/
struct GNUNET_PeerIdentity peer_identity;
-
+
/**
* To be followed by the HELLO message of A
*/
struct GNUNET_MessageHeader hello[0];
-
+
};
@@ -702,6 +701,5 @@ struct GNUNET_TESTBED_SlaveConfiguration
GNUNET_NETWORK_STRUCT_END
-
#endif
/* end of testbed.h */
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index fa218db02a..b0db6160d3 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -259,7 +259,7 @@ struct SDEntry
* DLL prev pointer
*/
struct SDEntry *prev;
-
+
/**
* The value to store
*/
@@ -273,12 +273,12 @@ struct SDHandle
* DLL head for storing entries
*/
struct SDEntry *head;
-
+
/**
* DLL tail for storing entries
*/
struct SDEntry *tail;
-
+
/**
* Squared sum of data values
*/
@@ -303,7 +303,7 @@ struct SDHandle
* Number of data values; also the length of DLL containing SDEntries
*/
unsigned int cnt;
-
+
/**
* max number of entries we can have in the DLL
*/
@@ -321,7 +321,7 @@ static struct SDHandle *
SD_init (unsigned int max_cnt)
{
struct SDHandle *h;
-
+
GNUNET_assert (1 < max_cnt);
h = GNUNET_malloc (sizeof (struct SDHandle));
h->max_cnt = max_cnt;
@@ -338,7 +338,7 @@ static void
SD_destroy (struct SDHandle *h)
{
struct SDEntry *entry;
-
+
while (NULL != (entry = h->head))
{
GNUNET_CONTAINER_DLL_remove (h->head, h->tail, entry);
@@ -367,8 +367,8 @@ SD_add_data (struct SDHandle *h, unsigned int amount)
entry = h->head;
GNUNET_CONTAINER_DLL_remove (h->head, h->tail, entry);
h->sum -= entry->amount;
- h->sqsum -= ((unsigned long) entry->amount) *
- ((unsigned long) entry->amount);
+ h->sqsum -=
+ ((unsigned long) entry->amount) * ((unsigned long) entry->amount);
h->cnt--;
}
GNUNET_assert (h->cnt < h->max_cnt);
@@ -407,7 +407,7 @@ SD_deviation_factor (struct SDHandle *h, unsigned int amount)
if (((float) amount) > h->avg)
diff = ((float) amount) - h->avg;
else
- return 0; //diff = h->avg - ((float) amount);
+ return 0; //diff = h->avg - ((float) amount);
diff *= diff;
for (n = 1; n < 4; n++)
if (diff < (((double) (n * n)) * h->vr))
@@ -502,8 +502,8 @@ handle_addhostconfirm (struct GNUNET_TESTBED_Controller *c,
*/
static void
handle_forwarded_operation_msg (struct GNUNET_TESTBED_Controller *c,
- struct OperationContext *opc,
- const struct GNUNET_MessageHeader *msg)
+ struct OperationContext *opc,
+ const struct GNUNET_MessageHeader *msg)
{
struct ForwardedOperationData *fo_data;
@@ -549,35 +549,35 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c,
switch (opc->type)
{
case OP_FORWARDED:
- {
- handle_forwarded_operation_msg
- (c, opc, (const struct GNUNET_MessageHeader *) msg);
- return GNUNET_YES;
- }
+ {
+ handle_forwarded_operation_msg (c, opc,
+ (const struct GNUNET_MessageHeader *) msg);
+ return GNUNET_YES;
+ }
break;
case OP_PEER_DESTROY:
- {
- struct GNUNET_TESTBED_Peer *peer;
-
- peer = opc->data;
- GNUNET_free (peer);
- opc->data = NULL;
- //PEERDESTROYDATA
- }
+ {
+ struct GNUNET_TESTBED_Peer *peer;
+
+ peer = opc->data;
+ GNUNET_free (peer);
+ opc->data = NULL;
+ //PEERDESTROYDATA
+ }
break;
case OP_LINK_CONTROLLERS:
- {
- struct ControllerLinkData *data;
-
- data = opc->data;
- GNUNET_assert (NULL != data);
- GNUNET_free (data);
- opc->data = NULL;
- }
+ {
+ struct ControllerLinkData *data;
+
+ data = opc->data;
+ GNUNET_assert (NULL != data);
+ GNUNET_free (data);
+ opc->data = NULL;
+ }
break;
default:
GNUNET_assert (0);
- }
+ }
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
opc->state = OPC_STATE_FINISHED;
if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
@@ -623,7 +623,7 @@ handle_peer_create_success (struct GNUNET_TESTBED_Controller *c,
if (OP_FORWARDED == opc->type)
{
handle_forwarded_operation_msg (c, opc,
- (const struct GNUNET_MessageHeader *) msg);
+ (const struct GNUNET_MessageHeader *) msg);
return GNUNET_YES;
}
GNUNET_assert (OP_PEER_CREATE == opc->type);
@@ -676,7 +676,7 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c,
if (OP_FORWARDED == opc->type)
{
handle_forwarded_operation_msg (c, opc,
- (const struct GNUNET_MessageHeader *) msg);
+ (const struct GNUNET_MessageHeader *) msg);
return GNUNET_YES;
}
GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
@@ -746,7 +746,7 @@ handle_peer_conevent (struct GNUNET_TESTBED_Controller *c,
if (OP_FORWARDED == opc->type)
{
handle_forwarded_operation_msg (c, opc,
- (const struct GNUNET_MessageHeader *) msg);
+ (const struct GNUNET_MessageHeader *) msg);
return GNUNET_YES;
}
GNUNET_assert (OP_OVERLAY_CONNECT == opc->type);
@@ -816,7 +816,7 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
if (OP_FORWARDED == opc->type)
{
handle_forwarded_operation_msg (c, opc,
- (const struct GNUNET_MessageHeader *) msg);
+ (const struct GNUNET_MessageHeader *) msg);
return GNUNET_YES;
}
data = opc->data;
@@ -835,11 +835,11 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
case GNUNET_TESTBED_PIT_IDENTITY:
pinfo->result.id = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
(void) memcpy (pinfo->result.id, &msg->peer_identity,
- sizeof (struct GNUNET_PeerIdentity));
+ sizeof (struct GNUNET_PeerIdentity));
break;
case GNUNET_TESTBED_PIT_CONFIGURATION:
- pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
- GNUNET_TESTBED_extract_config_ (&msg->header);
+ pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
+ GNUNET_TESTBED_extract_config_ (&msg->header);
break;
case GNUNET_TESTBED_PIT_GENERIC:
GNUNET_assert (0); /* never reach here */
@@ -882,7 +882,7 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
if (OP_FORWARDED == opc->type)
{
handle_forwarded_operation_msg (c, opc,
- (const struct GNUNET_MessageHeader *) msg);
+ (const struct GNUNET_MessageHeader *) msg);
return GNUNET_YES;
}
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
@@ -893,11 +893,12 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
if (OP_PEER_INFO == opc->type)
{
struct PeerInfoData *data;
+
data = opc->data;
if (NULL != data->cb)
data->cb (data->cb_cls, opc->op, NULL, emsg);
GNUNET_free (data);
- return GNUNET_YES; /* We do not call controller callback for peer info */
+ return GNUNET_YES; /* We do not call controller callback for peer info */
}
if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) &&
(NULL != c->cc))
@@ -912,45 +913,48 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
switch (opc->type)
{
case OP_PEER_CREATE:
- {
- struct PeerCreateData *data;
- data = opc->data;
- GNUNET_free (data->peer);
- if (NULL != data->cb)
- data->cb (data->cls, NULL, emsg);
- GNUNET_free (data);
- }
+ {
+ struct PeerCreateData *data;
+
+ data = opc->data;
+ GNUNET_free (data->peer);
+ if (NULL != data->cb)
+ data->cb (data->cls, NULL, emsg);
+ GNUNET_free (data);
+ }
break;
case OP_PEER_START:
case OP_PEER_STOP:
- {
- struct PeerEventData *data;
- data = opc->data;
- if (NULL != data->pcc)
- data->pcc (data->pcc_cls, emsg);
- GNUNET_free (data);
- }
+ {
+ struct PeerEventData *data;
+
+ data = opc->data;
+ if (NULL != data->pcc)
+ data->pcc (data->pcc_cls, emsg);
+ GNUNET_free (data);
+ }
break;
case OP_PEER_DESTROY:
break;
case OP_PEER_INFO:
GNUNET_assert (0);
case OP_OVERLAY_CONNECT:
- {
- struct OverlayConnectData *data;
- data = opc->data;
- data->failed = GNUNET_YES;
- if (NULL != data->cb)
- data->cb (data->cb_cls, opc->op, emsg);
- }
+ {
+ struct OverlayConnectData *data;
+
+ data = opc->data;
+ data->failed = GNUNET_YES;
+ if (NULL != data->cb)
+ data->cb (data->cb_cls, opc->op, emsg);
+ }
break;
case OP_FORWARDED:
GNUNET_assert (0);
- case OP_LINK_CONTROLLERS: /* No secondary callback */
+ case OP_LINK_CONTROLLERS: /* No secondary callback */
break;
default:
GNUNET_break (0);
- }
+ }
return GNUNET_YES;
}
@@ -967,7 +971,7 @@ GNUNET_TESTBED_generate_slavegetconfig_msg_ (uint64_t op_id, uint32_t slave_id)
{
struct GNUNET_TESTBED_SlaveGetConfigurationMessage *msg;
uint16_t msize;
-
+
msize = sizeof (struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
msg = GNUNET_malloc (msize);
msg->header.size = htons (msize);
@@ -989,11 +993,11 @@ GNUNET_TESTBED_generate_slavegetconfig_msg_ (uint64_t op_id, uint32_t slave_id)
*/
static int
handle_slave_config (struct GNUNET_TESTBED_Controller *c,
- const struct GNUNET_TESTBED_SlaveConfiguration * msg)
+ const struct GNUNET_TESTBED_SlaveConfiguration *msg)
{
struct OperationContext *opc;
uint64_t op_id;
- struct GNUNET_TESTBED_EventInformation event;
+ struct GNUNET_TESTBED_EventInformation event;
op_id = GNUNET_ntohll (msg->operation_id);
if (NULL == (opc = find_opc (c, op_id)))
@@ -1014,7 +1018,7 @@ handle_slave_config (struct GNUNET_TESTBED_Controller *c,
(NULL != c->cc))
{
opc->data = GNUNET_TESTBED_extract_config_ (&msg->header);
- event.type = GNUNET_TESTBED_ET_OPERATION_FINISHED;
+ event.type = GNUNET_TESTBED_ET_OPERATION_FINISHED;
event.details.operation_finished.generic = opc->data;
event.details.operation_finished.operation = opc->op;
event.details.operation_finished.op_cls = opc->op_cls;
@@ -1113,11 +1117,11 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
msg);
break;
case GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG:
- GNUNET_assert (msize >
- sizeof (struct GNUNET_TESTBED_SlaveConfiguration));
- status =
- handle_slave_config (c, (const struct
- GNUNET_TESTBED_SlaveConfiguration *) msg);
+ GNUNET_assert (msize > sizeof (struct GNUNET_TESTBED_SlaveConfiguration));
+ status =
+ handle_slave_config (c,
+ (const struct GNUNET_TESTBED_SlaveConfiguration *)
+ msg);
break;
default:
GNUNET_assert (0);
@@ -1482,10 +1486,10 @@ GNUNET_TESTBED_set_num_parallel_overlay_connects_ (struct
{
fprintf (stderr, "%d", npoc);
GNUNET_free_non_null (c->tslots);
- c->tslots_filled = 0;
+ c->tslots_filled = 0;
c->num_parallel_connects = npoc;
c->tslots = GNUNET_malloc (npoc * sizeof (struct TimeSlot));
- GNUNET_TESTBED_operation_queue_reset_max_active_
+ GNUNET_TESTBED_operation_queue_reset_max_active_
(c->opq_parallel_overlay_connect_operations, npoc);
}
@@ -1503,7 +1507,7 @@ copy_argv (const char *const *argv)
unsigned int argp;
GNUNET_assert (NULL != argv);
- for (argp = 0; NULL != argv[argp]; argp++);
+ for (argp = 0; NULL != argv[argp]; argp++) ;
argv_dup = GNUNET_malloc (sizeof (char *) * (argp + 1));
for (argp = 0; NULL != argv[argp]; argp++)
argv_dup[argp] = strdup (argv[argp]);
@@ -1552,7 +1556,7 @@ static void
free_argv (char **argv)
{
unsigned int argp;
-
+
for (argp = 0; NULL != argv[argp]; argp++)
GNUNET_free (argv[argp]);
GNUNET_free (argv);
@@ -1588,22 +1592,20 @@ gen_rsh_args (const char *port, const char *dst)
char *arg;
unsigned int cnt;
- ssh_args = NULL;
+ ssh_args = NULL;
if (NULL != (ssh_cmd = getenv ("GNUNET_TESTBED_RSH_CMD")))
{
ssh_cmd = GNUNET_strdup (ssh_cmd);
ssh_cmd_cp = ssh_cmd;
- for (cnt = 0;
- NULL != (arg = strtok (ssh_cmd, " "));
- ssh_cmd = NULL)
+ for (cnt = 0; NULL != (arg = strtok (ssh_cmd, " ")); ssh_cmd = NULL)
GNUNET_array_append (ssh_args, cnt, GNUNET_strdup (arg));
GNUNET_free (ssh_cmd_cp);
}
else
{
- ssh_args = copy_argv (default_ssh_args);
- cnt = (sizeof (default_ssh_args)) / (sizeof (const char *));
- GNUNET_array_grow (ssh_args, cnt, cnt - 1);
+ ssh_args = copy_argv (default_ssh_args);
+ cnt = (sizeof (default_ssh_args)) / (sizeof (const char *));
+ GNUNET_array_grow (ssh_args, cnt, cnt - 1);
}
GNUNET_array_append (ssh_args, cnt, GNUNET_strdup ("-p"));
GNUNET_array_append (ssh_args, cnt, GNUNET_strdup (port));
@@ -1630,19 +1632,17 @@ gen_rsh_suffix_args (const char *helper_binary_path)
char *rshell_cmd_cp;
char *arg;
unsigned int cnt;
-
+
rshell_args = NULL;
cnt = 0;
if (NULL != (rshell_cmd = getenv ("GNUNET_TESTBED_RSH_CMD_SUFFIX")))
{
rshell_cmd = GNUNET_strdup (rshell_cmd);
rshell_cmd_cp = rshell_cmd;
- for (;
- NULL != (arg = strtok (rshell_cmd, " "));
- rshell_cmd = NULL)
+ for (; NULL != (arg = strtok (rshell_cmd, " ")); rshell_cmd = NULL)
GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (arg));
GNUNET_free (rshell_cmd_cp);
- }
+ }
GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (helper_binary_path));
GNUNET_array_append (rshell_args, cnt, NULL);
return rshell_args;
@@ -1681,9 +1681,10 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip,
struct GNUNET_TESTBED_ControllerProc *cp;
struct GNUNET_TESTBED_HelperInit *msg;
const char *hostname;
+
static char *const binary_argv[] = {
HELPER_TESTBED_BINARY, NULL
- };
+ };
hostname = NULL;
cp = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ControllerProc));
@@ -1711,15 +1712,16 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip,
GNUNET_asprintf (&dst, "%s@%s", username, hostname);
LOG_DEBUG ("Starting SSH to destination %s\n", dst);
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "testbed",
- "HELPER_BINARY_PATH",
- &helper_binary_path))
- helper_binary_path = GNUNET_OS_get_libexec_binary_path
- (HELPER_TESTBED_BINARY);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg, "testbed",
+ "HELPER_BINARY_PATH",
+ &helper_binary_path))
+ helper_binary_path =
+ GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY);
ssh_args = gen_rsh_args (port, dst);
rshell_args = gen_rsh_suffix_args (helper_binary_path);
- cp->helper_argv = join_argv ((const char **) ssh_args,
- (const char **)rshell_args);
+ cp->helper_argv =
+ join_argv ((const char **) ssh_args, (const char **) rshell_args);
free_argv (ssh_args);
free_argv (rshell_args);
GNUNET_free (port);
@@ -1865,10 +1867,10 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle
controller->opq_parallel_service_connections =
GNUNET_TESTBED_operation_queue_create_ ((unsigned int)
max_parallel_service_connections);
- controller->opq_parallel_topology_config_operations=
+ controller->opq_parallel_topology_config_operations =
GNUNET_TESTBED_operation_queue_create_ ((unsigned int)
max_parallel_topology_config_operations);
- controller->opq_parallel_overlay_connect_operations=
+ controller->opq_parallel_overlay_connect_operations =
GNUNET_TESTBED_operation_queue_create_ (0);
GNUNET_TESTBED_set_num_parallel_overlay_connects_ (controller, 1);
controller->poc_sd = SD_init (10);
@@ -1927,7 +1929,7 @@ GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controller
GNUNET_TESTBED_queue_message_ (controller,
(struct GNUNET_MessageHeader *) msg);
GNUNET_break (0); /* This function is not yet implemented on the
- testbed service */
+ * testbed service */
}
@@ -2084,9 +2086,9 @@ struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link_2_ (void *op_cls,
struct GNUNET_TESTBED_Controller *master,
uint32_t delegated_host_id,
- uint32_t slave_host_id,
- const char *sxcfg, size_t sxcfg_size,
- size_t scfg_size, int is_subordinate)
+ uint32_t slave_host_id, const char *sxcfg,
+ size_t sxcfg_size, size_t scfg_size,
+ int is_subordinate)
{
struct OperationContext *opc;
struct GNUNET_TESTBED_ControllerLinkMessage *msg;
@@ -2143,30 +2145,27 @@ GNUNET_TESTBED_controller_link_2_ (void *op_cls,
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link_2 (void *op_cls,
- struct GNUNET_TESTBED_Controller *master,
+ struct GNUNET_TESTBED_Controller *master,
struct GNUNET_TESTBED_Host *delegated_host,
struct GNUNET_TESTBED_Host *slave_host,
const char *sxcfg, size_t sxcfg_size,
size_t scfg_size, int is_subordinate)
-{
+{
uint32_t delegated_host_id;
uint32_t slave_host_id;
GNUNET_assert (GNUNET_YES ==
GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
- slave_host_id =
- GNUNET_TESTBED_host_get_id_ ((NULL != slave_host)
- ? slave_host : master->host);
+ slave_host_id =
+ GNUNET_TESTBED_host_get_id_ ((NULL !=
+ slave_host) ? slave_host : master->host);
if ((NULL != slave_host) && (0 != GNUNET_TESTBED_host_get_id_ (slave_host)))
GNUNET_assert (GNUNET_YES ==
GNUNET_TESTBED_is_host_registered_ (slave_host, master));
-
- return GNUNET_TESTBED_controller_link_2_ (op_cls,
- master,
- delegated_host_id,
- slave_host_id,
- sxcfg, sxcfg_size,
+
+ return GNUNET_TESTBED_controller_link_2_ (op_cls, master, delegated_host_id,
+ slave_host_id, sxcfg, sxcfg_size,
scfg_size, is_subordinate);
}
@@ -2217,12 +2216,11 @@ GNUNET_TESTBED_compress_config_ (const char *config, size_t size,
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link_ (void *op_cls,
- struct GNUNET_TESTBED_Controller *master,
- uint32_t delegated_host_id,
- uint32_t slave_host_id,
- const struct GNUNET_CONFIGURATION_Handle
- *slave_cfg,
- int is_subordinate)
+ struct GNUNET_TESTBED_Controller *master,
+ uint32_t delegated_host_id,
+ uint32_t slave_host_id,
+ const struct GNUNET_CONFIGURATION_Handle
+ *slave_cfg, int is_subordinate)
{
struct GNUNET_TESTBED_Operation *op;
char *config;
@@ -2234,8 +2232,8 @@ GNUNET_TESTBED_controller_link_ (void *op_cls,
cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig);
GNUNET_free (config);
/* Configuration doesn't fit in 1 message */
- GNUNET_assert ((UINT16_MAX -
- sizeof (struct GNUNET_TESTBED_ControllerLinkMessage)) >=
+ GNUNET_assert ((UINT16_MAX -
+ sizeof (struct GNUNET_TESTBED_ControllerLinkMessage)) >=
cc_size);
op = GNUNET_TESTBED_controller_link_2_ (op_cls, master, delegated_host_id,
slave_host_id, (const char *) cconfig,
@@ -2276,7 +2274,7 @@ GNUNET_TESTBED_controller_link_ (void *op_cls,
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link (void *op_cls,
- struct GNUNET_TESTBED_Controller *master,
+ struct GNUNET_TESTBED_Controller *master,
struct GNUNET_TESTBED_Host *delegated_host,
struct GNUNET_TESTBED_Host *slave_host,
const struct GNUNET_CONFIGURATION_Handle
@@ -2287,19 +2285,17 @@ GNUNET_TESTBED_controller_link (void *op_cls,
GNUNET_assert (GNUNET_YES ==
GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
- slave_host_id =
- GNUNET_TESTBED_host_get_id_ ((NULL != slave_host)
- ? slave_host : master->host);
+ slave_host_id =
+ GNUNET_TESTBED_host_get_id_ ((NULL !=
+ slave_host) ? slave_host : master->host);
delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
if ((NULL != slave_host) && (0 != slave_host_id))
GNUNET_assert (GNUNET_YES ==
GNUNET_TESTBED_is_host_registered_ (slave_host, master));
- return GNUNET_TESTBED_controller_link_ (op_cls, master,
- delegated_host_id,
- slave_host_id,
- slave_cfg,
+ return GNUNET_TESTBED_controller_link_ (op_cls, master, delegated_host_id,
+ slave_host_id, slave_cfg,
is_subordinate);
-
+
}
@@ -2319,7 +2315,7 @@ struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_get_slave_config_ (void *op_cls,
struct GNUNET_TESTBED_Controller *master,
uint32_t slave_host_id)
-{
+{
struct OperationContext *opc;
struct GetSlaveConfigData *data;
@@ -2336,7 +2332,7 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls,
GNUNET_TESTBED_operation_create_ (opc, &opstart_get_slave_config,
&oprelease_get_slave_config);
GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
- opc->op);
+ opc->op);
GNUNET_TESTBED_operation_begin_wait_ (opc->op);
return opc->op;
}
@@ -2365,7 +2361,8 @@ GNUNET_TESTBED_get_slave_config (void *op_cls,
if (GNUNET_NO == GNUNET_TESTBED_is_host_registered_ (slave_host, master))
return NULL;
return GNUNET_TESTBED_get_slave_config_ (op_cls, master,
- GNUNET_TESTBED_host_get_id_ (slave_host));
+ GNUNET_TESTBED_host_get_id_
+ (slave_host));
}
@@ -2402,7 +2399,7 @@ GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Controller
*/
struct GNUNET_TESTBED_HelperInit *
GNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip,
- const char *hostname,
+ const char *hostname,
const struct GNUNET_CONFIGURATION_Handle
*cfg)
{
@@ -2423,12 +2420,12 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip,
trusted_ip_len = strlen (trusted_ip);
hostname_len = (NULL == hostname) ? 0 : strlen (hostname);
msg_size =
- xconfig_size + trusted_ip_len + 1 + sizeof (struct GNUNET_TESTBED_HelperInit);
+ xconfig_size + trusted_ip_len + 1 +
+ sizeof (struct GNUNET_TESTBED_HelperInit);
msg_size += hostname_len;
msg = GNUNET_realloc (xconfig, msg_size);
- (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len,
- msg,
- xconfig_size);
+ (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len, msg,
+ xconfig_size);
msg->header.size = htons (msg_size);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
msg->trusted_ip_size = htons (trusted_ip_len);
@@ -2436,7 +2433,8 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip,
msg->config_size = htons (config_size);
(void) strcpy ((char *) &msg[1], trusted_ip);
if (0 != hostname_len)
- (void) strncpy (((char *) &msg[1]) + trusted_ip_len + 1, hostname, hostname_len);
+ (void) strncpy (((char *) &msg[1]) + trusted_ip_len + 1, hostname,
+ hostname_len);
return msg;
}
@@ -2469,7 +2467,7 @@ GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation)
void
GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
{
- GNUNET_TESTBED_operation_release_ (operation);
+ GNUNET_TESTBED_operation_release_ (operation);
}
@@ -2484,7 +2482,7 @@ GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
*/
struct GNUNET_CONFIGURATION_Handle *
GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
-{
+{
struct GNUNET_CONFIGURATION_Handle *cfg;
Bytef *data;
const Bytef *xdata;
@@ -2495,35 +2493,35 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG:
- {
- const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *imsg;
-
- imsg = (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *)
- msg;
- data_len = (uLong) ntohs (imsg->config_size);
- xdata_len = ntohs (imsg->header.size)
- - sizeof (struct GNUNET_TESTBED_PeerConfigurationInformationMessage);
- xdata = (const Bytef *) &imsg[1];
- }
+ {
+ const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *imsg;
+
+ imsg =
+ (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg;
+ data_len = (uLong) ntohs (imsg->config_size);
+ xdata_len =
+ ntohs (imsg->header.size) -
+ sizeof (struct GNUNET_TESTBED_PeerConfigurationInformationMessage);
+ xdata = (const Bytef *) &imsg[1];
+ }
break;
case GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG:
- {
- const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
+ {
+ const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
- imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *) msg;
- data_len = (uLong) ntohs (imsg->config_size);
- xdata_len = ntohs (imsg->header.size)
- - sizeof (struct GNUNET_TESTBED_SlaveConfiguration);
- xdata = (const Bytef *) &imsg[1];
- }
+ imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *) msg;
+ data_len = (uLong) ntohs (imsg->config_size);
+ xdata_len =
+ ntohs (imsg->header.size) -
+ sizeof (struct GNUNET_TESTBED_SlaveConfiguration);
+ xdata = (const Bytef *) &imsg[1];
+ }
break;
default:
GNUNET_assert (0);
- }
+ }
data = GNUNET_malloc (data_len);
- if (Z_OK !=
- (ret =
- uncompress (data, &data_len, xdata, xdata_len)))
+ if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
GNUNET_assert (0);
cfg = GNUNET_CONFIGURATION_create ();
GNUNET_assert (GNUNET_OK ==
@@ -2549,7 +2547,7 @@ GNUNET_TESTBED_parse_error_string_ (const struct
{
uint16_t msize;
const char *emsg;
-
+
msize = ntohs (msg->header.size);
if (sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
return NULL;
@@ -2572,12 +2570,12 @@ GNUNET_TESTBED_parse_error_string_ (const struct
* @return the incremented operation id.
*/
uint64_t
-GNUNET_TESTBED_get_next_op_id (struct GNUNET_TESTBED_Controller *controller)
+GNUNET_TESTBED_get_next_op_id (struct GNUNET_TESTBED_Controller * controller)
{
- uint64_t op_id;
+ uint64_t op_id;
op_id = (uint64_t) GNUNET_TESTBED_host_get_id_ (controller->host);
- op_id = op_id << 32;
+ op_id = op_id << 32;
op_id |= (uint64_t) controller->operation_counter++;
return op_id;
}
@@ -2639,24 +2637,27 @@ decide_npoc (struct GNUNET_TESTBED_Controller *c)
if (GNUNET_SYSERR == sd)
{
SD_add_data (c->poc_sd, (unsigned int) avg.rel_value);
- GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c, c->num_parallel_connects);
+ GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c,
+ c->num_parallel_connects);
return;
}
GNUNET_assert (0 <= sd);
if (0 == sd)
{
SD_add_data (c->poc_sd, (unsigned int) avg.rel_value);
- GNUNET_TESTBED_set_num_parallel_overlay_connects_
- (c, c->num_parallel_connects * 2);
+ GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c,
+ c->num_parallel_connects
+ * 2);
return;
}
if (1 == sd)
{
SD_add_data (c->poc_sd, (unsigned int) avg.rel_value);
- GNUNET_TESTBED_set_num_parallel_overlay_connects_
- (c, c->num_parallel_connects + 1);
+ GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c,
+ c->num_parallel_connects
+ + 1);
return;
- }
+ }
if (1 == c->num_parallel_connects)
{
GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c, 1);
@@ -2665,12 +2666,14 @@ decide_npoc (struct GNUNET_TESTBED_Controller *c)
if (2 == sd)
{
SD_add_data (c->poc_sd, (unsigned int) avg.rel_value);
- GNUNET_TESTBED_set_num_parallel_overlay_connects_
- (c, c->num_parallel_connects - 1);
+ GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c,
+ c->num_parallel_connects
+ - 1);
return;
}
- GNUNET_TESTBED_set_num_parallel_overlay_connects_
- (c, c->num_parallel_connects / 2);
+ GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c,
+ c->num_parallel_connects /
+ 2);
}
@@ -2686,8 +2689,7 @@ decide_npoc (struct GNUNET_TESTBED_Controller *c)
*/
int
GNUNET_TESTBED_release_time_slot_ (struct GNUNET_TESTBED_Controller *c,
- unsigned int index,
- void *key)
+ unsigned int index, void *key)
{
struct TimeSlot *slot;
@@ -2713,10 +2715,8 @@ GNUNET_TESTBED_release_time_slot_ (struct GNUNET_TESTBED_Controller *c,
*/
void
GNUNET_TESTBED_update_time_slot_ (struct GNUNET_TESTBED_Controller *c,
- unsigned int index,
- void *key,
- struct GNUNET_TIME_Relative time,
- int failed)
+ unsigned int index, void *key,
+ struct GNUNET_TIME_Relative time, int failed)
{
struct TimeSlot *slot;
@@ -2727,8 +2727,9 @@ GNUNET_TESTBED_update_time_slot_ (struct GNUNET_TESTBED_Controller *c,
GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c, 1);
return;
}
- GNUNET_TESTBED_set_num_parallel_overlay_connects_
- (c, c->num_parallel_connects - 1);
+ GNUNET_TESTBED_set_num_parallel_overlay_connects_ (c,
+ c->num_parallel_connects
+ - 1);
}
if (GNUNET_NO == GNUNET_TESTBED_release_time_slot_ (c, index, key))
return;
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index 7586ed28d8..d6c04a6a2b 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -86,7 +86,6 @@ enum OperationType
* Get slave config operation
*/
OP_GET_SLAVE_CONFIG
-
};
@@ -193,7 +192,7 @@ struct TimeSlot
* A key to identify this timeslot
*/
void *key;
-
+
/**
* Time
*/
@@ -305,7 +304,7 @@ struct GNUNET_TESTBED_Controller
/**
* An array of timing slots; size should be equal to the current number of parallel
- * overlay connects
+ * overlay connects
*/
struct TimeSlot *tslots;
@@ -319,7 +318,7 @@ struct GNUNET_TESTBED_Controller
* The controller event mask
*/
uint64_t event_mask;
-
+
/**
* Did we start the receive loop yet?
*/
@@ -396,8 +395,7 @@ GNUNET_TESTBED_operation_add_ (struct GNUNET_TESTBED_Operation *op);
* @return the initialization message
*/
struct GNUNET_TESTBED_HelperInit *
-GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
- const char *hostname,
+GNUNET_TESTBED_create_helper_init_msg_ (const char *cname, const char *hostname,
const struct GNUNET_CONFIGURATION_Handle
*cfg);
@@ -510,9 +508,9 @@ struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link_2_ (void *op_cls,
struct GNUNET_TESTBED_Controller *master,
uint32_t delegated_host_id,
- uint32_t slave_host_id,
- const char *sxcfg, size_t sxcfg_size,
- size_t scfg_size, int is_subordinate);
+ uint32_t slave_host_id, const char *sxcfg,
+ size_t sxcfg_size, size_t scfg_size,
+ int is_subordinate);
/**
@@ -536,12 +534,11 @@ GNUNET_TESTBED_controller_link_2_ (void *op_cls,
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link_ (void *op_cls,
- struct GNUNET_TESTBED_Controller *master,
- uint32_t delegated_host_id,
- uint32_t slave_host_id,
- const struct GNUNET_CONFIGURATION_Handle
- *slave_cfg,
- int is_subordinate);
+ struct GNUNET_TESTBED_Controller *master,
+ uint32_t delegated_host_id,
+ uint32_t slave_host_id,
+ const struct GNUNET_CONFIGURATION_Handle
+ *slave_cfg, int is_subordinate);
/**
@@ -568,10 +565,8 @@ GNUNET_TESTBED_get_tslot_ (struct GNUNET_TESTBED_Controller *c, void *key);
*/
void
GNUNET_TESTBED_update_time_slot_ (struct GNUNET_TESTBED_Controller *c,
- unsigned int index,
- void *key,
- struct GNUNET_TIME_Relative time,
- int failed);
+ unsigned int index, void *key,
+ struct GNUNET_TIME_Relative time, int failed);
/**
@@ -586,8 +581,7 @@ GNUNET_TESTBED_update_time_slot_ (struct GNUNET_TESTBED_Controller *c,
*/
int
GNUNET_TESTBED_release_time_slot_ (struct GNUNET_TESTBED_Controller *c,
- unsigned int index,
- void *key);
+ unsigned int index, void *key);
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index 8bba56d6c8..293f3493b7 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -332,18 +332,18 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
if (((data[offset] == '\n')) && (buf != &data[offset]))
{
data[offset] = '\0';
- ret = SSCANF (buf, "%255[a-zA-Z0-9_]@%255[a-zA-Z0-9.]:%5hd",
- username, hostname, &port);
- if (3 == ret)
+ ret =
+ SSCANF (buf, "%255[a-zA-Z0-9_]@%255[a-zA-Z0-9.]:%5hd", username,
+ hostname, &port);
+ if (3 == ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Successfully read host %s, port %d and user %s from file\n",
hostname, port, username);
/* We store hosts in a static list; hence we only require the starting
- host pointer in that list to access the newly created list of hosts */
+ * host pointer in that list to access the newly created list of hosts */
if (NULL == starting_host)
- starting_host = GNUNET_TESTBED_host_create (hostname, username,
- port);
+ starting_host = GNUNET_TESTBED_host_create (hostname, username, port);
else
(void) GNUNET_TESTBED_host_create (hostname, username, port);
count++;
@@ -360,8 +360,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
if (NULL == starting_host)
return 0;
*hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * count);
- memcpy (*hosts,
- &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
+ memcpy (*hosts, &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
sizeof (struct GNUNET_TESTBED_Host *) * count);
return count;
}
@@ -475,7 +474,7 @@ struct GNUNET_TESTBED_HostHabitableCheckHandle
/* * the configuration handle to lookup the path of the testbed helper */
/* *\/ */
/* const struct GNUNET_CONFIGURATION_Handle *cfg; */
-
+
/**
* The callback to call once we have the status
*/
@@ -549,15 +548,14 @@ habitability_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
h->wait_time = GNUNET_TIME_STD_BACKOFF (h->wait_time);
h->habitability_check_task =
- GNUNET_SCHEDULER_add_delayed (h->wait_time,
- &habitability_check, h);
+ GNUNET_SCHEDULER_add_delayed (h->wait_time, &habitability_check, h);
return;
}
GNUNET_OS_process_destroy (h->auxp);
h->auxp = NULL;
ret = (0 != code) ? GNUNET_NO : GNUNET_YES;
-
- call_cb:
+
+call_cb:
GNUNET_free (h->ssh_addr);
GNUNET_free (h->portstr);
GNUNET_free (h->helper_binary_path);
@@ -604,9 +602,10 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
h->ssh_addr = GNUNET_strdup (hostname);
else
GNUNET_asprintf (&h->ssh_addr, "%s@%s", host->username, hostname);
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (config, "testbed",
- "HELPER_BINARY_PATH",
- &h->helper_binary_path))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (config, "testbed",
+ "HELPER_BINARY_PATH",
+ &h->helper_binary_path))
h->helper_binary_path =
GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY);
argp = 0;
@@ -628,7 +627,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
NULL, "ssh", remote_args);
if (NULL == h->auxp)
{
- GNUNET_break (0); /* Cannot exec SSH? */
+ GNUNET_break (0); /* Cannot exec SSH? */
GNUNET_free (h->ssh_addr);
GNUNET_free (h->portstr);
GNUNET_free (h->helper_binary_path);
@@ -637,8 +636,7 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
}
h->wait_time = GNUNET_TIME_STD_BACKOFF (h->wait_time);
h->habitability_check_task =
- GNUNET_SCHEDULER_add_delayed (h->wait_time,
- &habitability_check, h);
+ GNUNET_SCHEDULER_add_delayed (h->wait_time, &habitability_check, h);
return h;
}
@@ -662,4 +660,5 @@ GNUNET_TESTBED_is_host_habitable_cancel (struct
GNUNET_free (handle->helper_binary_path);
GNUNET_free (handle);
}
+
/* end of testbed_api_hosts.c */
diff --git a/src/testbed/testbed_api_operations.c b/src/testbed/testbed_api_operations.c
index 139448d91d..3e7eb91bde 100644
--- a/src/testbed/testbed_api_operations.c
+++ b/src/testbed/testbed_api_operations.c
@@ -92,17 +92,17 @@ enum OperationState
* The operation is just created and is in initial state
*/
OP_STATE_INIT,
-
+
/**
* The operation is currently waiting for resources
*/
OP_STATE_WAITING,
-
+
/**
* The operation is ready to be started
*/
OP_STATE_READY,
-
+
/**
* The operation has started
*/
@@ -292,14 +292,13 @@ GNUNET_TESTBED_operation_queue_reset_max_active_ (struct OperationQueue *queue,
unsigned int max_active)
{
struct QueueEntry *entry;
-
+
queue->max_active = max_active;
/* if (queue->active >= queue->max_active) */
/* return; */
entry = queue->head;
- while ( (queue->active > queue->max_active) &&
- (NULL != entry))
+ while ((queue->active > queue->max_active) && (NULL != entry))
{
if (entry->op->state == OP_STATE_READY)
defer (entry->op);
@@ -307,8 +306,7 @@ GNUNET_TESTBED_operation_queue_reset_max_active_ (struct OperationQueue *queue,
}
entry = queue->head;
- while ( (NULL != entry) &&
- (queue->active < queue->max_active) )
+ while ((NULL != entry) && (queue->active < queue->max_active))
{
if (OP_STATE_WAITING == entry->op->state)
check_readiness (entry->op);
@@ -331,8 +329,7 @@ GNUNET_TESTBED_operation_queue_reset_max_active_ (struct OperationQueue *queue,
void
GNUNET_TESTBED_operation_queue_insert2_ (struct OperationQueue *queue,
struct GNUNET_TESTBED_Operation
- *operation,
- unsigned int nres)
+ *operation, unsigned int nres)
{
struct QueueEntry *entry;
unsigned int qsize;
@@ -380,7 +377,7 @@ GNUNET_TESTBED_operation_queue_insert_ (struct OperationQueue *queue,
*/
void
GNUNET_TESTBED_operation_begin_wait_ (struct GNUNET_TESTBED_Operation
- *operation)
+ *operation)
{
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == operation->start_task_id);
operation->state = OP_STATE_WAITING;
diff --git a/src/testbed/testbed_api_operations.h b/src/testbed/testbed_api_operations.h
index 2f0ef19b6f..61b45e2365 100644
--- a/src/testbed/testbed_api_operations.h
+++ b/src/testbed/testbed_api_operations.h
@@ -85,8 +85,7 @@ GNUNET_TESTBED_operation_queue_reset_max_active_ (struct OperationQueue *queue,
void
GNUNET_TESTBED_operation_queue_insert2_ (struct OperationQueue *queue,
struct GNUNET_TESTBED_Operation
- *operation,
- unsigned int nres);
+ *operation, unsigned int nres);
/**
@@ -115,7 +114,7 @@ GNUNET_TESTBED_operation_queue_insert_ (struct OperationQueue *queue,
*/
void
GNUNET_TESTBED_operation_begin_wait_ (struct GNUNET_TESTBED_Operation
- *operation);
+ *operation);
/**
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index 1c0e875576..9105793f17 100644
--- a/src/testbed/testbed_api_peers.c
+++ b/src/testbed/testbed_api_peers.c
@@ -378,8 +378,8 @@ oprelease_overlay_connect (void *cls)
break;
case OPC_STATE_FINISHED:
duration = GNUNET_TIME_absolute_get_duration (data->tstart);
- GNUNET_TESTBED_update_time_slot_ (opc->c, data->tslot_index,
- data, duration, data->failed);
+ GNUNET_TESTBED_update_time_slot_ (opc->c, data->tslot_index, data, duration,
+ data->failed);
}
GNUNET_free (data);
GNUNET_free (opc);
@@ -435,7 +435,7 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_TESTBED_PeerCreateCallback cb, void *cls)
{
-
+
struct GNUNET_TESTBED_Peer *peer;
struct PeerCreateData *data;
struct OperationContext *opc;
@@ -478,14 +478,12 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_peer_start (void *op_cls,
- struct GNUNET_TESTBED_Peer *peer,
- GNUNET_TESTBED_PeerChurnCallback pcc,
- void *pcc_cls)
+GNUNET_TESTBED_peer_start (void *op_cls, struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls)
{
struct OperationContext *opc;
struct PeerEventData *data;
-
+
data = GNUNET_malloc (sizeof (struct PeerEventData));
data->peer = peer;
data->pcc = pcc;
@@ -518,12 +516,11 @@ GNUNET_TESTBED_peer_start (void *op_cls,
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
- GNUNET_TESTBED_PeerChurnCallback pcc,
- void *pcc_cls)
+ GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls)
{
struct OperationContext *opc;
struct PeerEventData *data;
-
+
data = GNUNET_malloc (sizeof (struct PeerEventData));
data->peer = peer;
data->pcc = pcc;
@@ -558,10 +555,9 @@ GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer,
- enum GNUNET_TESTBED_PeerInformationType
- pit,
- GNUNET_TESTBED_PeerInfoCallback cb,
- void *cb_cls)
+ enum GNUNET_TESTBED_PeerInformationType
+ pit, GNUNET_TESTBED_PeerInfoCallback cb,
+ void *cb_cls)
{
struct OperationContext *opc;
struct PeerInfoData *data;
@@ -676,9 +672,8 @@ GNUNET_TESTBED_underlay_configure_link (void *op_cls,
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_overlay_connect (void *op_cls,
GNUNET_TESTBED_OperationCompletionCallback cb,
- void *cb_cls,
- struct GNUNET_TESTBED_Peer *p1,
- struct GNUNET_TESTBED_Peer *p2)
+ void *cb_cls, struct GNUNET_TESTBED_Peer *p1,
+ struct GNUNET_TESTBED_Peer *p2)
{
struct OperationContext *opc;
struct OverlayConnectData *data;
@@ -698,8 +693,9 @@ GNUNET_TESTBED_overlay_connect (void *op_cls,
opc->op =
GNUNET_TESTBED_operation_create_ (opc, &opstart_overlay_connect,
&oprelease_overlay_connect);
- GNUNET_TESTBED_operation_queue_insert_
- (opc->c->opq_parallel_overlay_connect_operations, opc->op);
+ GNUNET_TESTBED_operation_queue_insert_ (opc->
+ c->opq_parallel_overlay_connect_operations,
+ opc->op);
GNUNET_TESTBED_operation_begin_wait_ (opc->op);
return opc->op;
}
diff --git a/src/testbed/testbed_api_peers.h b/src/testbed/testbed_api_peers.h
index b1f226214b..8598cc177a 100644
--- a/src/testbed/testbed_api_peers.h
+++ b/src/testbed/testbed_api_peers.h
@@ -130,17 +130,17 @@ struct PeerEventData
* The handle of the peer to start
*/
struct GNUNET_TESTBED_Peer *peer;
-
+
/**
* The Peer churn callback to call when this operation is completed
*/
GNUNET_TESTBED_PeerChurnCallback pcc;
-
+
/**
* Closure for the above callback
*/
void *pcc_cls;
-
+
};
@@ -172,7 +172,7 @@ struct PeerInfoData
* The Peer info callback to call when this operation has completed
*/
GNUNET_TESTBED_PeerInfoCallback cb;
-
+
/**
* The closure for peer info callback
*/
@@ -205,7 +205,7 @@ struct OverlayConnectData
* The operation completion callback to call once this operation is done
*/
GNUNET_TESTBED_OperationCompletionCallback cb;
-
+
/**
* The closure for the above callback
*/
diff --git a/src/testbed/testbed_api_services.c b/src/testbed/testbed_api_services.c
index c755a13a5c..0c3d63de70 100644
--- a/src/testbed/testbed_api_services.c
+++ b/src/testbed/testbed_api_services.c
@@ -43,12 +43,11 @@ enum State
* The configuration request has been sent
*/
CFG_REQUEST_QUEUED,
-
+
/**
* connected to service
*/
SERVICE_CONNECTED
-
};
@@ -149,23 +148,24 @@ configuration_receiver (void *cls, const struct GNUNET_MessageHeader *msg)
info.details.operation_finished.op_cls = data->op_cls;
if (GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT == mtype)
{
- emsg = GNUNET_TESTBED_parse_error_string_ ((const struct
- GNUNET_TESTBED_OperationFailureEventMessage
- *) msg);
+ emsg =
+ GNUNET_TESTBED_parse_error_string_ ((const struct
+ GNUNET_TESTBED_OperationFailureEventMessage
+ *) msg);
if (NULL == emsg)
emsg = "Unknown error";
info.details.operation_finished.emsg = emsg;
info.details.operation_finished.generic = NULL;
goto call_cb;
- }
+ }
data->cfg = GNUNET_TESTBED_extract_config_ (msg);
GNUNET_assert (NULL == data->op_result);
- data->op_result = data->ca (data->cada_cls, data->cfg);
+ data->op_result = data->ca (data->cada_cls, data->cfg);
info.details.operation_finished.emsg = NULL;
info.details.operation_finished.generic = data->op_result;
data->state = SERVICE_CONNECTED;
-
- call_cb:
+
+call_cb:
if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) &&
(NULL != c->cc))
c->cc (c->cc_cls, &info);
@@ -237,7 +237,7 @@ oprelease_service_connect (void *cls)
* maintain connections with other systems. The actual service
* handle is then returned via the 'op_result' member in the event
* callback. The 'ca' callback is used to create the connection
- * when the time is right; the 'da' callback will be used to
+ * when the time is right; the 'da' callback will be used to
* destroy the connection (upon 'GNUNET_TESTBED_operation_done').
* 'GNUNET_TESTBED_operation_cancel' can be used to abort this
* operation until the event callback has been called.
@@ -253,14 +253,13 @@ oprelease_service_connect (void *cls)
* @return handle for the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_service_connect (void *op_cls,
- struct GNUNET_TESTBED_Peer *peer,
- const char *service_name,
- GNUNET_TESTBED_ServiceConnectCompletionCallback cb,
- void *cb_cls,
- GNUNET_TESTBED_ConnectAdapter ca,
- GNUNET_TESTBED_DisconnectAdapter da,
- void *cada_cls)
+GNUNET_TESTBED_service_connect (void *op_cls, struct GNUNET_TESTBED_Peer *peer,
+ const char *service_name,
+ GNUNET_TESTBED_ServiceConnectCompletionCallback
+ cb, void *cb_cls,
+ GNUNET_TESTBED_ConnectAdapter ca,
+ GNUNET_TESTBED_DisconnectAdapter da,
+ void *cada_cls)
{
struct ServiceConnectData *data;
diff --git a/src/testbed/testbed_api_statistics.c b/src/testbed/testbed_api_statistics.c
index 0ee36151d8..f013c03021 100644
--- a/src/testbed/testbed_api_statistics.c
+++ b/src/testbed/testbed_api_statistics.c
@@ -29,7 +29,7 @@
/**
- * Convenience method that iterates over all (running) peers
+ * Convenience method that iterates over all (running) peers
* and retrieves all statistics from each peer.
*
* @param num_peers number of peers to iterate over
@@ -41,7 +41,7 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_get_statistics (unsigned int num_peers,
- struct GNUNET_TESTBED_Peer **peers,
+ struct GNUNET_TESTBED_Peer **peers,
GNUNET_TESTBED_StatisticsIterator proc,
GNUNET_TESTBED_OperationCompletionCallback cont,
void *cls)
diff --git a/src/testbed/testbed_api_test.c b/src/testbed/testbed_api_test.c
index 834f23c76b..af91cec651 100644
--- a/src/testbed/testbed_api_test.c
+++ b/src/testbed/testbed_api_test.c
@@ -52,7 +52,7 @@ struct TestRunContext
* Closure for the above callback
*/
void *cc_cls;
-
+
/**
* event mask for the controller callback
*/
@@ -79,8 +79,8 @@ run (void *cls, char *const *args, const char *cfgfile,
{
struct TestRunContext *rc = cls;
- GNUNET_TESTBED_run (NULL, config, rc->num_peers, rc->event_mask,
- rc->cc, rc->cc_cls, rc->test_master, rc->test_master_cls);
+ GNUNET_TESTBED_run (NULL, config, rc->num_peers, rc->event_mask, rc->cc,
+ rc->cc_cls, rc->test_master, rc->test_master_cls);
}
@@ -119,10 +119,8 @@ run (void *cls, char *const *args, const char *cfgfile,
*/
int
GNUNET_TESTBED_test_run (const char *testname, const char *cfg_filename,
- unsigned int num_peers,
- uint64_t event_mask,
- GNUNET_TESTBED_ControllerCallback cc,
- void *cc_cls,
+ unsigned int num_peers, uint64_t event_mask,
+ GNUNET_TESTBED_ControllerCallback cc, void *cc_cls,
GNUNET_TESTBED_TestMaster test_master,
void *test_master_cls)
{
@@ -150,8 +148,9 @@ GNUNET_TESTBED_test_run (const char *testname, const char *cfg_filename,
rc->event_mask = event_mask;
rc->cc = cc;
rc->cc_cls = cc_cls;
- ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- testname, "nohelp", options, &run, rc);
+ ret =
+ GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
+ testname, "nohelp", options, &run, rc);
GNUNET_free (rc);
GNUNET_free (argv2[0]);
GNUNET_free (argv2[2]);
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index 24f17bc75b..3177f8df86 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -156,7 +156,7 @@ struct RunContext
* TestMaster callback to call when testbed initialization is done
*/
GNUNET_TESTBED_TestMaster test_master;
-
+
/**
* The closure for the TestMaster callback
*/
@@ -275,7 +275,7 @@ struct RunContext
* Number of random links to established
*/
unsigned int random_links;
-
+
};
@@ -394,7 +394,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (NULL != rc->h)
GNUNET_TESTBED_host_destroy (rc->h);
for (hid = 0; hid < rc->num_hosts; hid++)
- GNUNET_TESTBED_host_destroy (rc->hosts[hid]);
+ GNUNET_TESTBED_host_destroy (rc->hosts[hid]);
GNUNET_free_non_null (rc->hosts);
if (NULL != rc->cfg)
GNUNET_CONFIGURATION_destroy (rc->cfg);
@@ -530,7 +530,7 @@ shutdown_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
return;
GNUNET_free (rc->peers);
rc->peers = NULL;
- }
+ }
}
rc->state = RC_PEERS_DESTROYED; /* No peers are present so we consider the
* state where all peers are destroyed */
@@ -548,11 +548,11 @@ static void
call_master (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct RunContext *rc = cls;
-
+
if (NULL != rc->topology_operation)
{
DEBUG ("Overlay topology generated in %s\n", prof_time (rc));
- GNUNET_TESTBED_operation_done (rc->topology_operation);
+ GNUNET_TESTBED_operation_done (rc->topology_operation);
rc->topology_operation = NULL;
}
if (NULL != rc->test_master)
@@ -570,7 +570,7 @@ create_peers (struct RunContext *rc)
{
struct DLLOperation *dll_op;
unsigned int peer;
-
+
DEBUG ("Creating peers\n");
rc->pstart_time = GNUNET_TIME_absolute_get ();
rc->peers =
@@ -582,11 +582,11 @@ create_peers (struct RunContext *rc)
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
dll_op->rc = rc;
dll_op->op =
- GNUNET_TESTBED_peer_create (rc->c,
- (0 == rc->num_hosts)
- ? rc->h : rc->hosts[peer % rc->num_hosts],
- rc->cfg,
- peer_create_cb, dll_op);
+ GNUNET_TESTBED_peer_create (rc->c,
+ (0 ==
+ rc->num_hosts) ? rc->h : rc->hosts[peer %
+ rc->num_hosts],
+ rc->cfg, peer_create_cb, dll_op);
GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op);
}
}
@@ -614,8 +614,7 @@ event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
dll_op = event->details.operation_finished.op_cls;
if (NULL != event->details.operation_finished.emsg)
{
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Linking controllers failed. Exiting"));
+ LOG (GNUNET_ERROR_TYPE_ERROR, _("Linking controllers failed. Exiting"));
shutdown_now (rc);
}
else
@@ -719,20 +718,17 @@ call_cc:
GNUNET_free (dll_op);
rc->peer_count++;
if (rc->peer_count < rc->num_peers)
- return;
- DEBUG ("%u peers started in %s\n", rc->num_peers,
- prof_time (rc));
+ return;
+ DEBUG ("%u peers started in %s\n", rc->num_peers, prof_time (rc));
if (GNUNET_TESTBED_TOPOLOGY_NONE != rc->topology)
- {
- if ( (GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology)
- || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology)
- || (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology))
+ {
+ if ((GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI == rc->topology) ||
+ (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING == rc->topology) ||
+ (GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD == rc->topology))
{
rc->topology_operation =
- GNUNET_TESTBED_overlay_configure_topology (NULL,
- rc->num_peers,
- rc->peers,
- &rc->num_oc,
+ GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers,
+ rc->peers, &rc->num_oc,
rc->topology,
rc->random_links,
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
@@ -741,20 +737,16 @@ call_cc:
{
GNUNET_assert (NULL != rc->topo_file);
rc->topology_operation =
- GNUNET_TESTBED_overlay_configure_topology (NULL,
- rc->num_peers,
- rc->peers,
- &rc->num_oc,
+ GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers,
+ rc->peers, &rc->num_oc,
rc->topology,
rc->topo_file,
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
}
else
rc->topology_operation =
- GNUNET_TESTBED_overlay_configure_topology (NULL,
- rc->num_peers,
- rc->peers,
- &rc->num_oc,
+ GNUNET_TESTBED_overlay_configure_topology (NULL, rc->num_peers,
+ rc->peers, &rc->num_oc,
rc->topology,
GNUNET_TESTBED_TOPOLOGY_OPTION_END);
if (NULL == rc->topology_operation)
@@ -763,7 +755,7 @@ call_cc:
else
{
DEBUG ("Creating overlay topology\n");
- rc->pstart_time = GNUNET_TIME_absolute_get ();
+ rc->pstart_time = GNUNET_TIME_absolute_get ();
return;
}
}
@@ -828,21 +820,18 @@ register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
dll_op->rc = rc;
- dll_op->op = GNUNET_TESTBED_controller_link (dll_op,
- rc->c,
- rc->hosts[slave],
- rc->h,
- rc->cfg,
- GNUNET_YES);
- GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op);
+ dll_op->op =
+ GNUNET_TESTBED_controller_link (dll_op, rc->c, rc->hosts[slave],
+ rc->h, rc->cfg, GNUNET_YES);
+ GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
+ dll_op);
}
rc->reg_hosts = 0;
return;
}
- rc->reg_handle = GNUNET_TESTBED_register_host (rc->c,
- rc->hosts[rc->reg_hosts++],
- host_registration_completion,
- rc);
+ rc->reg_handle =
+ GNUNET_TESTBED_register_host (rc->c, rc->hosts[rc->reg_hosts++],
+ host_registration_completion, rc);
}
@@ -871,7 +860,7 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
return;
default:
rc->cproc = NULL;
- shutdown_now (rc);
+ shutdown_now (rc);
return;
}
}
@@ -884,7 +873,8 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
if (rc->topology < GNUNET_TESTBED_TOPOLOGY_NONE)
event_mask |= GNUNET_TESTBED_ET_CONNECT;
rc->c =
- GNUNET_TESTBED_controller_connect (rc->cfg, rc->h, event_mask, &event_cb, rc);
+ GNUNET_TESTBED_controller_connect (rc->cfg, rc->h, event_mask, &event_cb,
+ rc);
if (0 < rc->num_hosts)
{
rc->register_hosts_task = GNUNET_SCHEDULER_add_now (&register_hosts, rc);
@@ -908,32 +898,28 @@ controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/
static int
-netint_proc (void *cls, const char *name,
- int isDefault,
- const struct sockaddr *addr,
- const struct sockaddr *broadcast_addr,
- const struct sockaddr *netmask,
- socklen_t addrlen)
+netint_proc (void *cls, const char *name, int isDefault,
+ const struct sockaddr *addr, const struct sockaddr *broadcast_addr,
+ const struct sockaddr *netmask, socklen_t addrlen)
{
- struct RunContext *rc = cls;
- char hostip[NI_MAXHOST];
- char *buf;
-
- if (sizeof (struct sockaddr_in) != addrlen)
- return GNUNET_OK; /* Only consider IPv4 for now */
- if (0 != getnameinfo(addr, addrlen,
- hostip, NI_MAXHOST,
- NULL, 0, NI_NUMERICHOST))
- GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "getnameinfo");
- if (NULL == rc->trusted_ip)
- {
- rc->trusted_ip = GNUNET_strdup (hostip);
- return GNUNET_YES;
- }
- (void) GNUNET_asprintf (&buf, "%s; %s", rc->trusted_ip, hostip);
- GNUNET_free (rc->trusted_ip);
- rc->trusted_ip = buf;
- return GNUNET_YES;
+ struct RunContext *rc = cls;
+ char hostip[NI_MAXHOST];
+ char *buf;
+
+ if (sizeof (struct sockaddr_in) != addrlen)
+ return GNUNET_OK; /* Only consider IPv4 for now */
+ if (0 !=
+ getnameinfo (addr, addrlen, hostip, NI_MAXHOST, NULL, 0, NI_NUMERICHOST))
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "getnameinfo");
+ if (NULL == rc->trusted_ip)
+ {
+ rc->trusted_ip = GNUNET_strdup (hostip);
+ return GNUNET_YES;
+ }
+ (void) GNUNET_asprintf (&buf, "%s; %s", rc->trusted_ip, hostip);
+ GNUNET_free (rc->trusted_ip);
+ rc->trusted_ip = buf;
+ return GNUNET_YES;
}
@@ -947,12 +933,13 @@ netint_proc (void *cls, const char *name,
* given to GNUNET_TESTBED_is_host_habitable() is NULL
* @param status GNUNET_YES if it is habitable; GNUNET_NO if not
*/
-static void
-host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status)
+static void
+host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host,
+ int status)
{
struct RunContext *rc = cls;
unsigned int nhost;
-
+
for (nhost = 0; nhost < rc->num_hosts; nhost++)
{
if (host == rc->hosts[nhost])
@@ -966,7 +953,8 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status
LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"),
GNUNET_TESTBED_host_get_hostname (host));
else
- LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n"));
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Testbed cannot be started on localhost\n"));
shutdown_now (rc);
return;
}
@@ -1040,7 +1028,7 @@ GNUNET_TESTBED_run (const char *host_filename,
unsigned long long random_links;
unsigned int hid;
unsigned int nhost;
-
+
GNUNET_assert (num_peers > 0);
rc = GNUNET_malloc (sizeof (struct RunContext));
if (NULL != host_filename)
@@ -1064,17 +1052,17 @@ GNUNET_TESTBED_run (const char *host_filename,
rc->test_master = test_master;
rc->test_master_cls = test_master_cls;
rc->state = RC_INIT;
- rc->topology = GNUNET_TESTBED_TOPOLOGY_NONE;
- if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed",
- "OVERLAY_TOPOLOGY",
- &topology))
+ rc->topology = GNUNET_TESTBED_TOPOLOGY_NONE;
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed",
+ "OVERLAY_TOPOLOGY", &topology))
{
- if (GNUNET_NO == GNUNET_TESTBED_topology_get_ (&rc->topology,
- topology))
+ if (GNUNET_NO == GNUNET_TESTBED_topology_get_ (&rc->topology, topology))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
- "testbed", "OVERLAY_TOPLOGY",
- _("Specified topology must be supported by testbed"));
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "testbed",
+ "OVERLAY_TOPLOGY",
+ _
+ ("Specified topology must be supported by testbed"));
}
GNUNET_free (topology);
}
@@ -1083,51 +1071,54 @@ GNUNET_TESTBED_run (const char *host_filename,
case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING:
case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD:
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (rc->cfg, "testbed",
- "OVERLAY_RANDOM_LINKS",
- &random_links))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (rc->cfg, "testbed",
+ "OVERLAY_RANDOM_LINKS",
+ &random_links))
{
/* OVERLAY option RANDOM & SMALL_WORLD_RING requires OVERLAY_RANDOM_LINKS
- option to be set to the number of random links to be established */
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "testbed", "OVERLAY_RANDOM_LINKS");
+ * option to be set to the number of random links to be established */
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "testbed",
+ "OVERLAY_RANDOM_LINKS");
goto error_cleanup;
}
if (random_links > UINT32_MAX)
{
- GNUNET_break (0); /* Too big number */
+ GNUNET_break (0); /* Too big number */
goto error_cleanup;
}
rc->random_links = (unsigned int) random_links;
break;
case GNUNET_TESTBED_TOPOLOGY_FROM_FILE:
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed",
- "OVERLAY_TOPOLOGY_FILE",
- &rc->topo_file))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (rc->cfg, "testbed",
+ "OVERLAY_TOPOLOGY_FILE",
+ &rc->topo_file))
{
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "testbed", "OVERLAY_TOPOLOGY_FILE");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "testbed",
+ "OVERLAY_TOPOLOGY_FILE");
goto error_cleanup;
}
- default:
+ default:
/* Warn if OVERLAY_RANDOM_LINKS is present that it will be ignored */
- if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (rc->cfg, "testbed",
- "OVERLAY_RANDOM_LINKS"))
+ if (GNUNET_YES ==
+ GNUNET_CONFIGURATION_have_value (rc->cfg, "testbed",
+ "OVERLAY_RANDOM_LINKS"))
LOG (GNUNET_ERROR_TYPE_WARNING,
"Ignoring value of `OVERLAY_RANDOM_LINKS' in given configuration\n");
break;
}
if (NULL != host_filename)
{
- rc->hc_handles = GNUNET_malloc (sizeof (struct
- GNUNET_TESTBED_HostHabitableCheckHandle *)
- * rc->num_hosts);
- for (nhost = 0; nhost < rc->num_hosts; nhost++)
- {
- if (NULL == (rc->hc_handles[nhost] =
- GNUNET_TESTBED_is_host_habitable (rc->hosts[nhost], rc->cfg,
- &host_habitable_cb,
- rc)))
+ rc->hc_handles =
+ GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostHabitableCheckHandle *)
+ * rc->num_hosts);
+ for (nhost = 0; nhost < rc->num_hosts; nhost++)
+ {
+ if (NULL ==
+ (rc->hc_handles[nhost] =
+ GNUNET_TESTBED_is_host_habitable (rc->hosts[nhost], rc->cfg,
+ &host_habitable_cb, rc)))
{
GNUNET_break (0);
for (nhost = 0; nhost < rc->num_hosts; nhost++)
@@ -1141,14 +1132,14 @@ GNUNET_TESTBED_run (const char *host_filename,
}
else
rc->cproc =
- GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, rc->cfg,
- &controller_status_cb, rc);
+ GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, rc->cfg,
+ &controller_status_cb, rc);
rc->shutdown_run_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_run, rc);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_run,
+ rc);
return;
- error_cleanup:
+error_cleanup:
if (NULL != rc->h)
GNUNET_TESTBED_host_destroy (rc->h);
if (NULL != rc->hosts)
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index 0b949d3aac..95ac7ae70e 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -56,7 +56,7 @@ struct OverlayLink
/**
* The topology context this link is a part of
- */
+ */
struct TopologyContext *tc;
/**
@@ -106,7 +106,7 @@ struct TopologyContext
* should the automatic retry be disabled
*/
int disable_retry;
-
+
};
@@ -114,75 +114,74 @@ struct TopologyContext
* A array of names representing topologies. Should be in sync with enum
* GNUNET_TESTBED_TopologyOption
*/
-const char * topology_strings[] = {
-
+const char *topology_strings[] = {
+
/**
* A clique (everyone connected to everyone else). No options. If there are N
* peers this topology results in (N * (N -1)) connections.
*/
- "CLIQUE",
+ "CLIQUE",
/**
* Small-world network (2d torus plus random links). Followed
* by the number of random links to add (unsigned int).
*/
- "SMALL_WORLD",
+ "SMALL_WORLD",
/**
* Small-world network (ring plus random links). Followed
* by the number of random links to add (unsigned int).
*/
- "SMALL_WORLD_RING",
+ "SMALL_WORLD_RING",
/**
* Ring topology. No options.
*/
- "RING",
+ "RING",
/**
* 2-d torus. No options.
*/
- "2D_TORUS",
+ "2D_TORUS",
/**
* Random graph. Followed by the number of random links to be established
* (unsigned int)
*/
- "RANDOM", // GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI
+ "RANDOM", // GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI
/**
* Certain percentage of peers are unable to communicate directly
* replicating NAT conditions. Followed by the fraction of
* NAT'ed peers (float).
*/
- "INTERNAT",
+ "INTERNAT",
/**
* Scale free topology. No options.
*/
- "SCALE_FREE",
+ "SCALE_FREE",
/**
* Straight line topology. No options.
*/
- "LINE",
+ "LINE",
/**
* Read a topology from a given file. Followed by the name of the file (const char *).
*/
- "FROM_FILE",
+ "FROM_FILE",
/**
* All peers are disconnected. No options.
*/
- "NONE",
-
+ "NONE",
+
/**
* End of strings
*/
- NULL
-
- };
+ NULL
+};
/**
@@ -193,10 +192,9 @@ const char * topology_strings[] = {
* @param emsg error message in case the operation has failed; will be NULL if
* operation has executed successfully.
*/
-static void
-overlay_link_completed (void *cls,
- struct GNUNET_TESTBED_Operation *op,
- const char *emsg)
+static void
+overlay_link_completed (void *cls, struct GNUNET_TESTBED_Operation *op,
+ const char *emsg)
{
struct OverlayLink *link = cls;
struct TopologyContext *tc;
@@ -208,12 +206,10 @@ overlay_link_completed (void *cls,
if ((NULL != emsg) && (GNUNET_NO == tc->disable_retry))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "Error while establishing a link: %s -- Retrying\n", emsg);
+ "Error while establishing a link: %s -- Retrying\n", emsg);
link->op =
- GNUNET_TESTBED_overlay_connect (tc->op_cls,
- &overlay_link_completed,
- link,
- tc->peers[link->A],
+ GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed,
+ link, tc->peers[link->A],
tc->peers[link->B]);
return;
}
@@ -231,14 +227,14 @@ opstart_overlay_configure_topology (void *cls)
{
struct TopologyContext *tc = cls;
unsigned int p;
-
+
for (p = 0; p < tc->link_array_size; p++)
{
tc->link_array[p].op =
- GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed,
- &tc->link_array[p],
- tc->peers[tc->link_array[p].A],
- tc->peers[tc->link_array[p].B]);
+ GNUNET_TESTBED_overlay_connect (tc->op_cls, &overlay_link_completed,
+ &tc->link_array[p],
+ tc->peers[tc->link_array[p].A],
+ tc->peers[tc->link_array[p].B]);
}
}
@@ -253,7 +249,7 @@ oprelease_overlay_configure_topology (void *cls)
{
struct TopologyContext *tc = cls;
unsigned int p;
-
+
if (NULL != tc->link_array)
{
for (p = 0; p < tc->link_array_size; p++)
@@ -272,12 +268,10 @@ oprelease_overlay_configure_topology (void *cls)
* @param A the peer A. Should be different from B
* @param B the peer B. Should be different from A
* @param tc the TopologyContext
- * @return
+ * @return
*/
static void
-make_link (struct OverlayLink *link,
- uint32_t A,
- uint32_t B,
+make_link (struct OverlayLink *link, uint32_t A, uint32_t B,
struct TopologyContext *tc)
{
GNUNET_assert (A != B);
@@ -300,9 +294,9 @@ gen_topo_line (struct TopologyContext *tc)
unsigned int cnt;
tc->link_array_size = tc->num_peers - 1;
- tc->link_array = GNUNET_malloc (sizeof (struct OverlayLink) *
- tc->link_array_size);
- for (cnt=0; cnt < (tc->num_peers - 1); cnt++)
+ tc->link_array =
+ GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
+ for (cnt = 0; cnt < (tc->num_peers - 1); cnt++)
make_link (&tc->link_array[cnt], cnt, cnt + 1, tc);
}
@@ -317,12 +311,10 @@ gen_topo_ring (struct TopologyContext *tc)
{
gen_topo_line (tc);
tc->link_array_size++;
- tc->link_array = GNUNET_realloc (tc->link_array,
- sizeof (struct OverlayLink) *
- tc->link_array_size);
- make_link (&tc->link_array[tc->link_array_size - 1],
- tc->num_peers - 1,
- 0,
+ tc->link_array =
+ GNUNET_realloc (tc->link_array,
+ sizeof (struct OverlayLink) * tc->link_array_size);
+ make_link (&tc->link_array[tc->link_array_size - 1], tc->num_peers - 1, 0,
tc);
}
@@ -338,8 +330,7 @@ gen_topo_ring (struct TopologyContext *tc)
* fresh. The caller should free it. Can be NULL
*/
unsigned int
-GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers,
- unsigned int *rows,
+GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers, unsigned int *rows,
unsigned int **rows_len)
{
double sq;
@@ -350,12 +341,12 @@ GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers,
unsigned int y;
unsigned int _num_peers;
unsigned int cnt;
-
+
sq = sqrt (num_peers);
sq = floor (sq);
sq_floor = (unsigned int) sq;
_rows = (sq_floor + 1);
- _rows_len = GNUNET_malloc (sizeof (unsigned int) * _rows);
+ _rows_len = GNUNET_malloc (sizeof (unsigned int) * _rows);
for (y = 0; y < _rows - 1; y++)
_rows_len[y] = sq_floor;
_num_peers = sq_floor * sq_floor;
@@ -399,28 +390,22 @@ gen_topo_2dtorus (struct TopologyContext *tc)
unsigned int cnt;
unsigned int offset;
- tc->link_array_size = GNUNET_TESTBED_2dtorus_calc_links (tc->num_peers, &rows,
- &rows_len);
- tc->link_array = GNUNET_malloc (sizeof (struct OverlayLink) *
- tc->link_array_size);
+ tc->link_array_size =
+ GNUNET_TESTBED_2dtorus_calc_links (tc->num_peers, &rows, &rows_len);
+ tc->link_array =
+ GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
cnt = 0;
offset = 0;
for (y = 0; y < rows; y++)
{
for (x = 0; x < rows_len[y] - 1; x++)
{
- make_link (&tc->link_array[cnt],
- offset + x,
- offset + x + 1,
- tc);
+ make_link (&tc->link_array[cnt], offset + x, offset + x + 1, tc);
cnt++;
}
if (0 == x)
break;
- make_link (&tc->link_array[cnt],
- offset + x,
- offset,
- tc);
+ make_link (&tc->link_array[cnt], offset + x, offset, tc);
cnt++;
offset += rows_len[y];
}
@@ -429,22 +414,17 @@ gen_topo_2dtorus (struct TopologyContext *tc)
offset = 0;
for (y = 0; y < rows - 1; y++)
{
- if (x == rows_len[y+1])
+ if (x == rows_len[y + 1])
break;
- GNUNET_assert (x < rows_len[y+1]);
- make_link (&tc->link_array[cnt],
- offset + x,
- offset + rows_len[y] + x,
+ GNUNET_assert (x < rows_len[y + 1]);
+ make_link (&tc->link_array[cnt], offset + x, offset + rows_len[y] + x,
tc);
offset += rows_len[y];
cnt++;
}
if (0 == offset)
break;
- make_link (&tc->link_array[cnt],
- offset + x,
- x,
- tc);
+ make_link (&tc->link_array[cnt], offset + x, x, tc);
cnt++;
}
GNUNET_assert (cnt == tc->link_array_size);
@@ -467,33 +447,35 @@ gen_topo_random (struct TopologyContext *tc, unsigned int links, int append)
unsigned int index;
uint32_t A_rand;
uint32_t B_rand;
-
+
if (GNUNET_YES == append)
{
GNUNET_assert ((0 < tc->link_array_size) && (NULL != tc->link_array));
- index = tc->link_array_size;
+ index = tc->link_array_size;
tc->link_array_size += links;
- tc->link_array = GNUNET_realloc (tc->link_array,
- sizeof (struct OverlayLink) *
- tc->link_array_size);
+ tc->link_array =
+ GNUNET_realloc (tc->link_array,
+ sizeof (struct OverlayLink) * tc->link_array_size);
}
else
{
GNUNET_assert ((0 == tc->link_array_size) && (NULL == tc->link_array));
- index = 0;
+ index = 0;
tc->link_array_size = links;
- tc->link_array = GNUNET_malloc (sizeof (struct OverlayLink) *
- tc->link_array_size);
+ tc->link_array =
+ GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
}
for (cnt = 0; cnt < links; cnt++)
{
- do {
- A_rand = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- tc->num_peers);
- B_rand = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- tc->num_peers);
- } while (A_rand == B_rand);
- make_link (&tc->link_array[index + cnt], A_rand, B_rand, tc);
+ do
+ {
+ A_rand =
+ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, tc->num_peers);
+ B_rand =
+ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, tc->num_peers);
+ }
+ while (A_rand == B_rand);
+ make_link (&tc->link_array[index + cnt], A_rand, B_rand, tc);
}
}
@@ -518,24 +500,26 @@ gen_scale_free (struct TopologyContext *tc)
popularity = GNUNET_malloc (sizeof (uint16_t) * tc->num_peers);
/* Initially connect peer 1 to peer 0 */
tc->link_array_size = 1;
- tc->link_array = GNUNET_malloc (sizeof (struct OverlayLink));
+ tc->link_array = GNUNET_malloc (sizeof (struct OverlayLink));
make_link (&tc->link_array[0], 0, 1, tc);
- popularity[0]++; /* increase popularity of 0 as 1 connected to it*/
+ popularity[0]++; /* increase popularity of 0 as 1 connected to it */
for (cnt = 1; cnt < tc->num_peers; cnt++)
{
previous_connections = tc->link_array_size;
for (i = 0; i < cnt; i++)
{
probability = ((double) popularity[i]) / ((double) previous_connections);
- random = ((double)
+ random =
+ ((double)
GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
UINT64_MAX)) / ((double) UINT64_MAX);
if (random < probability)
{
tc->link_array_size++;
- tc->link_array = GNUNET_realloc (tc->link_array,
- (sizeof (struct OverlayLink) *
- tc->link_array_size));
+ tc->link_array =
+ GNUNET_realloc (tc->link_array,
+ (sizeof (struct OverlayLink) *
+ tc->link_array_size));
make_link (&tc->link_array[tc->link_array_size - 1], cnt, i, tc);
popularity[cnt]++;
}
@@ -561,8 +545,9 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
uint64_t offset;
unsigned long int peer_id;
unsigned long int other_peer_id;
- enum ParseState {
-
+ enum ParseState
+ {
+
/**
* We read the peer index
*/
@@ -585,7 +570,8 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
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"), filename);
+ LOG (GNUNET_ERROR_TYPE_ERROR, _("Topology file %s has no data\n"),
+ filename);
return;
}
data = GNUNET_malloc (fs);
@@ -635,8 +621,7 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
if (tc->num_peers <= peer_id)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Topology file needs more peers than given ones\n"),
- filename);
+ _("Topology file needs more peers than given ones\n"), filename);
goto _exit;
}
state = OTHER_PEER_INDEX;
@@ -644,7 +629,7 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
break;
case OTHER_PEER_INDEX:
errno = 0;
- other_peer_id = (unsigned int) strtoul (&data[offset], &end, 10);
+ other_peer_id = (unsigned int) strtoul (&data[offset], &end, 10);
if (0 != errno)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -660,25 +645,24 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
if (tc->num_peers <= other_peer_id)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Topology file needs more peers than given ones\n"),
- filename);
+ _("Topology file needs more peers than given ones\n"), filename);
goto _exit;
}
if (peer_id != other_peer_id)
{
tc->link_array_size++;
- tc->link_array = GNUNET_realloc (tc->link_array,
- sizeof (struct OverlayLink) *
- tc->link_array_size);
+ tc->link_array =
+ GNUNET_realloc (tc->link_array,
+ sizeof (struct OverlayLink) * tc->link_array_size);
offset += end - &data[offset];
make_link (&tc->link_array[tc->link_array_size - 1], peer_id,
other_peer_id, tc);
}
else
LOG (GNUNET_ERROR_TYPE_WARNING,
- _("Ignoring to connect peer %u to peer %u\n"), peer_id, other_peer_id);
- while (('\n' != data[offset]) && ('|' != data[offset])
- && (offset < fs))
+ _("Ignoring to connect peer %u to peer %u\n"), peer_id,
+ other_peer_id);
+ while (('\n' != data[offset]) && ('|' != data[offset]) && (offset < fs))
offset++;
if ('\n' == data[offset])
state = PEER_INDEX;
@@ -691,13 +675,12 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
}
}
status = GNUNET_OK;
-
- _exit:
+
+_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;
GNUNET_free_non_null (tc->link_array);
tc->link_array = NULL;
@@ -772,7 +755,8 @@ GNUNET_TESTBED_underlay_configure_topology (void *op_cls,
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
unsigned int num_peers,
- struct GNUNET_TESTBED_Peer **peers,
+ struct GNUNET_TESTBED_Peer
+ **peers,
unsigned int *max_connections,
enum GNUNET_TESTBED_TopologyOption
topo, va_list va)
@@ -799,29 +783,27 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
gen_topo_ring (tc);
break;
case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
- gen_topo_random (tc,
- va_arg (va, unsigned int),
- GNUNET_NO);
+ gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_NO);
+
break;
case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING:
gen_topo_ring (tc);
- gen_topo_random (tc,
- va_arg (va, unsigned int),
- GNUNET_YES);
+ gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_YES);
+
break;
case GNUNET_TESTBED_TOPOLOGY_CLIQUE:
tc->link_array_size = num_peers * (num_peers - 1);
- tc->link_array = GNUNET_malloc (sizeof (struct OverlayLink) *
- tc->link_array_size);
+ tc->link_array =
+ GNUNET_malloc (sizeof (struct OverlayLink) * tc->link_array_size);
{
unsigned int offset;
-
+
offset = 0;
- for (cnt=0; cnt < num_peers; cnt++)
+ for (cnt = 0; cnt < num_peers; cnt++)
{
unsigned int neighbour;
-
- for (neighbour=0; neighbour < num_peers; neighbour++)
+
+ for (neighbour = 0; neighbour < num_peers; neighbour++)
{
if (neighbour == cnt)
continue;
@@ -838,21 +820,21 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
break;
case GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD:
gen_topo_2dtorus (tc);
- gen_topo_random (tc,
- va_arg (va, unsigned int),
- GNUNET_YES);
+ gen_topo_random (tc, va_arg (va, unsigned int), GNUNET_YES);
+
break;
case GNUNET_TESTBED_TOPOLOGY_SCALE_FREE:
gen_scale_free (tc);
break;
case GNUNET_TESTBED_TOPOLOGY_FROM_FILE:
- {
- const char *filename;
-
- filename = va_arg (va, const char *);
- GNUNET_assert (NULL != filename);
- gen_topo_from_file (tc, filename);
- }
+ {
+ const char *filename;
+
+ filename = va_arg (va, const char *);
+
+ GNUNET_assert (NULL != filename);
+ gen_topo_from_file (tc, filename);
+ }
break;
default:
GNUNET_break (0);
@@ -862,6 +844,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
do
{
secondary_option = va_arg (va, enum GNUNET_TESTBED_TopologyOption);
+
switch (secondary_option)
{
case GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY:
@@ -871,20 +854,21 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
break;
default:
GNUNET_break (0); /* Should not use any other option apart from
- the ones handled here */
+ * the ones handled here */
GNUNET_free_non_null (tc->link_array);
GNUNET_free (tc);
return NULL;
}
- } while (GNUNET_TESTBED_TOPOLOGY_OPTION_END != secondary_option);
+ }
+ while (GNUNET_TESTBED_TOPOLOGY_OPTION_END != secondary_option);
op = GNUNET_TESTBED_operation_create_ (tc,
- &opstart_overlay_configure_topology,
- &oprelease_overlay_configure_topology);
+ &opstart_overlay_configure_topology,
+ &oprelease_overlay_configure_topology);
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", tc->link_array_size);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Generated %u connections\n",
+ tc->link_array_size);
if (NULL != max_connections)
*max_connections = tc->link_array_size;
return op;
@@ -920,8 +904,8 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers,
GNUNET_assert (topo < GNUNET_TESTBED_TOPOLOGY_OPTION_END);
va_start (vargs, topo);
op = GNUNET_TESTBED_overlay_configure_topology_va (op_cls, num_peers, peers,
- max_connections,
- topo, vargs);
+ max_connections, topo,
+ vargs);
va_end (vargs);
return op;
}
@@ -939,7 +923,7 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int num_peers,
int
GNUNET_TESTBED_topology_get_ (enum GNUNET_TESTBED_TopologyOption *topology,
const char *topology_string)
-{
+{
unsigned int cnt;
for (cnt = 0; NULL != topology_strings[cnt]; cnt++)
diff --git a/src/testbed/testbed_api_topology.h b/src/testbed/testbed_api_topology.h
index b3430f5f38..b5f36859d3 100644
--- a/src/testbed/testbed_api_topology.h
+++ b/src/testbed/testbed_api_topology.h
@@ -21,7 +21,7 @@
/**
* @file testbed/testbed_api_topology.h
* @brief header for intra library exported functions
- * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#ifndef TESTBED_API_TOPOLOGY_H
@@ -38,8 +38,7 @@
* fresh. The caller should free it. Can be NULL.
*/
unsigned int
-GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers,
- unsigned int *rows,
+GNUNET_TESTBED_2dtorus_calc_links (unsigned int num_peers, unsigned int *rows,
unsigned int **rows_len);
@@ -67,6 +66,5 @@ GNUNET_TESTBED_topology_get_ (enum GNUNET_TESTBED_TopologyOption *topology,
char *
GNUNET_TESTBED_topology_to_str_ (enum GNUNET_TESTBED_TopologyOption topology);
-#endif
+#endif
/* end of testbed_api_topology.h */
-
diff --git a/src/testbed/testbed_helper.h b/src/testbed/testbed_helper.h
index 4bed996da9..6b476cddf8 100644
--- a/src/testbed/testbed_helper.h
+++ b/src/testbed/testbed_helper.h
@@ -29,11 +29,10 @@
#define TESTBED_HELPER_H
GNUNET_NETWORK_STRUCT_BEGIN
-
/**
* Initialization message for gnunet-helper-testbed to start testbed service
*/
-struct GNUNET_TESTBED_HelperInit
+ struct GNUNET_TESTBED_HelperInit
{
/**
* Type is GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT
@@ -60,7 +59,7 @@ struct GNUNET_TESTBED_HelperInit
/* Followed by NULL terminated trusted ip */
/* Followed by hostname of the machine on which helper runs. This is not NULL
- terminated */
+ * terminated */
/* Followed by serialized and compressed configuration which should be
* config_size long when un-compressed */
@@ -86,7 +85,5 @@ struct GNUNET_TESTBED_HelperReply
};
GNUNET_NETWORK_STRUCT_END
-
#endif
-
/* end of testbed_helper.h */