[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23531 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23531 - gnunet/src/testbed |
Date: |
Fri, 31 Aug 2012 12:36:28 +0200 |
Author: harsha
Date: 2012-08-31 12:36:28 +0200 (Fri, 31 Aug 2012)
New Revision: 23531
Modified:
gnunet/src/testbed/gnunet-service-testbed.c
gnunet/src/testbed/gnunet-testbed-helper.c
gnunet/src/testbed/test_gnunet_testbed_helper.c
gnunet/src/testbed/test_testbed_api.c
gnunet/src/testbed/test_testbed_api_2peers.c
gnunet/src/testbed/test_testbed_api_controllerlink.c
gnunet/src/testbed/test_testbed_api_hosts.c
gnunet/src/testbed/test_testbed_api_operations.c
gnunet/src/testbed/test_testbed_api_testbed_run.c
gnunet/src/testbed/testbed.h
gnunet/src/testbed/testbed_api.c
gnunet/src/testbed/testbed_api.h
gnunet/src/testbed/testbed_api_hosts.c
gnunet/src/testbed/testbed_api_hosts.h
gnunet/src/testbed/testbed_api_operations.c
gnunet/src/testbed/testbed_api_operations.h
gnunet/src/testbed/testbed_api_peers.c
gnunet/src/testbed/testbed_api_peers.h
gnunet/src/testbed/testbed_api_services.c
gnunet/src/testbed/testbed_api_test.c
gnunet/src/testbed/testbed_api_testbed.c
gnunet/src/testbed/testbed_api_topology.c
gnunet/src/testbed/testbed_helper.h
Log:
adhering to indentation standard
Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -79,7 +79,7 @@
* The TESTING system handle for starting peers locally
*/
struct GNUNET_TESTING_System *system;
-
+
/**
* Event mask of event to be responded in this context
*/
@@ -106,12 +106,12 @@
* The client to send the message to
*/
struct GNUNET_SERVER_Client *client;
-
+
/**
* next pointer for DLL
*/
struct MessageQueue *next;
-
+
/**
* prev pointer for DLL
*/
@@ -184,30 +184,29 @@
* States of LCFContext
*/
enum LCFContextState
- {
+{
/**
* The Context has been initialized; Nothing has been done on it
*/
- INIT,
+ INIT,
/**
* Delegated host has been registered at the forwarding controller
*/
- DELEGATED_HOST_REGISTERED,
-
+ DELEGATED_HOST_REGISTERED,
+
/**
* The slave host has been registred at the forwarding controller
*/
- SLAVE_HOST_REGISTERED,
+ SLAVE_HOST_REGISTERED,
/**
* The context has been finished (may have error)
*/
- FINISHED
+ FINISHED
+};
- };
-
/**
* Link controllers request forwarding context
*/
@@ -285,13 +284,13 @@
{
union
{
- struct
+ struct
{
/**
* The peer handle from testing API
*/
struct GNUNET_TESTING_Peer *peer;
-
+
/**
* The modified (by GNUNET_TESTING_peer_configure) configuration this
* peer is configured with
@@ -308,7 +307,7 @@
struct GNUNET_TESTBED_Controller *controller;
} remote;
-
+
} details;
/**
@@ -328,23 +327,23 @@
* State information for overlay connect context
*/
enum OCCState
- {
+{
/**
* Initial state
*/
- OCC_STATE_INIT,
+ OCC_STATE_INIT,
/**
* Peer 1 has connected to peer0
*/
- OCC_STATE_PEER0_SUCCESS,
+ OCC_STATE_PEER0_SUCCESS,
/**
* Peer 2 has connected to peer1
*/
- OCC_STATE_PEER1_SUCCESS,
+ OCC_STATE_PEER1_SUCCESS,
- };
+};
/**
@@ -366,7 +365,7 @@
* The other peer
*/
struct Peer *other_peer;
-
+
/**
* Transport handle of the first peer to offer second peer's HELLO
*/
@@ -386,7 +385,7 @@
* HELLO of the other peer
*/
struct GNUNET_MessageHeader *hello;
-
+
/**
* Get hello handle for the other peer
*/
@@ -396,7 +395,7 @@
* The error message we send if this overlay connect operation has timed out
*/
char *emsg;
-
+
/**
* The peer identity of the first peer
*/
@@ -417,7 +416,7 @@
* connect to peer 2
*/
GNUNET_SCHEDULER_TaskIdentifier send_hello_task;
-
+
/**
* The id of the overlay connect timeout task
*/
@@ -450,7 +449,7 @@
/**
* Closure pointer
*/
- void *cls;
+ void *cls;
/**
* Task ID for the timeout task
@@ -460,7 +459,7 @@
/**
* The id of the operation that has been forwarded
*/
- uint64_t operation_id;
+ uint64_t operation_id;
};
@@ -479,7 +478,7 @@
* The ID of the operation
*/
uint64_t operation_id;
-
+
/**
* Pointer to the slave handle if we are directly starting/connecting to the
controller
*/
@@ -614,11 +613,11 @@
GNUNET_free (mq_entry);
mq_entry = mq_head;
if (NULL != mq_entry)
- transmit_handle =
- GNUNET_SERVER_notify_transmit_ready (mq_entry->client,
- ntohs (mq_entry->msg->size),
- GNUNET_TIME_UNIT_FOREVER_REL,
- &transmit_ready_notify, NULL);
+ transmit_handle =
+ GNUNET_SERVER_notify_transmit_ready (mq_entry->client,
+ ntohs (mq_entry->msg->size),
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &transmit_ready_notify, NULL);
return size;
}
@@ -640,18 +639,18 @@
type = ntohs (msg->type);
size = ntohs (msg->size);
GNUNET_assert ((GNUNET_MESSAGE_TYPE_TESTBED_INIT <= type) &&
- (GNUNET_MESSAGE_TYPE_TESTBED_MAX > type));
+ (GNUNET_MESSAGE_TYPE_TESTBED_MAX > type));
mq_entry = GNUNET_malloc (sizeof (struct MessageQueue));
mq_entry->msg = msg;
mq_entry->client = client;
- LOG_DEBUG ( "Queueing message of type %u, size %u for sending\n", type,
- ntohs (msg->size));
+ LOG_DEBUG ("Queueing message of type %u, size %u for sending\n", type,
+ ntohs (msg->size));
GNUNET_CONTAINER_DLL_insert_tail (mq_head, mq_tail, mq_entry);
if (NULL == transmit_handle)
- transmit_handle =
- GNUNET_SERVER_notify_transmit_ready (client, size,
- GNUNET_TIME_UNIT_FOREVER_REL,
- &transmit_ready_notify, NULL);
+ transmit_handle =
+ GNUNET_SERVER_notify_transmit_ready (client, size,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &transmit_ready_notify, NULL);
}
@@ -676,7 +675,7 @@
/**
* Function to add a host to the current list of known hosts
*
- * @param host the host to add
+ * @param host the host to add
* @return GNUNET_OK on success; GNUNET_SYSERR on failure due to host-id
* already in use
*/
@@ -688,11 +687,11 @@
host_id = GNUNET_TESTBED_host_get_id_ (host);
if (host_list_size <= host_id)
{
- host_list =
- TESTBED_realloc (host_list,
- sizeof (struct GNUNET_TESTBED_Host *) * host_list_size,
- sizeof (struct GNUNET_TESTBED_Host *) *
- (host_list_size + LIST_GROW_STEP));
+ host_list =
+ TESTBED_realloc (host_list,
+ sizeof (struct GNUNET_TESTBED_Host *) *
host_list_size,
+ sizeof (struct GNUNET_TESTBED_Host *) *
+ (host_list_size + LIST_GROW_STEP));
host_list_size += LIST_GROW_STEP;
}
if (NULL != host_list[host_id])
@@ -715,11 +714,10 @@
{
if (route->dest >= route_list_size)
{
- route_list =
- TESTBED_realloc (route_list,
- sizeof (struct Route *) * route_list_size,
- sizeof (struct Route *) *
- (route_list_size + LIST_GROW_STEP));
+ route_list =
+ TESTBED_realloc (route_list, sizeof (struct Route *) * route_list_size,
+ sizeof (struct Route *) * (route_list_size +
+ LIST_GROW_STEP));
route_list_size += LIST_GROW_STEP;
}
GNUNET_assert (NULL == route_list[route->dest]);
@@ -735,12 +733,12 @@
static void
slave_list_add (struct Slave *slave)
{
- if (slave->host_id >= slave_list_size)
+ if (slave->host_id >= slave_list_size)
{
- slave_list = TESTBED_realloc (slave_list,
- sizeof (struct Slave *) *slave_list_size,
- sizeof (struct Slave *) *
- (slave_list_size + LIST_GROW_STEP));
+ slave_list =
+ TESTBED_realloc (slave_list, sizeof (struct Slave *) * slave_list_size,
+ sizeof (struct Slave *) * (slave_list_size +
+ LIST_GROW_STEP));
slave_list_size += LIST_GROW_STEP;
}
GNUNET_assert (NULL == slave_list[slave->host_id]);
@@ -757,15 +755,15 @@
peer_list_add (struct Peer *peer)
{
uint32_t orig_size;
-
+
orig_size = peer_list_size;
- if (peer->id >= peer_list_size)
+ if (peer->id >= peer_list_size)
{
while (peer->id >= peer_list_size)
peer_list_size += LIST_GROW_STEP;
- peer_list = TESTBED_realloc (peer_list,
- sizeof (struct Peer *) * orig_size,
- sizeof (struct Peer *) * peer_list_size);
+ peer_list =
+ TESTBED_realloc (peer_list, sizeof (struct Peer *) * orig_size,
+ sizeof (struct Peer *) * peer_list_size);
}
GNUNET_assert (NULL == peer_list[peer->id]);
peer_list[peer->id] = peer;
@@ -797,8 +795,8 @@
}
if (orig_size == peer_list_size)
return;
- peer_list = GNUNET_realloc (peer_list, sizeof (struct Peer *)
- * peer_list_size);
+ peer_list =
+ GNUNET_realloc (peer_list, sizeof (struct Peer *) * peer_list_size);
}
@@ -814,8 +812,8 @@
find_dest_route (uint32_t host_id)
{
struct Route *route;
-
- while(NULL != (route = route_list[host_id]))
+
+ while (NULL != (route = route_list[host_id]))
{
if (route->thru == master_context->host_id)
break;
@@ -847,14 +845,13 @@
*/
static void
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;
uint16_t emsg_len;
-
- msize = sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage);
+
+ msize = sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage);
emsg_len = (NULL == emsg) ? 0 : strlen (emsg) + 1;
msize += emsg_len;
msg = GNUNET_malloc (msize);
@@ -876,18 +873,18 @@
*/
static void
send_operation_success_msg (struct GNUNET_SERVER_Client *client,
- uint64_t operation_id)
+ uint64_t operation_id)
{
struct GNUNET_TESTBED_GenericOperationSuccessEventMessage *msg;
uint16_t msize;
-
- msize = sizeof (struct GNUNET_TESTBED_GenericOperationSuccessEventMessage);
+
+ msize = sizeof (struct GNUNET_TESTBED_GenericOperationSuccessEventMessage);
msg = GNUNET_malloc (msize);
msg->header.size = htons (msize);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS);
msg->operation_id = GNUNET_htonll (operation_id);
msg->event_type = htonl (GNUNET_TESTBED_ET_OPERATION_FINISHED);
- queue_message (client, &msg->header);
+ queue_message (client, &msg->header);
}
@@ -923,19 +920,19 @@
lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf);
break;
case DELEGATED_HOST_REGISTERED:
- if (NULL != emsg)
+ if (NULL != emsg)
goto registration_error;
- lcf->state = SLAVE_HOST_REGISTERED;
- lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf);
- break;
+ lcf->state = SLAVE_HOST_REGISTERED;
+ lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf);
+ break;
default:
- GNUNET_assert (0); /* Shouldn't reach here */
- }
+ GNUNET_assert (0); /* Shouldn't reach here */
+ }
return;
- registration_error:
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Host registration failed with message: %s\n", emsg);
+registration_error:
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Host registration failed with message:
%s\n",
+ emsg);
lcf->state = FINISHED;
lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf);
}
@@ -953,15 +950,15 @@
const struct GNUNET_MessageHeader *msg)
{
struct ForwardedOperationContext *fopc = cls;
- struct GNUNET_MessageHeader *dup_msg;
+ struct GNUNET_MessageHeader *dup_msg;
uint16_t msize;
-
+
msize = ntohs (msg->size);
dup_msg = GNUNET_malloc (msize);
- (void) memcpy (dup_msg, msg, msize);
+ (void) memcpy (dup_msg, msg, msize);
queue_message (fopc->client, dup_msg);
GNUNET_SERVER_client_drop (fopc->client);
- GNUNET_SCHEDULER_cancel (fopc->timeout_task);
+ GNUNET_SCHEDULER_cancel (fopc->timeout_task);
GNUNET_free (fopc);
}
@@ -974,15 +971,14 @@
*/
static void
forwarded_operation_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext
- *tc)
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct ForwardedOperationContext *fopc = cls;
-
+
GNUNET_TESTBED_forward_operation_msg_cancel_ (fopc->opc);
send_operation_fail_msg (fopc->client, fopc->operation_id, "Timeout");
GNUNET_SERVER_client_drop (fopc->client);
- GNUNET_free (fopc);
+ GNUNET_free (fopc);
}
@@ -998,19 +994,19 @@
struct LCFContext *lcf = cls;
struct LCFContextQueue *lcfq;
struct ForwardedOperationContext *fopc;
-
+
lcf_proc_task_id = GNUNET_SCHEDULER_NO_TASK;
switch (lcf->state)
{
case INIT:
if (GNUNET_NO ==
- GNUNET_TESTBED_is_host_registered_ (host_list[lcf->delegated_host_id],
- lcf->gateway->controller))
+ GNUNET_TESTBED_is_host_registered_ (host_list[lcf->delegated_host_id],
+ lcf->gateway->controller))
{
lcf->rhandle =
- GNUNET_TESTBED_register_host (lcf->gateway->controller,
- host_list[lcf->delegated_host_id],
- lcf_proc_cc, lcf);
+ GNUNET_TESTBED_register_host (lcf->gateway->controller,
+ host_list[lcf->delegated_host_id],
+ lcf_proc_cc, lcf);
}
else
{
@@ -1020,13 +1016,13 @@
break;
case DELEGATED_HOST_REGISTERED:
if (GNUNET_NO ==
- GNUNET_TESTBED_is_host_registered_ (host_list[lcf->slave_host_id],
- lcf->gateway->controller))
+ GNUNET_TESTBED_is_host_registered_ (host_list[lcf->slave_host_id],
+ lcf->gateway->controller))
{
lcf->rhandle =
- GNUNET_TESTBED_register_host (lcf->gateway->controller,
- host_list[lcf->slave_host_id],
- lcf_proc_cc, lcf);
+ GNUNET_TESTBED_register_host (lcf->gateway->controller,
+ host_list[lcf->slave_host_id],
+ lcf_proc_cc, lcf);
}
else
{
@@ -1038,15 +1034,15 @@
fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
fopc->client = lcf->client;
fopc->operation_id = lcf->operation_id;
- fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (lcf->gateway->controller,
- lcf->operation_id,
- &lcf->msg->header,
- &forwarded_operation_reply_relay,
- fopc);
- fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &forwarded_operation_timeout, fopc);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (lcf->gateway->controller,
+ lcf->operation_id,
+ &lcf->msg->header,
+
&forwarded_operation_reply_relay,
+ fopc);
+ fopc->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout,
+ fopc);
lcf->state = FINISHED;
lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf);
break;
@@ -1058,8 +1054,8 @@
GNUNET_CONTAINER_DLL_remove (lcfq_head, lcfq_tail, lcfq);
GNUNET_free (lcfq);
if (NULL != lcfq_head)
- lcf_proc_task_id =
- GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcfq_head->lcf);
+ lcf_proc_task_id =
+ GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcfq_head->lcf);
}
}
@@ -1070,9 +1066,9 @@
* @param cls struct Slave *
* @param event information about the event
*/
-static void
+static void
slave_event_callback (void *cls,
- const struct GNUNET_TESTBED_EventInformation *event)
+ const struct GNUNET_TESTBED_EventInformation *event)
{
GNUNET_break (0);
}
@@ -1087,9 +1083,8 @@
* @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
* GNUNET_TESTBED_controller_stop() shouldn't be called in this case
*/
-static void
-slave_status_callback (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
+static void
+slave_status_callback (void *cls, const struct GNUNET_CONFIGURATION_Handle
*cfg,
int status)
{
struct LinkControllersContext *lcc = cls;
@@ -1097,20 +1092,19 @@
if (GNUNET_SYSERR == status)
{
lcc->slave->controller_proc = NULL;
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Unexpected slave shutdown\n");
- GNUNET_SCHEDULER_shutdown (); /* We too shutdown */
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Unexpected slave shutdown\n");
+ GNUNET_SCHEDULER_shutdown (); /* We too shutdown */
return;
}
lcc->slave->controller =
- GNUNET_TESTBED_controller_connect (cfg, host_list[lcc->slave->host_id],
- master_context->event_mask,
- &slave_event_callback, lcc->slave);
+ GNUNET_TESTBED_controller_connect (cfg, host_list[lcc->slave->host_id],
+ master_context->event_mask,
+ &slave_event_callback, lcc->slave);
if (NULL != lcc->slave->controller)
send_operation_success_msg (lcc->client, lcc->operation_id);
else
send_operation_fail_msg (lcc->client, lcc->operation_id,
- "Could not connect to delegated controller");
+ "Could not connect to delegated controller");
GNUNET_SERVER_client_drop (lcc->client);
GNUNET_free (lcc);
}
@@ -1123,9 +1117,8 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_init (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_init (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_InitMessage *msg;
@@ -1147,23 +1140,24 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- msize -= sizeof (struct GNUNET_TESTBED_InitMessage);
+ msize -= sizeof (struct GNUNET_TESTBED_InitMessage);
controller_hostname = (const char *) &msg[1];
if ('\0' != controller_hostname[msize - 1])
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
- }
+ }
master_context = GNUNET_malloc (sizeof (struct Context));
master_context->client = client;
master_context->host_id = ntohl (msg->host_id);
- master_context->master_ip = GNUNET_strdup (controller_hostname);
+ master_context->master_ip = GNUNET_strdup (controller_hostname);
LOG_DEBUG ("Master Controller IP: %s\n", master_context->master_ip);
- master_context->system =
- GNUNET_TESTING_system_create ("testbed", master_context->master_ip);
- host = GNUNET_TESTBED_host_create_with_id (master_context->host_id,
- NULL, NULL, 0);
+ master_context->system =
+ GNUNET_TESTING_system_create ("testbed", master_context->master_ip);
+ host =
+ GNUNET_TESTBED_host_create_with_id (master_context->host_id, NULL, NULL,
+ 0);
host_list_add (host);
master_context->event_mask = GNUNET_ntohll (msg->event_mask);
GNUNET_SERVER_client_keep (client);
@@ -1180,9 +1174,8 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_add_host (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
struct GNUNET_TESTBED_Host *host;
@@ -1196,39 +1189,41 @@
uint16_t hostname_length;
uint16_t reply_size;
uint16_t msize;
-
+
msg = (const struct GNUNET_TESTBED_AddHostMessage *) message;
msize = ntohs (msg->header.size);
username = (char *) &(msg[1]);
username_length = ntohs (msg->user_name_length);
- GNUNET_assert (msize > (sizeof (struct GNUNET_TESTBED_AddHostMessage)
- + username_length + 1)); /* msg must contain hostname
*/
+ GNUNET_assert (msize > (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
username_length + 1)); /* msg must contain hostname */
if (0 != username_length)
GNUNET_assert ('\0' == username[username_length]);
- username_length = (0 == username_length) ? 0 : username_length + 1;
+ username_length = (0 == username_length) ? 0 : username_length + 1;
hostname = username + username_length;
- hostname_length = msize - (sizeof (struct GNUNET_TESTBED_AddHostMessage)
- + username_length);
+ hostname_length =
+ msize - (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
username_length);
GNUNET_assert ('\0' == hostname[hostname_length - 1]);
GNUNET_assert (strlen (hostname) == hostname_length - 1);
host_id = ntohl (msg->host_id);
LOG_DEBUG ("Received ADDHOST message\n");
LOG_DEBUG ("-------host id: %u\n", host_id);
- if (NULL != hostname) LOG_DEBUG ("-------hostname: %s\n", hostname);
- if (0 != username_length) LOG_DEBUG ("-------username: %s\n", username);
- else
+ if (NULL != hostname)
+ LOG_DEBUG ("-------hostname: %s\n", hostname);
+ if (0 != username_length)
+ LOG_DEBUG ("-------username: %s\n", username);
+ else
{
LOG_DEBUG ("-------username: NULL\n");
username = NULL;
}
LOG_DEBUG ("-------ssh port: %u\n", ntohs (msg->ssh_port));
- host = GNUNET_TESTBED_host_create_with_id (host_id, hostname, username,
- ntohs (msg->ssh_port));
+ host =
+ GNUNET_TESTBED_host_create_with_id (host_id, hostname, username,
+ ntohs (msg->ssh_port));
GNUNET_assert (NULL != host);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
reply_size = sizeof (struct GNUNET_TESTBED_HostConfirmedMessage);
if (GNUNET_OK != host_list_add (host))
- {
+ {
/* We are unable to add a host */
emsg = "A host exists with given host-id";
LOG_DEBUG ("%s: %u", emsg, host_id);
@@ -1238,10 +1233,10 @@
memcpy (&reply[1], emsg, strlen (emsg) + 1);
}
else
- reply = GNUNET_malloc (reply_size);
+ reply = GNUNET_malloc (reply_size);
reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM);
reply->header.size = htons (reply_size);
- reply->host_id = htonl (host_id);
+ reply->host_id = htonl (host_id);
queue_message (client, &reply->header);
}
@@ -1256,9 +1251,8 @@
* iterate,
* GNUNET_NO if not.
*/
-int ss_exists_iterator (void *cls,
- const struct GNUNET_HashCode * key,
- void *value)
+int
+ss_exists_iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
{
struct SharedService *queried_ss = cls;
struct SharedService *ss = value;
@@ -1277,9 +1271,8 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_configure_shared_service (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_configure_shared_service (void *cls, struct GNUNET_SERVER_Client
*client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_ConfigureSharedServiceMessage *msg;
@@ -1288,7 +1281,7 @@
struct GNUNET_HashCode hash;
uint16_t msg_size;
uint16_t service_name_size;
-
+
msg = (const struct GNUNET_TESTBED_ConfigureSharedServiceMessage *) message;
msg_size = ntohs (message->size);
if (msg_size <= sizeof (struct GNUNET_TESTBED_ConfigureSharedServiceMessage))
@@ -1297,8 +1290,8 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- service_name_size = msg_size -
- sizeof (struct GNUNET_TESTBED_ConfigureSharedServiceMessage);
+ service_name_size =
+ msg_size - sizeof (struct GNUNET_TESTBED_ConfigureSharedServiceMessage);
service_name = (char *) &msg[1];
if ('\0' != service_name[service_name_size - 1])
{
@@ -1319,7 +1312,7 @@
ss->name = strdup (service_name);
ss->num_shared = ntohl (msg->num_peers);
GNUNET_CRYPTO_hash (ss->name, service_name_size, &hash);
- if (GNUNET_SYSERR ==
+ if (GNUNET_SYSERR ==
GNUNET_CONTAINER_multihashmap_get_multiple (ss_map, &hash,
&ss_exists_iterator, ss))
{
@@ -1331,7 +1324,7 @@
return;
}
GNUNET_CONTAINER_multihashmap_put (ss_map, &hash, ss,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
}
@@ -1342,9 +1335,8 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_link_controllers (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_ControllerLinkMessage *msg;
@@ -1352,13 +1344,13 @@
struct LCFContextQueue *lcfq;
struct Route *route;
struct Route *new_route;
- char *config;
+ char *config;
uLongf dest_size;
size_t config_size;
uint32_t delegated_host_id;
uint32_t slave_host_id;
uint16_t msize;
-
+
if (NULL == master_context)
{
GNUNET_break (0);
@@ -1381,7 +1373,7 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- if ((delegated_host_id >= host_list_size) ||
+ if ((delegated_host_id >= host_list_size) ||
(NULL == host_list[delegated_host_id]))
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Delegated host not registered with us\n");
@@ -1400,28 +1392,28 @@
LOG (GNUNET_ERROR_TYPE_WARNING, "Slave and delegated host are same\n");
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
- }
-
+ }
+
if (slave_host_id == master_context->host_id) /* Link from us */
{
struct Slave *slave;
-
+
msize -= sizeof (struct GNUNET_TESTBED_ControllerLinkMessage);
config_size = ntohs (msg->config_size);
- if ((delegated_host_id < slave_list_size) &&
- (NULL != slave_list[delegated_host_id])) /* We have already added */
+ if ((delegated_host_id < slave_list_size) && (NULL !=
slave_list[delegated_host_id])) /* We have already added */
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Host %u already connected\n",
delegated_host_id);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
- }
+ }
config = GNUNET_malloc (config_size);
- dest_size = (uLongf) config_size;
- if (Z_OK != uncompress ((Bytef *) config, &dest_size,
- (const Bytef *) &msg[1], (uLong) msize))
+ dest_size = (uLongf) config_size;
+ if (Z_OK !=
+ uncompress ((Bytef *) config, &dest_size, (const Bytef *) &msg[1],
+ (uLong) msize))
{
- GNUNET_break (0); /* Compression error */
+ GNUNET_break (0); /* Compression error */
GNUNET_free (config);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
@@ -1433,50 +1425,51 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- cfg = GNUNET_CONFIGURATION_create (); /* Free here or in lcfcontext */
- if (GNUNET_OK != GNUNET_CONFIGURATION_deserialize (cfg, config,
config_size,
- GNUNET_NO))
+ cfg = GNUNET_CONFIGURATION_create (); /* Free here or in lcfcontext
*/
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_deserialize (cfg, config, config_size, GNUNET_NO))
{
- GNUNET_break (0); /* Configuration parsing error */
+ GNUNET_break (0); /* Configuration parsing error */
GNUNET_free (config);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
GNUNET_free (config);
if ((delegated_host_id < slave_list_size) &&
- (NULL != slave_list[delegated_host_id]))
+ (NULL != slave_list[delegated_host_id]))
{
- GNUNET_break (0); /* Configuration parsing error */
+ GNUNET_break (0); /* Configuration parsing error */
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
slave = GNUNET_malloc (sizeof (struct Slave));
- slave->host_id = delegated_host_id;
+ slave->host_id = delegated_host_id;
slave_list_add (slave);
if (1 == msg->is_subordinate)
{
struct LinkControllersContext *lcc;
+
lcc = GNUNET_malloc (sizeof (struct LinkControllersContext));
lcc->operation_id = GNUNET_ntohll (msg->operation_id);
GNUNET_SERVER_client_keep (client);
lcc->client = client;
- lcc->slave = slave;
+ lcc->slave = slave;
slave->controller_proc =
- GNUNET_TESTBED_controller_start (master_context->master_ip,
- host_list[slave->host_id],
- cfg, &slave_status_callback,
- lcc);
+ GNUNET_TESTBED_controller_start (master_context->master_ip,
+ host_list[slave->host_id], cfg,
+ &slave_status_callback, lcc);
}
- else {
- slave->controller =
- GNUNET_TESTBED_controller_connect (cfg, host_list[slave->host_id],
- master_context->event_mask,
- &slave_event_callback, slave);
+ else
+ {
+ slave->controller =
+ GNUNET_TESTBED_controller_connect (cfg, host_list[slave->host_id],
+ master_context->event_mask,
+ &slave_event_callback, slave);
if (NULL != slave->controller)
- send_operation_success_msg (client, GNUNET_ntohll (msg->operation_id));
+ send_operation_success_msg (client, GNUNET_ntohll (msg->operation_id));
else
- send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
- "Could not connect to delegated controller");
+ send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
+ "Could not connect to delegated controller");
}
GNUNET_CONFIGURATION_destroy (cfg);
new_route = GNUNET_malloc (sizeof (struct Route));
@@ -1499,9 +1492,9 @@
lcfq->lcf->delegated_host_id = delegated_host_id;
lcfq->lcf->slave_host_id = slave_host_id;
route = find_dest_route (slave_host_id);
- GNUNET_assert (NULL != route); /* because we add routes carefully */
+ GNUNET_assert (NULL != route); /* because we add routes carefully */
GNUNET_assert (route->dest < slave_list_size);
- GNUNET_assert (NULL != slave_list[route->dest]);
+ GNUNET_assert (NULL != slave_list[route->dest]);
lcfq->lcf->state = INIT;
lcfq->lcf->operation_id = GNUNET_ntohll (msg->operation_id);
lcfq->lcf->gateway = slave_list[route->dest];
@@ -1518,7 +1511,7 @@
else
GNUNET_CONTAINER_DLL_insert_tail (lcfq_head, lcfq_tail, lcfq);
/* FIXME: Adding a new route should happen after the controllers are linked
- successfully */
+ * successfully */
GNUNET_SERVER_receive_done (client, GNUNET_OK);
new_route = GNUNET_malloc (sizeof (struct Route));
new_route->dest = delegated_host_id;
@@ -1539,13 +1532,12 @@
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct ForwardedOperationContext *fo_ctxt = cls;
-
+
/* send error msg to client */
- send_operation_fail_msg (fo_ctxt->client, fo_ctxt->operation_id,
- "Timedout");
+ send_operation_fail_msg (fo_ctxt->client, fo_ctxt->operation_id, "Timedout");
GNUNET_SERVER_client_drop (fo_ctxt->client);
GNUNET_TESTBED_forward_operation_msg_cancel_ (fo_ctxt->opc);
- GNUNET_free (fo_ctxt);
+ GNUNET_free (fo_ctxt);
}
@@ -1557,33 +1549,32 @@
* @param msg the peer create success message
*/
static void
-peer_create_success_cb (void *cls,
- const struct GNUNET_MessageHeader *msg)
+peer_create_success_cb (void *cls, const struct GNUNET_MessageHeader *msg)
{
struct ForwardedOperationContext *fo_ctxt = cls;
const struct GNUNET_TESTBED_PeerCreateSuccessEventMessage *success_msg;
struct GNUNET_MessageHeader *dup_msg;
struct Peer *peer;
uint16_t msize;
-
+
GNUNET_SCHEDULER_cancel (fo_ctxt->timeout_task);
if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS)
{
- success_msg
- = (const struct GNUNET_TESTBED_PeerCreateSuccessEventMessage *) msg;
+ success_msg =
+ (const struct GNUNET_TESTBED_PeerCreateSuccessEventMessage *) msg;
peer = GNUNET_malloc (sizeof (struct Peer));
peer->is_remote = GNUNET_YES;
peer->id = ntohl (success_msg->peer_id);
GNUNET_assert (NULL != fo_ctxt->cls);
peer->details.remote.controller = fo_ctxt->cls;
- peer_list_add (peer);
+ peer_list_add (peer);
}
msize = ntohs (msg->size);
dup_msg = GNUNET_malloc (msize);
- (void) memcpy (dup_msg, msg, msize);
+ (void) memcpy (dup_msg, msg, msize);
queue_message (fo_ctxt->client, dup_msg);
GNUNET_SERVER_client_drop (fo_ctxt->client);
- GNUNET_free (fo_ctxt);
+ GNUNET_free (fo_ctxt);
}
@@ -1595,9 +1586,8 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_peer_create (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_PeerCreateMessage *msg;
@@ -1613,8 +1603,8 @@
uint32_t host_id;
uint32_t peer_id;
uint16_t msize;
-
+
msize = ntohs (message->size);
if (msize <= sizeof (struct GNUNET_TESTBED_PeerCreateMessage))
{
@@ -1635,31 +1625,33 @@
if (host_id == master_context->host_id)
{
char *emsg;
-
+
/* We are responsible for this peer */
msize -= sizeof (struct GNUNET_TESTBED_PeerCreateMessage);
- config_size = ntohl (msg->config_size);
+ config_size = ntohl (msg->config_size);
config = GNUNET_malloc (config_size);
dest_size = config_size;
- if (Z_OK != (ret = uncompress ((Bytef *) config, (uLongf *) &dest_size,
- (const Bytef *) &msg[1], (uLong) msize)))
+ if (Z_OK !=
+ (ret =
+ uncompress ((Bytef *) config, (uLongf *) & dest_size,
+ (const Bytef *) &msg[1], (uLong) msize)))
{
- GNUNET_break (0); /* uncompression error */
+ GNUNET_break (0); /* uncompression error */
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
if (config_size != dest_size)
{
- GNUNET_break (0);/* Uncompressed config size mismatch */
+ GNUNET_break (0); /* Uncompressed config size mismatch */
GNUNET_free (config);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
cfg = GNUNET_CONFIGURATION_create ();
- if (GNUNET_OK != GNUNET_CONFIGURATION_deserialize (cfg, config,
config_size,
- GNUNET_NO))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_deserialize (cfg, config, config_size, GNUNET_NO))
{
- GNUNET_break (0); /* Configuration parsing error */
+ GNUNET_break (0); /* Configuration parsing error */
GNUNET_free (config);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
@@ -1670,11 +1662,11 @@
peer->details.local.cfg = cfg;
peer->id = peer_id;
LOG_DEBUG ("Creating peer with id: %u\n", peer->id);
- peer->details.local.peer =
- GNUNET_TESTING_peer_configure (master_context->system,
- peer->details.local.cfg, peer->id,
- NULL /* Peer id */,
- &emsg);
+ peer->details.local.peer =
+ GNUNET_TESTING_peer_configure (master_context->system,
+ peer->details.local.cfg, peer->id,
+ NULL /* Peer id */ ,
+ &emsg);
if (NULL == peer->details.local.peer)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "Configuring peer failed: %s\n", emsg);
@@ -1685,8 +1677,11 @@
return;
}
peer_list_add (peer);
- reply = GNUNET_malloc (sizeof (struct
GNUNET_TESTBED_PeerCreateSuccessEventMessage));
- reply->header.size = htons (sizeof (struct
GNUNET_TESTBED_PeerCreateSuccessEventMessage));
+ reply =
+ GNUNET_malloc (sizeof
+ (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage));
+ reply->header.size =
+ htons (sizeof (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage));
reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS);
reply->peer_id = msg->peer_id;
reply->operation_id = msg->operation_id;
@@ -1694,7 +1689,7 @@
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
-
+
/* Forward peer create request */
route = find_dest_route (host_id);
if (NULL == route)
@@ -1706,17 +1701,18 @@
fo_ctxt = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
GNUNET_SERVER_client_keep (client);
fo_ctxt->client = client;
- fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id);
- fo_ctxt->cls = slave_list[route->dest]->controller;
- fo_ctxt->opc =
- GNUNET_TESTBED_forward_operation_msg_ (slave_list[route->dest]->controller,
- fo_ctxt->operation_id,
- &msg->header,
- peer_create_success_cb, fo_ctxt);
- fo_ctxt->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &peer_create_forward_timeout, fo_ctxt);
-
+ fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id);
+ fo_ctxt->cls = slave_list[route->dest]->controller;
+ fo_ctxt->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (slave_list
+ [route->dest]->controller,
+ fo_ctxt->operation_id,
+ &msg->header,
+ peer_create_success_cb, fo_ctxt);
+ fo_ctxt->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &peer_create_forward_timeout,
+ fo_ctxt);
+
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -1728,20 +1724,19 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_peer_destroy (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_PeerDestroyMessage *msg;
struct ForwardedOperationContext *fopc;
struct Peer *peer;
uint32_t peer_id;
-
+
msg = (const struct GNUNET_TESTBED_PeerDestroyMessage *) message;
peer_id = ntohl (msg->peer_id);
LOG_DEBUG ("Received peer destory on peer: %u and operation id: %ul\n",
- peer_id, GNUNET_ntohll (msg->operation_id));
+ peer_id, GNUNET_ntohll (msg->operation_id));
if ((peer_list_size <= peer_id) || (NULL == peer_list[peer_id]))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -1756,18 +1751,17 @@
{
/* Forward the destory message to sub controller */
fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
- GNUNET_SERVER_client_keep (client);
+ GNUNET_SERVER_client_keep (client);
fopc->client = client;
fopc->operation_id = GNUNET_ntohll (msg->operation_id);
- fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
- fopc->operation_id,
- &msg->header,
- &forwarded_operation_reply_relay,
- fopc);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+ fopc->operation_id,
&msg->header,
+
&forwarded_operation_reply_relay,
+ fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &forwarded_operation_timeout, fopc);
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout,
+ fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1787,10 +1781,9 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_peer_start (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_PeerStartMessage *msg;
struct GNUNET_TESTBED_PeerEventMessage *reply;
@@ -1800,12 +1793,11 @@
msg = (const struct GNUNET_TESTBED_PeerStartMessage *) message;
peer_id = ntohl (msg->peer_id);
- if ((peer_id >= peer_list_size)
- || (NULL == peer_list[peer_id]))
+ if ((peer_id >= peer_list_size) || (NULL == peer_list[peer_id]))
{
GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_ERROR,
- "Asked to start a non existent peer with id: %u\n", peer_id);
+ "Asked to start a non existent peer with id: %u\n", peer_id);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -1813,23 +1805,21 @@
if (GNUNET_YES == peer->is_remote)
{
fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
- GNUNET_SERVER_client_keep (client);
+ GNUNET_SERVER_client_keep (client);
fopc->client = client;
fopc->operation_id = GNUNET_ntohll (msg->operation_id);
- fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
- fopc->operation_id,
- &msg->header,
- &forwarded_operation_reply_relay,
- fopc);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+ fopc->operation_id,
&msg->header,
+
&forwarded_operation_reply_relay,
+ fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &forwarded_operation_timeout, fopc);
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout,
+ fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
- if (GNUNET_OK !=
- GNUNET_TESTING_peer_start (peer->details.local.peer))
+ if (GNUNET_OK != GNUNET_TESTING_peer_start (peer->details.local.peer))
{
send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
"Failed to start");
@@ -1855,10 +1845,9 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_peer_stop (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_PeerStopMessage *msg;
struct GNUNET_TESTBED_PeerEventMessage *reply;
@@ -1869,7 +1858,7 @@
msg = (const struct GNUNET_TESTBED_PeerStopMessage *) message;
peer_id = ntohl (msg->peer_id);
if ((peer_id >= peer_list_size) || (NULL == peer_list[peer_id]))
- {
+ {
send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
"Peer not found");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -1879,23 +1868,21 @@
if (GNUNET_YES == peer->is_remote)
{
fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
- GNUNET_SERVER_client_keep (client);
+ GNUNET_SERVER_client_keep (client);
fopc->client = client;
fopc->operation_id = GNUNET_ntohll (msg->operation_id);
- fopc->opc =
- GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
- fopc->operation_id,
- &msg->header,
- &forwarded_operation_reply_relay,
- fopc);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+ fopc->operation_id,
&msg->header,
+
&forwarded_operation_reply_relay,
+ fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &forwarded_operation_timeout, fopc);
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout,
+ fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
- if (GNUNET_OK !=
- GNUNET_TESTING_peer_stop (peer->details.local.peer))
+ if (GNUNET_OK != GNUNET_TESTING_peer_stop (peer->details.local.peer))
{
send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
"Peer not running");
@@ -1921,9 +1908,8 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_peer_get_config (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg;
@@ -1932,10 +1918,10 @@
char *config;
char *xconfig;
size_t c_size;
- size_t xc_size;
+ size_t xc_size;
uint32_t peer_id;
uint16_t msize;
-
+
msg = (const struct GNUNET_TESTBED_PeerGetConfigurationMessage *) message;
peer_id = ntohl (msg->peer_id);
if ((peer_id >= peer_list_size) || (NULL == peer_list[peer_id]))
@@ -1954,12 +1940,13 @@
return;
}
config =
- GNUNET_CONFIGURATION_serialize (peer_list[peer_id]->details.local.cfg,
- &c_size);
+ GNUNET_CONFIGURATION_serialize (peer_list[peer_id]->details.local.cfg,
+ &c_size);
xc_size = GNUNET_TESTBED_compress_config_ (config, c_size, &xconfig);
GNUNET_free (config);
- msize = xc_size + sizeof (struct
-
GNUNET_TESTBED_PeerConfigurationInformationMessage);
+ msize =
+ xc_size +
+ sizeof (struct GNUNET_TESTBED_PeerConfigurationInformationMessage);
reply = GNUNET_realloc (xconfig, msize);
(void) memmove (&reply[1], reply, xc_size);
reply->header.size = htons (msize);
@@ -2030,11 +2017,10 @@
* @param ats performance data
* @param ats_count number of entries in ats (excluding 0-termination)
*/
-static void
-overlay_connect_notify (void *cls,
- const struct GNUNET_PeerIdentity * new_peer,
- const struct GNUNET_ATS_Information * ats,
- unsigned int ats_count)
+static void
+overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer,
+ const struct GNUNET_ATS_Information *ats,
+ unsigned int ats_count)
{
struct OverlayConnectContext *occ = cls;
struct GNUNET_TESTBED_ConnectionEventMessage *msg;
@@ -2042,16 +2028,18 @@
char *other_peer_str;
LOG_DEBUG ("Overlay connect notify\n");
- if (0 == memcmp (new_peer, &occ->peer_identity,
- sizeof (struct GNUNET_PeerIdentity)))
+ if (0 ==
+ memcmp (new_peer, &occ->peer_identity,
+ sizeof (struct GNUNET_PeerIdentity)))
return;
new_peer_str = GNUNET_strdup (GNUNET_i2s (new_peer));
other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
- if (0 != memcmp (new_peer, &occ->other_peer_identity,
- sizeof (struct GNUNET_PeerIdentity)))
+ if (0 !=
+ memcmp (new_peer, &occ->other_peer_identity,
+ sizeof (struct GNUNET_PeerIdentity)))
{
- LOG_DEBUG ("Unexpected peer %4s connected to peer %4s\n",
- new_peer_str, other_peer_str);
+ LOG_DEBUG ("Unexpected peer %4s connected to peer %4s\n", new_peer_str,
+ other_peer_str);
GNUNET_free (new_peer_str);
GNUNET_free (other_peer_str);
return;
@@ -2074,8 +2062,8 @@
/* Peer 1 has connected connect to peer2 - now send overlay connect success
message */
LOG_DEBUG ("Peers connected - Sending overlay connect success\n");
msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
- msg->header.size = htons (sizeof (struct
- GNUNET_TESTBED_ConnectionEventMessage));
+ msg->header.size =
+ htons (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT);
msg->event_type = htonl (GNUNET_TESTBED_ET_CONNECT);
msg->peer1 = htonl (occ->peer->id);
@@ -2098,12 +2086,13 @@
return;
GNUNET_assert (NULL != occ->hello);
other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
- LOG_DEBUG ("Offering HELLO of %s to %s\n", other_peer_str, GNUNET_i2s
(&occ->peer_identity));
+ LOG_DEBUG ("Offering HELLO of %s to %s\n", other_peer_str,
+ GNUNET_i2s (&occ->peer_identity));
GNUNET_free (other_peer_str);
GNUNET_TRANSPORT_offer_hello (occ->p1th, occ->hello, NULL, NULL);
GNUNET_TRANSPORT_try_connect (occ->p1th, &occ->other_peer_identity);
- occ->send_hello_task = GNUNET_SCHEDULER_add_delayed
(GNUNET_TIME_UNIT_SECONDS,
- &send_hello, occ);
+ occ->send_hello_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &send_hello,
occ);
}
/**
@@ -2112,7 +2101,7 @@
* @param cls empty flag to set
* @param address the HELLO
* @param expiration expiration of the HELLO
- * @return
+ * @return
*/
static int
test_address (void *cls, const struct GNUNET_HELLO_Address *address,
@@ -2132,28 +2121,29 @@
* @param cls closure
* @param hello our updated HELLO
*/
-static void
+static void
hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello)
{
struct OverlayConnectContext *occ = cls;
int empty;
uint16_t msize;
-
+
msize = ntohs (hello->size);
if (msize < 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "HELLO message of peer %s is of size 0\n",
- &occ->other_peer_identity);
+ "HELLO message of peer %s is of size 0\n",
+ &occ->other_peer_identity);
return;
}
empty = GNUNET_YES;
- (void)
- GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *)
hello,
- GNUNET_NO, &test_address, &empty);
+ (void) GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *)
+ hello, GNUNET_NO, &test_address,
+ &empty);
if (GNUNET_YES == empty)
{
- LOG_DEBUG ("HELLO of %s is empty\n", GNUNET_i2s
(&occ->other_peer_identity));
+ LOG_DEBUG ("HELLO of %s is empty\n",
+ GNUNET_i2s (&occ->other_peer_identity));
return;
}
LOG_DEBUG ("Received HELLO of %s\n", GNUNET_i2s (&occ->other_peer_identity));
@@ -2163,7 +2153,7 @@
occ->ghh = NULL;
GNUNET_TRANSPORT_disconnect (occ->p2th);
occ->p2th = NULL;
- GNUNET_free_non_null (occ->emsg);
+ GNUNET_free_non_null (occ->emsg);
occ->emsg = GNUNET_strdup ("Timeout while offering HELLO to other peer");
occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ);
}
@@ -2180,39 +2170,40 @@
* @param server handle to the server, NULL if we failed
* @param my_identity ID of this peer, NULL if we failed
*/
-static void
-core_startup_cb (void *cls, struct GNUNET_CORE_Handle * server,
- const struct GNUNET_PeerIdentity *my_identity)
+static void
+core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server,
+ const struct GNUNET_PeerIdentity *my_identity)
{
struct OverlayConnectContext *occ = cls;
GNUNET_free_non_null (occ->emsg);
occ->emsg = NULL;
- memcpy (&occ->peer_identity, my_identity, sizeof (struct
GNUNET_PeerIdentity));
+ memcpy (&occ->peer_identity, my_identity,
+ sizeof (struct GNUNET_PeerIdentity));
occ->p1th =
- GNUNET_TRANSPORT_connect (occ->peer->details.local.cfg,
- &occ->peer_identity, NULL, NULL, NULL, NULL);
+ GNUNET_TRANSPORT_connect (occ->peer->details.local.cfg,
+ &occ->peer_identity, NULL, NULL, NULL, NULL);
/* Connect to the transport of 2nd peer and get its HELLO message */
GNUNET_TESTING_peer_get_identity (occ->other_peer->details.local.peer,
- &occ->other_peer_identity);
- occ->p2th =
- GNUNET_TRANSPORT_connect (occ->other_peer->details.local.cfg,
- &occ->other_peer_identity,
- NULL, NULL, NULL, NULL);
+ &occ->other_peer_identity);
+ occ->p2th =
+ GNUNET_TRANSPORT_connect (occ->other_peer->details.local.cfg,
+ &occ->other_peer_identity, NULL, NULL, NULL,
+ NULL);
if ((NULL == occ->p1th) || (NULL == occ->p2th))
{
occ->emsg = GNUNET_strdup ("Cannot connect to TRANSPORTs of peers");
goto send_failure;
}
- LOG_DEBUG ("Acquiring HELLO of peer %s\n", GNUNET_i2s
- (&occ->other_peer_identity));
+ LOG_DEBUG ("Acquiring HELLO of peer %s\n",
+ GNUNET_i2s (&occ->other_peer_identity));
occ->emsg = GNUNET_strdup ("Timeout while acquiring HELLO message");
occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p2th, &hello_update_cb, occ);
return;
- send_failure:
+send_failure:
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);
}
@@ -2223,13 +2214,13 @@
* @param client identification of the client
* @param message the actual message
*/
-static void
-handle_overlay_connect (void *cls,
- struct GNUNET_SERVER_Client *client,
+static void
+handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_OverlayConnectMessage *msg;
struct OverlayConnectContext *occ;
+
struct GNUNET_CORE_MessageHandler no_handlers[] = {
{NULL, 0, 0}
};
@@ -2244,7 +2235,7 @@
GNUNET_assert (p2 < peer_list_size);
GNUNET_assert (NULL != peer_list[p2]);
/* FIXME: Add cases where we have to forward overlay connect message to sub
- controllers */
+ * controllers */
occ = GNUNET_malloc (sizeof (struct OverlayConnectContext));
GNUNET_SERVER_client_keep (client);
occ->client = client;
@@ -2253,15 +2244,15 @@
occ->other_peer = peer_list[p2];
occ->op_id = GNUNET_ntohll (msg->operation_id);
occ->timeout_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 30),
- &timeout_overlay_connect, occ);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 30),
+ &timeout_overlay_connect, occ);
/* Connect to the core of 1st peer and wait for the 2nd peer to connect */
occ->emsg = GNUNET_strdup ("Timeout while connecting to CORE");
- occ->ch =
- GNUNET_CORE_connect (occ->peer->details.local.cfg, occ, &core_startup_cb,
- &overlay_connect_notify, NULL, NULL, GNUNET_NO, NULL,
- GNUNET_NO, no_handlers);
+ occ->ch =
+ GNUNET_CORE_connect (occ->peer->details.local.cfg, occ, &core_startup_cb,
+ &overlay_connect_notify, NULL, NULL, GNUNET_NO,
NULL,
+ GNUNET_NO, no_handlers);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
@@ -2276,14 +2267,13 @@
* iterate,
* GNUNET_NO if not.
*/
-static int
-ss_map_free_iterator (void *cls,
- const struct GNUNET_HashCode * key, void *value)
+static int
+ss_map_free_iterator (void *cls, const struct GNUNET_HashCode *key, void
*value)
{
struct SharedService *ss = value;
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (ss_map, key, value));
+ GNUNET_CONTAINER_multihashmap_remove (ss_map, key, value));
GNUNET_free (ss->name);
GNUNET_free (ss);
return GNUNET_YES;
@@ -2297,8 +2287,7 @@
* @param tc the TaskContext from scheduler
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct LCFContextQueue *lcfq;
uint32_t id;
@@ -2307,7 +2296,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down testbed service\n");
(void) GNUNET_CONTAINER_multihashmap_iterate (ss_map, &ss_map_free_iterator,
NULL);
- GNUNET_CONTAINER_multihashmap_destroy (ss_map);
+ GNUNET_CONTAINER_multihashmap_destroy (ss_map);
if (NULL != lcfq_head)
{
if (GNUNET_SCHEDULER_NO_TASK != lcf_proc_task_id)
@@ -2331,10 +2320,10 @@
if (NULL != peer_list[id])
{
if (GNUNET_NO == peer_list[id]->is_remote)
- {
+ {
GNUNET_TESTING_peer_destroy (peer_list[id]->details.local.peer);
GNUNET_CONFIGURATION_destroy (peer_list[id]->details.local.cfg);
- }
+ }
GNUNET_free (peer_list[id]);
}
GNUNET_free_non_null (peer_list);
@@ -2353,12 +2342,12 @@
if (NULL != slave_list[id])
{
if (NULL != slave_list[id]->controller)
- GNUNET_TESTBED_controller_disconnect (slave_list[id]->controller);
+ GNUNET_TESTBED_controller_disconnect (slave_list[id]->controller);
if (NULL != slave_list[id]->controller_proc)
GNUNET_TESTBED_controller_stop (slave_list[id]->controller_proc);
}
if (NULL != master_context)
- {
+ {
GNUNET_free_non_null (master_context->master_ip);
if (NULL != master_context->system)
GNUNET_TESTING_system_destroy (master_context->system, GNUNET_YES);
@@ -2384,10 +2373,10 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "Master client disconnected\n");
GNUNET_SERVER_client_drop (client);
/* should not be needed as we're terminated by failure to read
- from stdin, but if stdin fails for some reason, this shouldn't
- hurt for now --- might need to revise this later if we ever
- decide that master connections might be temporarily down
- for some reason */
+ * from stdin, but if stdin fails for some reason, this shouldn't
+ * hurt for now --- might need to revise this later if we ever
+ * decide that master connections might be temporarily down
+ * for some reason */
//GNUNET_SCHEDULER_shutdown ();
}
}
@@ -2400,43 +2389,37 @@
* @param server the initialized server
* @param cfg configuration to use
*/
-static void
-testbed_run (void *cls,
- struct GNUNET_SERVER_Handle *server,
+static void
+testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- static const struct GNUNET_SERVER_MessageHandler message_handlers[] =
- {
- {&handle_init, NULL, GNUNET_MESSAGE_TYPE_TESTBED_INIT, 0},
- {&handle_add_host, NULL, GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST, 0},
- {&handle_configure_shared_service, NULL,
- GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE, 0},
- {&handle_link_controllers, NULL,
- GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS, 0},
- {&handle_peer_create, NULL, GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER, 0},
- {&handle_peer_destroy, NULL, GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER,
- sizeof (struct GNUNET_TESTBED_PeerDestroyMessage)},
- {&handle_peer_start, NULL, GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER,
- sizeof (struct GNUNET_TESTBED_PeerStartMessage)},
- {&handle_peer_stop, NULL, GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER,
- sizeof (struct GNUNET_TESTBED_PeerStopMessage)},
- {&handle_peer_get_config, NULL,
GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG,
- sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage)},
- {&handle_overlay_connect, NULL, GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT,
- sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)},
- {NULL}
- };
+ static const struct GNUNET_SERVER_MessageHandler message_handlers[] = {
+ {&handle_init, NULL, GNUNET_MESSAGE_TYPE_TESTBED_INIT, 0},
+ {&handle_add_host, NULL, GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST, 0},
+ {&handle_configure_shared_service, NULL,
+ GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE, 0},
+ {&handle_link_controllers, NULL,
+ GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS, 0},
+ {&handle_peer_create, NULL, GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER, 0},
+ {&handle_peer_destroy, NULL, GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER,
+ sizeof (struct GNUNET_TESTBED_PeerDestroyMessage)},
+ {&handle_peer_start, NULL, GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER,
+ sizeof (struct GNUNET_TESTBED_PeerStartMessage)},
+ {&handle_peer_stop, NULL, GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER,
+ sizeof (struct GNUNET_TESTBED_PeerStopMessage)},
+ {&handle_peer_get_config, NULL, GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG,
+ sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage)},
+ {&handle_overlay_connect, NULL, GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT,
+ sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)},
+ {NULL}
+ };
- GNUNET_SERVER_add_handlers (server,
- message_handlers);
- GNUNET_SERVER_disconnect_notify (server,
- &client_disconnect_cb,
- NULL);
+ GNUNET_SERVER_add_handlers (server, message_handlers);
+ GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL);
ss_map = GNUNET_CONTAINER_multihashmap_create (5);
- shutdown_task_id =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_task,
- NULL);
+ shutdown_task_id =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ &shutdown_task, NULL);
LOG_DEBUG ("Testbed startup complete\n");
}
@@ -2444,15 +2427,11 @@
/**
* The starting point of execution
*/
-int main (int argc, char *const *argv)
+int
+main (int argc, char *const *argv)
{
- //sleep (15); /* Debugging */
- return
- (GNUNET_OK ==
- GNUNET_SERVICE_run (argc,
- argv,
- "testbed",
- GNUNET_SERVICE_OPTION_NONE,
- &testbed_run,
- NULL)) ? 0 : 1;
+ //sleep (15); /* Debugging */
+ return (GNUNET_OK ==
+ GNUNET_SERVICE_run (argc, argv, "testbed",
GNUNET_SERVICE_OPTION_NONE,
+ &testbed_run, NULL)) ? 0 : 1;
}
Modified: gnunet/src/testbed/gnunet-testbed-helper.c
===================================================================
--- gnunet/src/testbed/gnunet-testbed-helper.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/gnunet-testbed-helper.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -26,7 +26,7 @@
* with ports and paths fixed so that gnunet-service-testbed runs
* without any hurdles. This binary also kills the testbed service
* should the connection from the remote controller is dropped
- * @author Sree Harsha Totakura <address@hidden>
+ * @author Sree Harsha Totakura <address@hidden>
*/
@@ -150,7 +150,7 @@
(void) GNUNET_DISK_file_close (stdin_fd);
if (NULL != stdout_fd)
(void) GNUNET_DISK_file_close (stdout_fd);
- GNUNET_SERVER_mst_destroy (tokenizer);
+ GNUNET_SERVER_mst_destroy (tokenizer);
tokenizer = NULL;
if (NULL != testbed)
{
@@ -188,8 +188,9 @@
GNUNET_free (wc);
return;
}
- bytes_wrote = GNUNET_DISK_file_write (stdout_fd, wc->data + wc->pos,
- wc->length - wc->pos);
+ bytes_wrote =
+ GNUNET_DISK_file_write (stdout_fd, wc->data + wc->pos,
+ wc->length - wc->pos);
GNUNET_assert (GNUNET_SYSERR != bytes_wrote);
wc->pos += bytes_wrote;
if (wc->pos == wc->length)
@@ -198,8 +199,9 @@
GNUNET_free (wc);
return;
}
- write_task_id = GNUNET_SCHEDULER_add_write_file
- (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd, &write_task, wc);
+ write_task_id =
+ GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd,
+ &write_task, wc);
}
@@ -215,7 +217,7 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing
*/
-static int
+static int
tokenizer_cb (void *cls, void *client,
const struct GNUNET_MessageHeader *message)
{
@@ -234,8 +236,7 @@
if ((sizeof (struct GNUNET_TESTBED_HelperInit) >= ntohs (message->size)) ||
(GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT != ntohs (message->type)))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Received unexpected message -- exiting\n");
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message --
exiting\n");
goto error;
}
msg = (const struct GNUNET_TESTBED_HelperInit *) message;
@@ -243,28 +244,30 @@
controller = (char *) &msg[1];
if ('\0' != controller[cname_size])
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"Controller name cannot be empty -- exiting\n");
goto error;
}
ul_config_size = (uLongf) ntohs (msg->config_size);
config = GNUNET_malloc (ul_config_size);
- xconfig_size = ntohs (message->size) -
- (cname_size + 1 + sizeof (struct GNUNET_TESTBED_HelperInit));
- if (Z_OK != uncompress ((Bytef *) config, &ul_config_size,
- (const Bytef *) (controller + cname_size + 1),
- (uLongf) xconfig_size))
+ xconfig_size =
+ ntohs (message->size) - (cname_size + 1 +
+ sizeof (struct GNUNET_TESTBED_HelperInit));
+ if (Z_OK !=
+ uncompress ((Bytef *) config, &ul_config_size,
+ (const Bytef *) (controller + cname_size + 1),
+ (uLongf) xconfig_size))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"Error while uncompressing config -- exiting\n");
GNUNET_free (config);
goto error;
}
- cfg = GNUNET_CONFIGURATION_create ();
- if (GNUNET_OK != GNUNET_CONFIGURATION_deserialize (cfg, config,
- ul_config_size,
GNUNET_NO))
+ cfg = GNUNET_CONFIGURATION_create ();
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_deserialize (cfg, config, ul_config_size,
GNUNET_NO))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"Unable to deserialize config -- exiting\n");
GNUNET_free (config);
goto error;
@@ -272,26 +275,30 @@
GNUNET_free (config);
test_system = GNUNET_TESTING_system_create ("testbed-helper", controller);
GNUNET_assert (NULL != test_system);
- GNUNET_assert (GNUNET_OK == GNUNET_TESTING_configuration_create
- (test_system, cfg));
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string
- (cfg, "PATHS", "DEFAULTCONFIG", &config));
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_TESTING_configuration_create (test_system, cfg));
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg, "PATHS",
+ "DEFAULTCONFIG",
+ &config));
if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"Unable to write config file: %s -- exiting\n", config);
GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free (config);
goto error;
}
LOG_DEBUG ("Staring testbed with config: %s\n", config);
- testbed = GNUNET_OS_start_process
- (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR /*verbose? */, NULL, NULL,
- "gnunet-service-testbed", "gnunet-service-testbed", "-c", config, NULL);
+ testbed =
+ GNUNET_OS_start_process (GNUNET_YES,
+ GNUNET_OS_INHERIT_STD_ERR /*verbose? */ , NULL,
+ NULL, "gnunet-service-testbed",
+ "gnunet-service-testbed", "-c", config, NULL);
GNUNET_free (config);
if (NULL == testbed)
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
+ LOG (GNUNET_ERROR_TYPE_WARNING,
"Error staring gnunet-service-testbed -- exiting\n");
GNUNET_CONFIGURATION_destroy (cfg);
goto error;
@@ -300,8 +307,8 @@
config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
GNUNET_CONFIGURATION_destroy (cfg);
cfg = NULL;
- xconfig_size = GNUNET_TESTBED_compress_config_ (config, config_size,
- &xconfig);
+ xconfig_size =
+ GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
GNUNET_free (config);
wc = GNUNET_malloc (sizeof (struct WriteContext));
wc->length = xconfig_size + sizeof (struct GNUNET_TESTBED_HelperReply);
@@ -311,11 +318,12 @@
reply->header.size = htons ((uint16_t) wc->length);
reply->config_size = htons ((uint16_t) config_size);
wc->data = reply;
- write_task_id = GNUNET_SCHEDULER_add_write_file
- (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd, &write_task, wc);
+ write_task_id =
+ GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, stdout_fd,
+ &write_task, wc);
return GNUNET_OK;
-
- error:
+
+error:
status = GNUNET_SYSERR;
GNUNET_SCHEDULER_shutdown ();
return GNUNET_SYSERR;
@@ -336,7 +344,7 @@
read_task_id = GNUNET_SCHEDULER_NO_TASK;
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
- return;
+ return;
sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof (buf));
if ((GNUNET_SYSERR == sread) || (0 == sread))
{
@@ -351,16 +359,16 @@
}
LOG_DEBUG ("Read %u bytes\n", sread);
if (GNUNET_OK !=
- GNUNET_SERVER_mst_receive (tokenizer, NULL, buf, sread,
- GNUNET_NO, GNUNET_NO))
+ GNUNET_SERVER_mst_receive (tokenizer, NULL, buf, sread, GNUNET_NO,
+ GNUNET_NO))
{
GNUNET_break (0);
GNUNET_SCHEDULER_shutdown ();
return;
}
read_task_id = /* No timeout while reading */
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- stdin_fd, &read_task, NULL);
+ GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, stdin_fd,
+ &read_task, NULL);
}
@@ -372,19 +380,19 @@
* @param cfgfile name of the configuration file used (for saving, can be
NULL!)
* @param cfg configuration
*/
-static void
+static void
run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle * cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
LOG_DEBUG ("Starting testbed helper...\n");
tokenizer = GNUNET_SERVER_mst_create (&tokenizer_cb, NULL);
stdin_fd = GNUNET_DISK_get_handle_from_native (stdin);
stdout_fd = GNUNET_DISK_get_handle_from_native (stdout);
read_task_id =
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- stdin_fd, &read_task, NULL);
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_task, NULL);
+ GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, stdin_fd,
+ &read_task, NULL);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
+ NULL);
}
@@ -400,8 +408,8 @@
GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (testbed));
GNUNET_OS_process_destroy (testbed);
testbed = NULL;
- GNUNET_SCHEDULER_shutdown (); /* We are done too! */
- }
+ GNUNET_SCHEDULER_shutdown (); /* We are done too! */
+ }
}
@@ -412,9 +420,11 @@
* @param argv command line arg array
* @return return code
*/
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
struct GNUNET_SIGNAL_Context *shc_chld;
+
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
@@ -423,10 +433,11 @@
status = GNUNET_OK;
in_shutdown = GNUNET_NO;
shc_chld =
- GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
- ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-helper",
- "Helper for starting gnunet-service-testbed",
- options, &run, NULL);
+ GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
+ ret =
+ GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-helper",
+ "Helper for starting gnunet-service-testbed",
options,
+ &run, NULL);
GNUNET_SIGNAL_handler_uninstall (shc_chld);
shc_chld = NULL;
if (GNUNET_OK != ret)
Modified: gnunet/src/testbed/test_gnunet_testbed_helper.c
===================================================================
--- gnunet/src/testbed/test_gnunet_testbed_helper.c 2012-08-31 10:06:42 UTC
(rev 23530)
+++ gnunet/src/testbed/test_gnunet_testbed_helper.c 2012-08-31 10:36:28 UTC
(rev 23531)
@@ -21,7 +21,7 @@
/**
* @file testbed/test_gnunet_testbed_helper.c
* @brief Testcase for testing gnunet-testbed-helper.c
- * @author Sree Harsha Totakura <address@hidden>
+ * @author Sree Harsha Totakura <address@hidden>
*/
#include "platform.h"
@@ -84,7 +84,7 @@
*/
static void
do_shutdown (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
+{
if (GNUNET_SCHEDULER_NO_TASK != abort_task)
GNUNET_SCHEDULER_cancel (abort_task);
GNUNET_HELPER_stop (helper);
@@ -115,13 +115,13 @@
/**
* Continuation function.
- *
+ *
* @param cls closure
* @param result GNUNET_OK on success,
* GNUNET_NO if helper process died
* GNUNET_SYSERR during GNUNET_HELPER_stop
*/
-static void
+static void
cont_cb (void *cls, int result)
{
shandle = NULL;
@@ -142,32 +142,35 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing
*/
-static int
+static int
mst_cb (void *cls, void *client, const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_HelperReply *msg;
char *config;
uLongf config_size;
uLongf xconfig_size;
-
+
msg = (const struct GNUNET_TESTBED_HelperReply *) message;
config_size = 0;
xconfig_size = 0;
- GNUNET_assert (sizeof (struct GNUNET_TESTBED_HelperReply)
- < ntohs (msg->header.size));
- GNUNET_assert (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY
- == ntohs (msg->header.type));
+ GNUNET_assert (sizeof (struct GNUNET_TESTBED_HelperReply) <
+ ntohs (msg->header.size));
+ GNUNET_assert (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY ==
+ ntohs (msg->header.type));
config_size = (uLongf) ntohs (msg->config_size);
- xconfig_size = (uLongf) (ntohs (msg->header.size)
- - sizeof (struct GNUNET_TESTBED_HelperReply));
+ xconfig_size =
+ (uLongf) (ntohs (msg->header.size) -
+ sizeof (struct GNUNET_TESTBED_HelperReply));
config = GNUNET_malloc (config_size);
- GNUNET_assert (Z_OK == uncompress ((Bytef *) config, &config_size,
- (const Bytef *) &msg[1], xconfig_size));
+ GNUNET_assert (Z_OK ==
+ uncompress ((Bytef *) config, &config_size,
+ (const Bytef *) &msg[1], xconfig_size));
GNUNET_free (config);
if (GNUNET_SCHEDULER_NO_TASK == shutdown_task)
- shutdown_task = GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
- &do_shutdown, NULL);
+ shutdown_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 1),
+ &do_shutdown, NULL);
return GNUNET_OK;
}
@@ -178,7 +181,7 @@
*
* @param cls the closure from GNUNET_HELPER_start()
*/
-static void
+static void
exp_cb (void *cls)
{
helper = NULL;
@@ -194,29 +197,29 @@
* @param cfgfile name of the configuration file used (for saving, can be
NULL!)
* @param cfg configuration
*/
-static void
+static void
run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle * cfg2)
+ const struct GNUNET_CONFIGURATION_Handle *cfg2)
{
- static char * const binary_argv[] = {
+ static char *const binary_argv[] = {
"gnunet-testbed-helper",
NULL
- };
+ };
const char *controller_name = "127.0.0.1";
- helper = GNUNET_HELPER_start (GNUNET_YES,
- "gnunet-testbed-helper",
- binary_argv,
- &mst_cb, &exp_cb, NULL);
+ helper =
+ GNUNET_HELPER_start (GNUNET_YES, "gnunet-testbed-helper", binary_argv,
+ &mst_cb, &exp_cb, NULL);
GNUNET_assert (NULL != helper);
- cfg = GNUNET_CONFIGURATION_dup (cfg2);
+ cfg = GNUNET_CONFIGURATION_dup (cfg2);
msg = GNUNET_TESTBED_create_helper_init_msg_ (controller_name, cfg);
- shandle = GNUNET_HELPER_send (helper,
- &msg->header,
- GNUNET_NO, &cont_cb, NULL);
+ shandle =
+ GNUNET_HELPER_send (helper, &msg->header, GNUNET_NO, &cont_cb, NULL);
GNUNET_assert (NULL != shandle);
- abort_task = GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1), &do_abort,
NULL);
+ abort_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MINUTES, 1), &do_abort,
+ NULL);
}
@@ -227,17 +230,18 @@
* @param argv command line arg array
* @return return code
*/
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
-
+
result = GNUNET_OK;
- if (GNUNET_OK !=
+ if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc, argv, "test_gnunet_testbed_helper",
- "Testcase for testing gnunet-testbed-helper.c",
- options, &run, NULL))
+ "Testcase for testing gnunet-testbed-helper.c",
+ options, &run, NULL))
return 1;
return (GNUNET_OK == result) ? 0 : 1;
}
Modified: gnunet/src/testbed/test_testbed_api.c
===================================================================
--- gnunet/src/testbed/test_testbed_api.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/test_testbed_api.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -102,27 +102,27 @@
* Enumeration of sub testcases
*/
enum Test
- {
+{
/**
* Test cases which are not covered by the below ones
*/
- OTHER,
+ OTHER,
/**
* Test where we get a peer config from controller
*/
- PEER_GETCONFIG,
+ PEER_GETCONFIG,
/**
* Test where we connect to a service running on the peer
*/
- PEER_SERVICE_CONNECT,
+ PEER_SERVICE_CONNECT,
/**
* Test where we get a peer's identity from controller
*/
- PEER_DESTROY,
- };
+ PEER_DESTROY,
+};
/**
* Testing status
@@ -170,7 +170,7 @@
/**
* Adapter function called to establish a connection to
* a service.
- *
+ *
* @param cls closure
* @param cfg configuration of the peer to connect to; will be available until
* GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -178,8 +178,7 @@
* @return service handle to return in 'op_result', NULL on error
*/
static void *
-dht_connect_adapter (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+dht_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (NULL == cls);
GNUNET_assert (OTHER == sub_test);
@@ -192,13 +191,12 @@
/**
* Adapter function called to destroy a connection to
* a service.
- *
+ *
* @param cls closure
* @param op_result service handle returned from the connect adapter
*/
-static void
-dht_disconnect_adapter (void *cls,
- void *op_result)
+static void
+dht_disconnect_adapter (void *cls, void *op_result)
{
if (NULL != op_result)
GNUNET_DHT_disconnect (op_result);
@@ -217,20 +215,20 @@
* @param cls closure
* @param event information about the event
*/
-static void
-controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
+static void
+controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
{
switch (event->type)
{
case GNUNET_TESTBED_ET_OPERATION_FINISHED:
- switch(sub_test)
+ switch (sub_test)
{
case PEER_GETCONFIG:
GNUNET_assert (event->details.operation_finished.operation == operation);
GNUNET_assert (NULL == event->details.operation_finished.op_cls);
GNUNET_assert (NULL == event->details.operation_finished.emsg);
GNUNET_assert (GNUNET_TESTBED_PIT_CONFIGURATION ==
- event->details.operation_finished.pit);
+ event->details.operation_finished.pit);
GNUNET_assert (NULL != event->details.operation_finished.op_result.cfg);
sub_test = PEER_DESTROY;
GNUNET_TESTBED_operation_done (operation);
@@ -241,9 +239,9 @@
GNUNET_assert (NULL == event->details.operation_finished.op_cls);
GNUNET_assert (NULL == event->details.operation_finished.emsg);
GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC ==
- event->details.operation_finished.pit);
+ event->details.operation_finished.pit);
GNUNET_assert (NULL ==
- event->details.operation_finished.op_result.generic);
+ event->details.operation_finished.op_result.generic);
GNUNET_TESTBED_operation_done (operation);
GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
break;
@@ -252,27 +250,26 @@
GNUNET_assert (NULL == event->details.operation_finished.op_cls);
GNUNET_assert (NULL == event->details.operation_finished.emsg);
GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC ==
- event->details.operation_finished.pit);
+ event->details.operation_finished.pit);
GNUNET_assert (NULL != dht_handle);
- GNUNET_assert (event->details.operation_finished.op_result.generic
- == dht_handle);
- GNUNET_TESTBED_operation_done (operation); /* This results in call to
- * disconnect adapter */
+ GNUNET_assert (event->details.operation_finished.op_result.generic ==
+ dht_handle);
+ GNUNET_TESTBED_operation_done (operation); /* This results in
call to
+ * disconnect adapter
*/
break;
case OTHER:
GNUNET_assert (0);
break;
- }
+ }
break;
case GNUNET_TESTBED_ET_PEER_START:
GNUNET_assert (event->details.peer_start.host == host);
GNUNET_assert (event->details.peer_start.peer == peer);
GNUNET_assert (OTHER == sub_test);
GNUNET_TESTBED_operation_done (operation);
- operation = GNUNET_TESTBED_service_connect (NULL, peer, "dht",
- &dht_connect_adapter,
- &dht_disconnect_adapter,
- NULL);
+ operation =
+ GNUNET_TESTBED_service_connect (NULL, peer, "dht",
&dht_connect_adapter,
+ &dht_disconnect_adapter, NULL);
GNUNET_assert (NULL != operation);
break;
case GNUNET_TESTBED_ET_PEER_STOP:
@@ -281,12 +278,12 @@
result = GNUNET_YES;
sub_test = PEER_GETCONFIG;
GNUNET_TESTBED_operation_done (operation);
- operation =
- GNUNET_TESTBED_peer_get_information (peer,
- GNUNET_TESTBED_PIT_CONFIGURATION);
+ operation =
+ GNUNET_TESTBED_peer_get_information (peer,
+ GNUNET_TESTBED_PIT_CONFIGURATION);
break;
default:
- GNUNET_assert (0); /* We should never reach this state */
+ GNUNET_assert (0); /* We should never reach this state */
}
}
@@ -301,11 +298,10 @@
* @param emsg NULL if peer is not NULL; else MAY contain the error description
*/
static void
-peer_create_cb (void *cls,
- struct GNUNET_TESTBED_Peer *peer, const char *emsg)
+peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
{
struct GNUNET_TESTBED_Peer **peer_ptr;
-
+
peer_ptr = cls;
GNUNET_assert (NULL != peer);
GNUNET_assert (NULL != peer_ptr);
@@ -322,12 +318,14 @@
* @param cls the host which has been registered
* @param emsg the error message; NULL if host registration is successful
*/
-static void
+static void
registration_comp (void *cls, const char *emsg)
{
GNUNET_assert (cls == neighbour);
- reg_handle = NULL;
- operation = GNUNET_TESTBED_peer_create (controller, host, cfg,
&peer_create_cb, &peer);
+ reg_handle = NULL;
+ operation =
+ GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb,
+ &peer);
GNUNET_assert (NULL != operation);
}
@@ -341,9 +339,8 @@
* @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
* GNUNET_TESTBED_controller_stop() shouldn't be called in this case
*/
-static void
-status_cb (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
+static void
+status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int
status)
{
uint64_t event_mask;
@@ -353,21 +350,22 @@
event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED);
- controller = GNUNET_TESTBED_controller_connect (cfg, host, event_mask,
- &controller_cb, NULL);
+ controller =
+ GNUNET_TESTBED_controller_connect (cfg, host, event_mask, &controller_cb,
+ NULL);
GNUNET_assert (NULL != controller);
neighbour = GNUNET_TESTBED_host_create ("localhost", NULL, 0);
GNUNET_assert (NULL != neighbour);
- reg_handle =
- GNUNET_TESTBED_register_host (controller, neighbour, ®istration_comp,
- neighbour);
+ reg_handle =
+ GNUNET_TESTBED_register_host (controller, neighbour, ®istration_comp,
+ neighbour);
GNUNET_assert (NULL != reg_handle);
}
/**
- * Main run function.
+ * Main run function.
*
* @param cls NULL
* @param args arguments passed to GNUNET_PROGRAM_run
@@ -381,30 +379,35 @@
host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
GNUNET_assert (NULL != host);
cfg = GNUNET_CONFIGURATION_dup (config);
- cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
NULL);
- abort_task = GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5), &do_abort,
NULL);
+ cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
+ NULL);
+ abort_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MINUTES, 5), &do_abort,
+ NULL);
}
/**
* Main function
*/
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
int ret;
+
char *const argv2[] = { "test_testbed_api",
- "-c", "test_testbed_api.conf",
- NULL
+ "-c", "test_testbed_api.conf",
+ NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
result = GNUNET_SYSERR;
- ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_testbed_api", "nohelp", options, &run,
- NULL);
+ ret =
+ GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
+ "test_testbed_api", "nohelp", options, &run, NULL);
if ((GNUNET_OK != ret) || (GNUNET_OK != result))
return 1;
return 0;
Modified: gnunet/src/testbed/test_testbed_api_2peers.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_2peers.c 2012-08-31 10:06:42 UTC
(rev 23530)
+++ gnunet/src/testbed/test_testbed_api_2peers.c 2012-08-31 10:36:28 UTC
(rev 23531)
@@ -51,9 +51,9 @@
{
/**
* The peer handle
- */
+ */
struct GNUNET_TESTBED_Peer *peer;
-
+
/**
* Operations involving this peer
*/
@@ -119,38 +119,38 @@
* Different stages in testing
*/
enum Stage
- {
+{
/**
* Initial stage
*/
- INIT,
-
+ INIT,
+
/**
* peers are created
*/
- PEERS_CREATED,
-
+ PEERS_CREATED,
+
/**
* peers are started
*/
- PEERS_STARTED,
-
+ PEERS_STARTED,
+
/**
* peers are connected
*/
- PEERS_CONNECTED,
+ PEERS_CONNECTED,
/**
* peers are stopped
*/
- PEERS_STOPPED,
+ PEERS_STOPPED,
/**
* Final success stage
*/
- SUCCESS
- };
+ SUCCESS
+};
/**
* The testing result
@@ -202,99 +202,98 @@
* @param cls closure
* @param event information about the event
*/
-static void
-controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
+static void
+controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
{
- switch (event->type)
- {
- case GNUNET_TESTBED_ET_OPERATION_FINISHED: /* Will be reached when we destroy
peers */
- GNUNET_assert (PEERS_STOPPED == result);
- GNUNET_assert (NULL == event->details.operation_finished.op_cls);
- GNUNET_assert (NULL == event->details.operation_finished.emsg);
- GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC ==
- event->details.operation_finished.pit);
- GNUNET_assert (NULL ==
- event->details.operation_finished.op_result.generic);
- if (event->details.operation_finished.operation == peer1.operation)
- {
- GNUNET_TESTBED_operation_done (peer1.operation);
- peer1.operation = NULL;
- peer1.peer = NULL;
- }
- else if (event->details.operation_finished.operation == peer2.operation)
- {
- GNUNET_TESTBED_operation_done (peer2.operation);
- peer2.operation = NULL;
- peer2.peer = NULL;
- }
- else
- GNUNET_assert (0);
- if ((NULL == peer1.peer) && (NULL == peer2.peer))
- {
- result = SUCCESS;
- GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
- }
- break;
- case GNUNET_TESTBED_ET_PEER_START:
- GNUNET_assert (INIT == result);
- GNUNET_assert (event->details.peer_start.host == host);
- if (event->details.peer_start.peer == peer1.peer)
- {
- peer1.is_running = GNUNET_YES;
- GNUNET_TESTBED_operation_done (peer1.operation);
- peer1.operation = NULL;
- }
- else if (event->details.peer_start.peer == peer2.peer)
- {
- peer2.is_running = GNUNET_YES;
- GNUNET_TESTBED_operation_done (peer2.operation);
- peer2.operation = NULL;
- }
- else
- GNUNET_assert (0);
- if ((GNUNET_YES == peer1.is_running) && (GNUNET_YES == peer2.is_running))
- {
- result = PEERS_STARTED;
- common_operation =
- GNUNET_TESTBED_overlay_connect (NULL, peer1.peer, peer2.peer);
- }
- break;
- case GNUNET_TESTBED_ET_PEER_STOP:
- GNUNET_assert (PEERS_CONNECTED == result);
- if (event->details.peer_stop.peer == peer1.peer)
- {
- peer1.is_running = GNUNET_NO;
- GNUNET_TESTBED_operation_done (peer1.operation);
- peer1.operation = GNUNET_TESTBED_peer_destroy (peer1.peer);
- }
- else if (event->details.peer_stop.peer == peer2.peer)
- {
- peer2.is_running = GNUNET_NO;
- GNUNET_TESTBED_operation_done (peer2.operation);
- peer2.operation = GNUNET_TESTBED_peer_destroy (peer2.peer);
- }
- else
- GNUNET_assert (0);
- if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running))
- result = PEERS_STOPPED;
- break;
- case GNUNET_TESTBED_ET_CONNECT:
- GNUNET_assert (PEERS_STARTED == result);
- GNUNET_assert (NULL == peer1.operation);
- GNUNET_assert (NULL == peer2.operation);
- GNUNET_assert (NULL != common_operation);
- GNUNET_assert ((event->details.peer_connect.peer1 == peer1.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");
- peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer);
- peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer);
- break;
- default:
- GNUNET_assert (0);
- };
+ switch (event->type)
+ {
+ case GNUNET_TESTBED_ET_OPERATION_FINISHED: /* Will be reached when we
destroy peers */
+ GNUNET_assert (PEERS_STOPPED == result);
+ GNUNET_assert (NULL == event->details.operation_finished.op_cls);
+ GNUNET_assert (NULL == event->details.operation_finished.emsg);
+ GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC ==
+ event->details.operation_finished.pit);
+ GNUNET_assert (NULL ==
event->details.operation_finished.op_result.generic);
+ if (event->details.operation_finished.operation == peer1.operation)
+ {
+ GNUNET_TESTBED_operation_done (peer1.operation);
+ peer1.operation = NULL;
+ peer1.peer = NULL;
+ }
+ else if (event->details.operation_finished.operation == peer2.operation)
+ {
+ GNUNET_TESTBED_operation_done (peer2.operation);
+ peer2.operation = NULL;
+ peer2.peer = NULL;
+ }
+ else
+ GNUNET_assert (0);
+ if ((NULL == peer1.peer) && (NULL == peer2.peer))
+ {
+ result = SUCCESS;
+ GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ }
+ break;
+ case GNUNET_TESTBED_ET_PEER_START:
+ GNUNET_assert (INIT == result);
+ GNUNET_assert (event->details.peer_start.host == host);
+ if (event->details.peer_start.peer == peer1.peer)
+ {
+ peer1.is_running = GNUNET_YES;
+ GNUNET_TESTBED_operation_done (peer1.operation);
+ peer1.operation = NULL;
+ }
+ else if (event->details.peer_start.peer == peer2.peer)
+ {
+ peer2.is_running = GNUNET_YES;
+ GNUNET_TESTBED_operation_done (peer2.operation);
+ peer2.operation = NULL;
+ }
+ else
+ GNUNET_assert (0);
+ if ((GNUNET_YES == peer1.is_running) && (GNUNET_YES == peer2.is_running))
+ {
+ result = PEERS_STARTED;
+ common_operation =
+ GNUNET_TESTBED_overlay_connect (NULL, peer1.peer, peer2.peer);
+ }
+ break;
+ case GNUNET_TESTBED_ET_PEER_STOP:
+ GNUNET_assert (PEERS_CONNECTED == result);
+ if (event->details.peer_stop.peer == peer1.peer)
+ {
+ peer1.is_running = GNUNET_NO;
+ GNUNET_TESTBED_operation_done (peer1.operation);
+ peer1.operation = GNUNET_TESTBED_peer_destroy (peer1.peer);
+ }
+ else if (event->details.peer_stop.peer == peer2.peer)
+ {
+ peer2.is_running = GNUNET_NO;
+ GNUNET_TESTBED_operation_done (peer2.operation);
+ peer2.operation = GNUNET_TESTBED_peer_destroy (peer2.peer);
+ }
+ else
+ GNUNET_assert (0);
+ if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running))
+ result = PEERS_STOPPED;
+ break;
+ case GNUNET_TESTBED_ET_CONNECT:
+ GNUNET_assert (PEERS_STARTED == result);
+ GNUNET_assert (NULL == peer1.operation);
+ GNUNET_assert (NULL == peer2.operation);
+ GNUNET_assert (NULL != common_operation);
+ GNUNET_assert ((event->details.peer_connect.peer1 == peer1.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");
+ peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer);
+ peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer);
+ break;
+ default:
+ GNUNET_assert (0);
+ };
}
@@ -308,8 +307,7 @@
* @param emsg NULL if peer is not NULL; else MAY contain the error description
*/
static void
-peer_create_cb (void *cls,
- struct GNUNET_TESTBED_Peer *peer, const char *emsg)
+peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
{
struct PeerContext *pc = cls;
@@ -328,15 +326,17 @@
* @param cls the host which has been registered
* @param emsg the error message; NULL if host registration is successful
*/
-static void
+static void
registration_comp (void *cls, const char *emsg)
{
GNUNET_assert (cls == neighbour);
- reg_handle = NULL;
- peer1.operation = GNUNET_TESTBED_peer_create (controller, host, cfg,
- &peer_create_cb, &peer1);
- peer2.operation = GNUNET_TESTBED_peer_create (controller, host, cfg,
- &peer_create_cb, &peer2);
+ reg_handle = NULL;
+ peer1.operation =
+ GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb,
+ &peer1);
+ peer2.operation =
+ GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb,
+ &peer2);
GNUNET_assert (NULL != peer1.operation);
GNUNET_assert (NULL != peer2.operation);
}
@@ -351,9 +351,8 @@
* @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
* GNUNET_TESTBED_controller_stop() shouldn't be called in this case
*/
-static void
-status_cb (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg, int status)
+static void
+status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, int
status)
{
uint64_t event_mask;
@@ -363,21 +362,22 @@
event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);
event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED);
- controller = GNUNET_TESTBED_controller_connect (cfg, host, event_mask,
- &controller_cb, NULL);
+ controller =
+ GNUNET_TESTBED_controller_connect (cfg, host, event_mask, &controller_cb,
+ NULL);
GNUNET_assert (NULL != controller);
neighbour = GNUNET_TESTBED_host_create ("localhost", NULL, 0);
GNUNET_assert (NULL != neighbour);
- reg_handle =
- GNUNET_TESTBED_register_host (controller, neighbour, ®istration_comp,
- neighbour);
+ reg_handle =
+ GNUNET_TESTBED_register_host (controller, neighbour, ®istration_comp,
+ neighbour);
GNUNET_assert (NULL != reg_handle);
}
/**
- * Main run function.
+ * Main run function.
*
* @param cls NULL
* @param args arguments passed to GNUNET_PROGRAM_run
@@ -391,30 +391,35 @@
host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
GNUNET_assert (NULL != host);
cfg = GNUNET_CONFIGURATION_dup (config);
- cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
NULL);
- abort_task = GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 30), &do_abort,
NULL);
+ cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
+ NULL);
+ abort_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MINUTES, 30), &do_abort,
+ NULL);
}
/**
* Main function
*/
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
int ret;
char *const argv2[] = { "test_testbed_api_2peers",
- "-c", "test_testbed_api.conf",
- NULL
+ "-c", "test_testbed_api.conf",
+ NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
result = INIT;
- ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_testbed_api_2peers", "nohelp", options, &run,
- NULL);
+ ret =
+ GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
+ "test_testbed_api_2peers", "nohelp", options, &run,
+ NULL);
if ((GNUNET_OK != ret) || (SUCCESS != result))
return 1;
return 0;
Modified: gnunet/src/testbed/test_testbed_api_controllerlink.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-08-31
10:06:42 UTC (rev 23530)
+++ gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-08-31
10:36:28 UTC (rev 23531)
@@ -21,7 +21,7 @@
/**
* @file testbed/test_testbed_api_controllerlink.c
* @brief testcase for testing controller to subcontroller linking
- * @author Sree Harsha Totakura <address@hidden>
+ * @author Sree Harsha Totakura <address@hidden>
*/
#include "platform.h"
@@ -45,78 +45,78 @@
* Different stages in testing
*/
enum Stage
- {
+{
/**
* Initial stage
*/
- INIT,
+ INIT,
/**
* Master controller has started
*/
- MASTER_STARTED,
+ MASTER_STARTED,
/**
* The first slave has been registered at master controller
*/
- SLAVE1_REGISTERED,
+ SLAVE1_REGISTERED,
/**
* The second slave has been registered at the master controller
*/
- SLAVE2_REGISTERED,
-
+ SLAVE2_REGISTERED,
+
/**
* Link from master to slave 1 has been successfully created
*/
- SLAVE1_LINK_SUCCESS,
+ SLAVE1_LINK_SUCCESS,
/**
* Link from slave 1 to slave 2 has been successfully created.
*/
- SLAVE2_LINK_SUCCESS,
+ SLAVE2_LINK_SUCCESS,
/**
* Peer create on slave 1 successful
*/
- SLAVE1_PEER_CREATE_SUCCESS,
+ SLAVE1_PEER_CREATE_SUCCESS,
/**
* Peer create on slave 2 successful
*/
- SLAVE2_PEER_CREATE_SUCCESS,
+ SLAVE2_PEER_CREATE_SUCCESS,
/**
* Peer startup on slave 1 successful
*/
- SLAVE1_PEER_START_SUCCESS,
+ SLAVE1_PEER_START_SUCCESS,
/**
* Peer on slave 1 successfully stopped
*/
- SLAVE1_PEER_STOP_SUCCESS,
-
+ SLAVE1_PEER_STOP_SUCCESS,
+
/**
* Peer startup on slave 2 successful
*/
- SLAVE2_PEER_START_SUCCESS,
+ SLAVE2_PEER_START_SUCCESS,
/**
* Peer on slave 2 successfully stopped
*/
- SLAVE2_PEER_STOP_SUCCESS,
+ SLAVE2_PEER_STOP_SUCCESS,
/**
* Peer destroy on slave 1 successful
*/
- SLAVE1_PEER_DESTROY_SUCCESS,
+ SLAVE1_PEER_DESTROY_SUCCESS,
/**
* Peer destory on slave 2 successful; Marks test as successful
*/
- SUCCESS
- };
+ SUCCESS
+};
/**
* Host for running master controller
@@ -197,7 +197,7 @@
GNUNET_SCHEDULER_cancel (abort_task);
if (NULL != slave2)
GNUNET_TESTBED_host_destroy (slave2);
- if (NULL != slave)
+ if (NULL != slave)
GNUNET_TESTBED_host_destroy (slave);
if (NULL != host)
GNUNET_TESTBED_host_destroy (host);
@@ -209,7 +209,7 @@
GNUNET_TESTBED_controller_stop (cp);
if (NULL != rh)
GNUNET_TESTBED_cancel_registration (rh);
-
+
}
@@ -231,8 +231,8 @@
/**
* Task for inserting delay between tests
*
- * @param
- * @return
+ * @param
+ * @return
*/
static void
delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -241,15 +241,15 @@
{
case SLAVE1_PEER_START_SUCCESS:
op = GNUNET_TESTBED_peer_stop (slave1_peer);
- GNUNET_assert (NULL != op);
+ GNUNET_assert (NULL != op);
break;
case SLAVE2_PEER_START_SUCCESS:
op = GNUNET_TESTBED_peer_stop (slave2_peer);
- GNUNET_assert (NULL != op);
+ GNUNET_assert (NULL != op);
break;
default:
- GNUNET_assert (0);
- }
+ GNUNET_assert (0);
+ }
}
@@ -262,7 +262,7 @@
* creation
* @param emsg NULL if peer is not NULL; else MAY contain the error description
*/
-static void
+static void
peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
{
switch (result)
@@ -270,9 +270,9 @@
case SLAVE2_LINK_SUCCESS:
GNUNET_assert (NULL != peer);
GNUNET_assert (NULL == emsg);
- result = SLAVE1_PEER_CREATE_SUCCESS;
+ result = SLAVE1_PEER_CREATE_SUCCESS;
slave1_peer = peer;
- GNUNET_TESTBED_operation_done (op);
+ GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_create (mc, slave2, cfg, peer_create_cb, NULL);
GNUNET_assert (NULL != op);
break;
@@ -280,13 +280,13 @@
GNUNET_assert (NULL != peer);
GNUNET_assert (NULL == emsg);
result = SLAVE2_PEER_CREATE_SUCCESS;
- slave2_peer = peer;
+ slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
- op = GNUNET_TESTBED_peer_start (slave1_peer);
- GNUNET_assert (NULL != op);
+ op = GNUNET_TESTBED_peer_start (slave1_peer);
+ GNUNET_assert (NULL != op);
break;
default:
- GNUNET_assert (0);
+ GNUNET_assert (0);
}
}
@@ -318,13 +318,13 @@
* @param cls closure
* @param event information about the event
*/
-static void
-controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
+static void
+controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
{
switch (result)
{
case SLAVE2_REGISTERED:
- check_operation_success (event);
+ check_operation_success (event);
GNUNET_TESTBED_operation_done (op);
op = NULL;
result = SLAVE1_LINK_SUCCESS;
@@ -347,9 +347,9 @@
GNUNET_assert (event->details.peer_start.peer == slave1_peer);
GNUNET_TESTBED_operation_done (op);
result = SLAVE1_PEER_START_SUCCESS;
- GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
- &delay_task, NULL);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
+ NULL);
break;
case SLAVE1_PEER_START_SUCCESS:
GNUNET_assert (GNUNET_TESTBED_ET_PEER_STOP == event->type);
@@ -357,7 +357,7 @@
GNUNET_TESTBED_operation_done (op);
result = SLAVE1_PEER_STOP_SUCCESS;
op = GNUNET_TESTBED_peer_start (slave2_peer);
- GNUNET_assert (NULL != op);
+ GNUNET_assert (NULL != op);
break;
case SLAVE1_PEER_STOP_SUCCESS:
GNUNET_assert (GNUNET_TESTBED_ET_PEER_START == event->type);
@@ -365,9 +365,9 @@
GNUNET_assert (event->details.peer_start.peer == slave2_peer);
GNUNET_TESTBED_operation_done (op);
result = SLAVE2_PEER_START_SUCCESS;
- GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1),
- &delay_task, NULL);
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
+ NULL);
break;
case SLAVE2_PEER_START_SUCCESS:
GNUNET_assert (GNUNET_TESTBED_ET_PEER_STOP == event->type);
@@ -389,7 +389,7 @@
GNUNET_TESTBED_operation_done (op);
result = SUCCESS;
GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
- break;
+ break;
default:
GNUNET_assert (0);
}
@@ -402,7 +402,7 @@
* @param cls the host which has been registered
* @param emsg the error message; NULL if host registration is successful
*/
-static void
+static void
registration_cont (void *cls, const char *emsg)
{
rh = NULL;
@@ -439,9 +439,9 @@
* @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
* 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)
+static void
+status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config,
+ int status)
{
switch (result)
{
@@ -453,7 +453,7 @@
event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED);
mc = GNUNET_TESTBED_controller_connect (config, host, event_mask,
- &controller_cb, NULL);
+ &controller_cb, NULL);
GNUNET_assert (NULL != mc);
result = MASTER_STARTED;
slave = GNUNET_TESTBED_host_create_with_id (1, "127.0.0.1", NULL, 0);
@@ -468,7 +468,7 @@
/**
- * Main run function.
+ * Main run function.
*
* @param cls NULL
* @param args arguments passed to GNUNET_PROGRAM_run
@@ -482,23 +482,26 @@
host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
GNUNET_assert (NULL != host);
cfg = GNUNET_CONFIGURATION_dup (config);
- cp =
- GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb, NULL);
- abort_task = GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5),
- &do_abort, NULL);
+ cp = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
+ NULL);
+ abort_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MINUTES, 5), &do_abort,
+ NULL);
}
/**
* Main function
*/
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
int ret;
+
char *const argv2[] = { "test_testbed_api_controllerlink",
- "-c", "test_testbed_api.conf",
- NULL
+ "-c", "test_testbed_api.conf",
+ NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
@@ -509,28 +512,31 @@
struct GNUNET_OS_Process *auxp;
enum GNUNET_OS_ProcessStatusType type;
unsigned long code;
-
- auxp = GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, "ssh", remote_args);
+
+ auxp =
+ GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
+ NULL, "ssh", remote_args);
GNUNET_assert (NULL != auxp);
do
{
- ret = GNUNET_OS_process_status (auxp, &type, &code);
+ ret = GNUNET_OS_process_status (auxp, &type, &code);
GNUNET_assert (GNUNET_SYSERR != ret);
- (void) usleep (300);
- } while (GNUNET_NO == ret);
- GNUNET_OS_process_destroy (auxp);
+ (void) usleep (300);
+ }
+ while (GNUNET_NO == ret);
+ GNUNET_OS_process_destroy (auxp);
if (0 != code)
- {
+ {
(void) printf ("Unable to run the test as this system is not configured "
- "to use password less SSH logins to localhost.\n"
- "Marking test as successful\n");
- return 0;
+ "to use password less SSH logins to localhost.\n"
+ "Marking test as successful\n");
+ return 0;
}
result = INIT;
- ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_testbed_api_controllerlink", "nohelp",
options, &run,
- NULL);
+ ret =
+ GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
+ "test_testbed_api_controllerlink", "nohelp", options,
+ &run, NULL);
if ((GNUNET_OK != ret) || (SUCCESS != result))
return 1;
return 0;
Modified: gnunet/src/testbed/test_testbed_api_hosts.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_hosts.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/test_testbed_api_hosts.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -62,7 +62,7 @@
/**
- * Main run function.
+ * Main run function.
*
* @param cls NULL
* @param args arguments passed to GNUNET_PROGRAM_run
@@ -81,26 +81,27 @@
GNUNET_assert (NULL != host);
GNUNET_assert (0 == GNUNET_TESTBED_host_get_id_ (host));
GNUNET_assert (host == GNUNET_TESTBED_host_lookup_by_id_ (0));
- shutdown_id =
- GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (2), &do_shutdown, NULL);
+ shutdown_id =
+ GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (2), &do_shutdown, NULL);
}
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
char *const argv2[] = { "test_testbed_api_hosts",
- "-c", "test_testbed_api.conf",
- NULL
+ "-c", "test_testbed_api.conf",
+ NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
status = GNUNET_YES;
- if (GNUNET_OK !=
+ if (GNUNET_OK !=
GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_testbed_api_hosts", "nohelp",
- options, &run, NULL))
+ "test_testbed_api_hosts", "nohelp", options, &run,
+ NULL))
return 1;
return (GNUNET_OK == status) ? 0 : 1;
}
Modified: gnunet/src/testbed/test_testbed_api_operations.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_operations.c 2012-08-31 10:06:42 UTC
(rev 23530)
+++ gnunet/src/testbed/test_testbed_api_operations.c 2012-08-31 10:36:28 UTC
(rev 23531)
@@ -59,34 +59,33 @@
* Enumeration of test stages
*/
enum Test
- {
+{
/**
* Initial stage
*/
- TEST_INIT,
+ TEST_INIT,
/**
* op1 has been started
*/
- TEST_OP1_STARTED,
+ TEST_OP1_STARTED,
/**
* op1 has been released
*/
- TEST_OP1_RELEASED,
+ TEST_OP1_RELEASED,
/**
* op2 has started
*/
- TEST_OP2_STARTED,
+ TEST_OP2_STARTED,
/**
* op2 released
*/
- TEST_OP2_RELEASED
+ TEST_OP2_RELEASED
+};
- };
-
/**
* The test result
*/
@@ -151,7 +150,7 @@
* a callback to the 'OperationStart' preceeds the call to
* 'OperationRelease'. Implementations of this function are expected
* to clean up whatever state is in 'cls' and release all resources
- * associated with the operation.
+ * associated with the operation.
*/
static void
release_cb (void *cls)
@@ -175,7 +174,7 @@
/**
- * Main run function.
+ * Main run function.
*
* @param cls NULL
* @param args arguments passed to GNUNET_PROGRAM_run
@@ -190,7 +189,7 @@
GNUNET_assert (NULL != q1);
q2 = GNUNET_TESTBED_operation_queue_create_ (2);
GNUNET_assert (NULL != q2);
- op1 = GNUNET_TESTBED_operation_create_ (&op1, start_cb, release_cb);
+ op1 = GNUNET_TESTBED_operation_create_ (&op1, start_cb, release_cb);
GNUNET_assert (NULL != op1);
op2 = GNUNET_TESTBED_operation_create_ (&op2, start_cb, release_cb);
GNUNET_TESTBED_operation_queue_insert_ (q1, op1);
@@ -203,17 +202,19 @@
/**
* Main function
*/
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
int ret;
- char *const argv2[] =
- {"test_testbed_api_operations", "-c", "test_testbed_api.conf", NULL};
- struct GNUNET_GETOPT_CommandLineOption options[] =
- {GNUNET_GETOPT_OPTION_END};
+ char *const argv2[] =
+ { "test_testbed_api_operations", "-c", "test_testbed_api.conf", NULL };
+ struct GNUNET_GETOPT_CommandLineOption options[] =
+ { GNUNET_GETOPT_OPTION_END };
- ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_testbed_api_operations", "nohelp", options,
- &run, NULL);
+ ret =
+ GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
+ "test_testbed_api_operations", "nohelp", options,
+ &run, NULL);
if ((GNUNET_OK != ret) || (TEST_OP2_RELEASED != result))
return 1;
op1 = NULL;
Modified: gnunet/src/testbed/test_testbed_api_testbed_run.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_testbed_run.c 2012-08-31 10:06:42 UTC
(rev 23530)
+++ gnunet/src/testbed/test_testbed_api_testbed_run.c 2012-08-31 10:36:28 UTC
(rev 23531)
@@ -21,7 +21,7 @@
/**
* @file testbed/test_testbed_api_testbed_run.c
* @brief Test cases for testing high-level testbed management
- * @author Sree Harsha Totakura <address@hidden>
+ * @author Sree Harsha Totakura <address@hidden>
*/
#include "platform.h"
@@ -110,7 +110,7 @@
controller_event_cb (void *cls,
const struct GNUNET_TESTBED_EventInformation *event)
{
-
+
switch (event->type)
{
case GNUNET_TESTBED_ET_PEER_START:
@@ -125,7 +125,7 @@
/**
- * Main run function.
+ * Main run function.
*
* @param cls NULL
* @param args arguments passed to GNUNET_PROGRAM_run
@@ -137,7 +137,7 @@
const struct GNUNET_CONFIGURATION_Handle *config)
{
uint64_t event_mask;
-
+
event_mask = 0;
event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START);
event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_STOP);
@@ -146,18 +146,22 @@
event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
GNUNET_TESTBED_run (NULL, config, NUM_PEERS, event_mask,
&controller_event_cb,
NULL, &master_task, NULL);
- abort_task = GNUNET_SCHEDULER_add_delayed
- (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), &do_abort,
NULL);
+ abort_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 5), &do_abort,
+ NULL);
}
/**
* Main function
*/
-int main (int argc, char **argv)
+int
+main (int argc, char **argv)
{
int ret;
- char *const argv2[] = {
+
+ char *const argv2[] = {
"test_testbed_api_testbed_run",
"-c", "test_testbed_api.conf",
NULL
@@ -167,9 +171,10 @@
};
result = GNUNET_SYSERR;
- ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
- "test_testbed_api_testbed_run", "nohelp", options,
- &run, NULL);
+ ret =
+ GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
+ "test_testbed_api_testbed_run", "nohelp", options,
+ &run, NULL);
if ((GNUNET_OK != ret) || (GNUNET_OK != result))
return 1;
return 0;
Modified: gnunet/src/testbed/testbed.h
===================================================================
--- gnunet/src/testbed/testbed.h 2012-08-31 10:06:42 UTC (rev 23530)
+++ gnunet/src/testbed/testbed.h 2012-08-31 10:36:28 UTC (rev 23531)
@@ -44,7 +44,7 @@
/**
* Host ID that the controller is either given (if this is the
* dominating client) or assumed to have (for peer-connections
- * between controllers). A controller must check that all
+ * between controllers). A controller must check that all
* connections make consistent claims...
*/
uint32_t host_id GNUNET_PACKED;
@@ -112,9 +112,9 @@
*/
uint32_t host_id GNUNET_PACKED;
- /* followed by the 0-terminated error message (on failure)
- (typical errors include failure to login and
- host-id already in use) */
+ /* followed by the 0-terminated error message (on failure)
+ * (typical errors include failure to login and
+ * host-id already in use) */
};
@@ -187,13 +187,13 @@
uint8_t is_subordinate;
/* followed by serialized slave configuration;
- gzip'ed configuration file in INI format */
+ * gzip'ed configuration file in INI format */
};
/**
- * Message sent from client to testing service to
+ * Message sent from client to testing service to
* create (configure, but not start) a peer.
*/
struct GNUNET_TESTBED_PeerCreateMessage
@@ -225,13 +225,13 @@
uint32_t config_size GNUNET_PACKED;
/* followed by serialized peer configuration;
- gzip'ed configuration file in INI format */
-
+ * gzip'ed configuration file in INI format */
+
};
/**
- * Message sent from client to testing service to
+ * Message sent from client to testing service to
* reconfigure a (stopped) a peer.
*/
struct GNUNET_TESTBED_PeerReconfigureMessage
@@ -253,8 +253,8 @@
uint64_t operation_id GNUNET_PACKED;
/* followed by serialized peer configuration;
- gzip'ed configuration file in INI format */
-
+ * gzip'ed configuration file in INI format */
+
};
@@ -416,7 +416,7 @@
* either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER_STOP.
*/
int32_t event_type GNUNET_PACKED;
-
+
/**
* Host where the peer is running.
*/
@@ -451,7 +451,7 @@
* either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCONNECT.
*/
int32_t event_type GNUNET_PACKED;
-
+
/**
* First peer.
*/
@@ -486,7 +486,7 @@
* GNUNET_TESTBED_ET_OPERATION_FINISHED.
*/
int32_t event_type GNUNET_PACKED;
-
+
/**
* Operation ID of the operation that created this event.
*/
@@ -512,7 +512,7 @@
* Peer identity of the peer that was created.
*/
uint32_t peer_id GNUNET_PACKED;
-
+
/**
* Operation ID of the operation that created this event.
*/
@@ -539,7 +539,7 @@
* GNUNET_TESTBED_ET_OPERATION_FINISHED.
*/
int32_t event_type GNUNET_PACKED;
-
+
/**
* Operation ID of the operation that created this event.
*/
@@ -551,7 +551,7 @@
/**
- * Message sent from client to testing service to
+ * Message sent from client to testing service to
* obtain the configuration of a peer.
*/
struct GNUNET_TESTBED_PeerGetConfigurationMessage
@@ -591,7 +591,7 @@
* The id of the peer relevant to this information
*/
uint32_t peer_id GNUNET_PACKED;
-
+
/**
* Operation ID of the operation that created this event.
*/
Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c 2012-08-31 10:06:42 UTC (rev 23530)
+++ gnunet/src/testbed/testbed_api.c 2012-08-31 10:36:28 UTC (rev 23531)
@@ -81,7 +81,7 @@
* next pointer for DLL
*/
struct MessageQueue *next;
-
+
/**
* prev pointer for DLL
*/
@@ -160,17 +160,17 @@
*/
struct ForwardedOperationData
{
-
+
/**
* The callback to call when reply is available
*/
- GNUNET_CLIENT_MessageHandler cc;
+ GNUNET_CLIENT_MessageHandler cc;
/**
* The closure for the above callback
*/
void *cc_cls;
-
+
};
@@ -215,8 +215,8 @@
rh = c->rh;
if (NULL == rh)
- {
- return GNUNET_OK;
+ {
+ return GNUNET_OK;
}
if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
{
@@ -229,20 +229,20 @@
if (sizeof (struct GNUNET_TESTBED_HostConfirmedMessage) == msg_size)
{
LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
- GNUNET_TESTBED_mark_host_registered_at_ (rh->host, c);
+ GNUNET_TESTBED_mark_host_registered_at_ (rh->host, c);
rh->cc (rh->cc_cls, NULL);
GNUNET_free (rh);
return GNUNET_OK;
- }
+ }
/* We have an error message */
emsg = (char *) &msg[1];
- if ('\0' != emsg[msg_size -
- sizeof (struct GNUNET_TESTBED_HostConfirmedMessage)])
+ if ('\0' !=
+ emsg[msg_size - sizeof (struct GNUNET_TESTBED_HostConfirmedMessage)])
{
GNUNET_break (0);
GNUNET_free (rh);
return GNUNET_NO;
- }
+ }
LOG (GNUNET_ERROR_TYPE_ERROR, _("Adding host %u failed with error: %s\n"),
ntohl (msg->host_id), emsg);
rh->cc (rh->cc_cls, emsg);
@@ -268,7 +268,7 @@
struct OperationContext *opc;
struct GNUNET_TESTBED_EventInformation *event;
uint64_t op_id;
-
+
op_id = GNUNET_ntohll (msg->operation_id);
LOG_DEBUG ("Operation %ul successful\n", op_id);
if (NULL == (opc = find_opc (c, op_id)))
@@ -284,28 +284,29 @@
switch (opc->type)
{
case OP_FORWARDED:
- {
- struct ForwardedOperationData *fo_data;
-
- fo_data = opc->data;
- if (NULL != fo_data->cc)
- fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *)
msg);
- GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc);
- GNUNET_free (fo_data);
- GNUNET_free (opc);
- return GNUNET_YES;
- }
+ {
+ struct ForwardedOperationData *fo_data;
+
+ fo_data = opc->data;
+ if (NULL != fo_data->cc)
+ fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg);
+ GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc);
+ GNUNET_free (fo_data);
+ GNUNET_free (opc);
+ 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:
+ case OP_LINK_CONTROLLERS:
break;
default:
GNUNET_assert (0);
@@ -325,8 +326,8 @@
if (NULL != c->cc)
c->cc (c->cc_cls, event);
GNUNET_free (event);
- }
- return GNUNET_YES;
+ }
+ return GNUNET_YES;
}
@@ -341,8 +342,8 @@
*/
static int
handle_peer_create_success (struct GNUNET_TESTBED_Controller *c,
- const struct
- GNUNET_TESTBED_PeerCreateSuccessEventMessage *msg)
+ const struct
+ GNUNET_TESTBED_PeerCreateSuccessEventMessage *msg)
{
struct OperationContext *opc;
struct PeerCreateData *data;
@@ -351,8 +352,8 @@
void *cls;
uint64_t op_id;
- GNUNET_assert (sizeof (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage)
- == ntohs (msg->header.size));
+ GNUNET_assert (sizeof (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage)
==
+ ntohs (msg->header.size));
op_id = GNUNET_ntohll (msg->operation_id);
if (NULL == (opc = find_opc (c, op_id)))
{
@@ -362,14 +363,14 @@
if (OP_FORWARDED == opc->type)
{
struct ForwardedOperationData *fo_data;
-
+
fo_data = opc->data;
if (NULL != fo_data->cc)
fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg);
GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc);
GNUNET_free (fo_data);
- GNUNET_free (opc);
- return GNUNET_YES;
+ GNUNET_free (opc);
+ return GNUNET_YES;
}
GNUNET_assert (OP_PEER_CREATE == opc->type);
GNUNET_assert (NULL != opc->data);
@@ -380,7 +381,7 @@
peer->state = PS_CREATED;
cb = data->cb;
cls = data->cls;
- GNUNET_free (opc->data);
+ GNUNET_free (opc->data);
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
opc->state = OPC_STATE_FINISHED;
if (NULL != cb)
@@ -400,15 +401,15 @@
*/
static int
handle_peer_event (struct GNUNET_TESTBED_Controller *c,
- const struct GNUNET_TESTBED_PeerEventMessage *msg)
+ const struct GNUNET_TESTBED_PeerEventMessage *msg)
{
struct OperationContext *opc;
struct GNUNET_TESTBED_Peer *peer;
struct GNUNET_TESTBED_EventInformation event;
uint64_t op_id;
- GNUNET_assert (sizeof (struct GNUNET_TESTBED_PeerEventMessage)
- == ntohs (msg->header.size));
+ GNUNET_assert (sizeof (struct GNUNET_TESTBED_PeerEventMessage) ==
+ ntohs (msg->header.size));
op_id = GNUNET_ntohll (msg->operation_id);
if (NULL == (opc = find_opc (c, op_id)))
{
@@ -418,14 +419,14 @@
if (OP_FORWARDED == opc->type)
{
struct ForwardedOperationData *fo_data;
-
+
fo_data = opc->data;
if (NULL != fo_data->cc)
fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg);
GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc);
GNUNET_free (fo_data);
- GNUNET_free (opc);
- return GNUNET_YES;
+ GNUNET_free (opc);
+ return GNUNET_YES;
}
GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
peer = opc->data;
@@ -439,20 +440,21 @@
event.details.peer_start.peer = peer;
break;
case GNUNET_TESTBED_ET_PEER_STOP:
- peer->state = PS_STOPPED;
- event.details.peer_stop.peer = peer;
+ peer->state = PS_STOPPED;
+ event.details.peer_stop.peer = peer;
break;
default:
- GNUNET_assert (0); /* We should never reach this state */
+ GNUNET_assert (0); /* We should never reach this state */
}
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
opc->state = OPC_STATE_FINISHED;
- if (0 != ((GNUNET_TESTBED_ET_PEER_START | GNUNET_TESTBED_ET_PEER_STOP)
- & c->event_mask))
+ if (0 !=
+ ((GNUNET_TESTBED_ET_PEER_START | GNUNET_TESTBED_ET_PEER_STOP) &
+ c->event_mask))
{
if (NULL != c->cc)
c->cc (c->cc_cls, &event);
- }
+ }
return GNUNET_YES;
}
@@ -483,8 +485,8 @@
}
data = opc->data;
GNUNET_assert (NULL != data);
- GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id)
- && (ntohl (msg->peer2) == data->p2->unique_id));
+ GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id) &&
+ (ntohl (msg->peer2) == data->p2->unique_id));
event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
switch (event.type)
{
@@ -502,8 +504,9 @@
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
opc->state = OPC_STATE_FINISHED;
GNUNET_free (data);
- if (0 != ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT)
- & c->event_mask))
+ if (0 !=
+ ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT) &
+ c->event_mask))
{
if (NULL != c->cc)
c->cc (c->cc_cls, &event);
@@ -523,7 +526,8 @@
*/
static int
handle_peer_config (struct GNUNET_TESTBED_Controller *c,
- const struct
GNUNET_TESTBED_PeerConfigurationInformationMessage *msg)
+ const struct
+ GNUNET_TESTBED_PeerConfigurationInformationMessage *msg)
{
struct OperationContext *opc;
struct GNUNET_TESTBED_Peer *peer;
@@ -531,7 +535,7 @@
struct PeerInfoData2 *response_data;
struct GNUNET_TESTBED_EventInformation info;
uint64_t op_id;
-
+
op_id = GNUNET_ntohll (msg->operation_id);
if (NULL == (opc = find_opc (c, op_id)))
{
@@ -541,14 +545,14 @@
if (OP_FORWARDED == opc->type)
{
struct ForwardedOperationData *fo_data;
-
+
fo_data = opc->data;
if (NULL != fo_data->cc)
fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg);
GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc);
GNUNET_free (fo_data);
- GNUNET_free (opc);
- return GNUNET_YES;
+ GNUNET_free (opc);
+ return GNUNET_YES;
}
data = opc->data;
GNUNET_assert (NULL != data);
@@ -572,34 +576,35 @@
switch (response_data->pit)
{
case GNUNET_TESTBED_PIT_IDENTITY:
- {
- struct GNUNET_PeerIdentity *peer_identity;
+ {
+ struct GNUNET_PeerIdentity *peer_identity;
- peer_identity = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
- (void) memcpy (peer_identity, &msg->peer_identity,
- sizeof (struct GNUNET_PeerIdentity));
- response_data->details.peer_identity = peer_identity;
- info.details.operation_finished.op_result.pid = peer_identity;
- }
+ peer_identity = GNUNET_malloc (sizeof (struct GNUNET_PeerIdentity));
+ (void) memcpy (peer_identity, &msg->peer_identity,
+ sizeof (struct GNUNET_PeerIdentity));
+ response_data->details.peer_identity = peer_identity;
+ info.details.operation_finished.op_result.pid = peer_identity;
+ }
break;
case GNUNET_TESTBED_PIT_CONFIGURATION:
- response_data->details.cfg = /* Freed in oprelease_peer_getinfo */
- GNUNET_TESTBED_get_config_from_peerinfo_msg_ (msg);
+ response_data->details.cfg = /* Freed in oprelease_peer_getinfo */
+ GNUNET_TESTBED_get_config_from_peerinfo_msg_ (msg);
info.details.operation_finished.op_result.cfg = response_data->details.cfg;
break;
case GNUNET_TESTBED_PIT_GENERIC:
- GNUNET_assert (0); /* never reach here */
+ GNUNET_assert (0); /* never reach here */
break;
}
opc->data = response_data;
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
opc->state = OPC_STATE_FINISHED;
- if (0 != ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT)
- & c->event_mask))
+ if (0 !=
+ ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT) &
+ c->event_mask))
{
if (NULL != c->cc)
c->cc (c->cc_cls, &info);
- }
+ }
return GNUNET_YES;
}
@@ -615,15 +620,15 @@
*/
static int
handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
- const struct
- GNUNET_TESTBED_OperationFailureEventMessage *msg)
+ const struct GNUNET_TESTBED_OperationFailureEventMessage
+ *msg)
{
struct OperationContext *opc;
char *emsg;
uint64_t op_id;
- struct GNUNET_TESTBED_EventInformation event;
+ struct GNUNET_TESTBED_EventInformation event;
uint16_t msize;
-
+
op_id = GNUNET_ntohll (msg->operation_id);
if (NULL == (opc = find_opc (c, op_id)))
{
@@ -633,14 +638,14 @@
if (OP_FORWARDED == opc->type)
{
struct ForwardedOperationData *fo_data;
-
+
fo_data = opc->data;
if (NULL != fo_data->cc)
fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg);
GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc);
GNUNET_free (fo_data);
- GNUNET_free (opc);
- return GNUNET_YES;
+ GNUNET_free (opc);
+ return GNUNET_YES;
}
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
opc->state = OPC_STATE_FINISHED;
@@ -658,8 +663,8 @@
emsg = (char *) &msg[1];
GNUNET_assert ('\0' == emsg[msize - 1]);
}
- if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask))
- && (NULL != c->cc))
+ if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) &&
+ (NULL != c->cc))
{
event.type = GNUNET_TESTBED_ET_OPERATION_FINISHED;
event.details.operation_finished.operation = opc->op;
@@ -668,7 +673,7 @@
event.details.operation_finished.pit = GNUNET_TESTBED_PIT_GENERIC;
event.details.operation_finished.op_result.generic = NULL;
c->cc (c->cc_cls, &event);
- }
+ }
return GNUNET_YES;
}
@@ -679,7 +684,7 @@
* @param cls the controller handler
* @param msg message received, NULL on timeout or fatal error
*/
-static void
+static void
message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_TESTBED_Controller *c = cls;
@@ -698,54 +703,67 @@
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM:
- GNUNET_assert (msize >= sizeof (struct
- GNUNET_TESTBED_HostConfirmedMessage));
+ GNUNET_assert (msize >=
+ sizeof (struct GNUNET_TESTBED_HostConfirmedMessage));
status =
- handle_addhostconfirm (c, (const struct
GNUNET_TESTBED_HostConfirmedMessage *) msg);
+ handle_addhostconfirm (c,
+ (const struct
GNUNET_TESTBED_HostConfirmedMessage
+ *) msg);
break;
case GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS:
- GNUNET_assert
- (msize == sizeof (struct
GNUNET_TESTBED_GenericOperationSuccessEventMessage));
+ GNUNET_assert (msize ==
+ sizeof (struct
+
GNUNET_TESTBED_GenericOperationSuccessEventMessage));
status =
- handle_opsuccess (c, (const struct
- GNUNET_TESTBED_GenericOperationSuccessEventMessage
- *) msg);
+ handle_opsuccess (c,
+ (const struct
+ GNUNET_TESTBED_GenericOperationSuccessEventMessage
*)
+ msg);
break;
case GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS:
- GNUNET_assert (msize ==
- sizeof (struct
GNUNET_TESTBED_PeerCreateSuccessEventMessage));
+ GNUNET_assert (msize ==
+ sizeof (struct
+ GNUNET_TESTBED_PeerCreateSuccessEventMessage));
status =
- handle_peer_create_success
- (c, (const struct GNUNET_TESTBED_PeerCreateSuccessEventMessage *)msg);
+ handle_peer_create_success (c,
+ (const struct
+
GNUNET_TESTBED_PeerCreateSuccessEventMessage
+ *) msg);
break;
case GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT:
GNUNET_assert (msize == sizeof (struct GNUNET_TESTBED_PeerEventMessage));
status =
- handle_peer_event (c, (const struct GNUNET_TESTBED_PeerEventMessage *)
msg);
-
+ handle_peer_event (c,
+ (const struct GNUNET_TESTBED_PeerEventMessage *)
+ msg);
+
break;
case GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG:
- GNUNET_assert (msize >=
- sizeof (struct
GNUNET_TESTBED_PeerConfigurationInformationMessage));
- status =
- handle_peer_config
- (c, (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *)
- msg);
+ GNUNET_assert (msize >=
+ sizeof (struct
+
GNUNET_TESTBED_PeerConfigurationInformationMessage));
+ status =
+ handle_peer_config (c,
+ (const struct
+ GNUNET_TESTBED_PeerConfigurationInformationMessage
+ *) msg);
break;
case GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT:
GNUNET_assert (msize ==
sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
- status =
- handle_peer_conevent (c, (const struct
- GNUNET_TESTBED_ConnectionEventMessage *) msg);
+ status =
+ handle_peer_conevent (c,
+ (const struct
+ GNUNET_TESTBED_ConnectionEventMessage *) msg);
break;
case GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONEVENT:
- GNUNET_assert (msize >=
+ GNUNET_assert (msize >=
sizeof (struct
GNUNET_TESTBED_OperationFailureEventMessage));
- status =
- handle_op_fail_event (c, (const struct
- GNUNET_TESTBED_OperationFailureEventMessage *)
- msg);
+ status =
+ handle_op_fail_event (c,
+ (const struct
+ GNUNET_TESTBED_OperationFailureEventMessage *)
+ msg);
break;
default:
GNUNET_assert (0);
@@ -754,7 +772,7 @@
{
c->in_receive = GNUNET_YES;
GNUNET_CLIENT_receive (c->client, &message_handler, c,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ GNUNET_TIME_UNIT_FOREVER_REL);
}
}
@@ -778,38 +796,36 @@
c->th = NULL;
mq_entry = c->mq_head;
GNUNET_assert (NULL != mq_entry);
- if ((0 == size) && (NULL == buf)) /* Timeout */
+ if ((0 == size) && (NULL == buf)) /* Timeout */
{
LOG_DEBUG ("Message sending timed out -- retrying\n");
c->th =
- GNUNET_CLIENT_notify_transmit_ready (c->client,
- ntohs (mq_entry->msg->size),
- TIMEOUT_REL,
- GNUNET_YES, &transmit_ready_notify,
- c);
+ GNUNET_CLIENT_notify_transmit_ready (c->client,
+ ntohs (mq_entry->msg->size),
+ TIMEOUT_REL, GNUNET_YES,
+ &transmit_ready_notify, c);
return 0;
}
GNUNET_assert (ntohs (mq_entry->msg->size) <= size);
- size = ntohs (mq_entry->msg->size);
+ size = ntohs (mq_entry->msg->size);
memcpy (buf, mq_entry->msg, size);
LOG_DEBUG ("Message of type: %u and size: %u sent\n",
- ntohs (mq_entry->msg->type), size);
+ ntohs (mq_entry->msg->type), size);
GNUNET_free (mq_entry->msg);
GNUNET_CONTAINER_DLL_remove (c->mq_head, c->mq_tail, mq_entry);
GNUNET_free (mq_entry);
mq_entry = c->mq_head;
if (NULL != mq_entry)
- c->th =
- GNUNET_CLIENT_notify_transmit_ready (c->client,
- ntohs (mq_entry->msg->size),
- TIMEOUT_REL,
- GNUNET_YES, &transmit_ready_notify,
- c);
+ c->th =
+ GNUNET_CLIENT_notify_transmit_ready (c->client,
+ ntohs (mq_entry->msg->size),
+ TIMEOUT_REL, GNUNET_YES,
+ &transmit_ready_notify, c);
if (GNUNET_NO == c->in_receive)
{
c->in_receive = GNUNET_YES;
GNUNET_CLIENT_receive (c->client, &message_handler, c,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ GNUNET_TIME_UNIT_FOREVER_REL);
}
return size;
}
@@ -823,7 +839,7 @@
*/
void
GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
- struct GNUNET_MessageHeader *msg)
+ struct GNUNET_MessageHeader *msg)
{
struct MessageQueue *mq_entry;
uint16_t type;
@@ -832,7 +848,7 @@
type = ntohs (msg->type);
size = ntohs (msg->size);
GNUNET_assert ((GNUNET_MESSAGE_TYPE_TESTBED_INIT <= type) &&
- (GNUNET_MESSAGE_TYPE_TESTBED_MAX > type));
+ (GNUNET_MESSAGE_TYPE_TESTBED_MAX > type));
mq_entry = GNUNET_malloc (sizeof (struct MessageQueue));
mq_entry->msg = msg;
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -841,11 +857,11 @@
GNUNET_CONTAINER_DLL_insert_tail (controller->mq_head, controller->mq_tail,
mq_entry);
if (NULL == controller->th)
- controller->th =
- GNUNET_CLIENT_notify_transmit_ready (controller->client, size,
- TIMEOUT_REL,
- GNUNET_YES, &transmit_ready_notify,
- controller);
+ controller->th =
+ GNUNET_CLIENT_notify_transmit_ready (controller->client, size,
+ TIMEOUT_REL, GNUNET_YES,
+ &transmit_ready_notify,
+ controller);
}
@@ -861,36 +877,35 @@
* @param cc the callback to call when reply is available
* @param cc_cls the closure for the above callback
* @return the operation context which can be used to cancel the forwarded
- * operation
+ * operation
*/
struct OperationContext *
GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller
- * controller,
- uint64_t operation_id,
+ *controller, uint64_t operation_id,
const struct GNUNET_MessageHeader *msg,
GNUNET_CLIENT_MessageHandler cc,
void *cc_cls)
{
struct OperationContext *opc;
struct ForwardedOperationData *data;
- struct GNUNET_MessageHeader *dup_msg;
+ struct GNUNET_MessageHeader *dup_msg;
uint16_t msize;
-
+
data = GNUNET_malloc (sizeof (struct ForwardedOperationData));
data->cc = cc;
- data->cc_cls = cc_cls;
+ data->cc_cls = cc_cls;
opc = GNUNET_malloc (sizeof (struct OperationContext));
- opc->c = controller;
+ opc->c = controller;
opc->type = OP_FORWARDED;
opc->data = data;
opc->id = operation_id;
msize = ntohs (msg->size);
dup_msg = GNUNET_malloc (msize);
- (void) memcpy (dup_msg, msg, msize);
+ (void) memcpy (dup_msg, msg, msize);
GNUNET_TESTBED_queue_message_ (opc->c, dup_msg);
- GNUNET_CONTAINER_DLL_insert_tail (controller->ocq_head,
- controller->ocq_tail, opc);
- return opc;
+ GNUNET_CONTAINER_DLL_insert_tail (controller->ocq_head, controller->ocq_tail,
+ opc);
+ return opc;
}
@@ -905,7 +920,7 @@
{
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
GNUNET_free (opc->data);
- GNUNET_free (opc);
+ GNUNET_free (opc);
}
@@ -974,9 +989,8 @@
*
* @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing
*/
-static int
-helper_mst (void *cls, void *client,
- const struct GNUNET_MessageHeader *message)
+static int
+helper_mst (void *cls, void *client, const struct GNUNET_MessageHeader
*message)
{
struct GNUNET_TESTBED_ControllerProc *cp = cls;
const struct GNUNET_TESTBED_HelperReply *msg;
@@ -984,29 +998,31 @@
char *config;
uLongf config_size;
uLongf xconfig_size;
-
+
msg = (const struct GNUNET_TESTBED_HelperReply *) message;
- GNUNET_assert (sizeof (struct GNUNET_TESTBED_HelperReply)
- < ntohs (msg->header.size));
- GNUNET_assert (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY
- == ntohs (msg->header.type));
+ GNUNET_assert (sizeof (struct GNUNET_TESTBED_HelperReply) <
+ ntohs (msg->header.size));
+ GNUNET_assert (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY ==
+ ntohs (msg->header.type));
config_size = (uLongf) ntohs (msg->config_size);
- xconfig_size = (uLongf) (ntohs (msg->header.size)
- - sizeof (struct GNUNET_TESTBED_HelperReply));
+ xconfig_size =
+ (uLongf) (ntohs (msg->header.size) -
+ sizeof (struct GNUNET_TESTBED_HelperReply));
config = GNUNET_malloc (config_size);
- GNUNET_assert (Z_OK == uncompress ((Bytef *) config, &config_size,
- (const Bytef *) &msg[1], xconfig_size));
+ GNUNET_assert (Z_OK ==
+ uncompress ((Bytef *) config, &config_size,
+ (const Bytef *) &msg[1], xconfig_size));
GNUNET_assert (NULL == cp->cfg);
cp->cfg = GNUNET_CONFIGURATION_create ();
- GNUNET_assert (GNUNET_CONFIGURATION_deserialize (cp->cfg, config,
- config_size, GNUNET_NO));
+ GNUNET_assert (GNUNET_CONFIGURATION_deserialize
+ (cp->cfg, config, config_size, GNUNET_NO));
GNUNET_free (config);
- if ((NULL == cp->host) ||
+ if ((NULL == cp->host) ||
(NULL == (hostname = GNUNET_TESTBED_host_get_hostname_ (cp->host))))
hostname = "localhost";
/* Change the hostname so that we can connect to it */
- GNUNET_CONFIGURATION_set_value_string (cp->cfg, "testbed", "hostname",
- hostname);
+ GNUNET_CONFIGURATION_set_value_string (cp->cfg, "testbed", "hostname",
+ hostname);
cp->cb (cp->cls, cp->cfg, GNUNET_OK);
return GNUNET_OK;
}
@@ -1014,17 +1030,17 @@
/**
* Continuation function from GNUNET_HELPER_send()
- *
+ *
* @param cls closure
* @param result GNUNET_OK on success,
* GNUNET_NO if helper process died
* GNUNET_SYSERR during GNUNET_HELPER_stop
*/
-static void
+static void
clear_msg (void *cls, int result)
{
struct GNUNET_TESTBED_ControllerProc *cp = cls;
-
+
GNUNET_assert (NULL != cp->shandle);
cp->shandle = NULL;
GNUNET_free (cp->msg);
@@ -1037,7 +1053,7 @@
*
* @param cls the closure from GNUNET_HELPER_start()
*/
-static void
+static void
helper_exp_cb (void *cls)
{
struct GNUNET_TESTBED_ControllerProc *cp = cls;
@@ -1059,7 +1075,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_link_controllers (void *cls)
{
struct OperationContext *opc = cls;
@@ -1079,7 +1095,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_link_controllers (void *cls)
{
struct OperationContext *opc = cls;
@@ -1115,24 +1131,24 @@
*/
struct GNUNET_TESTBED_ControllerProc *
GNUNET_TESTBED_controller_start (const char *controller_ip,
- struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_TESTBED_ControllerStatusCallback cb,
- void *cls)
+ void *cls)
{
struct GNUNET_TESTBED_ControllerProc *cp;
struct GNUNET_TESTBED_HelperInit *msg;
-
+
cp = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ControllerProc));
if ((NULL == host) || (0 == GNUNET_TESTBED_host_get_id_ (host)))
{
- char * const binary_argv[] = {
+ char *const binary_argv[] = {
"gnunet-testbed-helper", NULL
};
- cp->helper = GNUNET_HELPER_start (GNUNET_YES,
- "gnunet-testbed-helper", binary_argv,
- &helper_mst, &helper_exp_cb, cp);
+ cp->helper =
+ GNUNET_HELPER_start (GNUNET_YES, "gnunet-testbed-helper", binary_argv,
+ &helper_mst, &helper_exp_cb, cp);
}
else
{
@@ -1146,7 +1162,7 @@
GNUNET_asprintf (&cp->port, "%u", GNUNET_TESTBED_host_get_ssh_port_
(host));
if (NULL == username)
GNUNET_asprintf (&cp->dst, "%s", hostname);
- else
+ else
GNUNET_asprintf (&cp->dst, "address@hidden", username, hostname);
LOG_DEBUG ("Starting SSH to destination %s\n", cp->dst);
argp = 0;
@@ -1159,9 +1175,9 @@
remote_args[argp++] = "gnunet-testbed-helper";
remote_args[argp++] = NULL;
GNUNET_assert (argp == 8);
- cp->helper = GNUNET_HELPER_start (GNUNET_NO,
- "ssh", remote_args,
- &helper_mst, &helper_exp_cb, cp);
+ cp->helper =
+ GNUNET_HELPER_start (GNUNET_NO, "ssh", remote_args, &helper_mst,
+ &helper_exp_cb, cp);
}
if (NULL == cp->helper)
{
@@ -1175,8 +1191,8 @@
cp->cls = cls;
msg = GNUNET_TESTBED_create_helper_init_msg_ (controller_ip, cfg);
cp->msg = &msg->header;
- cp->shandle = GNUNET_HELPER_send (cp->helper, &msg->header, GNUNET_NO,
- &clear_msg, cp);
+ cp->shandle =
+ GNUNET_HELPER_send (cp->helper, &msg->header, GNUNET_NO, &clear_msg, cp);
if (NULL == cp->shandle)
{
GNUNET_free (msg);
@@ -1226,11 +1242,11 @@
* @return handle to the controller
*/
struct GNUNET_TESTBED_Controller *
-GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle
*cfg,
- struct GNUNET_TESTBED_Host *host,
- uint64_t event_mask,
- GNUNET_TESTBED_ControllerCallback cc,
- void *cc_cls)
+GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle
+ *cfg, struct GNUNET_TESTBED_Host *host,
+ uint64_t event_mask,
+ GNUNET_TESTBED_ControllerCallback cc,
+ void *cc_cls)
{
struct GNUNET_TESTBED_Controller *controller;
struct GNUNET_TESTBED_InitMessage *msg;
@@ -1259,7 +1275,7 @@
controller->cc_cls = cc_cls;
controller->event_mask = event_mask;
controller->cfg = GNUNET_CONFIGURATION_dup (cfg);
- controller->client = GNUNET_CLIENT_connect ("testbed", controller->cfg);
+ controller->client = GNUNET_CLIENT_connect ("testbed", controller->cfg);
if (NULL == controller->client)
{
GNUNET_TESTBED_controller_disconnect (controller);
@@ -1271,8 +1287,8 @@
if (NULL == host) /* If the above host create fails */
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "Treating NULL host as localhost. Multiple references to localhost "
- "may break when localhost freed before calling disconnect \n");
+ "Treating NULL host as localhost. Multiple references to localhost "
+ "may break when localhost freed before calling disconnect \n");
host = GNUNET_TESTBED_host_lookup_by_id_ (0);
}
else
@@ -1284,24 +1300,26 @@
GNUNET_TESTBED_mark_host_registered_at_ (host, controller);
controller->host = host;
controller->opq_parallel_operations =
- GNUNET_TESTBED_operation_queue_create_ ((unsigned int)
- max_parallel_operations);
+ GNUNET_TESTBED_operation_queue_create_ ((unsigned int)
+ max_parallel_operations);
controller->opq_parallel_service_connections =
- GNUNET_TESTBED_operation_queue_create_ ((unsigned int)
- max_parallel_service_connections);
+ GNUNET_TESTBED_operation_queue_create_ ((unsigned int)
+
max_parallel_service_connections);
controller_hostname = GNUNET_TESTBED_host_get_hostname_ (host);
if (NULL == controller_hostname)
controller_hostname = "127.0.0.1";
- msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_InitMessage)
- + strlen (controller_hostname) + 1);
+ msg =
+ GNUNET_malloc (sizeof (struct GNUNET_TESTBED_InitMessage) +
+ strlen (controller_hostname) + 1);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_INIT);
- msg->header.size = htons (sizeof (struct GNUNET_TESTBED_InitMessage)
- + strlen (controller_hostname) + 1);
+ msg->header.size =
+ htons (sizeof (struct GNUNET_TESTBED_InitMessage) +
+ strlen (controller_hostname) + 1);
msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
msg->event_mask = GNUNET_htonll (controller->event_mask);
strcpy ((char *) &msg[1], controller_hostname);
- GNUNET_TESTBED_queue_message_ (controller, (struct GNUNET_MessageHeader *)
- msg);
+ GNUNET_TESTBED_queue_message_ (controller,
+ (struct GNUNET_MessageHeader *) msg);
return controller;
}
@@ -1312,7 +1330,7 @@
* should not be run for each peer but instead be shared
* across N peers on the specified host. This function
* must be called before any peers are created at the host.
- *
+ *
* @param controller controller to configure
* @param service_name name of the service to share
* @param num_peers number of peers that should share one instance
@@ -1320,24 +1338,27 @@
* use 0 to disable the service
*/
void
-GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controller
*controller,
- const char *service_name,
- uint32_t num_peers)
+GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controller
+ *controller,
+ const char *service_name,
+ uint32_t num_peers)
{
struct GNUNET_TESTBED_ConfigureSharedServiceMessage *msg;
uint16_t service_name_size;
uint16_t msg_size;
-
+
service_name_size = strlen (service_name) + 1;
- msg_size = sizeof (struct GNUNET_TESTBED_ConfigureSharedServiceMessage)
- + service_name_size;
+ msg_size =
+ sizeof (struct GNUNET_TESTBED_ConfigureSharedServiceMessage) +
+ service_name_size;
msg = GNUNET_malloc (msg_size);
msg->header.size = htons (msg_size);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE);
msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (controller->host));
msg->num_peers = htonl (num_peers);
memcpy (&msg[1], service_name, service_name_size);
- GNUNET_TESTBED_queue_message_ (controller, (struct GNUNET_MessageHeader *)
msg);
+ GNUNET_TESTBED_queue_message_ (controller,
+ (struct GNUNET_MessageHeader *) msg);
}
@@ -1347,18 +1368,18 @@
* @param controller handle to controller to stop
*/
void
-GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller
*controller)
+GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller
+ *controller)
{
struct MessageQueue *mq_entry;
if (NULL != controller->th)
GNUNET_CLIENT_notify_transmit_ready_cancel (controller->th);
- /* Clear the message queue */
+ /* Clear the message queue */
while (NULL != (mq_entry = controller->mq_head))
{
- GNUNET_CONTAINER_DLL_remove (controller->mq_head,
- controller->mq_tail,
- mq_entry);
+ GNUNET_CONTAINER_DLL_remove (controller->mq_head, controller->mq_tail,
+ mq_entry);
GNUNET_free (mq_entry->msg);
GNUNET_free (mq_entry);
}
@@ -1369,7 +1390,7 @@
GNUNET_TESTBED_host_destroy (controller->host);
GNUNET_TESTBED_operation_queue_destroy_
(controller->opq_parallel_operations);
GNUNET_TESTBED_operation_queue_destroy_
- (controller->opq_parallel_service_connections);
+ (controller->opq_parallel_service_connections);
GNUNET_free (controller);
}
@@ -1384,7 +1405,7 @@
* will be invalid. Cannot be NULL.
* @param cc_cls the closure for the cc
* @return handle to the host registration which can be used to cancel the
- * registration
+ * registration
*/
struct GNUNET_TESTBED_HostRegistrationHandle *
GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
@@ -1404,11 +1425,10 @@
hostname = GNUNET_TESTBED_host_get_hostname_ (host);
if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller))
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Host hostname: %s already registered\n",
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Host hostname: %s already registered\n",
(NULL == hostname) ? "localhost" : hostname);
return NULL;
- }
+ }
rh = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostRegistrationHandle));
rh->host = host;
rh->c = controller;
@@ -1436,7 +1456,8 @@
if (NULL != username)
memcpy (&msg[1], username, user_name_length);
strcpy (((void *) &msg[1]) + user_name_length, hostname);
- GNUNET_TESTBED_queue_message_ (controller, (struct GNUNET_MessageHeader *)
msg);
+ GNUNET_TESTBED_queue_message_ (controller,
+ (struct GNUNET_MessageHeader *) msg);
return rh;
}
@@ -1458,7 +1479,7 @@
return;
}
handle->c->rh = NULL;
- GNUNET_free (handle);
+ GNUNET_free (handle);
}
@@ -1479,29 +1500,28 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link_2 (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)
+ 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)
{
struct OperationContext *opc;
struct GNUNET_TESTBED_ControllerLinkMessage *msg;
uint16_t msg_size;
- GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
if ((NULL != slave_host) && (0 != GNUNET_TESTBED_host_get_id_ (slave_host)))
- GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (slave_host, master));
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_TESTBED_is_host_registered_ (slave_host, master));
msg_size = sxcfg_size + sizeof (struct GNUNET_TESTBED_ControllerLinkMessage);
msg = GNUNET_malloc (msg_size);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS);
msg->header.size = htons (msg_size);
msg->delegated_host_id = htonl (GNUNET_TESTBED_host_get_id_
(delegated_host));
- msg->slave_host_id = htonl (GNUNET_TESTBED_host_get_id_
- ((NULL != slave_host) ? slave_host :
master->host));
+ msg->slave_host_id =
+ htonl (GNUNET_TESTBED_host_get_id_
+ ((NULL != slave_host) ? slave_host : master->host));
msg->config_size = htons ((uint16_t) scfg_size);
msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
memcpy (&msg[1], sxcfg, sxcfg_size);
@@ -1512,8 +1532,9 @@
opc->id = master->operation_counter++;
opc->state = OPC_STATE_INIT;
msg->operation_id = GNUNET_htonll (opc->id);
- opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_link_controllers,
- &oprelease_link_controllers);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_link_controllers,
+ &oprelease_link_controllers);
GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
opc->op);
return opc->op;
@@ -1526,25 +1547,25 @@
* @param config the serialized configuration
* @param size the size of config
* @param xconfig will be set to the compressed configuration (memory is fresly
- * allocated)
+ * allocated)
* @return the size of the xconfig
*/
size_t
GNUNET_TESTBED_compress_config_ (const char *config, size_t size,
- char **xconfig)
+ char **xconfig)
{
size_t xsize;
-
+
xsize = compressBound ((uLong) size);
*xconfig = GNUNET_malloc (xsize);
GNUNET_assert (Z_OK ==
- compress2 ((Bytef *)* xconfig, (uLongf *) &xsize,
- (const Bytef *) config, (uLongf) size,
+ compress2 ((Bytef *) * xconfig, (uLongf *) & xsize,
+ (const Bytef *) config, (uLongf) size,
Z_BEST_SPEED));
return xsize;
}
-
+
/**
* Create a link from slave controller to delegated controller. Whenever the
* master controller is asked to start a peer at the delegated controller the
@@ -1559,7 +1580,7 @@
*
* @param master handle to the master controller who creates the association
* @param delegated_host requests to which host should be delegated
- * @param slave_host which host is used to run the slave controller
+ * @param slave_host which host is used to run the slave controller
* @param slave_cfg configuration to use for the slave controller
* @param is_subordinate GNUNET_YES if the slave should be started (and
stopped)
* by the master controller; GNUNET_NO if we are just
@@ -1568,31 +1589,29 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_controller_link (struct GNUNET_TESTBED_Controller *master,
- struct GNUNET_TESTBED_Host *delegated_host,
- struct GNUNET_TESTBED_Host *slave_host,
- const struct GNUNET_CONFIGURATION_Handle
*slave_cfg,
- int is_subordinate)
+ struct GNUNET_TESTBED_Host *delegated_host,
+ struct GNUNET_TESTBED_Host *slave_host,
+ const struct GNUNET_CONFIGURATION_Handle
+ *slave_cfg, int is_subordinate)
{
struct GNUNET_TESTBED_Operation *op;
char *config;
char *cconfig;
size_t cc_size;
- size_t config_size;
-
+ size_t config_size;
+
GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
+ GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
if ((NULL != slave_host) && (0 != GNUNET_TESTBED_host_get_id_ (slave_host)))
GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (slave_host, master));
+ GNUNET_TESTBED_is_host_registered_ (slave_host, master));
config = GNUNET_CONFIGURATION_serialize (slave_cfg, &config_size);
cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig);
GNUNET_free (config);
- GNUNET_assert ((UINT16_MAX -
- sizeof (struct GNUNET_TESTBED_ControllerLinkMessage))
- >= cc_size); /* Configuration doesn't fit in 1 message */
+ GNUNET_assert ((UINT16_MAX - sizeof (struct
GNUNET_TESTBED_ControllerLinkMessage)) >= cc_size); /* Configuration
doesn't fit in 1 message */
op = GNUNET_TESTBED_controller_link_2 (master, delegated_host, slave_host,
- (const char *) cconfig,
- cc_size, config_size, is_subordinate);
+ (const char *) cconfig, cc_size,
+ config_size, is_subordinate);
GNUNET_free (cconfig);
return op;
}
@@ -1608,8 +1627,9 @@
* be written to.
*/
void
-GNUNET_TESTBED_overlay_write_topology_to_file (struct
GNUNET_TESTBED_Controller *controller,
- const char *filename)
+GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Controller
+ *controller,
+ const char *filename)
{
GNUNET_break (0);
}
@@ -1626,7 +1646,8 @@
*/
struct GNUNET_TESTBED_HelperInit *
GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
- const struct
GNUNET_CONFIGURATION_Handle *cfg)
+ const struct
GNUNET_CONFIGURATION_Handle
+ *cfg)
{
struct GNUNET_TESTBED_HelperInit *msg;
char *config;
@@ -1639,13 +1660,13 @@
config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
GNUNET_assert (NULL != config);
xconfig_size =
- GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
+ GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
GNUNET_free (config);
cname_len = strlen (cname);
- msg_size = xconfig_size + cname_len + 1 +
- sizeof (struct GNUNET_TESTBED_HelperInit);
+ msg_size =
+ xconfig_size + cname_len + 1 + sizeof (struct GNUNET_TESTBED_HelperInit);
msg = GNUNET_realloc (xconfig, msg_size);
- (void) memmove ( ((void *) &msg[1]) + cname_len + 1, msg, xconfig_size);
+ (void) memmove (((void *) &msg[1]) + cname_len + 1, msg, xconfig_size);
msg->header.size = htons (msg_size);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
msg->cname_size = htons (cname_len);
@@ -1660,8 +1681,8 @@
* of the operation and will ensure that no event
* is generated for the operation. Does NOT guarantee
* that the operation will be fully undone (or that
- * nothing ever happened).
- *
+ * nothing ever happened).
+ *
* @param operation operation to cancel
*/
void
@@ -1677,7 +1698,7 @@
* of type 'operation_finished' to fully remove the operation
* from the operation queue. After calling this function, the
* 'op_result' becomes invalid (!).
- *
+ *
* @param operation operation to signal completion for
*/
void
@@ -1717,18 +1738,20 @@
uLong config_size;
int ret;
uint16_t msize;
-
+
config_size = (uLong) ntohs (msg->config_size);
config = GNUNET_malloc (config_size);
msize = ntohs (msg->header.size);
msize -= sizeof (struct GNUNET_TESTBED_PeerConfigurationInformationMessage);
- if (Z_OK != (ret = uncompress ((Bytef *) config, &config_size,
- (const Bytef *) &msg[1], (uLong) msize)))
+ if (Z_OK !=
+ (ret =
+ uncompress ((Bytef *) config, &config_size, (const Bytef *) &msg[1],
+ (uLong) msize)))
GNUNET_assert (0);
cfg = GNUNET_CONFIGURATION_create ();
- GNUNET_assert (GNUNET_OK ==
+ GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_deserialize (cfg, config,
- (size_t) config_size,
+ (size_t) config_size,
GNUNET_NO));
GNUNET_free (config);
return cfg;
Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h 2012-08-31 10:06:42 UTC (rev 23530)
+++ gnunet/src/testbed/testbed_api.h 2012-08-31 10:36:28 UTC (rev 23531)
@@ -34,48 +34,48 @@
* Enumeration of operations
*/
enum OperationType
- {
+{
/**
* Peer create operation
*/
- OP_PEER_CREATE,
-
+ OP_PEER_CREATE,
+
/**
* Peer start operation
*/
- OP_PEER_START,
+ OP_PEER_START,
/**
* Peer stop operation
*/
- OP_PEER_STOP,
+ OP_PEER_STOP,
/**
* Peer destroy operation
*/
- OP_PEER_DESTROY,
+ OP_PEER_DESTROY,
/**
* Get peer information operation
*/
- OP_PEER_INFO,
+ OP_PEER_INFO,
/**
* Overlay connection operation
*/
- OP_OVERLAY_CONNECT,
+ OP_OVERLAY_CONNECT,
/**
* Forwarded operation
*/
- OP_FORWARDED,
+ OP_FORWARDED,
/**
* Link controllers operation
*/
- OP_LINK_CONTROLLERS,
+ OP_LINK_CONTROLLERS,
- };
+};
/**
@@ -130,25 +130,25 @@
* Enumeration of states of OperationContext
*/
enum OperationContextState
- {
+{
/**
* The initial state where the associated operation has just been created
* and is waiting in the operation queues to be started
*/
- OPC_STATE_INIT = 0,
-
+ OPC_STATE_INIT = 0,
+
/**
* The operation has been started. It may occupy some resources which are
to
* be freed if cancelled.
*/
- OPC_STATE_STARTED,
+ OPC_STATE_STARTED,
/**
* The operation has finished. The end results of this operation may occupy
* some resources which are to be freed by operation_done
*/
- OPC_STATE_FINISHED
- };
+ OPC_STATE_FINISHED
+};
/**
@@ -234,7 +234,7 @@
* The client connection handle to the controller service
*/
struct GNUNET_CLIENT_Connection *client;
-
+
/**
* The head of the message queue
*/
@@ -262,7 +262,7 @@
/**
* The host registration handle; NULL if no current registration requests are
- * present
+ * present
*/
struct GNUNET_TESTBED_HostRegistrationHandle *rh;
@@ -290,7 +290,7 @@
* The operation id counter. use current value and increment
*/
uint64_t operation_counter;
-
+
/**
* The controller event mask
*/
@@ -316,7 +316,7 @@
*/
void
GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
- struct GNUNET_MessageHeader *msg);
+ struct GNUNET_MessageHeader *msg);
/**
@@ -325,12 +325,12 @@
* @param config the serialized configuration
* @param size the size of config
* @param xconfig will be set to the compressed configuration (memory is fresly
- * allocated)
+ * allocated)
* @return the size of the xconfig
*/
size_t
GNUNET_TESTBED_compress_config_ (const char *config, size_t size,
- char **xconfig);
+ char **xconfig);
/**
@@ -352,8 +352,8 @@
*/
struct GNUNET_TESTBED_HelperInit *
GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
- const struct
- GNUNET_CONFIGURATION_Handle *cfg);
+ const struct
GNUNET_CONFIGURATION_Handle
+ *cfg);
/**
@@ -368,12 +368,11 @@
* @param cc the callback to call when reply is available
* @param cc_cls the closure for the above callback
* @return the operation context which can be used to cancel the forwarded
- * operation
+ * operation
*/
struct OperationContext *
GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller
- * controller,
- uint64_t operation_id,
+ *controller, uint64_t operation_id,
const struct GNUNET_MessageHeader *msg,
GNUNET_CLIENT_MessageHandler cc,
void *cc_cls);
Modified: gnunet/src/testbed/testbed_api_hosts.c
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_hosts.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -57,7 +57,7 @@
* The controller at which this host is registered
*/
const struct GNUNET_TESTBED_Controller *controller;
-
+
/**
* The next ptr for DLL
*/
@@ -134,7 +134,7 @@
/**
* Lookup a host by ID.
- *
+ *
* @param id global host ID assigned to the host; 0 is
* reserved to always mean 'localhost'
* @return handle to the host, NULL if host not found
@@ -152,7 +152,7 @@
* Create a host by ID; given this host handle, we could not
* run peers at the host, but we can talk about the host
* internally.
- *
+ *
* @param id global host ID assigned to the host; 0 is
* reserved to always mean 'localhost'
* @return handle to the host, NULL on error
@@ -166,13 +166,13 @@
/**
* Obtain the host's unique global ID.
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return id global host ID assigned to the host (0 is
* 'localhost', but then obviously not globally unique)
*/
uint32_t
-GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host)
+GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host * host)
{
return host->id;
}
@@ -180,7 +180,7 @@
/**
* Obtain the host's hostname.
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return hostname of the host
*/
@@ -193,7 +193,7 @@
/**
* Obtain the host's username
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return username to login to the host
*/
@@ -206,12 +206,12 @@
/**
* Obtain the host's ssh port
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return username to login to the host
*/
uint16_t
-GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host *host)
+GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host * host)
{
return host->port;
}
@@ -219,7 +219,7 @@
/**
* Create a host to run peers and controllers on.
- *
+ *
* @param id global host ID assigned to the host; 0 is
* reserved to always mean 'localhost'
* @param hostname name of the host, use "NULL" for localhost
@@ -228,10 +228,8 @@
* @return handle to the host, NULL on error
*/
struct GNUNET_TESTBED_Host *
-GNUNET_TESTBED_host_create_with_id (uint32_t id,
- const char *hostname,
- const char *username,
- uint16_t port)
+GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname,
+ const char *username, uint16_t port)
{
struct GNUNET_TESTBED_Host *host;
uint32_t new_size;
@@ -251,15 +249,15 @@
new_size += HOST_LIST_GROW_STEP;
if (new_size != host_list_size)
{
- host_list = GNUNET_realloc (host_list, sizeof (struct GNUNET_TESTBED_Host
*)
- * new_size);
- (void) memset(&host_list[host_list_size], 0,
- sizeof (struct GNUNET_TESTBED_Host *) *
- (new_size - host_list_size));
+ host_list =
+ GNUNET_realloc (host_list,
+ sizeof (struct GNUNET_TESTBED_Host *) * new_size);
+ (void) memset (&host_list[host_list_size], 0,
+ sizeof (struct GNUNET_TESTBED_Host *) * (new_size -
+ host_list_size));
host_list_size = new_size;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Adding host with id: %u\n", host->id);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding host with id: %u\n", host->id);
host_list[id] = host;
return host;
}
@@ -267,24 +265,22 @@
/**
* Create a host to run peers and controllers on.
- *
+ *
* @param hostname name of the host, use "NULL" for localhost
* @param username username to use for the login; may be NULL
* @param port port number to use for ssh; use 0 to let ssh decide
* @return handle to the host, NULL on error
*/
struct GNUNET_TESTBED_Host *
-GNUNET_TESTBED_host_create (const char *hostname,
- const char *username,
- uint16_t port)
+GNUNET_TESTBED_host_create (const char *hostname, const char *username,
+ uint16_t port)
{
static uint32_t uid_generator;
if (NULL == hostname)
return GNUNET_TESTBED_host_create_with_id (0, hostname, username, port);
- return GNUNET_TESTBED_host_create_with_id (++uid_generator,
- hostname, username,
- port);
+ return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname,
+ username, port);
}
@@ -297,7 +293,7 @@
*/
unsigned int
GNUNET_TESTBED_hosts_load_from_file (const char *filename,
- struct GNUNET_TESTBED_Host **hosts)
+ struct GNUNET_TESTBED_Host **hosts)
{
// see testing_group.c, GNUNET_TESTING_hosts_load
GNUNET_break (0);
@@ -313,7 +309,7 @@
*/
void
GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host)
-{
+{
struct RegisteredController *rc;
uint32_t id;
@@ -321,7 +317,7 @@
GNUNET_assert (host_list[host->id] == host);
host_list[host->id] = NULL;
/* clear registered controllers list */
- for (rc=host->rc_head; NULL != rc; rc=host->rc_head)
+ for (rc = host->rc_head; NULL != rc; rc = host->rc_head)
{
GNUNET_CONTAINER_DLL_remove (host->rc_head, host->rc_tail, rc);
GNUNET_free (rc);
@@ -331,18 +327,19 @@
GNUNET_free (host);
while (host_list_size >= HOST_LIST_GROW_STEP)
{
- for (id = host_list_size - 1;
- id > host_list_size - HOST_LIST_GROW_STEP; id--)
+ for (id = host_list_size - 1; id > host_list_size - HOST_LIST_GROW_STEP;
+ id--)
if (NULL != host_list[id])
- break;
+ break;
if (id != host_list_size - HOST_LIST_GROW_STEP)
break;
if (NULL != host_list[id])
break;
host_list_size -= HOST_LIST_GROW_STEP;
}
- host_list = GNUNET_realloc (host_list, sizeof (struct GNUNET_TESTBED_Host) *
- host_list_size);
+ host_list =
+ GNUNET_realloc (host_list,
+ sizeof (struct GNUNET_TESTBED_Host) * host_list_size);
}
@@ -354,14 +351,14 @@
*/
void
GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_TESTBED_Controller
- * const controller)
+ const struct GNUNET_TESTBED_Controller
+ *const controller)
{
struct RegisteredController *rc;
-
- for (rc=host->rc_head; NULL != rc; rc=rc->next)
+
+ for (rc = host->rc_head; NULL != rc; rc = rc->next)
{
- if (controller == rc->controller) /* already registered at controller */
+ if (controller == rc->controller) /* already registered at controller */
{
GNUNET_break (0);
return;
@@ -383,14 +380,14 @@
*/
int
GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_TESTBED_Controller
- *const controller)
+ const struct GNUNET_TESTBED_Controller
+ *const controller)
{
struct RegisteredController *rc;
-
- for (rc=host->rc_head; NULL != rc; rc=rc->next)
+
+ for (rc = host->rc_head; NULL != rc; rc = rc->next)
{
- if (controller == rc->controller) /* already registered at controller */
+ if (controller == rc->controller) /* already registered at controller */
{
return GNUNET_YES;
}
Modified: gnunet/src/testbed/testbed_api_hosts.h
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.h 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_hosts.h 2012-08-31 10:36:28 UTC (rev
23531)
@@ -33,7 +33,7 @@
/**
* Lookup a host by ID.
- *
+ *
* @param id global host ID assigned to the host; 0 is
* reserved to always mean 'localhost'
* @return handle to the host, NULL on error
@@ -46,7 +46,7 @@
* Create a host by ID; given this host handle, we could not
* run peers at the host, but we can talk about the host
* internally.
- *
+ *
* @param id global host ID assigned to the host; 0 is
* reserved to always mean 'localhost'
* @return handle to the host, NULL on error
@@ -57,7 +57,7 @@
/**
* Obtain a host's unique global ID.
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return id global host ID assigned to the host (0 is
* 'localhost', but then obviously not globally unique)
@@ -68,7 +68,7 @@
/**
* Obtain the host's hostname.
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return hostname of the host
*/
@@ -78,7 +78,7 @@
/**
* Obtain the host's username
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return username to login to the host
*/
@@ -88,7 +88,7 @@
/**
* Obtain the host's ssh port
- *
+ *
* @param host handle to the host, NULL means 'localhost'
* @return username to login to the host
*/
@@ -147,8 +147,8 @@
*/
void
GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_TESTBED_Controller
- *controller);
+ const struct GNUNET_TESTBED_Controller
+ *controller);
/**
@@ -160,8 +160,8 @@
*/
int
GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_TESTBED_Controller
- *controller);
+ const struct GNUNET_TESTBED_Controller
+ *controller);
Modified: gnunet/src/testbed/testbed_api_operations.c
===================================================================
--- gnunet/src/testbed/testbed_api_operations.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_operations.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -69,7 +69,7 @@
* Number of operations that can be concurrently
* active in this queue.
*/
- unsigned int active;
+ unsigned int active;
};
@@ -77,17 +77,17 @@
* Operation state
*/
enum OperationState
- {
+{
/**
* The operation is currently waiting for resources
*/
- OP_STATE_WAITING,
+ OP_STATE_WAITING,
/**
* The operation has started
*/
- OP_STATE_STARTED,
- };
+ OP_STATE_STARTED,
+};
/**
@@ -105,7 +105,7 @@
* not have been started yet).
*/
OperationRelease release;
-
+
/**
* Closure for callbacks.
*/
@@ -129,8 +129,8 @@
/**
* The state of the operation
*/
- enum OperationState state;
-
+ enum OperationState state;
+
};
@@ -142,15 +142,15 @@
*/
static void
call_start (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
+{
struct GNUNET_TESTBED_Operation *op = cls;
-
+
op->start_task_id = GNUNET_SCHEDULER_NO_TASK;
op->state = OP_STATE_STARTED;
if (NULL != op->start)
{
op->start (op->cb_cls);
- }
+ }
}
@@ -161,11 +161,11 @@
*/
static void
check_readiness (struct GNUNET_TESTBED_Operation *op)
-{
+{
unsigned int i;
if (GNUNET_SCHEDULER_NO_TASK != op->start_task_id)
- return;
+ return;
for (i = 0; i < op->nqueues; i++)
{
if (0 == op->queues[i]->active)
@@ -188,9 +188,8 @@
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_operation_create_ (void *cls,
- OperationStart start,
- OperationRelease release)
+GNUNET_TESTBED_operation_create_ (void *cls, OperationStart start,
+ OperationRelease release)
{
struct GNUNET_TESTBED_Operation *op;
@@ -240,9 +239,9 @@
* Add an operation to a queue. An operation can be in multiple
* queues at once. Once all queues permit the operation to become
* active, the operation will be activated. The actual activation
- * will occur in a separate task (thus allowing multiple queue
+ * will occur in a separate task (thus allowing multiple queue
* insertions to be made without having the first one instantly
- * trigger the operation if the first queue has sufficient
+ * trigger the operation if the first queue has sufficient
* resources).
*
* @param queue queue to add the operation to
@@ -250,7 +249,8 @@
*/
void
GNUNET_TESTBED_operation_queue_insert_ (struct OperationQueue *queue,
- struct GNUNET_TESTBED_Operation
*operation)
+ struct GNUNET_TESTBED_Operation
+ *operation)
{
struct QueueEntry *entry;
@@ -258,8 +258,9 @@
entry->op = operation;
GNUNET_CONTAINER_DLL_insert_tail (queue->head, queue->tail, entry);
operation->queues =
- GNUNET_realloc (operation->queues,
- sizeof (struct OperationQueue *) * (++operation->nqueues));
+ GNUNET_realloc (operation->queues,
+ sizeof (struct OperationQueue *) *
+ (++operation->nqueues));
operation->queues[operation->nqueues - 1] = queue;
check_readiness (operation);
}
@@ -276,11 +277,12 @@
*/
void
GNUNET_TESTBED_operation_queue_remove_ (struct OperationQueue *queue,
- struct GNUNET_TESTBED_Operation
*operation)
+ struct GNUNET_TESTBED_Operation
+ *operation)
{
struct QueueEntry *entry;
struct QueueEntry *entry2;
-
+
for (entry = queue->head; NULL != entry; entry = entry->next)
if (entry->op == operation)
break;
@@ -309,7 +311,7 @@
GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *operation)
{
unsigned int i;
-
+
if (GNUNET_SCHEDULER_NO_TASK != operation->start_task_id)
{
GNUNET_SCHEDULER_cancel (operation->start_task_id);
Modified: gnunet/src/testbed/testbed_api_operations.h
===================================================================
--- gnunet/src/testbed/testbed_api_operations.h 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_operations.h 2012-08-31 10:36:28 UTC (rev
23531)
@@ -62,9 +62,9 @@
* Add an operation to a queue. An operation can be in multiple
* queues at once. Once all queues permit the operation to become
* active, the operation will be activated. The actual activation
- * will occur in a separate task (thus allowing multiple queue
+ * will occur in a separate task (thus allowing multiple queue
* insertions to be made without having the first one instantly
- * trigger the operation if the first queue has sufficient
+ * trigger the operation if the first queue has sufficient
* resources).
*
* @param queue queue to add the operation to
@@ -72,7 +72,8 @@
*/
void
GNUNET_TESTBED_operation_queue_insert_ (struct OperationQueue *queue,
- struct GNUNET_TESTBED_Operation
*operation);
+ struct GNUNET_TESTBED_Operation
+ *operation);
/**
@@ -86,7 +87,8 @@
*/
void
GNUNET_TESTBED_operation_queue_remove_ (struct OperationQueue *queue,
- struct GNUNET_TESTBED_Operation
*operation);
+ struct GNUNET_TESTBED_Operation
+ *operation);
@@ -97,7 +99,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-typedef void (*OperationStart)(void *cls);
+typedef void (*OperationStart) (void *cls);
/**
@@ -113,7 +115,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-typedef void (*OperationRelease)(void *cls);
+typedef void (*OperationRelease) (void *cls);
/**
@@ -125,9 +127,8 @@
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_operation_create_ (void *cls,
- OperationStart start,
- OperationRelease release);
+GNUNET_TESTBED_operation_create_ (void *cls, OperationStart start,
+ OperationRelease release);
/**
Modified: gnunet/src/testbed/testbed_api_peers.c
===================================================================
--- gnunet/src/testbed/testbed_api_peers.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_peers.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -40,7 +40,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_peer_create (void *cls)
{
struct OperationContext *opc = cls;
@@ -52,7 +52,7 @@
size_t xc_size;
uint16_t msize;
- GNUNET_assert (OP_PEER_CREATE == opc->type);
+ GNUNET_assert (OP_PEER_CREATE == opc->type);
data = opc->data;
GNUNET_assert (NULL != data);
GNUNET_assert (NULL != data->peer);
@@ -79,10 +79,10 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_peer_create (void *cls)
{
- struct OperationContext *opc = cls;
+ struct OperationContext *opc = cls;
if (OPC_STATE_FINISHED != opc->state)
{
@@ -99,7 +99,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_peer_destroy (void *cls)
{
struct OperationContext *opc = cls;
@@ -115,8 +115,7 @@
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER);
msg->peer_id = htonl (peer->unique_id);
msg->operation_id = GNUNET_htonll (opc->id);
- GNUNET_CONTAINER_DLL_insert_tail (opc->c->ocq_head,
- opc->c->ocq_tail, opc);
+ GNUNET_CONTAINER_DLL_insert_tail (opc->c->ocq_head, opc->c->ocq_tail, opc);
GNUNET_TESTBED_queue_message_ (peer->controller, &msg->header);
}
@@ -126,11 +125,11 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_peer_destroy (void *cls)
{
struct OperationContext *opc = cls;
-
+
if (OPC_STATE_FINISHED != opc->state)
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
GNUNET_free (opc);
@@ -142,7 +141,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_peer_start (void *cls)
{
struct OperationContext *opc = cls;
@@ -169,11 +168,11 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_peer_start (void *cls)
{
struct OperationContext *opc = cls;
-
+
if (OPC_STATE_FINISHED != opc->state)
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
GNUNET_free (opc);
@@ -185,7 +184,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_peer_stop (void *cls)
{
struct OperationContext *opc = cls;
@@ -194,8 +193,8 @@
GNUNET_assert (NULL != opc->data);
peer = opc->data;
- GNUNET_assert (PS_STARTED == peer->state);
- opc->state = OPC_STATE_STARTED;
+ GNUNET_assert (PS_STARTED == peer->state);
+ opc->state = OPC_STATE_STARTED;
msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerStopMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER);
msg->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerStopMessage));
@@ -211,11 +210,11 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_peer_stop (void *cls)
{
struct OperationContext *opc = cls;
-
+
if (OPC_STATE_FINISHED != opc->state)
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
GNUNET_free (opc);
@@ -236,10 +235,11 @@
{
struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg;
- msg = GNUNET_malloc (sizeof (struct
- GNUNET_TESTBED_PeerGetConfigurationMessage));
- msg->header.size = htons
- (sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage));
+ msg =
+ GNUNET_malloc (sizeof
+ (struct GNUNET_TESTBED_PeerGetConfigurationMessage));
+ msg->header.size =
+ htons (sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG);
msg->peer_id = htonl (peer_id);
msg->operation_id = GNUNET_htonll (operation_id);
@@ -252,18 +252,19 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_peer_getinfo (void *cls)
{
struct OperationContext *opc = cls;
- struct PeerInfoData *data;
+ struct PeerInfoData *data;
struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg;
data = opc->data;
GNUNET_assert (NULL != data);
opc->state = OPC_STATE_STARTED;
- msg = GNUNET_TESTBED_generate_peergetconfig_msg_ (data->peer->unique_id,
- opc->id);
+ msg =
+ GNUNET_TESTBED_generate_peergetconfig_msg_ (data->peer->unique_id,
+ opc->id);
GNUNET_CONTAINER_DLL_insert_tail (opc->c->ocq_head, opc->c->ocq_tail, opc);
GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
}
@@ -274,16 +275,16 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_peer_getinfo (void *cls)
{
struct OperationContext *opc = cls;
struct PeerInfoData2 *data;
-
+
if (OPC_STATE_FINISHED != opc->state)
{
GNUNET_free_non_null (opc->data);
- GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
+ GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
}
else
{
@@ -311,19 +312,19 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_overlay_connect (void *cls)
{
struct OperationContext *opc = cls;
struct GNUNET_TESTBED_OverlayConnectMessage *msg;
struct OverlayConnectData *data;
-
+
opc->state = OPC_STATE_STARTED;
data = opc->data;
GNUNET_assert (NULL != data);
msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage));
- msg->header.size = htons (sizeof
- (struct GNUNET_TESTBED_OverlayConnectMessage));
+ msg->header.size =
+ htons (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage));
msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT);
msg->peer1 = htonl (data->p1->unique_id);
msg->peer2 = htonl (data->p2->unique_id);
@@ -338,23 +339,23 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_overlay_connect (void *cls)
{
struct OperationContext *opc = cls;
-
+
if (OPC_STATE_FINISHED != opc->state)
{
GNUNET_free (opc->data);
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
}
- GNUNET_free (opc);
+ GNUNET_free (opc);
}
/**
* Lookup a peer by ID.
- *
+ *
* @param id global peer ID assigned to the peer
* @return handle to the host, NULL on error
*/
@@ -400,11 +401,12 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_create_with_id_ (uint32_t unique_id,
- struct GNUNET_TESTBED_Controller
*controller,
- struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_CONFIGURATION_Handle
*cfg,
- GNUNET_TESTBED_PeerCreateCallback cb,
- void *cls)
+ struct GNUNET_TESTBED_Controller
+ *controller,
+ struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_CONFIGURATION_Handle
+ *cfg, GNUNET_TESTBED_PeerCreateCallback
cb,
+ void *cls)
{
struct GNUNET_TESTBED_Peer *peer;
struct PeerCreateData *data;
@@ -426,8 +428,9 @@
opc->data = data;
opc->id = controller->operation_counter++;
opc->type = OP_PEER_CREATE;
- opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_create,
- &oprelease_peer_create);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_create,
+ &oprelease_peer_create);
GNUNET_TESTBED_operation_queue_insert_ (controller->opq_parallel_operations,
opc->op);
return opc->op;
@@ -465,18 +468,14 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
- struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- GNUNET_TESTBED_PeerCreateCallback cb,
- void *cls)
+ struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ GNUNET_TESTBED_PeerCreateCallback cb, void *cls)
{
static uint32_t id_gen;
- return GNUNET_TESTBED_peer_create_with_id_ (id_gen++,
- controller,
- host,
- cfg,
- cb, cls);
+ return GNUNET_TESTBED_peer_create_with_id_ (id_gen++, controller, host, cfg,
+ cb, cls);
}
@@ -496,17 +495,18 @@
opc->data = peer;
opc->id = opc->c->operation_counter++;
opc->type = OP_PEER_START;
- opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_start,
- &oprelease_peer_start);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_start,
+ &oprelease_peer_start);
GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
opc->op);
- return opc->op;
+ return opc->op;
}
/**
* Stop the given peer. The handle remains valid (use
- * "GNUNET_TESTBED_peer_destroy" to fully clean up the
+ * "GNUNET_TESTBED_peer_destroy" to fully clean up the
* state of the peer).
*
* @param peer peer to stop
@@ -522,8 +522,9 @@
opc->data = peer;
opc->id = opc->c->operation_counter++;
opc->type = OP_PEER_STOP;
- opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_stop,
- &oprelease_peer_stop);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_stop,
+ &oprelease_peer_stop);
GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
opc->op);
return opc->op;
@@ -539,7 +540,8 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer,
- enum GNUNET_TESTBED_PeerInformationType
pit)
+ enum GNUNET_TESTBED_PeerInformationType
+ pit)
{
struct OperationContext *opc;
struct PeerInfoData *data;
@@ -553,8 +555,9 @@
opc->data = data;
opc->type = OP_PEER_INFO;
opc->id = opc->c->operation_counter++;
- opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_getinfo,
- &oprelease_peer_getinfo);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_getinfo,
+ &oprelease_peer_getinfo);
GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
opc->op);
return opc->op;
@@ -573,7 +576,8 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer,
- const struct
GNUNET_CONFIGURATION_Handle *cfg)
+ const struct
+ GNUNET_CONFIGURATION_Handle *cfg)
{
// FIXME: handle locally or delegate...
GNUNET_break (0);
@@ -598,8 +602,9 @@
opc->c = peer->controller;
opc->id = peer->controller->operation_counter++;
opc->type = OP_PEER_DESTROY;
- opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_destroy,
- &oprelease_peer_destroy);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_peer_destroy,
+ &oprelease_peer_destroy);
GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
opc->op);
return opc->op;
@@ -608,7 +613,7 @@
/**
* Manipulate the P2P underlay topology by configuring a link
- * between two peers.
+ * between two peers.
*
* @param op_cls closure argument to give with the operation event
* @param p1 first peer
@@ -620,9 +625,10 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_underlay_configure_link (void *op_cls,
- struct GNUNET_TESTBED_Peer *p1,
- struct GNUNET_TESTBED_Peer *p2,
- enum GNUNET_TESTBED_ConnectOption co,
...)
+ struct GNUNET_TESTBED_Peer *p1,
+ struct GNUNET_TESTBED_Peer *p2,
+ enum GNUNET_TESTBED_ConnectOption co,
+ ...)
{
GNUNET_break (0);
return NULL;
@@ -643,9 +649,8 @@
* not running or underlay disallows)
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_overlay_connect (void *op_cls,
- struct GNUNET_TESTBED_Peer *p1,
- struct GNUNET_TESTBED_Peer *p2)
+GNUNET_TESTBED_overlay_connect (void *op_cls, struct GNUNET_TESTBED_Peer *p1,
+ struct GNUNET_TESTBED_Peer *p2)
{
struct OperationContext *opc;
struct OverlayConnectData *data;
@@ -660,8 +665,9 @@
opc->c = p1->controller;
opc->id = opc->c->operation_counter++;
opc->type = OP_OVERLAY_CONNECT;
- opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_overlay_connect,
- &oprelease_overlay_connect);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_overlay_connect,
+ &oprelease_overlay_connect);
GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,
opc->op);
return opc->op;
Modified: gnunet/src/testbed/testbed_api_peers.h
===================================================================
--- gnunet/src/testbed/testbed_api_peers.h 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_peers.h 2012-08-31 10:36:28 UTC (rev
23531)
@@ -35,34 +35,34 @@
/**
* Enumeration of possible states a peer could be in
*/
-enum PeerState
- {
+enum PeerState
+{
/**
* State to signify that this peer is invalid
*/
- PS_INVALID,
+ PS_INVALID,
/**
* The peer has been created
*/
- PS_CREATED,
-
+ PS_CREATED,
+
/**
* The peer is running
*/
- PS_STARTED,
+ PS_STARTED,
/**
* The peer is stopped
*/
- PS_STOPPED,
- };
+ PS_STOPPED,
+};
/**
* A peer controlled by the testing framework. A peer runs
* at a particular host.
- */
+ */
struct GNUNET_TESTBED_Peer
{
/**
@@ -70,7 +70,7 @@
* that is responsible for starting/running the peer!).
*/
struct GNUNET_TESTBED_Controller *controller;
-
+
/**
* Which host does this peer run on?
*/
@@ -102,12 +102,12 @@
* The template configuration of the peer
*/
const struct GNUNET_CONFIGURATION_Handle *cfg;
-
+
/**
* The call back to call when we receive peer create success message
*/
GNUNET_TESTBED_PeerCreateCallback cb;
-
+
/**
* The closure for the above callback
*/
@@ -144,7 +144,7 @@
* The peer whose information has been requested
*/
struct GNUNET_TESTBED_Peer *peer;
-
+
/**
* The type of peer information requested
*/
@@ -232,11 +232,12 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_peer_create_with_id_ (uint32_t unique_id,
- struct GNUNET_TESTBED_Controller
*controller,
- struct GNUNET_TESTBED_Host *host,
- const struct GNUNET_CONFIGURATION_Handle
*cfg,
- GNUNET_TESTBED_PeerCreateCallback cb,
- void *cls);
+ struct GNUNET_TESTBED_Controller
+ *controller,
+ struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_CONFIGURATION_Handle
+ *cfg, GNUNET_TESTBED_PeerCreateCallback
cb,
+ void *cls);
/**
@@ -245,7 +246,7 @@
* @param peer_id the id of the peer whose information we have to get
* @param operation_id the ip of the operation that should be represented in
* the message
- * @param
+ * @param
* @return the PeerGetConfigurationMessage
*/
struct GNUNET_TESTBED_PeerGetConfigurationMessage *
Modified: gnunet/src/testbed/testbed_api_services.c
===================================================================
--- gnunet/src/testbed/testbed_api_services.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_services.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -33,26 +33,26 @@
* States for Service connect operations
*/
enum State
- {
+{
/**
* Initial state
*/
- INIT,
+ INIT,
/**
* The configuration request has been sent
*/
- CFG_REQUEST_QUEUED,
+ CFG_REQUEST_QUEUED,
/**
* connected to service
*/
- SERVICE_CONNECTED,
+ SERVICE_CONNECTED,
/**
- *
+ *
*/
- };
+};
/**
@@ -79,7 +79,7 @@
* Service name
*/
char *service_name;
-
+
/**
* Closure for operation event
*/
@@ -114,7 +114,7 @@
* State information
*/
enum State state;
-
+
};
@@ -125,17 +125,16 @@
* @param cls ServiceConnectData
* @param msg message received, NULL on timeout or fatal error
*/
-static void
-configuration_receiver (void *cls,
- const struct GNUNET_MessageHeader *msg)
+static void
+configuration_receiver (void *cls, const struct GNUNET_MessageHeader *msg)
{
struct ServiceConnectData *data = cls;
const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *imsg;
- struct GNUNET_TESTBED_Controller *c;
- struct GNUNET_TESTBED_EventInformation info;
-
- imsg = (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *)
- msg;
+ struct GNUNET_TESTBED_Controller *c;
+ struct GNUNET_TESTBED_EventInformation info;
+
+ imsg =
+ (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg;
data->cfg = GNUNET_TESTBED_get_config_from_peerinfo_msg_ (imsg);
data->op_result = data->ca (data->cada_cls, data->cfg);
info.type = GNUNET_TESTBED_ET_OPERATION_FINISHED;
@@ -146,9 +145,9 @@
info.details.operation_finished.op_result.generic = data->op_result;
c = data->peer->controller;
data->state = SERVICE_CONNECTED;
- if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask))
- && (NULL != c->cc))
- c->cc (c->cc_cls, &info);
+ if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) &&
+ (NULL != c->cc))
+ c->cc (c->cc_cls, &info);
}
@@ -157,23 +156,23 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
opstart_service_connect (void *cls)
{
struct ServiceConnectData *data = cls;
struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg;
- struct GNUNET_TESTBED_Controller *c;
- uint64_t op_id;
-
+ struct GNUNET_TESTBED_Controller *c;
+ uint64_t op_id;
+
GNUNET_assert (NULL != data);
GNUNET_assert (NULL != data->peer);
- c = data->peer->controller;
- op_id = c->operation_counter++;
- msg = GNUNET_TESTBED_generate_peergetconfig_msg_ (data->peer->unique_id,
- op_id);
+ c = data->peer->controller;
+ op_id = c->operation_counter++;
+ msg =
+ GNUNET_TESTBED_generate_peergetconfig_msg_ (data->peer->unique_id,
op_id);
data->opc =
- GNUNET_TESTBED_forward_operation_msg_ (c, op_id, &msg->header,
- &configuration_receiver, data);
+ GNUNET_TESTBED_forward_operation_msg_ (c, op_id, &msg->header,
+ &configuration_receiver, data);
GNUNET_free (msg);
data->state = CFG_REQUEST_QUEUED;
}
@@ -185,7 +184,7 @@
*
* @param cls the closure from GNUNET_TESTBED_operation_create_()
*/
-static void
+static void
oprelease_service_connect (void *cls)
{
struct ServiceConnectData *data = cls;
@@ -215,7 +214,7 @@
* 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.
@@ -229,12 +228,11 @@
* @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_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_ConnectAdapter ca,
+ GNUNET_TESTBED_DisconnectAdapter da,
+ void *cada_cls)
{
struct ServiceConnectData *data;
@@ -245,14 +243,16 @@
data->op_cls = op_cls;
data->peer = peer;
data->state = INIT;
- data->operation =
- GNUNET_TESTBED_operation_create_ (data, &opstart_service_connect,
- &oprelease_service_connect);
- GNUNET_TESTBED_operation_queue_insert_
- (peer->controller->opq_parallel_service_connections, data->operation);
- GNUNET_TESTBED_operation_queue_insert_
- (peer->controller->opq_parallel_operations, data->operation);
- return data->operation;
+ data->operation =
+ GNUNET_TESTBED_operation_create_ (data, &opstart_service_connect,
+ &oprelease_service_connect);
+ GNUNET_TESTBED_operation_queue_insert_ (peer->
+
controller->opq_parallel_service_connections,
+ data->operation);
+ GNUNET_TESTBED_operation_queue_insert_ (peer->
+ controller->opq_parallel_operations,
+ data->operation);
+ return data->operation;
}
/* end of testbed_api_services.c */
Modified: gnunet/src/testbed/testbed_api_test.c
===================================================================
--- gnunet/src/testbed/testbed_api_test.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_test.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -53,11 +53,10 @@
* @param test_master_cls closure for 'task'.
*/
void
-GNUNET_TESTBED_test_run (const char *testname,
- const char *cfg_filename,
- unsigned int num_peers,
- GNUNET_TESTBED_TestMaster test_master,
- void *test_master_cls)
+GNUNET_TESTBED_test_run (const char *testname, const char *cfg_filename,
+ unsigned int num_peers,
+ GNUNET_TESTBED_TestMaster test_master,
+ void *test_master_cls)
{
GNUNET_break (0);
}
Modified: gnunet/src/testbed/testbed_api_testbed.c
===================================================================
--- gnunet/src/testbed/testbed_api_testbed.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_testbed.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -61,13 +61,13 @@
/**
* Closure
*/
- void *cls;
-
+ void *cls;
+
/**
* The next pointer for DLL
*/
struct DLLOperation *next;
-
+
/**
* The prev pointer for DLL
*/
@@ -78,13 +78,13 @@
/**
* States of RunContext
*/
-enum State
+enum State
{
/**
* Initial state
*/
RC_INIT = 0,
-
+
/**
* Peers have been started
*/
@@ -94,12 +94,11 @@
* Peers are stopped
*/
RC_PEERS_STOPPED,
-
+
/**
* Peers are destroyed
*/
RC_PEERS_DESTROYED
-
};
@@ -127,17 +126,17 @@
* The callback to use as controller callback
*/
GNUNET_TESTBED_ControllerCallback cc;
-
+
/**
* The pointer to the controller callback
*/
void *cc_cls;
-
+
/**
* Master task to call when testbed initialization is done
*/
GNUNET_SCHEDULER_Task master;
-
+
/**
* The closure for the master task
*/
@@ -147,7 +146,7 @@
* The head element of DLL operations
*/
struct DLLOperation *dll_op_head;
-
+
/**
* The tail element of DLL operations
*/
@@ -157,7 +156,7 @@
* Array of peers which we create
*/
struct GNUNET_TESTBED_Peer **peers;
-
+
/**
* The event mask for the controller
*/
@@ -173,7 +172,7 @@
* successful operation on a peer
*/
unsigned int peer_count;
-
+
/**
* number of peers to start
*/
@@ -203,12 +202,12 @@
*/
struct GNUNET_TESTBED_Testbed *
GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller,
- unsigned int num_hosts,
- struct GNUNET_TESTBED_Host **hosts,
- unsigned int num_peers,
- const struct GNUNET_CONFIGURATION_Handle
*peer_cfg,
- enum GNUNET_TESTBED_TopologyOption
underlay_topology,
- va_list va)
+ unsigned int num_hosts,
+ struct GNUNET_TESTBED_Host **hosts,
+ unsigned int num_peers,
+ const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
+ enum GNUNET_TESTBED_TopologyOption underlay_topology,
+ va_list va)
{
GNUNET_break (0);
return NULL;
@@ -233,12 +232,12 @@
*/
struct GNUNET_TESTBED_Testbed *
GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller,
- unsigned int num_hosts,
- struct GNUNET_TESTBED_Host **hosts,
- unsigned int num_peers,
- const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
- enum GNUNET_TESTBED_TopologyOption underlay_topology,
- ...)
+ unsigned int num_hosts,
+ struct GNUNET_TESTBED_Host **hosts,
+ unsigned int num_peers,
+ const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
+ enum GNUNET_TESTBED_TopologyOption underlay_topology,
+ ...)
{
GNUNET_break (0);
return NULL;
@@ -268,18 +267,18 @@
start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct RunContext *rc = cls;
- struct DLLOperation *dll_op;
+ struct DLLOperation *dll_op;
unsigned int peer;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting Peers\n");
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting Peers\n");
for (peer = 0; peer < rc->num_peers; peer++)
{
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer]);
- dll_op->cls = rc->peers[peer];
+ dll_op->cls = rc->peers[peer];
GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
dll_op);
}
- rc->peer_count = 0;
+ rc->peer_count = 0;
}
@@ -292,17 +291,17 @@
* creation
* @param emsg NULL if peer is not NULL; else MAY contain the error description
*/
-static void
+static void
peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
-{
+{
struct DLLOperation *dll_op = cls;
struct RunContext *rc;
-
- GNUNET_assert (NULL != dll_op);
+
+ GNUNET_assert (NULL != dll_op);
rc = dll_op->rc;
GNUNET_assert (NULL != rc);
GNUNET_CONTAINER_DLL_remove (rc->dll_op_head, rc->dll_op_tail, dll_op);
- GNUNET_TESTBED_operation_done (dll_op->op);
+ GNUNET_TESTBED_operation_done (dll_op->op);
GNUNET_free (dll_op);
if (NULL == peer)
{
@@ -316,7 +315,7 @@
rc->peer_count++;
if (rc->peer_count < rc->num_peers)
return;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Required peers created successfully\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Required peers created successfully\n");
GNUNET_SCHEDULER_add_now (&start_peers_task, rc);
}
@@ -331,8 +330,8 @@
cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct RunContext *rc = cls;
- struct DLLOperation *dll_op;
-
+ struct DLLOperation *dll_op;
+
GNUNET_assert (NULL == rc->peers);
GNUNET_assert (RC_PEERS_DESTROYED == rc->state);
if (NULL != rc->c)
@@ -363,21 +362,21 @@
* @param cls closure
* @param event information about the event
*/
-static void
+static void
event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
{
struct RunContext *rc = cls;
struct DLLOperation *dll_op;
unsigned int peer_id;
-
- if ((RC_INIT != rc->state) &&
- ((GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type)||
+
+ if ((RC_INIT != rc->state) &&
+ ((GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type) ||
(GNUNET_TESTBED_ET_PEER_STOP == event->type)))
{
for (dll_op = rc->dll_op_head; NULL != dll_op; dll_op = dll_op->next)
{
- if ((GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type) &&
+ if ((GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type) &&
(event->details.operation_finished.operation == dll_op->op))
break;
if ((GNUNET_TESTBED_ET_PEER_STOP == event->type) &&
@@ -418,12 +417,12 @@
return;
}
- call_cc:
+call_cc:
rc->cc (rc->cc_cls, event);
if (GNUNET_TESTBED_ET_PEER_START != event->type)
return;
for (dll_op = rc->dll_op_head; NULL != dll_op; dll_op = dll_op->next)
- if ((NULL != dll_op->cls) &&
+ if ((NULL != dll_op->cls) &&
(event->details.peer_start.peer == dll_op->cls))
break;
GNUNET_assert (NULL != dll_op);
@@ -436,7 +435,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers started successfully\n");
rc->state = RC_PEERS_STARTED;
GNUNET_SCHEDULER_add_continuation (rc->master, rc->master_cls,
- GNUNET_SCHEDULER_REASON_PREREQ_DONE);
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
}
@@ -450,32 +449,33 @@
* @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
* GNUNET_TESTBED_controller_stop() shouldn't be called in this case
*/
-static void
+static void
controller_status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
- int status)
-{
+ int status)
+{
struct RunContext *rc = cls;
struct DLLOperation *dll_op;
unsigned int peer;
-
+
if (status != GNUNET_OK)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Testbed startup failed\n");
return;
}
- rc->c = GNUNET_TESTBED_controller_connect (cfg, rc->h, rc->event_mask,
- &event_cb, rc);
- rc->peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *)
- * rc->num_peers);
+ rc->c =
+ GNUNET_TESTBED_controller_connect (cfg, rc->h, rc->event_mask, &event_cb,
+ rc);
+ rc->peers =
+ GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *) * rc->num_peers);
GNUNET_assert (NULL != rc->c);
- rc->peer_count = 0;
+ rc->peer_count = 0;
for (peer = 0; peer < rc->num_peers; peer++)
{
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
- dll_op->rc = rc;
- dll_op->op = GNUNET_TESTBED_peer_create (rc->c, rc->h, cfg, peer_create_cb,
- dll_op);
- GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
dll_op);
+ dll_op->rc = rc;
+ dll_op->op =
+ GNUNET_TESTBED_peer_create (rc->c, rc->h, cfg, peer_create_cb, dll_op);
+ GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
dll_op);
}
}
@@ -488,11 +488,11 @@
*/
void
shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
+{
struct RunContext *rc = cls;
struct DLLOperation *dll_op;
unsigned int peer;
-
+
if (NULL != rc->c)
{
if (NULL != rc->peers)
@@ -509,8 +509,8 @@
return;
}
}
- rc->state = RC_PEERS_DESTROYED; /* No peers are present so we consider the
- state where all peers are destroyed */
+ rc->state = RC_PEERS_DESTROYED; /* No peers are present so we consider
the
+ * state where all peers are destroyed
*/
GNUNET_SCHEDULER_add_now (&cleanup_task, rc);
}
@@ -540,25 +540,23 @@
*/
void
GNUNET_TESTBED_run (const char *host_filename,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- unsigned int num_peers,
- uint64_t event_mask,
- GNUNET_TESTBED_ControllerCallback cc,
- void *cc_cls,
- GNUNET_SCHEDULER_Task master,
- void *master_cls)
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ unsigned int num_peers, uint64_t event_mask,
+ GNUNET_TESTBED_ControllerCallback cc, void *cc_cls,
+ GNUNET_SCHEDULER_Task master, void *master_cls)
{
struct RunContext *rc;
- event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START);
+ event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START);
rc = GNUNET_malloc (sizeof (struct RunContext));
GNUNET_break (NULL == host_filename); /* Currently we do not support host
- files */
+ * files */
host_filename = NULL;
rc->h = GNUNET_TESTBED_host_create (NULL, NULL, 0);
GNUNET_assert (NULL != rc->h);
- rc->cproc = GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, cfg,
- &controller_status_cb, rc);
+ rc->cproc =
+ GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, cfg,
+ &controller_status_cb, rc);
GNUNET_assert (NULL != rc->cproc);
rc->num_peers = num_peers;
rc->event_mask = event_mask;
Modified: gnunet/src/testbed/testbed_api_topology.c
===================================================================
--- gnunet/src/testbed/testbed_api_topology.c 2012-08-31 10:06:42 UTC (rev
23530)
+++ gnunet/src/testbed/testbed_api_topology.c 2012-08-31 10:36:28 UTC (rev
23531)
@@ -40,10 +40,12 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls,
- unsigned int num_peers,
- struct GNUNET_TESTBED_Peer
**peers,
- enum
GNUNET_TESTBED_TopologyOption topo,
- va_list ap)
+ unsigned int num_peers,
+ struct GNUNET_TESTBED_Peer
+ **peers,
+ enum
+ GNUNET_TESTBED_TopologyOption
+ topo, va_list ap)
{
GNUNET_break (0);
return NULL;
@@ -63,10 +65,10 @@
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_underlay_configure_topology (void *op_cls,
- unsigned int num_peers,
- struct GNUNET_TESTBED_Peer **peers,
- enum GNUNET_TESTBED_TopologyOption
topo,
- ...)
+ unsigned int num_peers,
+ struct GNUNET_TESTBED_Peer **peers,
+ enum GNUNET_TESTBED_TopologyOption
+ topo, ...)
{
GNUNET_break (0);
return NULL;
@@ -83,16 +85,16 @@
* @param peers array of 'num_peers' with the peers to configure
* @param topo desired underlay topology to use
* @param va topology-specific options
- * @return handle to the operation, NULL if connecting these
+ * @return handle to the operation, NULL if connecting these
* peers is fundamentally not possible at this time (peers
* not running or underlay disallows)
*/
struct GNUNET_TESTBED_Operation *
GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
- unsigned int num_peers,
- struct GNUNET_TESTBED_Peer *peers,
- enum
GNUNET_TESTBED_TopologyOption topo,
- va_list va)
+ unsigned int num_peers,
+ struct GNUNET_TESTBED_Peer
*peers,
+ enum
GNUNET_TESTBED_TopologyOption
+ topo, va_list va)
{
GNUNET_break (0);
return NULL;
@@ -109,16 +111,15 @@
* @param peers array of 'num_peers' with the peers to configure
* @param topo desired underlay topology to use
* @param ... topology-specific options
- * @return handle to the operation, NULL if connecting these
+ * @return handle to the operation, NULL if connecting these
* peers is fundamentally not possible at this time (peers
* not running or underlay disallows)
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
- unsigned int num_peers,
- struct GNUNET_TESTBED_Peer *peers,
- enum GNUNET_TESTBED_TopologyOption
topo,
- ...)
+GNUNET_TESTBED_overlay_configure_topology (void *op_cls, unsigned int
num_peers,
+ struct GNUNET_TESTBED_Peer *peers,
+ enum GNUNET_TESTBED_TopologyOption
+ topo, ...)
{
GNUNET_break (0);
return NULL;
Modified: gnunet/src/testbed/testbed_helper.h
===================================================================
--- gnunet/src/testbed/testbed_helper.h 2012-08-31 10:06:42 UTC (rev 23530)
+++ gnunet/src/testbed/testbed_helper.h 2012-08-31 10:36:28 UTC (rev 23531)
@@ -22,7 +22,7 @@
* @file testbed/testbed_helper.h
* @brief Message formats for communication between testbed api and
* gnunet-testbed-helper process
- * @author Sree Harsha Totakura <address@hidden>
+ * @author Sree Harsha Totakura <address@hidden>
*/
#ifndef TESTBED_HELPER_H
@@ -40,7 +40,7 @@
/**
* The controller hostname size excluding the NULL termination character -
- * strlen (hostname); cannot be zero
+ * strlen (hostname); cannot be zero
*/
uint16_t cname_size GNUNET_PACKED;
@@ -50,9 +50,9 @@
uint16_t config_size GNUNET_PACKED;
/* Followed by NULL terminated controller hostname */
-
+
/* Followed by serialized and compressed configuration which should be
- config_size long when un-compressed */
+ * config_size long when un-compressed */
};
/**
@@ -71,7 +71,7 @@
uint16_t config_size GNUNET_PACKED;
/* Followed by compressed configuration which should be config_size long when
- un-compressed */
+ * un-compressed */
};
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23531 - gnunet/src/testbed,
gnunet <=