implementation of the TESTBED service More...
#include "platform.h"
#include "gnunet-service-testbed.h"
#include "gnunet-service-testbed_barriers.h"
#include "gnunet-service-testbed_connectionpool.h"
Go to the source code of this file.
Macros | |
#define | GROW_SS |
Variables | |
struct GNUNET_CONFIGURATION_Handle * | GST_config |
Our configuration. More... | |
struct Context * | GST_context |
The master context; generated with the first INIT message. More... | |
struct GNUNET_TESTBED_Host ** | GST_host_list |
Array of hosts. More... | |
struct ForwardedOperationContext * | fopcq_head |
DLL head for forwarded operation contexts. More... | |
struct ForwardedOperationContext * | fopcq_tail |
DLL tail for forwarded operation contexts. More... | |
struct OperationQueue * | GST_opq_openfds |
Operation queue for open file descriptors. More... | |
struct GNUNET_TIME_Relative | GST_timeout |
Timeout for operations which may take some time. More... | |
unsigned int | GST_host_list_size |
The size of the host list. More... | |
unsigned int | GST_peer_list_size |
The size of the peer list. More... | |
static char * | hostname |
Our hostname; we give this to all the peers we start. More... | |
implementation of the TESTBED service
Definition in file gnunet-service-testbed.c.
#define GROW_SS |
|
static |
Function to add a host to the current list of known hosts.
host | the host to add |
Definition at line 100 of file gnunet-service-testbed.c.
References GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_host_get_id_(), GST_array_grow_large_enough, GST_host_list, GST_host_list_size, and LOG_DEBUG.
Referenced by handle_add_host(), and handle_init().
void GST_send_operation_fail_msg | ( | struct GNUNET_SERVICE_Client * | client, |
uint64_t | operation_id, | ||
const char * | emsg | ||
) |
Send operation failure message to client.
client | the client to which the failure message has to be sent to |
operation_id | the id of the failed operation |
emsg | the error message; can be NULL |
Definition at line 125 of file gnunet-service-testbed.c.
References env, GNUNET_htonll(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_ET_OPERATION_FINISHED, msg, and GNUNET_TESTBED_OperationFailureEventMessage::operation_id.
Referenced by GST_forwarded_operation_timeout(), handle_manage_peer_service(), handle_peer_create(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_slave_get_config(), prc_stop_cb(), service_manage_result_cb(), shutdown_peers_reply_cb(), and timeout_overlay_connect().
void GST_send_operation_success_msg | ( | struct GNUNET_SERVICE_Client * | client, |
uint64_t | operation_id | ||
) |
Function to send generic operation success message to given client.
client | the client to send the message to |
operation_id | the id of the operation which was successful |
Definition at line 154 of file gnunet-service-testbed.c.
References env, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_ET_OPERATION_FINISHED, msg, and GNUNET_TESTBED_GenericOperationSuccessEventMessage::operation_id.
Referenced by handle_peer_destroy(), handle_peer_reconfigure(), handle_shutdown_peers(), prc_stop_cb(), service_manage_result_cb(), and shutdown_peers_reply_cb().
|
static |
Callback which will be called after a host registration succeeded or failed.
Callback which will be called to after a host registration succeeded or failed.
cls | the handle to the slave at which the registration is completed |
emsg | the error message; NULL if host registration is successful |
Definition at line 212 of file gnunet-service-testbed.c.
References HostRegistration::cb, HostRegistration::cb_cls, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_TESTBED_host_get_id_(), GST_host_list, HostRegistration::host, Slave::host_id, Slave::hr_dll_head, Slave::hr_dll_tail, LOG, register_next_host(), and Slave::rhandle.
Referenced by register_next_host().
|
static |
Attempts to register the next host in the host registration queue.
slave | the slave controller whose host registration queue is checked for host registrations |
Definition at line 187 of file gnunet-service-testbed.c.
References Slave::controller, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_register_host(), GST_host_list, HostRegistration::host, Slave::host_id, hr_completion(), Slave::hr_dll_head, LOG, and Slave::rhandle.
Referenced by GST_queue_host_registration(), and hr_completion().
void GST_queue_host_registration | ( | struct Slave * | slave, |
GNUNET_TESTBED_HostRegistrationCompletion | cb, | ||
void * | cb_cls, | ||
struct GNUNET_TESTBED_Host * | host | ||
) |
Adds a host registration's request to a slave's registration queue.
slave | the slave controller at which the given host has to be registered |
cb | the host registration completion callback |
cb_cls | the closure for the host registration completion callback |
host | the host which has to be registered |
Definition at line 247 of file gnunet-service-testbed.c.
References HostRegistration::cb, HostRegistration::cb_cls, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_NO, GNUNET_TESTBED_host_get_id_(), GNUNET_YES, GST_host_list, HostRegistration::host, Slave::host_id, Slave::hr_dll_head, Slave::hr_dll_tail, LOG, and register_next_host().
Referenced by lcf_proc_task(), and register_host().
void GST_forwarded_operation_reply_relay | ( | void * | cls, |
const struct GNUNET_MessageHeader * | msg | ||
) |
Callback to relay the reply msg of a forwarded operation back to the client.
cls | ForwardedOperationContext |
msg | the message to relay |
Definition at line 279 of file gnunet-service-testbed.c.
References ForwardedOperationContext::client, ForwardedOperationContext::cls, env, fopcq_head, fopcq_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_msg_copy(), GNUNET_MQ_send(), GNUNET_SCHEDULER_cancel(), GNUNET_SERVICE_client_get_mq(), LOG_DEBUG, msg, GNUNET_MessageHeader::size, ForwardedOperationContext::timeout_task, and GNUNET_MessageHeader::type.
Referenced by forward_overlay_connect(), forwarded_overlay_connect_listener(), handle_manage_peer_service(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), peer_create_success_cb(), and peer_destroy_success_cb().
void GST_forwarded_operation_timeout | ( | void * | cls | ) |
Task to free resources when forwarded operation has been timed out.
cls | the ForwardedOperationContext |
Definition at line 300 of file gnunet-service-testbed.c.
References ForwardedOperationContext::client, ForwardedOperationContext::cls, fopcq_head, fopcq_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_TESTBED_forward_operation_msg_cancel_(), GST_send_operation_fail_msg(), LOG, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, and ForwardedOperationContext::timeout_task.
Referenced by client_disconnect_cb(), forward_overlay_connect(), forwarded_overlay_connect_timeout(), GST_notify_client_disconnect_oc(), GST_notify_client_disconnect_peers(), handle_manage_peer_service(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), and peer_create_forward_timeout().
|
static |
Parse service sharing specification line.
Format is "[<service:share>] [<service:share>] ..."
ss_str | the spec string to be parsed |
cfg | the configuration to use for shared services |
Definition at line 328 of file gnunet-service-testbed.c.
References find_typedefs::arg, cfg, GNUNET_TESTING_SharedService::cfg, GNUNET_ERROR_TYPE_WARNING, GNUNET_strdup, GROW_SS, LOG, LOG_DEBUG, service, GNUNET_TESTING_SharedService::service, and GNUNET_TESTING_SharedService::share.
Referenced by handle_init().
|
static |
Check GNUNET_MESSAGE_TYPE_TESTBED_INIT messages.
cls | identification of the client |
msg | the actual message |
Definition at line 387 of file gnunet-service-testbed.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.
|
static |
Message handler for GNUNET_MESSAGE_TYPE_TESTBED_INIT messages.
cls | identification of the client |
msg | the actual message |
Definition at line 411 of file gnunet-service-testbed.c.
References Context::client, GNUNET_CONFIGURATION_get_value_string(), GNUNET_free, GNUNET_new, GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_strdup, GNUNET_TESTBED_host_create_with_id(), GNUNET_TESTING_system_create(), GST_config, GST_context, Context::host_id, host_list_add(), hostname, LOG_DEBUG, Context::master_ip, msg, parse_shared_services(), service, GNUNET_TESTING_SharedService::service, and Context::system.
|
static |
Check #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages.
cls | identification of the client |
msg | the actual message |
Definition at line 483 of file gnunet-service-testbed.c.
References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.
|
static |
Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST messages.
cls | identification of the client |
msg | the actual message |
Definition at line 518 of file gnunet-service-testbed.c.
References env, GNUNET_break_op, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS, GNUNET_MQ_msg, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_OK, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_SERVICE_client_get_mq(), GNUNET_strlcpy(), GNUNET_TESTBED_extract_config_(), GNUNET_TESTBED_host_create_with_id(), GNUNET_TESTBED_host_destroy(), GST_context, Context::host_id, GNUNET_TESTBED_HostConfirmedMessage::host_id, host_list_add(), hostname, LOG_DEBUG, and msg.
|
static |
Handler for #GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG messages.
cls | identification of the client |
msg | the actual message |
Definition at line 615 of file gnunet-service-testbed.c.
References cfg, config, GNUNET_TESTBED_SlaveConfiguration::config_size, env, GNUNET_assert, GNUNET_CONFIGURATION_serialize(), GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_ntohll(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_compress_config_(), GNUNET_TESTBED_host_get_cfg_(), GST_host_list, GST_send_operation_fail_msg(), GST_slave_list, GST_slave_list_size, Slave::host_id, msg, GNUNET_TESTBED_SlaveConfiguration::operation_id, and GNUNET_TESTBED_SlaveConfiguration::slave_id.
void GST_clear_fopcq | ( | void | ) |
Clears the forwarded operations queue.
Definition at line 677 of file gnunet-service-testbed.c.
References ForwardedOperationContext::cls, fopcq_head, fopcq_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_TESTBED_forward_operation_msg_cancel_(), HandlerContext_ShutdownPeers::nslaves, OP_FORWARDED, OP_GET_SLAVE_CONFIG, OP_LINK_CONTROLLERS, OP_MANAGE_SERVICE, OP_OVERLAY_CONNECT, OP_PEER_CREATE, OP_PEER_DESTROY, OP_PEER_INFO, OP_PEER_RECONFIGURE, OP_PEER_START, OP_PEER_STOP, OP_SHUTDOWN_PEERS, ForwardedOperationContext::opc, ForwardedOperationContext::timeout_task, and ForwardedOperationContext::type.
Referenced by handle_shutdown_peers(), and shutdown_task().
|
static |
Task to clean up and shutdown nicely.
cls | NULL |
Definition at line 732 of file gnunet-service-testbed.c.
References GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_TESTBED_host_destroy(), GNUNET_TESTBED_operation_queue_destroy_(), GNUNET_TESTING_system_destroy(), GNUNET_YES, GST_barriers_destroy(), GST_cache_clear(), GST_clear_fopcq(), GST_config, GST_connection_pool_destroy(), GST_context, GST_destroy_peers(), GST_free_lcf(), GST_free_mctxq(), GST_free_nccq(), GST_free_occq(), GST_free_prcq(), GST_free_roccq(), GST_host_list, GST_host_list_size, GST_neighbour_list_clean(), GST_opq_openfds, GST_route_list_clear(), GST_slave_list_clear(), GST_stats_destroy(), hostname, id, LOG_DEBUG, Context::master_ip, and Context::system.
Referenced by testbed_run().
|
static |
Callback for client connect.
cls | NULL |
client | the client which has disconnected |
mq | queue for sending messages to client |
Definition at line 787 of file gnunet-service-testbed.c.
|
static |
Callback for client disconnect.
cls | NULL |
client | the client which has disconnected |
app_ctx | should match client |
Definition at line 803 of file gnunet-service-testbed.c.
References ForwardedOperationContext::client, Context::client, fopcq_head, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_SCHEDULER_cancel(), GST_context, GST_forwarded_operation_timeout(), GST_link_notify_disconnect(), GST_notify_client_disconnect_oc(), GST_notify_client_disconnect_peers(), LOG, ForwardedOperationContext::next, and ForwardedOperationContext::timeout_task.
|
static |
Testbed setup.
cls | closure |
cfg | configuration to use |
service | the initialized server |
Definition at line 848 of file gnunet-service-testbed.c.
References cfg, GNUNET_assert, GNUNET_break, GNUNET_CONFIGURATION_dup(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_free, GNUNET_log_setup(), GNUNET_OK, GNUNET_SCHEDULER_add_shutdown(), GNUNET_TESTBED_operation_queue_create_(), GST_barriers_init(), GST_cache_init(), GST_config, GST_connection_pool_init(), GST_opq_openfds, GST_stats_init(), GST_timeout, hostname, LOG_DEBUG, OPERATION_QUEUE_TYPE_FIXED, and shutdown_task().
Define "main" method using service macro.
struct GNUNET_CONFIGURATION_Handle* GST_config |
Our configuration.
Definition at line 39 of file gnunet-service-testbed.c.
Referenced by handle_init(), shutdown_task(), and testbed_run().
struct Context* GST_context |
The master context; generated with the first INIT message.
Definition at line 44 of file gnunet-service-testbed.c.
Referenced by client_disconnect_cb(), GST_find_dest_route(), handle_add_host(), handle_barrier_cancel(), handle_barrier_init(), handle_barrier_status(), handle_init(), handle_link_controllers(), handle_peer_create(), handle_peer_start(), handle_peer_stop(), shutdown_task(), and update_peer_config().
struct GNUNET_TESTBED_Host** GST_host_list |
Array of hosts.
Definition at line 49 of file gnunet-service-testbed.c.
Referenced by forward_overlay_connect(), GST_queue_host_registration(), handle_link_controllers(), handle_overlay_connect(), handle_slave_get_config(), host_list_add(), hr_completion(), lcf_proc_task(), opstart_neighbour_conn(), register_host(), register_next_host(), shutdown_task(), slave_event_cb(), and slave_status_cb().
struct ForwardedOperationContext* fopcq_head |
DLL head for forwarded operation contexts.
Definition at line 54 of file gnunet-service-testbed.c.
Referenced by client_disconnect_cb(), forward_overlay_connect(), GST_clear_fopcq(), GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_notify_client_disconnect_oc(), GST_notify_client_disconnect_peers(), GST_process_next_focc(), handle_manage_peer_service(), handle_peer_create(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_shutdown_peers(), and shutdown_peers_reply_cb().
struct ForwardedOperationContext* fopcq_tail |
DLL tail for forwarded operation contexts.
Definition at line 59 of file gnunet-service-testbed.c.
Referenced by forward_overlay_connect(), GST_clear_fopcq(), GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_process_next_focc(), handle_manage_peer_service(), handle_peer_create(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_shutdown_peers(), and shutdown_peers_reply_cb().
struct OperationQueue* GST_opq_openfds |
Operation queue for open file descriptors.
Definition at line 64 of file gnunet-service-testbed.c.
Referenced by GST_connection_pool_get_handle(), GST_neighbour_get_connection(), shutdown_task(), and testbed_run().
struct GNUNET_TIME_Relative GST_timeout |
Timeout for operations which may take some time.
Definition at line 64 of file gnunet-service-testbed.c.
Referenced by forward_overlay_connect(), GST_process_next_focc(), handle_link_controllers(), handle_manage_peer_service(), handle_overlay_connect(), handle_peer_create(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_remote_overlay_connect(), lcf_proc_task(), and testbed_run().
unsigned int GST_host_list_size |
The size of the host list.
Definition at line 74 of file gnunet-service-testbed.c.
Referenced by handle_link_controllers(), host_list_add(), and shutdown_task().
unsigned int GST_peer_list_size |
The size of the peer list.
Definition at line 79 of file gnunet-service-testbed.c.
Referenced by check_remote_overlay_connect(), GST_destroy_peers(), handle_manage_peer_service(), peer_list_add(), and peer_list_remove().
|
static |
Our hostname; we give this to all the peers we start.
Definition at line 89 of file gnunet-service-testbed.c.
Referenced by add_host(), add_services(), append_port(), check_config(), gen_rsh_args(), get_server_addresses(), GNUNET_CLIENT_test(), GNUNET_CONNECTION_create_from_connect(), GNUNET_HOSTLIST_server_start(), GNUNET_RESOLVER_hostname_resolve(), GNUNET_RESOLVER_ip_get(), GNUNET_RESOLVER_local_fqdn_get(), GNUNET_TESTBED_controller_start(), GNUNET_TESTBED_create_helper_init_msg_(), GNUNET_TESTBED_host_create(), GNUNET_TESTBED_host_create_with_id(), GNUNET_TESTBED_host_resolve_(), GNUNET_TESTBED_hosts_load_from_file(), GNUNET_TESTBED_is_host_habitable(), GNUNET_TESTBED_register_host(), GNUNET_TESTING_system_create(), GNUNET_TESTING_system_create_with_portrange(), GST_stats_init(), handle_add_host(), handle_get(), handle_init(), handle_response(), helper_mst(), http_common_dns_reverse_lookup_cb(), LEGACY_SERVICE_get_server_addresses(), numeric_resolution(), pack(), print_hostname(), process_get(), queue(), resolve_and_cache(), server_get_addresses(), shutdown_task(), test_service_configuration(), testbed_run(), tokenizer_cb(), and try_cache().