*/
struct OperationQueue *GST_opq_openfds;
+/**
+ * Timeout for operations which may take some time
+ */
+const struct GNUNET_TIME_Relative GST_timeout;
+
/**
* The size of the host list
*/
msize += emsg_len;
msg = GNUNET_malloc (msize);
msg->header.size = htons (msize);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT);
msg->event_type = htonl (GNUNET_TESTBED_ET_OPERATION_FINISHED);
msg->operation_id = GNUNET_htonll (operation_id);
if (0 != emsg_len)
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->header.type =
+ htons (GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS);
msg->operation_id = GNUNET_htonll (operation_id);
msg->event_type = htonl (GNUNET_TESTBED_ET_OPERATION_FINISHED);
GST_queue_message (client, &msg->header);
&lcf_forwarded_operation_reply_relay,
lcf);
lcf->fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &lcf_forwarded_operation_timeout,
+ GNUNET_SCHEDULER_add_delayed (GST_timeout, &lcf_forwarded_operation_timeout,
lcf);
GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, lcf->fopc);
lcf->state = FINISHED;
LOG_DEBUG ("Added host %u at %u\n", host_id, GST_context->host_id);
reply = GNUNET_malloc (reply_size);
}
- reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM);
+ reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS);
reply->header.size = htons (reply_size);
reply->host_id = htonl (host_id);
GST_queue_message (client, &reply->header);
struct ForwardedOperationContext *fopc = cls;
struct Peer *remote_peer;
- if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS)
+ if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS)
{
GNUNET_assert (NULL != fopc->cls);
remote_peer = fopc->cls;
struct ForwardedOperationContext *fopc = cls;
struct Peer *remote_peer;
- if (GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS == ntohs (msg->type))
+ if (GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS ==
+ ntohs (msg->type))
{
remote_peer = fopc->cls;
GNUNET_assert (NULL != remote_peer);
(struct GNUNET_TESTBED_PeerCreateSuccessEventMessage));
reply->header.size =
htons (sizeof (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage));
- reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS);
+ reply->header.type =
+ htons (GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS);
reply->peer_id = msg->peer_id;
reply->operation_id = msg->operation_id;
GST_queue_message (client, &reply->header);
&msg->header,
peer_create_success_cb, fo_ctxt);
fo_ctxt->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &peer_create_forward_timeout,
+ GNUNET_SCHEDULER_add_delayed (GST_timeout, &peer_create_forward_timeout,
fo_ctxt);
GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fo_ctxt);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
fopc->operation_id, &msg->header,
&peer_destroy_success_cb, fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
+ GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
fopc);
GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
&GST_forwarded_operation_reply_relay,
fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
+ GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
fopc);
GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
peer->details.local.is_running = GNUNET_YES;
reply = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerEventMessage));
- reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT);
+ reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT);
reply->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerEventMessage));
reply->event_type = htonl (GNUNET_TESTBED_ET_PEER_START);
reply->host_id = htonl (GST_context->host_id);
&GST_forwarded_operation_reply_relay,
fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
+ GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
fopc);
GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %u successfully stopped\n", peer_id);
peer->details.local.is_running = GNUNET_NO;
reply = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerEventMessage));
- reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT);
+ reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT);
reply->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerEventMessage));
reply->event_type = htonl (GNUNET_TESTBED_ET_PEER_STOP);
reply->host_id = htonl (GST_context->host_id);
&GST_forwarded_operation_reply_relay,
fopc);
fopc->timeout_task =
- GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
+ GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
fopc);
GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
reply = GNUNET_realloc (xconfig, msize);
(void) memmove (&reply[1], reply, xc_size);
reply->header.size = htons (msize);
- reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG);
+ reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONFIGURATION);
reply->peer_id = msg->peer_id;
reply->operation_id = msg->operation_id;
GNUNET_TESTING_peer_get_identity (GST_peer_list[peer_id]->details.local.peer,
GNUNET_break (config_size <= UINT16_MAX);
reply = GNUNET_realloc (xconfig, reply_size);
(void) memmove (&reply[1], reply, xconfig_size);
- reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG);
+ reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION);
reply->header.size = htons ((uint16_t) reply_size);
reply->slave_id = msg->slave_id;
reply->operation_id = msg->operation_id;
{
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_add_host, NULL, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST, 0},
{&handle_configure_shared_service, NULL,
- GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE, 0},
+ GNUNET_MESSAGE_TYPE_TESTBED_SHARE_SERVICE, 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,
+ GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS, 0},
+ {&handle_peer_create, NULL, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER, 0},
+ {&handle_peer_destroy, NULL, GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER,
sizeof (struct GNUNET_TESTBED_PeerDestroyMessage)},
- {&handle_peer_start, NULL, GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER,
+ {&handle_peer_start, NULL, GNUNET_MESSAGE_TYPE_TESTBED_START_PEER,
sizeof (struct GNUNET_TESTBED_PeerStartMessage)},
- {&handle_peer_stop, NULL, GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER,
+ {&handle_peer_stop, NULL, GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER,
sizeof (struct GNUNET_TESTBED_PeerStopMessage)},
- {&handle_peer_get_config, NULL, GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG,
+ {&handle_peer_get_config, NULL,
+ GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_CONFIGURATION,
sizeof (struct GNUNET_TESTBED_PeerGetConfigurationMessage)},
- {&GST_handle_overlay_connect, NULL, GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT,
+ {&GST_handle_overlay_connect, NULL,
+ GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT,
sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)},
- {&GST_handle_overlay_request_connect, NULL,
- GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT, 0},
- {handle_slave_get_config, NULL, GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG,
+ {&GST_handle_remote_overlay_connect, NULL,
+ GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT, 0},
+ {handle_slave_get_config, NULL,
+ GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION,
sizeof (struct GNUNET_TESTBED_SlaveGetConfigurationMessage)},
{NULL}
};
}
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
- "HELLO_CACHE_SIZE",
- &num));
+ "CACHE_SIZE", &num));
GST_cache_init ((unsigned int) num);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
+ "MAX_OPEN_FDS", &num));
+ GST_opq_openfds = GNUNET_TESTBED_operation_queue_create_ ((unsigned int) num);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_time (cfg, "TESTBED",
+ "OPERATION_TIMEOUT",
+ (struct
+ GNUNET_TIME_Relative *)
+ &GST_timeout));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (cfg, "testbed",
- "HOSTNAME", &hostname));
+ "HOSTNAME", &hostname));
our_config = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_SERVER_add_handlers (server, message_handlers);
GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL);
ss_map = GNUNET_CONTAINER_multihashmap_create (5, GNUNET_NO);
- GST_opq_openfds = GNUNET_TESTBED_operation_queue_create_ (GST_QLEN_OPENFDS);
shutdown_task_id =
GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_SCHEDULER_PRIORITY_IDLE,