implementation of TESTBED service that deals with peer management More...
#include "platform.h"
#include "gnunet-service-testbed.h"
#include "gnunet_arm_service.h"
#include <zlib.h>
Go to the source code of this file.
Data Structures | |
struct | ManageServiceContext |
Context information to manage peers' services. More... | |
struct | PeerReconfigureContext |
Context information for peer re-configure operations. More... | |
Functions | |
static void | peer_list_add (struct Peer *peer) |
Adds a peer to the peer array. More... | |
static void | peer_list_remove (struct Peer *peer) |
Removes a the give peer from the peer array. More... | |
static void | peer_create_forward_timeout (void *cls) |
The task to be executed if the forwarded peer create operation has been timed out. More... | |
static void | peer_create_success_cb (void *cls, const struct GNUNET_MessageHeader *msg) |
Callback to be called when forwarded peer create operation is successful. More... | |
void | GST_destroy_peer (struct Peer *peer) |
Function to destroy a peer. More... | |
static void | cleanup_mctx (struct ManageServiceContext *mctx) |
Cleanup the context information created for managing a peer's service. More... | |
static int | stop_peer (struct Peer *peer) |
Stops a peer. More... | |
static void | cleanup_prc (struct PeerReconfigureContext *prc) |
Cleans up the given PeerReconfigureContext. More... | |
void | GST_notify_client_disconnect_peers (struct GNUNET_SERVICE_Client *client) |
Notify peers subsystem that client disconnected. More... | |
static void | peer_destroy_success_cb (void *cls, const struct GNUNET_MessageHeader *msg) |
Callback to be called when forwarded peer destroy operation is successful. More... | |
int | check_peer_create (void *cls, const struct GNUNET_TESTBED_PeerCreateMessage *msg) |
Check #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages. More... | |
void | handle_peer_create (void *cls, const struct GNUNET_TESTBED_PeerCreateMessage *msg) |
Handler for #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages. More... | |
void | handle_peer_destroy (void *cls, const struct GNUNET_TESTBED_PeerDestroyMessage *msg) |
Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages. More... | |
static int | start_peer (struct Peer *peer) |
Stats a peer. More... | |
void | handle_peer_start (void *cls, const struct GNUNET_TESTBED_PeerStartMessage *msg) |
Message handler for GNUNET_MESSAGE_TYPE_TESTBED_START_PEER messages. More... | |
void | handle_peer_stop (void *cls, const struct GNUNET_TESTBED_PeerStopMessage *msg) |
Message handler for GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER messages. More... | |
void | handle_peer_get_config (void *cls, const struct GNUNET_TESTBED_PeerGetConfigurationMessage *msg) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION messages. More... | |
void | GST_free_prcq () |
Cleans up the Peer reconfigure context list. More... | |
static char * | update_peer_config (struct Peer *peer, struct GNUNET_CONFIGURATION_Handle *cfg) |
Update peer configuration. More... | |
static void | prc_stop_cb (void *cls, struct GNUNET_TESTING_Peer *p, int success) |
Callback to inform whether the peer is running or stopped. More... | |
int | check_peer_reconfigure (void *cls, const struct GNUNET_TESTBED_PeerReconfigureMessage *msg) |
Check #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages. More... | |
void | handle_peer_reconfigure (void *cls, const struct GNUNET_TESTBED_PeerReconfigureMessage *msg) |
Handler for #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages. More... | |
void | GST_free_mctxq () |
Frees the ManageServiceContext queue. More... | |
static const char * | arm_req_string (enum GNUNET_ARM_RequestStatus rs) |
Returns a string interpretation of rs. More... | |
static const char * | arm_ret_string (enum GNUNET_ARM_Result result) |
Returns a string interpretation of the result. More... | |
static void | service_manage_result_cb (void *cls, enum GNUNET_ARM_RequestStatus rs, enum GNUNET_ARM_Result result) |
Function called in response to a start/stop request. More... | |
int | check_manage_peer_service (void *cls, const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg) |
Check GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE message. More... | |
void | handle_manage_peer_service (void *cls, const struct GNUNET_TESTBED_ManagePeerServiceMessage *msg) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE messages. More... | |
void | GST_destroy_peers () |
Stops and destroys all peers. More... | |
static void | shutdown_peers_reply_cb (void *cls, const struct GNUNET_MessageHeader *msg) |
The reply msg handler forwarded SHUTDOWN_PEERS operation. More... | |
void | handle_shutdown_peers (void *cls, const struct GNUNET_TESTBED_ShutdownPeersMessage *msg) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS messages. More... | |
Variables | |
struct Peer ** | GST_peer_list |
A list of peers we know about. More... | |
unsigned int | GST_num_local_peers |
The current number of peers running locally under this controller. More... | |
static struct PeerReconfigureContext * | prc_head |
The DLL head for the peer reconfigure list. More... | |
static struct PeerReconfigureContext * | prc_tail |
The DLL tail for the peer reconfigure list. More... | |
static struct ManageServiceContext * | mctx_head |
DLL head for queue of manage service requests. More... | |
static struct ManageServiceContext * | mctx_tail |
DLL tail for queue of manage service requests. More... | |
implementation of TESTBED service that deals with peer management
Definition in file gnunet-service-testbed_peers.c.
|
static |
Adds a peer to the peer array.
peer | the peer to add |
Definition at line 169 of file gnunet-service-testbed_peers.c.
References GNUNET_assert, GNUNET_NO, GST_array_grow_large_enough, GST_num_local_peers, GST_peer_list, GST_peer_list_size, and peer.
Referenced by handle_peer_create(), and peer_create_success_cb().
|
static |
Removes a the give peer from the peer array.
peer | the peer to be removed |
Definition at line 186 of file gnunet-service-testbed_peers.c.
References GNUNET_NO, GNUNET_realloc, GST_num_local_peers, GST_peer_list, GST_peer_list_size, id, LIST_GROW_STEP, and peer.
Referenced by GST_destroy_peer().
|
static |
The task to be executed if the forwarded peer create operation has been timed out.
cls | the FowardedOperationContext |
Definition at line 221 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::cls, GNUNET_free, and GST_forwarded_operation_timeout().
Referenced by handle_peer_create().
|
static |
Callback to be called when forwarded peer create operation is successful.
We have to relay the reply msg back to the client
cls | ForwardedOperationContext |
msg | the peer create success message |
Definition at line 238 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::cls, GNUNET_assert, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS, GST_forwarded_operation_reply_relay(), msg, peer_list_add(), and GNUNET_MessageHeader::type.
Referenced by handle_peer_create().
void GST_destroy_peer | ( | struct Peer * | peer | ) |
Function to destroy a peer.
peer | the peer structure to destroy |
Definition at line 260 of file gnunet-service-testbed_peers.c.
References GNUNET_break, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_NO, GNUNET_TESTING_peer_destroy(), GNUNET_TESTING_peer_stop(), GNUNET_YES, peer, and peer_list_remove().
Referenced by cleanup_mctx(), cleanup_occ(), cleanup_rocc(), handle_peer_destroy(), and peer_destroy_success_cb().
|
static |
Cleanup the context information created for managing a peer's service.
mctx | the ManageServiceContext |
Definition at line 287 of file gnunet-service-testbed_peers.c.
References ManageServiceContext::ah, Peer::destroy_flag, ManageServiceContext::expired, GNUNET_ARM_disconnect(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_YES, GST_destroy_peer(), mctx_head, mctx_tail, ManageServiceContext::peer, Peer::reference_cnt, and ManageServiceContext::service.
Referenced by GST_free_mctxq(), GST_notify_client_disconnect_peers(), and service_manage_result_cb().
|
static |
Stops a peer.
peer | the peer to stop |
Definition at line 311 of file gnunet-service-testbed_peers.c.
References GNUNET_assert, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_peer_kill(), and peer.
Referenced by cleanup_prc(), and handle_peer_stop().
|
static |
Cleans up the given PeerReconfigureContext.
prc | the PeerReconfigureContext |
Definition at line 327 of file gnunet-service-testbed_peers.c.
References PeerReconfigureContext::cfg, GNUNET_CONFIGURATION_destroy(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_TESTING_peer_stop_async_cancel(), GST_peer_list, peer, PeerReconfigureContext::peer_id, prc_head, prc_tail, stop_peer(), PeerReconfigureContext::stopped, and VALID_PEER_ID.
Referenced by GST_free_prcq(), GST_notify_client_disconnect_peers(), and prc_stop_cb().
void GST_notify_client_disconnect_peers | ( | struct GNUNET_SERVICE_Client * | client | ) |
Notify peers subsystem that client disconnected.
client | the client that disconnected |
Definition at line 355 of file gnunet-service-testbed_peers.c.
References cleanup_mctx(), cleanup_prc(), ForwardedOperationContext::client, ManageServiceContext::client, PeerReconfigureContext::client, ForwardedOperationContext::cls, fopcq_head, GNUNET_free, GNUNET_SCHEDULER_cancel(), GST_forwarded_operation_timeout(), mctx_head, ForwardedOperationContext::next, ManageServiceContext::next, PeerReconfigureContext::next, OP_PEER_CREATE, prc_head, ForwardedOperationContext::timeout_task, and ForwardedOperationContext::type.
Referenced by client_disconnect_cb().
|
static |
Callback to be called when forwarded peer destroy operation is successful.
We have to relay the reply msg back to the client
cls | ForwardedOperationContext |
msg | the peer create success message |
Definition at line 398 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::cls, Peer::destroy_flag, GNUNET_assert, GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS, GNUNET_YES, GST_destroy_peer(), GST_forwarded_operation_reply_relay(), msg, Peer::reference_cnt, and GNUNET_MessageHeader::type.
Referenced by handle_peer_destroy().
int check_peer_create | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerCreateMessage * | msg | ||
) |
Check #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages.
cls | identification of the client |
msg | the actual message |
Definition at line 425 of file gnunet-service-testbed_peers.c.
References GNUNET_OK.
void handle_peer_create | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerCreateMessage * | msg | ||
) |
Handler for #GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER messages.
cls | identification of the client |
msg | the actual message |
Definition at line 433 of file gnunet-service-testbed_peers.c.
References cfg, ForwardedOperationContext::client, ForwardedOperationContext::cls, Slave::controller, Route::dest, env, fopcq_head, fopcq_tail, GNUNET_asprintf(), GNUNET_break, GNUNET_CONFIGURATION_set_value_number(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_NO, GNUNET_ntohll(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_extract_config_(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_TESTING_peer_configure(), GNUNET_YES, GST_context, GST_find_dest_route(), GST_send_operation_fail_msg(), GST_slave_list, GST_timeout, Context::host_id, LOG, LOG_DEBUG, msg, OP_PEER_CREATE, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerCreateSuccessEventMessage::operation_id, peer, peer_create_forward_timeout(), peer_create_success_cb(), peer_id, GNUNET_TESTBED_PeerCreateSuccessEventMessage::peer_id, peer_list_add(), Context::system, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, and VALID_PEER_ID.
void handle_peer_destroy | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerDestroyMessage * | msg | ||
) |
Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages.
cls | identification of the client |
msg | the actual message |
Definition at line 565 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::client, ForwardedOperationContext::cls, Slave::controller, fopcq_head, fopcq_tail, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_new, GNUNET_ntohll(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_YES, GST_destroy_peer(), GST_forwarded_operation_timeout(), GST_peer_list, GST_send_operation_fail_msg(), GST_send_operation_success_msg(), GST_timeout, LOG, LOG_DEBUG, msg, OP_PEER_DESTROY, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, peer, peer_destroy_success_cb(), peer_id, Peer::slave, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, and VALID_PEER_ID.
|
static |
Stats a peer.
peer | the peer to start |
Definition at line 632 of file gnunet-service-testbed_peers.c.
References GNUNET_assert, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_peer_start(), GNUNET_YES, and peer.
Referenced by handle_peer_start(), and prc_stop_cb().
void handle_peer_start | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerStartMessage * | msg | ||
) |
Message handler for GNUNET_MESSAGE_TYPE_TESTBED_START_PEER messages.
cls | identification of the client |
msg | the actual message |
Definition at line 643 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::client, Slave::controller, env, GNUNET_TESTBED_PeerEventMessage::event_type, fopcq_head, fopcq_tail, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_ERROR, GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_ntohll(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_ET_PEER_START, GNUNET_TESTBED_forward_operation_msg_(), GNUNET_YES, GST_context, GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_peer_list, GST_send_operation_fail_msg(), GST_timeout, Context::host_id, GNUNET_TESTBED_PeerEventMessage::host_id, LOG, msg, OP_PEER_START, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerEventMessage::operation_id, peer, peer_id, GNUNET_TESTBED_PeerEventMessage::peer_id, Peer::slave, start_peer(), ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, and VALID_PEER_ID.
void handle_peer_stop | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerStopMessage * | msg | ||
) |
Message handler for GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER messages.
Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages.
cls | identification of the client |
msg | the actual message |
Definition at line 713 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::client, Slave::controller, env, GNUNET_TESTBED_PeerEventMessage::event_type, fopcq_head, fopcq_tail, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, GNUNET_ntohll(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_ET_PEER_STOP, GNUNET_TESTBED_forward_operation_msg_(), GNUNET_TESTING_peer_wait(), GNUNET_YES, GST_context, GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_peer_list, GST_send_operation_fail_msg(), GST_timeout, Context::host_id, GNUNET_TESTBED_PeerEventMessage::host_id, LOG, msg, OP_PEER_STOP, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerEventMessage::operation_id, peer, peer_id, GNUNET_TESTBED_PeerEventMessage::peer_id, Peer::slave, stop_peer(), ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, and VALID_PEER_ID.
void handle_peer_get_config | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerGetConfigurationMessage * | msg | ||
) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION messages.
Handler for #GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG messages.
cls | identification of the client |
msg | the actual message |
Definition at line 797 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::client, config, GNUNET_TESTBED_PeerConfigurationInformationMessage::config_size, Slave::controller, Peer::details, env, fopcq_head, fopcq_tail, GNUNET_CONFIGURATION_serialize(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_ntohll(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_get_mq(), GNUNET_TESTBED_compress_config_(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_TESTING_peer_get_identity(), GNUNET_YES, GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_peer_list, GST_send_operation_fail_msg(), GST_timeout, LOG_DEBUG, msg, OP_PEER_INFO, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerConfigurationInformationMessage::operation_id, peer, peer_id, GNUNET_TESTBED_PeerConfigurationInformationMessage::peer_id, GNUNET_TESTBED_PeerConfigurationInformationMessage::peer_identity, Peer::slave, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, and VALID_PEER_ID.
void GST_free_prcq | ( | void | ) |
Cleans up the Peer reconfigure context list.
Definition at line 881 of file gnunet-service-testbed_peers.c.
References cleanup_prc(), and prc_head.
Referenced by shutdown_task().
|
static |
Update peer configuration.
peer | the peer to update |
cfg | the new configuration |
Definition at line 896 of file gnunet-service-testbed_peers.c.
References cfg, GNUNET_CONFIGURATION_destroy(), GNUNET_TESTING_peer_configure(), GNUNET_TESTING_peer_destroy(), GST_context, peer, and Context::system.
Referenced by handle_peer_reconfigure(), and prc_stop_cb().
|
static |
Callback to inform whether the peer is running or stopped.
cls | the closure given to GNUNET_TESTING_peer_stop_async() |
p | the respective peer whose status is being reported |
success | GNUNET_YES if the peer is stopped; GNUNET_SYSERR upon any error |
Definition at line 924 of file gnunet-service-testbed_peers.c.
References PeerReconfigureContext::cfg, cleanup(), cleanup_prc(), PeerReconfigureContext::client, GNUNET_assert, GNUNET_NO, GNUNET_OK, GST_peer_list, GST_send_operation_fail_msg(), GST_send_operation_success_msg(), PeerReconfigureContext::op_id, peer, PeerReconfigureContext::peer_id, start_peer(), PeerReconfigureContext::stopped, update_peer_config(), and VALID_PEER_ID.
Referenced by handle_peer_reconfigure().
int check_peer_reconfigure | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerReconfigureMessage * | msg | ||
) |
Check #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages.
cls | identification of the client |
msg | the actual message |
Definition at line 969 of file gnunet-service-testbed_peers.c.
References GNUNET_OK.
void handle_peer_reconfigure | ( | void * | cls, |
const struct GNUNET_TESTBED_PeerReconfigureMessage * | msg | ||
) |
Handler for #GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER type messages.
Should stop the peer asynchronously, destroy it and create it again with the new configuration.
cls | identification of the client |
msg | the actual message |
Definition at line 985 of file gnunet-service-testbed_peers.c.
References cfg, PeerReconfigureContext::cfg, ForwardedOperationContext::client, PeerReconfigureContext::client, GNUNET_TESTBED_Peer::controller, fopcq_head, fopcq_tail, GNUNET_asprintf(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_TESTBED_extract_config_(), GNUNET_TESTBED_forward_operation_msg_(), GNUNET_TESTING_peer_stop_async(), GNUNET_YES, GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_peer_list, GST_send_operation_fail_msg(), GST_send_operation_success_msg(), GST_timeout, LOG, LOG_DEBUG, msg, PeerReconfigureContext::op_id, OP_PEER_RECONFIGURE, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, peer, peer_id, PeerReconfigureContext::peer_id, prc_head, prc_stop_cb(), prc_tail, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, update_peer_config(), and VALID_PEER_ID.
void GST_free_mctxq | ( | void | ) |
Frees the ManageServiceContext queue.
Definition at line 1114 of file gnunet-service-testbed_peers.c.
References cleanup_mctx(), and mctx_head.
Referenced by handle_shutdown_peers(), and shutdown_task().
|
static |
Returns a string interpretation of rs.
rs | the request status from ARM |
Definition at line 1128 of file gnunet-service-testbed_peers.c.
References _, GNUNET_ARM_REQUEST_DISCONNECTED, and GNUNET_ARM_REQUEST_SENT_OK.
Referenced by service_manage_result_cb().
|
static |
Returns a string interpretation of the result.
result | the arm result |
Definition at line 1149 of file gnunet-service-testbed_peers.c.
References _, GNUNET_ARM_RESULT_IN_SHUTDOWN, GNUNET_ARM_RESULT_IS_NOT_KNOWN, GNUNET_ARM_RESULT_IS_STARTED_ALREADY, GNUNET_ARM_RESULT_IS_STARTING_ALREADY, GNUNET_ARM_RESULT_IS_STOPPED_ALREADY, GNUNET_ARM_RESULT_IS_STOPPING_ALREADY, GNUNET_ARM_RESULT_START_FAILED, GNUNET_ARM_RESULT_STARTING, GNUNET_ARM_RESULT_STOPPED, GNUNET_ARM_RESULT_STOPPING, and result.
Referenced by service_manage_result_cb().
|
static |
Function called in response to a start/stop request.
Will be called when request was not sent successfully, or when a reply comes. If the request was not sent successfully, rs will indicate that, and result will be undefined.
cls | ManageServiceContext |
rs | status of the request |
result | result of the operation |
Definition at line 1198 of file gnunet-service-testbed_peers.c.
References arm_req_string(), arm_ret_string(), cleanup_mctx(), ManageServiceContext::client, ManageServiceContext::expired, GNUNET_ARM_REQUEST_SENT_OK, GNUNET_ARM_RESULT_IS_STARTED_ALREADY, GNUNET_ARM_RESULT_IS_STARTING_ALREADY, GNUNET_ARM_RESULT_IS_STOPPED_ALREADY, GNUNET_ARM_RESULT_IS_STOPPING_ALREADY, GNUNET_ARM_RESULT_STARTING, GNUNET_ARM_RESULT_STOPPED, GNUNET_ARM_RESULT_STOPPING, GNUNET_asprintf(), GNUNET_free, GNUNET_YES, GST_send_operation_fail_msg(), GST_send_operation_success_msg(), Peer::id, LOG_DEBUG, ManageServiceContext::op_id, ManageServiceContext::peer, result, ret, ManageServiceContext::service, and ManageServiceContext::start.
Referenced by handle_manage_peer_service().
int check_manage_peer_service | ( | void * | cls, |
const struct GNUNET_TESTBED_ManagePeerServiceMessage * | msg | ||
) |
Check GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE message.
cls | identification of client |
msg | the actual message |
Definition at line 1269 of file gnunet-service-testbed_peers.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, msg, service, and GNUNET_MessageHeader::size.
void handle_manage_peer_service | ( | void * | cls, |
const struct GNUNET_TESTBED_ManagePeerServiceMessage * | msg | ||
) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE messages.
cls | identification of client |
msg | the actual message |
Definition at line 1294 of file gnunet-service-testbed_peers.c.
References ah, ManageServiceContext::ah, ForwardedOperationContext::client, ManageServiceContext::client, ForwardedOperationContext::cls, GNUNET_TESTBED_Peer::controller, fopcq_head, fopcq_tail, GNUNET_ARM_connect(), GNUNET_ARM_request_service_start(), GNUNET_ARM_request_service_stop(), GNUNET_asprintf(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_ntohll(), GNUNET_OS_INHERIT_STD_ERR, GNUNET_SCHEDULER_add_delayed(), GNUNET_SERVICE_client_continue(), GNUNET_strdup, GNUNET_TESTBED_forward_operation_msg_(), GNUNET_YES, GST_forwarded_operation_reply_relay(), GST_forwarded_operation_timeout(), GST_peer_list, GST_peer_list_size, GST_send_operation_fail_msg(), GST_timeout, LOG, LOG_DEBUG, mctx_head, mctx_tail, msg, ManageServiceContext::op_id, OP_MANAGE_SERVICE, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, ManageServiceContext::peer, peer, peer_id, service, ManageServiceContext::service, service_manage_result_cb(), ManageServiceContext::start, ForwardedOperationContext::timeout_task, and ForwardedOperationContext::type.
void GST_destroy_peers | ( | void | ) |
Stops and destroys all peers.
Definition at line 1410 of file gnunet-service-testbed_peers.c.
References GNUNET_break, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_NO, GNUNET_TESTING_peer_destroy(), GNUNET_TESTING_peer_kill(), GNUNET_TESTING_peer_wait(), GNUNET_YES, GST_peer_list, GST_peer_list_size, id, and peer.
Referenced by handle_shutdown_peers(), and shutdown_task().
|
static |
The reply msg handler forwarded SHUTDOWN_PEERS operation.
Checks if a success reply is received from all clients and then sends the success message to the client
cls | ForwardedOperationContext |
msg | the message to relay |
Definition at line 1460 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::client, ForwardedOperationContext::cls, fopcq_head, fopcq_tail, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS, GNUNET_YES, GST_send_operation_fail_msg(), GST_send_operation_success_msg(), msg, HandlerContext_ShutdownPeers::nslaves, ForwardedOperationContext::operation_id, HandlerContext_ShutdownPeers::timeout, and GNUNET_MessageHeader::type.
Referenced by handle_shutdown_peers().
void handle_shutdown_peers | ( | void * | cls, |
const struct GNUNET_TESTBED_ShutdownPeersMessage * | msg | ||
) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS messages.
cls | identification of the client |
msg | the actual message |
Definition at line 1498 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::client, ForwardedOperationContext::cls, Slave::controller, Slave::controller_proc, fopcq_head, fopcq_tail, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_free, GNUNET_new, GNUNET_ntohll(), GNUNET_SERVICE_client_continue(), GNUNET_TESTBED_forward_operation_msg_(), GST_clear_fopcq(), GST_destroy_peers(), GST_free_mctxq(), GST_free_occq(), GST_free_roccq(), GST_send_operation_success_msg(), GST_slave_list, GST_slave_list_size, LOG_DEBUG, msg, HandlerContext_ShutdownPeers::nslaves, OP_SHUTDOWN_PEERS, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, shutdown_peers_reply_cb(), and ForwardedOperationContext::type.
struct Peer** GST_peer_list |
A list of peers we know about.
Definition at line 37 of file gnunet-service-testbed_peers.c.
Referenced by check_remote_overlay_connect(), cleanup_occ(), cleanup_prc(), forward_overlay_connect(), GST_destroy_peers(), GST_process_next_focc(), handle_manage_peer_service(), handle_overlay_connect(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_remote_overlay_connect(), occ_hello_sent_cb(), p2_transport_connect(), peer_list_add(), peer_list_remove(), and prc_stop_cb().
unsigned int GST_num_local_peers |
The current number of peers running locally under this controller.
Definition at line 42 of file gnunet-service-testbed_peers.c.
Referenced by peer_list_add(), and peer_list_remove().
|
static |
The DLL head for the peer reconfigure list.
Definition at line 144 of file gnunet-service-testbed_peers.c.
Referenced by cleanup_prc(), GST_free_prcq(), GST_notify_client_disconnect_peers(), and handle_peer_reconfigure().
|
static |
The DLL tail for the peer reconfigure list.
Definition at line 149 of file gnunet-service-testbed_peers.c.
Referenced by cleanup_prc(), and handle_peer_reconfigure().
|
static |
DLL head for queue of manage service requests.
Definition at line 155 of file gnunet-service-testbed_peers.c.
Referenced by cleanup_mctx(), GST_free_mctxq(), GST_notify_client_disconnect_peers(), and handle_manage_peer_service().
|
static |
DLL tail for queue of manage service requests.
Definition at line 160 of file gnunet-service-testbed_peers.c.
Referenced by cleanup_mctx(), and handle_manage_peer_service().