122 msg->peer_id = htonl (
data->peer->unique_id);
123 msg->config_size = htons ((uint16_t) c_size);
401 if (NULL !=
data->result.cfg)
437 msg->peer1 = htonl (
data->p1->unique_id);
438 msg->peer2 = htonl (
data->p2->unique_id);
503 msg->peer_id = htonl (
data->peer->unique_id);
505 msg->config_size = htons (
data->cfg_size);
599 static uint32_t id_gen;
745 if (NULL ==
data->config)
750 if (
csize > UINT16_MAX)
874 msg->peer_id = htonl (
data->peer->unique_id);
876 msg->start = (uint8_t)
data->start;
881 data->service_name = NULL;
940 data->cb_cls = cb_cls;
944 data->msize = (uint16_t) msize;
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static int start
Set if we are to start default services (including ARM).
static char * peer_id
Option –peer.
uint32_t data
The data value.
static unsigned int csize
static const struct GNUNET_CONFIGURATION_Handle * config
static char * service_name
Option -s: service name (hash to get service descriptor)
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MESSAGE_TYPE_TESTBED_START_PEER
Message to start a peer at a host.
#define GNUNET_MESSAGE_TYPE_TESTBED_MANAGE_PEER_SERVICE
Message to start/stop a service of a peer.
#define GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT
Message to connect peers in a overlay.
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION
Message to get a peer's information.
#define GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
Message to reconfigure a peer.
#define GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER
Message to stop a peer at a host.
#define GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER
Message to destroy a peer.
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
Message to create a peer at a host.
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.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_update_configuration(struct GNUNET_TESTBED_Peer *peer, const struct GNUNET_CONFIGURATION_Handle *cfg)
Change peer configuration.
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.
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.
void(* GNUNET_TESTBED_PeerChurnCallback)(void *cls, const char *emsg)
Functions of this signature are called when a peer has been successfully started or stopped.
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.
GNUNET_TESTBED_PeerInformationType
Types of information that can be requested about a peer.
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.
void(* GNUNET_TESTBED_OperationCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when an operation is completed.
void(* GNUNET_TESTBED_PeerCreateCallback)(void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
Functions of this signature are called when a peer has been successfully created.
GNUNET_TESTBED_ConnectOption
Options for peer connections.
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.
void(* GNUNET_TESTBED_PeerInfoCallback)(void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
Callback to be called when the requested peer information is available The peer information in the ca...
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.
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).
@ GNUNET_TESTBED_PIT_CONFIGURATION
What configuration is the peer using? Returns a 'const struct GNUNET_CONFIGURATION_Handle *'.
@ GNUNET_TESTBED_PIT_IDENTITY
What is the identity of the peer? Returns a 'const struct GNUNET_PeerIdentity *'.
@ GNUNET_TESTBED_PIT_GENERIC
Special value (not valid for requesting information) that is used in the event struct if a 'generic' ...
Handle to interact with a GNUnet testbed controller.
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Opaque handle to a host running experiments managed by the testing framework.
Message to start/stop services of a peer.
Opaque handle to an abstract operation to be executed by the testing framework.
void * cb_cls
Closure for callbacks.
Message sent from client to testing service to connect two peers.
Message sent from client to testing service to create (configure, but not start) a peer.
Message sent from client to testing service to destroy a (stopped) peer.
Message sent from client to testing service to obtain the configuration of a peer.
uint64_t operation_id
Operation ID that is used to identify this operation.
Message sent from client to testing service to start a peer.
Message sent from client to testing service to stop a peer.
A peer controlled by the testing framework.
enum PeerState state
Peer's state.
struct GNUNET_TESTBED_Controller * controller
Our controller context (not necessarily the controller that is responsible for starting/running the p...
uint32_t unique_id
Globally unique ID of the peer.
struct GNUNET_TESTBED_Host * host
Which host does this peer run on?
Context information for GNUNET_TESTBED_Operation.
void * op_cls
The operation closure.
enum OperationContextState state
The state of the operation.
enum OperationType type
The type of operation.
uint64_t id
The id of the operation.
struct GNUNET_TESTBED_Operation * op
The operation.
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
void * data
Data relevant to the operation.
Data structure for OperationType OP_OVERLAY_CONNECT.
void * cb_cls
The closure for the above callback.
struct GNUNET_TESTBED_Peer * p2
Peer B.
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call once this operation is done.
struct GNUNET_TESTBED_Peer * p1
Peer A to connect to peer B.
Data for the OperationType OP_PEER_CREATE.
Data for OperationType OP_PEER_START and OP_PEER_STOP.
GNUNET_TESTBED_PeerChurnCallback pcc
The Peer churn callback to call when this operation is completed.
void * pcc_cls
Closure for the above callback.
Data for the OperationType OP_PEER_INFO.
GNUNET_TESTBED_PeerInfoCallback cb
The Peer info callback to call when this operation has completed.
void * cb_cls
The closure for peer info callback.
enum GNUNET_TESTBED_PeerInformationType pit
The type of peer information requested.
IPC messages between testing API and service ("controller")
void GNUNET_TESTBED_queue_message_(struct GNUNET_TESTBED_Controller *controller, struct GNUNET_MessageHeader *msg)
Queues a message in send queue for sending to the service.
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
uint64_t GNUNET_TESTBED_get_next_op_id(struct GNUNET_TESTBED_Controller *controller)
Function to return the operation id for a controller.
void GNUNET_TESTBED_insert_opc_(struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Inserts the given operation context into the operation context map of the given controller.
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Interface for functions internally exported from testbed_api.c.
@ OP_PEER_RECONFIGURE
Reconfigure a peer.
@ OP_PEER_START
Peer start operation.
@ OP_PEER_INFO
Get peer information operation.
@ OP_MANAGE_SERVICE
Start/stop service at a peer.
@ OP_PEER_DESTROY
Peer destroy operation.
@ OP_OVERLAY_CONNECT
Overlay connection operation.
@ OP_PEER_STOP
Peer stop operation.
@ OP_PEER_CREATE
Peer create operation.
@ OPC_STATE_INIT
The initial state where the associated operation has just been created and is waiting in the operatio...
@ OPC_STATE_STARTED
The operation has been started.
@ OPC_STATE_FINISHED
The operation has finished.
void GNUNET_TESTBED_host_queue_oc_(struct GNUNET_TESTBED_Host *h, struct GNUNET_TESTBED_Operation *op)
Queues the given operation in the queue for parallel overlay connects of the given host.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain a host's unique global ID.
internal API to access the 'hosts' subsystem
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an 'operation' to be performed.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
void GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.
internal API to access the 'operations' subsystem
static void oprelease_peer_getinfo(void *cls)
Callback which will be called when peer stop type operation is released.
static void opstart_overlay_connect(void *cls)
Function called when a overlay connect operation is ready.
static struct GNUNET_TESTBED_Peer * peer_list_tail
Peer list DLL tail.
void GNUNET_TESTBED_peer_deregister_(struct GNUNET_TESTBED_Peer *peer)
Removes a peer from the peer list.
static void opstart_peer_destroy(void *cls)
Function called when a peer destroy operation is ready.
void GNUNET_TESTBED_cleanup_peers_(void)
Frees all peers.
struct GNUNET_TESTBED_Peer * GNUNET_TESTBED_peer_lookup_by_id_(uint32_t id)
Lookup a peer by ID.
static void oprelease_peer_destroy(void *cls)
Callback which will be called when peer_create type operation is released.
struct GNUNET_TESTBED_PeerGetConfigurationMessage * GNUNET_TESTBED_generate_peergetconfig_msg_(uint32_t peer_id, uint64_t operation_id)
Generate PeerGetConfigurationMessage.
static void oprelease_peer_create(void *cls)
Callback which will be called when peer_create type operation is released.
static void opstart_peer_reconfigure(void *cls)
Function called when a peer reconfigure operation is ready.
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 decla...
static void oprelease_manage_service(void *cls)
Callback which will be called when peer manage server operation is released.
static void oprelease_peer_start(void *cls)
Callback which will be called when peer start type operation is released.
static void opstart_peer_stop(void *cls)
Function called when a peer stop operation is ready.
static void opstart_peer_getinfo(void *cls)
Function called when a peer get information operation is ready.
static void opstart_manage_service(void *cls)
Function called when a peer manage service operation is ready.
static struct GNUNET_TESTBED_Peer * peer_list_head
Peer list DLL head.
static void oprelease_peer_reconfigure(void *cls)
Callback which will be called when a peer reconfigure operation is released.
static void opstart_peer_start(void *cls)
Function called when a peer start operation is ready.
static void oprelease_peer_stop(void *cls)
Callback which will be called when peer stop type operation is released.
static void oprelease_overlay_connect(void *cls)
Callback which will be called when overlay connect operation is released.
void GNUNET_TESTBED_peer_register_(struct GNUNET_TESTBED_Peer *peer)
Adds a peer to the peer list.
internal API to access the 'peers' subsystem
@ TESTBED_PS_INVALID
State to signify that this peer is invalid.
@ TESTBED_PS_STOPPED
The peer is stopped.
@ TESTBED_PS_CREATED
The peer has been created.
@ TESTBED_PS_STARTED
The peer is running.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.