![]() |
GNUnet
0.11.x
|
implementation of TESTBED service that deals with peer management More...
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 successfull. 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 successfull. 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 168 of file gnunet-service-testbed_peers.c.
References GNUNET_assert, GNUNET_NO, GST_array_grow_large_enough, GST_num_local_peers, GST_peer_list_size, Peer::id, Peer::is_remote, and ManageServiceContext::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 185 of file gnunet-service-testbed_peers.c.
References GNUNET_NO, GNUNET_realloc, GST_num_local_peers, GST_peer_list_size, id, Peer::id, Peer::is_remote, and LIST_GROW_STEP.
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 220 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 successfull.
We have to relay the reply msg back to the client
cls | ForwardedOperationContext |
msg | the peer create success message |
Definition at line 237 of file gnunet-service-testbed_peers.c.
References ForwardedOperationContext::cls, GNUNET_assert, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS, GST_forwarded_operation_reply_relay(), 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 259 of file gnunet-service-testbed_peers.c.
References Peer::details, GNUNET_break, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_NO, GNUNET_TESTING_peer_destroy(), GNUNET_TESTING_peer_stop(), GNUNET_YES, Peer::is_remote, Peer::local, peer_list_remove(), and Peer::reference_cnt.
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 286 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(), 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 310 of file gnunet-service-testbed_peers.c.
References Peer::details, GNUNET_assert, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_peer_kill(), Peer::is_remote, and Peer::local.
Referenced by cleanup_prc(), and handle_peer_stop().
|
static |
Cleans up the given PeerReconfigureContext.
prc | the PeerReconfigureContext |
Definition at line 326 of file gnunet-service-testbed_peers.c.
References PeerReconfigureContext::cfg, Peer::details, GNUNET_CONFIGURATION_destroy(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_TESTING_peer_stop_async_cancel(), Peer::local, ManageServiceContext::peer, PeerReconfigureContext::peer_id, 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 354 of file gnunet-service-testbed_peers.c.
References cleanup_mctx(), cleanup_prc(), ManageServiceContext::client, ForwardedOperationContext::client, PeerReconfigureContext::client, ForwardedOperationContext::cls, fopcq_head, GNUNET_free, GNUNET_SCHEDULER_cancel(), GST_forwarded_operation_timeout(), ManageServiceContext::next, ForwardedOperationContext::next, PeerReconfigureContext::next, OP_PEER_CREATE, ForwardedOperationContext::timeout_task, and ForwardedOperationContext::type.
Referenced by client_disconnect_cb().
|
static |
Callback to be called when forwarded peer destroy operation is successfull.
We have to relay the reply msg back to the client
cls | ForwardedOperationContext |
msg | the peer create success message |
Definition at line 397 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(), 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 424 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 438 of file gnunet-service-testbed_peers.c.
References cfg, ManageServiceContext::client, ForwardedOperationContext::client, ForwardedOperationContext::cls, Slave::controller, Route::dest, Peer::details, 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, GNUNET_TESTBED_PeerCreateMessage::header, GNUNET_TESTBED_PeerCreateMessage::host_id, Context::host_id, Peer::id, Peer::is_remote, Peer::local, LOG, LOG_DEBUG, OP_PEER_CREATE, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerCreateMessage::operation_id, GNUNET_TESTBED_PeerCreateSuccessEventMessage::operation_id, ManageServiceContext::peer, peer_create_forward_timeout(), peer_create_success_cb(), peer_id, GNUNET_TESTBED_PeerCreateMessage::peer_id, GNUNET_TESTBED_PeerCreateSuccessEventMessage::peer_id, peer_list_add(), Peer::remote, 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 570 of file gnunet-service-testbed_peers.c.
References ManageServiceContext::client, ForwardedOperationContext::client, ForwardedOperationContext::cls, Slave::controller, Peer::destroy_flag, Peer::details, 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_send_operation_fail_msg(), GST_send_operation_success_msg(), GST_timeout, GNUNET_TESTBED_PeerDestroyMessage::header, Peer::is_remote, LOG, LOG_DEBUG, OP_PEER_DESTROY, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerDestroyMessage::operation_id, ManageServiceContext::peer, peer_destroy_success_cb(), peer_id, GNUNET_TESTBED_PeerDestroyMessage::peer_id, Peer::reference_cnt, Peer::remote, Peer::slave, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, and VALID_PEER_ID.
|
static |
Stats a peer.
peer | the peer to start |
Definition at line 637 of file gnunet-service-testbed_peers.c.
References Peer::details, GNUNET_assert, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTING_peer_start(), GNUNET_YES, Peer::is_remote, and Peer::local.
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.
Message handler for #GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER messages.
cls | identification of the client |
msg | the actual message |
Definition at line 654 of file gnunet-service-testbed_peers.c.
References ManageServiceContext::client, ForwardedOperationContext::client, Slave::controller, Peer::details, 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_send_operation_fail_msg(), GST_timeout, GNUNET_TESTBED_PeerStartMessage::header, Context::host_id, GNUNET_TESTBED_PeerEventMessage::host_id, Peer::is_remote, LOG, OP_PEER_START, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerStartMessage::operation_id, GNUNET_TESTBED_PeerEventMessage::operation_id, ManageServiceContext::peer, peer_id, GNUNET_TESTBED_PeerStartMessage::peer_id, GNUNET_TESTBED_PeerEventMessage::peer_id, Peer::remote, 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 724 of file gnunet-service-testbed_peers.c.
References ManageServiceContext::client, ForwardedOperationContext::client, Slave::controller, Peer::details, 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_send_operation_fail_msg(), GST_timeout, GNUNET_TESTBED_PeerStopMessage::header, Context::host_id, GNUNET_TESTBED_PeerEventMessage::host_id, Peer::is_remote, Peer::local, LOG, OP_PEER_STOP, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerStopMessage::operation_id, GNUNET_TESTBED_PeerEventMessage::operation_id, ManageServiceContext::peer, peer_id, GNUNET_TESTBED_PeerStopMessage::peer_id, GNUNET_TESTBED_PeerEventMessage::peer_id, Peer::remote, 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 808 of file gnunet-service-testbed_peers.c.
References ManageServiceContext::client, 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_send_operation_fail_msg(), GST_timeout, GNUNET_TESTBED_PeerGetConfigurationMessage::header, Peer::is_remote, LOG_DEBUG, OP_PEER_INFO, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerGetConfigurationMessage::operation_id, GNUNET_TESTBED_PeerConfigurationInformationMessage::operation_id, ManageServiceContext::peer, peer_id, GNUNET_TESTBED_PeerGetConfigurationMessage::peer_id, GNUNET_TESTBED_PeerConfigurationInformationMessage::peer_id, GNUNET_TESTBED_PeerConfigurationInformationMessage::peer_identity, Peer::remote, 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 892 of file gnunet-service-testbed_peers.c.
References cleanup_prc().
Referenced by shutdown_task().
|
static |
Update peer configuration.
peer | the peer to update |
cfg | the new configuration |
Definition at line 907 of file gnunet-service-testbed_peers.c.
References cfg, Peer::details, GNUNET_CONFIGURATION_destroy(), GNUNET_TESTING_peer_configure(), GNUNET_TESTING_peer_destroy(), GST_context, Peer::id, Peer::local, 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 935 of file gnunet-service-testbed_peers.c.
References PeerReconfigureContext::cfg, cleanup(), cleanup_prc(), PeerReconfigureContext::client, GNUNET_assert, GNUNET_NO, GNUNET_OK, GST_send_operation_fail_msg(), GST_send_operation_success_msg(), Peer::is_remote, PeerReconfigureContext::op_id, ManageServiceContext::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 980 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 asyncronously, destroy it and create it again with the new configuration.
cls | identification of the client |
msg | the actual message |
Definition at line 996 of file gnunet-service-testbed_peers.c.
References cfg, PeerReconfigureContext::cfg, ManageServiceContext::client, ForwardedOperationContext::client, PeerReconfigureContext::client, Peer::destroy_flag, Peer::details, 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_send_operation_fail_msg(), GST_send_operation_success_msg(), GST_timeout, GNUNET_TESTBED_PeerReconfigureMessage::header, Peer::is_remote, Peer::local, LOG, LOG_DEBUG, ManageServiceContext::op_id, PeerReconfigureContext::op_id, OP_PEER_RECONFIGURE, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_PeerReconfigureMessage::operation_id, ManageServiceContext::peer, peer_id, PeerReconfigureContext::peer_id, GNUNET_TESTBED_PeerReconfigureMessage::peer_id, prc_stop_cb(), Peer::reference_cnt, Peer::remote, ForwardedOperationContext::timeout_task, ForwardedOperationContext::type, update_peer_config(), and VALID_PEER_ID.
void GST_free_mctxq | ( | void | ) |
Frees the ManageServiceContext queue.
Definition at line 1125 of file gnunet-service-testbed_peers.c.
References cleanup_mctx().
Referenced by handle_shutdown_peers(), and shutdown_task().
|
static |
Returns a string interpretation of rs.
rs | the request status from ARM |
Definition at line 1139 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 1160 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, and GNUNET_ARM_RESULT_STOPPING.
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 1209 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, 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 1280 of file gnunet-service-testbed_peers.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_ManagePeerServiceMessage::header, ManageServiceContext::service, GNUNET_MessageHeader::size, and GNUNET_TESTBED_ManagePeerServiceMessage::start.
void handle_manage_peer_service | ( | void * | cls, |
const struct GNUNET_TESTBED_ManagePeerServiceMessage * | msg | ||
) |
Handler for GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE messages.
Handler for GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE message.
cls | identification of client |
msg | the actual message |
Definition at line 1311 of file gnunet-service-testbed_peers.c.
References ManageServiceContext::ah, ManageServiceContext::client, ForwardedOperationContext::client, ForwardedOperationContext::cls, Peer::details, 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_size, GST_send_operation_fail_msg(), GST_timeout, GNUNET_TESTBED_ManagePeerServiceMessage::header, Peer::is_remote, Peer::local, LOG, LOG_DEBUG, ManageServiceContext::op_id, OP_MANAGE_SERVICE, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_ManagePeerServiceMessage::operation_id, ManageServiceContext::peer, peer_id, GNUNET_TESTBED_ManagePeerServiceMessage::peer_id, Peer::reference_cnt, Peer::remote, ManageServiceContext::service, service_manage_result_cb(), ManageServiceContext::start, GNUNET_TESTBED_ManagePeerServiceMessage::start, ForwardedOperationContext::timeout_task, and ForwardedOperationContext::type.
void GST_destroy_peers | ( | void | ) |
Stops and destroys all peers.
Definition at line 1427 of file gnunet-service-testbed_peers.c.
References Peer::destroy_flag, Peer::details, 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_size, id, Peer::is_remote, Peer::local, ManageServiceContext::peer, and Peer::reference_cnt.
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 1477 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(), 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 1515 of file gnunet-service-testbed_peers.c.
References ManageServiceContext::client, 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, GNUNET_TESTBED_ShutdownPeersMessage::header, LOG_DEBUG, HandlerContext_ShutdownPeers::nslaves, ManageServiceContext::op_id, OP_SHUTDOWN_PEERS, ForwardedOperationContext::opc, ForwardedOperationContext::operation_id, GNUNET_TESTBED_ShutdownPeersMessage::operation_id, shutdown_peers_reply_cb(), and ForwardedOperationContext::type.
struct Peer** GST_peer_list |
A list of peers we know about.
Definition at line 36 of file gnunet-service-testbed_peers.c.
Referenced by check_remote_overlay_connect(), cleanup_occ(), forward_overlay_connect(), GST_process_next_focc(), handle_overlay_connect(), handle_remote_overlay_connect(), occ_hello_sent_cb(), and p2_transport_connect().
unsigned int GST_num_local_peers |
The current number of peers running locally under this controller.
Definition at line 41 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 143 of file gnunet-service-testbed_peers.c.
|
static |
The DLL tail for the peer reconfigure list.
Definition at line 148 of file gnunet-service-testbed_peers.c.
|
static |
DLL head for queue of manage service requests.
Definition at line 154 of file gnunet-service-testbed_peers.c.
|
static |
DLL tail for queue of manage service requests.
Definition at line 159 of file gnunet-service-testbed_peers.c.