management of the knowledge about peers in this library (we know the peer ID, its host, pending operations, etc.) More...
#include "platform.h"
#include "testbed_api_peers.h"
#include "testbed_api.h"
#include "testbed.h"
#include "testbed_api_hosts.h"
#include "testbed_api_operations.h"
Go to the source code of this file.
Functions | |
void | GNUNET_TESTBED_peer_register_ (struct GNUNET_TESTBED_Peer *peer) |
Adds a peer to the peer list. More... | |
void | GNUNET_TESTBED_peer_deregister_ (struct GNUNET_TESTBED_Peer *peer) |
Removes a peer from the peer list. More... | |
void | GNUNET_TESTBED_cleanup_peers_ (void) |
Frees all peers. More... | |
static void | opstart_peer_create (void *cls) |
Function to call to start a peer_create type operation once all queues the operation is part of declare that the operation can be activated. More... | |
static void | oprelease_peer_create (void *cls) |
Callback which will be called when peer_create type operation is released. More... | |
static void | opstart_peer_destroy (void *cls) |
Function called when a peer destroy operation is ready. More... | |
static void | oprelease_peer_destroy (void *cls) |
Callback which will be called when peer_create type operation is released. More... | |
static void | opstart_peer_start (void *cls) |
Function called when a peer start operation is ready. More... | |
static void | oprelease_peer_start (void *cls) |
Callback which will be called when peer start type operation is released. More... | |
static void | opstart_peer_stop (void *cls) |
Function called when a peer stop operation is ready. More... | |
static void | oprelease_peer_stop (void *cls) |
Callback which will be called when peer stop type operation is released. More... | |
struct GNUNET_TESTBED_PeerGetConfigurationMessage * | GNUNET_TESTBED_generate_peergetconfig_msg_ (uint32_t peer_id, uint64_t operation_id) |
Generate PeerGetConfigurationMessage. More... | |
static void | opstart_peer_getinfo (void *cls) |
Function called when a peer get information operation is ready. More... | |
static void | oprelease_peer_getinfo (void *cls) |
Callback which will be called when peer stop type operation is released. More... | |
static void | opstart_overlay_connect (void *cls) |
Function called when a overlay connect operation is ready. More... | |
static void | oprelease_overlay_connect (void *cls) |
Callback which will be called when overlay connect operation is released. More... | |
static void | opstart_peer_reconfigure (void *cls) |
Function called when a peer reconfigure operation is ready. More... | |
static void | oprelease_peer_reconfigure (void *cls) |
Callback which will be called when a peer reconfigure operation is released. More... | |
struct GNUNET_TESTBED_Peer * | GNUNET_TESTBED_peer_lookup_by_id_ (uint32_t id) |
Lookup a peer by ID. More... | |
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) |
Create the given peer at the specified host using the given controller. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_peer_start (void *op_cls, struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls) |
Start the given peer. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_peer_stop (void *op_cls, struct GNUNET_TESTBED_Peer *peer, GNUNET_TESTBED_PeerChurnCallback pcc, void *pcc_cls) |
Stop the given peer. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_PeerInformationType pit, GNUNET_TESTBED_PeerInfoCallback cb, void *cb_cls) |
Request information about a peer. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Change peer configuration. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer) |
Destroy the given peer; the peer should have been stopped first (if it was started). More... | |
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,...) |
Manipulate the P2P underlay topology by configuring a link between two peers. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_overlay_connect (void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls, struct GNUNET_TESTBED_Peer *p1, struct GNUNET_TESTBED_Peer *p2) |
Both peers must have been started before calling this function. More... | |
static void | opstart_manage_service (void *cls) |
Function called when a peer manage service operation is ready. More... | |
static void | oprelease_manage_service (void *cls) |
Callback which will be called when peer manage server operation is released. More... | |
struct GNUNET_TESTBED_Operation * | GNUNET_TESTBED_peer_manage_service (void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls, unsigned int start) |
Start or stop given service at a peer. More... | |
Variables | |
static struct GNUNET_TESTBED_Peer * | peer_list_head |
Peer list DLL head. More... | |
static struct GNUNET_TESTBED_Peer * | peer_list_tail |
Peer list DLL tail. More... | |
management of the knowledge about peers in this library (we know the peer ID, its host, pending operations, etc.)
Definition in file testbed_api_peers.c.
void GNUNET_TESTBED_peer_register_ | ( | struct GNUNET_TESTBED_Peer * | peer | ) |
Adds a peer to the peer list.
peer | the peer to add to the peer list |
Definition at line 54 of file testbed_api_peers.c.
References GNUNET_CONTAINER_DLL_insert_tail, peer, peer_list_head, and peer_list_tail.
Referenced by handle_peer_create_success().
void GNUNET_TESTBED_peer_deregister_ | ( | struct GNUNET_TESTBED_Peer * | peer | ) |
Removes a peer from the peer list.
peer | the peer to remove |
Definition at line 66 of file testbed_api_peers.c.
References GNUNET_CONTAINER_DLL_remove, peer, peer_list_head, and peer_list_tail.
Referenced by GNUNET_TESTBED_cleanup_peers_(), and handle_opsuccess().
void GNUNET_TESTBED_cleanup_peers_ | ( | void | ) |
Frees all peers.
Definition at line 76 of file testbed_api_peers.c.
References GNUNET_free, GNUNET_TESTBED_peer_deregister_(), peer, and peer_list_head.
Referenced by handle_opsuccess().
|
static |
Function to call to start a peer_create type operation once all queues the operation is part of declare that the operation can be activated.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 96 of file testbed_api_peers.c.
References OperationContext::c, config, OperationContext::data, data, env, GNUNET_assert, GNUNET_CONFIGURATION_serialize(), GNUNET_free, GNUNET_htonll(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TESTBED_compress_config_(), GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OP_PEER_CREATE, OPC_STATE_STARTED, OperationContext::state, and OperationContext::type.
Referenced by GNUNET_TESTBED_peer_create().
|
static |
Callback which will be called when peer_create type operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 140 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_create().
|
static |
Function called when a peer destroy operation is ready.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 168 of file testbed_api_peers.c.
References OperationContext::c, GNUNET_TESTBED_Peer::controller, OperationContext::data, env, GNUNET_assert, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OP_PEER_DESTROY, OPC_STATE_STARTED, peer, OperationContext::state, OperationContext::type, and GNUNET_TESTBED_Peer::unique_id.
Referenced by GNUNET_TESTBED_peer_destroy().
|
static |
Callback which will be called when peer_create type operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 194 of file testbed_api_peers.c.
References OperationContext::c, GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_destroy().
|
static |
Function called when a peer start operation is ready.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 220 of file testbed_api_peers.c.
References OperationContext::c, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, env, GNUNET_assert, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_START_PEER, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OP_PEER_START, OPC_STATE_STARTED, peer, OperationContext::state, GNUNET_TESTBED_Peer::state, TESTBED_PS_CREATED, TESTBED_PS_STOPPED, OperationContext::type, and GNUNET_TESTBED_Peer::unique_id.
Referenced by GNUNET_TESTBED_peer_start().
|
static |
Callback which will be called when peer start type operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 250 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_start().
|
static |
Function called when a peer stop operation is ready.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 277 of file testbed_api_peers.c.
References OperationContext::c, GNUNET_TESTBED_Peer::controller, OperationContext::data, data, env, GNUNET_assert, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OPC_STATE_STARTED, peer, OperationContext::state, GNUNET_TESTBED_Peer::state, TESTBED_PS_STARTED, and GNUNET_TESTBED_Peer::unique_id.
Referenced by GNUNET_TESTBED_peer_stop().
|
static |
Callback which will be called when peer stop type operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 305 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_stop().
struct GNUNET_TESTBED_PeerGetConfigurationMessage* GNUNET_TESTBED_generate_peergetconfig_msg_ | ( | uint32_t | peer_id, |
uint64_t | operation_id | ||
) |
Generate PeerGetConfigurationMessage.
peer_id | the id of the peer whose information we have to get |
operation_id | the ip of the operation that should be represented in the message |
Definition at line 335 of file testbed_api_peers.c.
References GNUNET_htonll(), GNUNET_malloc, GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION, msg, GNUNET_TESTBED_PeerGetConfigurationMessage::operation_id, peer_id, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
Referenced by opstart_peer_getinfo(), and opstart_service_connect().
|
static |
Function called when a peer get information operation is ready.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 358 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, GNUNET_assert, GNUNET_TESTBED_generate_peergetconfig_msg_(), GNUNET_TESTBED_insert_opc_(), GNUNET_TESTBED_queue_message_(), OperationContext::id, msg, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_get_information().
|
static |
Callback which will be called when peer stop type operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 380 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, GNUNET_assert, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_TESTBED_PIT_CONFIGURATION, GNUNET_TESTBED_PIT_IDENTITY, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_get_information().
|
static |
Function called when a overlay connect operation is ready.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 425 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, env, GNUNET_assert, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_overlay_connect().
|
static |
Callback which will be called when overlay connect operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 454 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_overlay_connect().
|
static |
Function called when a peer reconfigure operation is ready.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 483 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, env, GNUNET_assert, GNUNET_free, GNUNET_htonll(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TESTBED_compress_config_(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_update_configuration().
|
static |
Callback which will be called when a peer reconfigure operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 524 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_update_configuration().
struct GNUNET_TESTBED_Peer* GNUNET_TESTBED_peer_lookup_by_id_ | ( | uint32_t | id | ) |
Lookup a peer by ID.
id | global peer ID assigned to the peer |
Definition at line 554 of file testbed_api_peers.c.
References GNUNET_break.
|
static |
Function called when a peer manage service operation is ready.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 861 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, env, GNUNET_assert, GNUNET_free, GNUNET_htonll(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_manage_service().
|
static |
Callback which will be called when peer manage server operation is released.
cls | the closure from GNUNET_TESTBED_operation_create_() |
Definition at line 895 of file testbed_api_peers.c.
References OperationContext::c, OperationContext::data, data, GNUNET_assert, GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.
Referenced by GNUNET_TESTBED_peer_manage_service().
|
static |
Peer list DLL head.
Definition at line 40 of file testbed_api_peers.c.
Referenced by GNUNET_TESTBED_cleanup_peers_(), GNUNET_TESTBED_peer_deregister_(), and GNUNET_TESTBED_peer_register_().
|
static |
Peer list DLL tail.
Definition at line 45 of file testbed_api_peers.c.
Referenced by GNUNET_TESTBED_peer_deregister_(), and GNUNET_TESTBED_peer_register_().