47 #define LOG(kind, ...) GNUNET_log_from (kind, "testbed-api", __VA_ARGS__)
52 #define LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
57 #define TIME_REL_SECS(sec) \
58 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
64 #define TIMEOUT_REL TIME_REL_SECS (1)
199 while (NULL != entry)
211 while (NULL != entry)
213 entry2 = entry->
next;
256 if (opc->
id !=
sc->id)
347 msg_size = ntohs (
msg->header.
size) -
sizeof(*msg);
351 emsg = (
const char *) &
msg[1];
352 if (
'\0' != emsg[msg_size - 1])
381 LOG_DEBUG (
"Mismatch in host id's %u, %u of host confirm msg\n",
383 ntohl (
msg->host_id));
387 msg_size = ntohs (
msg->header.
size) -
sizeof(*msg);
390 LOG_DEBUG (
"Host %u successfully registered\n", ntohl (
msg->host_id));
397 emsg = (
const char *) &
msg[1];
399 _ (
"Adding host %u failed with error: %s\n"),
400 ntohl (
msg->host_id),
423 if (NULL != fo_data->
cc)
446 void *op_comp_cb_cls;
451 LOG_DEBUG (
"Operation %llu successful\n",
452 (
unsigned long long) op_id);
453 if (NULL == (opc =
find_opc (c, op_id)))
460 event.op_cls = opc->
op_cls;
461 event.details.operation_finished.emsg = NULL;
462 event.details.operation_finished.generic = NULL;
464 op_comp_cb_cls = NULL;
491 op_comp_cb =
data->cb;
492 op_comp_cb_cls =
data->cb_cls;
503 op_comp_cb =
data->cb;
504 op_comp_cb_cls =
data->cb_cls;
528 if (NULL != op_comp_cb)
529 op_comp_cb (op_comp_cb_cls, event.
op, NULL);
559 if (NULL == (opc =
find_opc (c, op_id)))
561 LOG_DEBUG (
"Operation context for PeerCreateSuccessEvent not found\n");
616 if (NULL == (opc =
find_opc (c, op_id)))
635 event.op_cls = opc->
op_cls;
640 event.details.peer_start.host =
peer->
host;
641 event.details.peer_start.peer =
peer;
646 event.details.peer_stop.peer =
peer;
653 pcc_cls =
data->pcc_cls;
695 if (NULL == (opc =
find_opc (c, op_id)))
710 (ntohl (
msg->peer2) ==
data->p2->unique_id));
713 event.op_cls = opc->
op_cls;
717 event.details.peer_connect.peer1 =
data->p1;
718 event.details.peer_connect.peer2 =
data->p2;
730 cb_cls =
data->cb_cls;
744 cb (cb_cls, opc->
op, NULL);
789 if (NULL == (opc =
find_opc (c, op_id)))
807 cb_cls =
data->cb_cls;
832 cb (cb_cls, opc->
op, pinfo, NULL);
877 if (NULL == (opc =
find_opc (c, op_id)))
893 emsg =
"Unknown error";
899 if (NULL !=
data->cb)
906 event.op_cls = opc->
op_cls;
907 event.details.operation_finished.emsg = emsg;
908 event.details.operation_finished.generic = NULL;
924 if (NULL !=
data->cb)
935 if (NULL !=
data->pcc)
952 if (NULL !=
data->cb)
1011 msg->header.
size = htons (msize);
1054 if (NULL == (opc =
find_opc (c, op_id)))
1072 event.op_cls = opc->
op_cls;
1073 event.details.operation_finished.generic = opc->
data;
1074 event.details.operation_finished.emsg = NULL;
1120 if (NULL == (opc =
find_opc (c, op_id)))
1146 event.op_cls = opc->
op_cls;
1147 event.details.operation_finished.emsg = NULL;
1148 event.details.operation_finished.generic = NULL;
1161 event.details.operation_finished.emsg =
emsg;
1165 if (0 != ntohs (
msg->config_size))
1205 msize = ntohs (
msg->header.
size);
1207 name_len = ntohs (
msg->name_len);
1214 if (
'\0' !=
name[name_len])
1257 msize = ntohs (
msg->header.
size);
1264 name_len = ntohs (
msg->name_len);
1266 (msize - ((
sizeof msg->header) +
sizeof(
msg->status))))
1271 if (
'\0' !=
name[name_len])
1276 LOG_DEBUG (
"Received BARRIER_STATUS msg\n");
1289 if (
'\0' != (
msg->data[(
name_len + 1) + (emsg_len - 1)]))
1304 if (NULL == barrier)
1372 uint64_t operation_id,
1389 data->cc_cls = cc_cls;
1391 opc->
c = controller;
1394 opc->
id = operation_id;
1512 if (NULL != opc->
data)
1610 const char *controller_hostname;
1611 unsigned long long max_parallel_operations;
1612 unsigned long long max_parallel_service_connections;
1613 unsigned long long max_parallel_topology_config_operations;
1620 "MAX_PARALLEL_OPERATIONS",
1621 &max_parallel_operations))
1630 "MAX_PARALLEL_SERVICE_CONNECTIONS",
1631 &max_parallel_service_connections))
1640 "MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS",
1641 &max_parallel_topology_config_operations))
1647 controller->
cc = cc;
1648 controller->
cc_cls = cc_cls;
1656 if (NULL == controller->
mq)
1663 controller->
host = host;
1667 max_parallel_operations);
1671 max_parallel_service_connections);
1675 (
unsigned int) max_parallel_topology_config_operations);
1677 if (NULL == controller_hostname)
1678 controller_hostname =
"127.0.0.1";
1679 slen = strlen (controller_hostname) + 1;
1728 if (NULL !=
c->
host)
1764 xsize = compressBound ((uLong)
size);
1841 uint32_t slave_host_id;
1842 uint32_t delegated_host_id;
1848 (NULL != slave_host) ? slave_host : master->
host);
1850 if ((NULL != slave_host) && (0 != slave_host_id))
1856 msg->header.
size = htons (msg_size);
1896 uint32_t slave_host_id)
1902 data->slave_id = slave_host_id;
1958 const char *trusted_ip,
1966 size_t xconfig_size;
1967 uint16_t trusted_ip_len;
1968 uint16_t hostname_len;
1976 trusted_ip_len = strlen (trusted_ip);
1978 msg_size = xconfig_size + trusted_ip_len + 1
1980 msg_size += hostname_len;
1982 (void) memmove (((
void *) &
msg[1]) + trusted_ip_len + 1 + hostname_len,
1985 msg->header.
size = htons (msg_size);
1987 msg->trusted_ip_size = htons (trusted_ip_len);
1988 msg->hostname_size = htons (hostname_len);
1990 (void) strcpy ((
char *) &
msg[1], trusted_ip);
1991 if (0 != hostname_len)
2063 xdata = (
const Bytef *) &imsg[1];
2074 xdata = (
const Bytef *) &imsg[1];
2086 xdata_len = ntohs (imsg->
header.
size) - osize;
2087 xdata = (
const Bytef *) ((
const void *) imsg + osize);
2098 xdata = (
const Bytef *) &imsg[1];
2109 xdata = (
const Bytef *) &imsg[1];
2120 xdata = (
const Bytef *) &imsg[1];
2128 if (Z_OK != (
ret = uncompress (
data, &data_len, xdata, xdata_len)))
2136 (
const char *)
data,
2156 msize = ntohs (
msg->header.
size);
2160 emsg = (
const char *) &
msg[1];
2161 if (
'\0' != emsg[msize - 1])
2183 op_id = op_id << 32;
2326 unsigned int quorum,
2339 name_len = strlen (
name);
2353 barrier->
c = controller;
2369 msg->quorum = (uint8_t) quorum;
2393 unsigned int quorum,
2418 slen = strlen (barrier->
name);
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static int ret
Return value of the commandline.
static struct GNUNET_ARM_Operation * op
Current operation.
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static int echo
Request echo service.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
static void cleanup(void *cls)
Function scheduled as very last function, cleans up after us.
static struct GNUNET_CONTAINER_MultiPeerMap * map
Handle to the map used to store old latency values for peers.
struct GNUNET_HashCode key
The key used in the DHT.
uint32_t data
The data value.
uint16_t status
See PRISM_STATUS_*-constants.
static char * value
Value of the record to add/remove.
static struct GNUNET_FS_SearchContext * sc
static char * hostname
Our hostname; we give this to all the peers we start.
static const struct GNUNET_CONFIGURATION_Handle * config
uint64_t event_mask
Global event mask for all testbed events.
Core service; the main API for encrypted P2P communications.
Helper library for handling HELLOs.
API for writing tests and creating large-scale emulation testbeds for GNUnet.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize(struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *source_filename)
De-serializes configuration.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing 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.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
int GNUNET_CONTAINER_multihashmap32_get_multiple(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
#define GNUNET_log(kind,...)
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
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_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#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.
@ GNUNET_ERROR_TYPE_ERROR
#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_realloc(ptr, size)
Wrapper around realloc.
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
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_handler_end()
End-marker for the handlers array.
#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_MQ_hd_var_size(name, code, str, ctx)
void(* GNUNET_MQ_MessageCallback)(void *cls, const struct GNUNET_MessageHeader *msg)
Called when a message has been received.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#define GNUNET_MESSAGE_TYPE_TESTBED_INIT
Initial message from a client to a testing control service.
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
Message to initialise a barrier.
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
Message to cancel a barrier.
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
Message to signal the result of GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS request.
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
Message for peer events.
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
Message to add host.
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
Message to signal successful peer creation.
#define GNUNET_MESSAGE_TYPE_TESTBED_MAX
Not really a message, but for careful checks on the testbed messages; Should always be the maximum an...
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
Message for signalling status of a barrier.
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
Message to signal that a add host succeeded.
#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
Message which contains the configuration of slave controller.
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
Message to link delegated controller to slave controller.
#define GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
Message to signal a generic operation has been successful.
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
Message to request configuration of a slave controller.
#define GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
Message to reconfigure a peer.
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
Message to create a peer at a host.
#define GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
Message for operation events.
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
Message containing the peer's information.
#define GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
A controller receiving this message floods it to its directly-connected sub-controllers and then stop...
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
Message for peer connect events.
#define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT
The initialization message towards gnunet-testbed-helper.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
void(* GNUNET_TESTBED_ControllerCallback)(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Signature of the event handler function called by the respective event controller.
struct GNUNET_TESTBED_Barrier * GNUNET_TESTBED_barrier_init(struct GNUNET_TESTBED_Controller *controller, const char *name, unsigned int quorum, GNUNET_TESTBED_barrier_status_cb cb, void *cb_cls)
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach...
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_slave_config(void *op_cls, struct GNUNET_TESTBED_Controller *master, struct GNUNET_TESTBED_Host *slave_host)
Function to acquire the configuration of a running slave controller.
void(* GNUNET_TESTBED_barrier_status_cb)(void *cls, const char *name, struct GNUNET_TESTBED_Barrier *barrier, enum GNUNET_TESTBED_BarrierStatus status, const char *emsg)
Functions of this type are to be given as callback argument to GNUNET_TESTBED_barrier_init().
void(* GNUNET_TESTBED_PeerChurnCallback)(void *cls, const char *emsg)
Functions of this signature are called when a peer has been successfully started or stopped.
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.
void GNUNET_TESTBED_controller_disconnect(struct GNUNET_TESTBED_Controller *c)
Stop the given controller (also will terminate all peers and controllers dependent on this controller...
void GNUNET_TESTBED_overlay_write_topology_to_file(struct GNUNET_TESTBED_Controller *controller, const char *filename)
Ask the testbed controller to write the current overlay topology to a file.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_shutdown_peers(struct GNUNET_TESTBED_Controller *c, void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls)
Stops and destroys all peers.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_controller_link(void *op_cls, struct GNUNET_TESTBED_Controller *master, struct GNUNET_TESTBED_Host *delegated_host, struct GNUNET_TESTBED_Host *slave_host, int is_subordinate)
Create a link from slave controller to delegated controller.
uint32_t GNUNET_TESTBED_get_index(const struct GNUNET_TESTBED_Peer *peer)
Return the index of the peer inside of the total peer array, aka.
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...
GNUNET_TESTBED_EventType
Enumeration with (at most 64) possible event types that can be monitored using the testbed framework.
struct GNUNET_TESTBED_Controller * GNUNET_TESTBED_controller_connect(struct GNUNET_TESTBED_Host *host, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls)
Start a controller process using the given configuration at the given host.
const char * GNUNET_TESTBED_host_get_hostname(const struct GNUNET_TESTBED_Host *host)
Obtain the host's hostname.
void GNUNET_TESTBED_barrier_cancel(struct GNUNET_TESTBED_Barrier *barrier)
Cancel a barrier.
@ 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' ...
@ GNUNET_TESTBED_ET_CONNECT
A connection between two peers was established.
@ GNUNET_TESTBED_ET_OPERATION_FINISHED
A requested testbed operation has been completed.
@ GNUNET_TESTBED_ET_PEER_START
A peer has been started.
@ GNUNET_TESTBED_ET_DISCONNECT
A connection between two peers was torn down.
@ GNUNET_TESTBED_ET_PEER_STOP
A peer has been stopped.
@ GNUNET_TESTBED_BARRIERSTATUS_CROSSED
Barrier is crossed.
@ GNUNET_TESTBED_BARRIERSTATUS_ERROR
Error status.
@ GNUNET_TESTBED_BARRIERSTATUS_INITIALISED
Barrier initialised successfully.
static unsigned int size
Size of the "table".
Context data for controller link operations.
struct GNUNET_TESTBED_ControllerLinkRequest * msg
The controller link message.
uint32_t host_id
The id of the host which is hosting the controller to be linked.
An entry in the stack for keeping operations which are about to expire.
struct ExpireOperationEntry * next
DLL head; new entries are to be inserted here.
struct ExpireOperationEntry * prev
DLL tail; entries are deleted from here.
const struct GNUNET_TESTBED_Operation * op
The operation.
Context data for forwarded Operation.
void * cc_cls
The closure for the above callback.
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Internal representation of the hash map.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
Notify the service about a host that we intend to use.
uint16_t username_length
Number of bytes in the user name that follows; 0 to use no user name; otherwise 'strlen (username)',...
uint16_t hostname_length
Number of bytes in the host name (excluding 0-termination) that follows the user name; cannot be 0.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
uint16_t config_size
The length of the uncompressed configuration.
Message to cancel a barrier.
Message to initialise a barrier.
Message for signalling status changes of a barrier.
uint16_t name_len
strlen of the barrier name
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
struct GNUNET_TESTBED_Controller * c
The controller handle given while initialising this barrier.
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
char * name
The name of the barrier.
int echo
Should the barrier crossed status message be echoed back to the controller?
void * cls
the closure for the above callback
Event notification from a controller to a client.
Client notifies controller that it should delegate requests for a particular client to a particular s...
uint32_t slave_host_id
Which host is responsible for managing the delegation? NBO.
uint32_t delegated_host_id
For which host should requests be delegated? NBO.
uint8_t is_subordinate
Set to 1 if the receiving controller is the master controller for the slave host (and thus responsibl...
Response message for ControllerLinkRequest message.
uint16_t config_size
The size of the compressed configuration.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Handle to interact with a GNUnet testbed controller.
uint32_t operation_counter
The operation id counter.
void * opcq_empty_cls
Closure for the above task.
uint64_t event_mask
The controller event mask.
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
void * cc_cls
The closure for controller callback.
struct OperationQueue * opq_parallel_topology_config_operations
Operation queue for simultaneous topology configuration operations.
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
TESTBED_opcq_empty_cb opcq_empty_cb
If this callback is not NULL, schedule it as a task when opc_map gets empty.
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Event notification from a controller to a client for a generic operational success where the operatio...
Initialization message for gnunet-helper-testbed to start testbed service.
uint16_t config_size
The size of the uncompressed configuration.
Confirmation from the service that adding a host worked (or failed).
handle for host registration
struct GNUNET_TESTBED_Host * host
The host being registered.
struct GNUNET_TESTBED_Controller * c
The controller at which this host is being registered.
GNUNET_TESTBED_HostRegistrationCompletion cc
The Registration completion callback.
void * cc_cls
The closure for above callback.
Opaque handle to a host running experiments managed by the testing framework.
Initial message from a client to a testing control service.
Event notification from a controller to a client.
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 create (configure, but not start) a peer.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER.
uint16_t config_size
Size of the uncompressed configuration.
Event notification from a controller to a client.
Event notification from a controller to a client.
A peer controlled by the testing framework.
enum PeerState state
Peer's state.
uint32_t unique_id
Globally unique ID of the peer.
struct GNUNET_TESTBED_Host * host
Which host does this peer run on?
Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message.
uint16_t config_size
The size of the configuration when uncompressed.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION.
Message to request configuration of a slave controller.
uint32_t slave_id
The id of the slave host.
Context data for get slave config operations.
uint32_t slave_id
The id of the slave controller.
GNUNET_TESTBED_OperationCompletionCallback cb
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.
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call once this operation is done.
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.
Context information to be used while searching for operation contexts.
uint64_t id
The id of the operation context we are searching for.
struct OperationContext * opc
The result of the search.
Date context for OP_SHUTDOWN_PEERS operations.
void * cb_cls
The closure for the above callback.
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call.
IPC messages between testing API and service ("controller")
static struct ExpireOperationEntry * exop_head
DLL head for list of operations marked for expiry.
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.
static void handle_peer_conevent(void *cls, const struct GNUNET_TESTBED_ConnectionEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT message from controller (testbed service)
static void handle_link_controllers_result(void *cls, const struct GNUNET_TESTBED_ControllerLinkResponse *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller (testbed serv...
static void handle_op_fail_event(void *cls, const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT message from controller (testbed service...
static void handle_opsuccess(void *cls, const struct GNUNET_TESTBED_GenericOperationSuccessEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS message from controller (testbed service)
static void handle_barrier_status(void *cls, const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS messages.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
struct GNUNET_TESTBED_HelperInit * GNUNET_TESTBED_create_helper_init_msg_(const char *trusted_ip, const char *hostname, const struct GNUNET_CONFIGURATION_Handle *cfg)
Creates a helper initialization message.
static void handle_add_host_confirm(void *cls, const struct GNUNET_TESTBED_HostConfirmedMessage *msg)
Handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from controller (testbed service)
struct GNUNET_TESTBED_Barrier * GNUNET_TESTBED_barrier_init_(struct GNUNET_TESTBED_Controller *controller, const char *name, unsigned int quorum, GNUNET_TESTBED_barrier_status_cb cb, void *cls, int echo)
Initialise a barrier and call the given callback when the required percentage of peers (quorum) reach...
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.
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
static int check_op_fail_event(void *cls, const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Validate GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT message from controller (testbed service)
static int opc_search_iterator(void *cls, uint32_t key, void *value)
Search iterator for searching an operation context.
static void opstart_shutdown_peers(void *cls)
Function called when a shutdown peers operation is ready.
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
static int check_link_controllers_result(void *cls, const struct GNUNET_TESTBED_ControllerLinkResponse *msg)
Check GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller (testbed service)
#define LOG_DEBUG(...)
Debug logging.
char * GNUNET_TESTBED_compress_cfg_(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size, size_t *xsize)
Function to serialize and compress using zlib a configuration through a configuration handle.
static int check_barrier_status(void *cls, const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
Validate GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS message.
const char * GNUNET_TESTBED_parse_error_string_(const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Checks the integrity of the OpeationFailureEventMessage and if good returns the error message it cont...
static void handle_peer_create_success(void *cls, const struct GNUNET_TESTBED_PeerCreateSuccessEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS message from controller (testbed service)
static void mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
void GNUNET_TESTBED_barrier_remove_(struct GNUNET_TESTBED_Barrier *barrier)
Remove a barrier and it was the last one in the barrier hash map, destroy the hash map.
static void handle_slave_config(void *cls, const struct GNUNET_TESTBED_SlaveConfiguration *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION message from controller (testbed service)
void GNUNET_TESTBED_forward_operation_msg_cancel_(struct OperationContext *opc)
Function to cancel an operation created by simply forwarding an operation message.
static void oprelease_shutdown_peers(void *cls)
Callback which will be called when shutdown peers operation is released.
uint64_t GNUNET_TESTBED_get_next_op_id(struct GNUNET_TESTBED_Controller *controller)
Function to return the operation id for a controller.
static void opstart_link_controllers(void *cls)
Function to call to start a link-controllers type operation once all queues the operation is part of ...
static void oprelease_link_controllers(void *cls)
Callback which will be called when link-controllers type operation is released.
static void opstart_get_slave_config(void *cls)
Function to be called when get slave config operation is ready.
static struct OperationContext * find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
Returns the operation context with the given id if found in the Operation context queues of the contr...
static int check_peer_config(void *cls, const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *msg)
Validate GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION message from controller (testbed service)
struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_extract_config_(const struct GNUNET_MessageHeader *msg)
Generates configuration by uncompressing configuration in given message.
struct OperationContext * GNUNET_TESTBED_forward_operation_msg_(struct GNUNET_TESTBED_Controller *controller, uint64_t operation_id, const struct GNUNET_MessageHeader *msg, GNUNET_MQ_MessageCallback cc, void *cc_cls)
Sends the given message as an operation.
static void handle_peer_event(void *cls, const struct GNUNET_TESTBED_PeerEventMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT message from controller (testbed service)
static int check_slave_config(void *cls, const struct GNUNET_TESTBED_SlaveConfiguration *msg)
Validate #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_INFORMATION message from controller (testbed service)
#define LOG(kind,...)
Generic logging shorthand.
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
static int opc_free_iterator(void *cls, uint32_t key, void *value)
Iterator to free opc map entries.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_get_slave_config_(void *op_cls, struct GNUNET_TESTBED_Controller *master, uint32_t slave_host_id)
Like GNUNET_TESTBED_get_slave_config(), however without the host registration check.
static void handle_peer_config(void *cls, const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *msg)
Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION message from controller (testbed service)
static void oprelease_get_slave_config(void *cls)
Function to be called when get slave config operation is cancelled or finished.
static struct GNUNET_TESTBED_SlaveGetConfigurationMessage * GNUNET_TESTBED_generate_slavegetconfig_msg_(uint64_t op_id, uint32_t slave_id)
Function to build GET_SLAVE_CONFIG message.
static int check_add_host_confirm(void *cls, const struct GNUNET_TESTBED_HostConfirmedMessage *msg)
Check #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message is well-formed.
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_GET_SLAVE_CONFIG
Get slave config operation.
@ OP_PEER_RECONFIGURE
Reconfigure a peer.
@ OP_FORWARDED
Forwarded operation.
@ OP_PEER_START
Peer start operation.
@ OP_PEER_INFO
Get peer information operation.
@ OP_SHUTDOWN_PEERS
Stop and destroy all peers.
@ OP_MANAGE_SERVICE
Start/stop service at a peer.
@ OP_PEER_DESTROY
Peer destroy operation.
@ OP_OVERLAY_CONNECT
Overlay connection operation.
@ OP_LINK_CONTROLLERS
Link controllers 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_mark_host_registered_at_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Marks a host as registered with a controller.
void GNUNET_TESTBED_deregister_host_at_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Unmarks a host registered at a controller.
int GNUNET_TESTBED_is_host_registered_(const struct GNUNET_TESTBED_Host *host, const struct GNUNET_TESTBED_Controller *const controller)
Checks whether a host has been registered.
void GNUNET_TESTBED_host_replace_cfg_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_CONFIGURATION_Handle *new_cfg)
Function to replace host's configuration.
const struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_host_get_cfg_(const struct GNUNET_TESTBED_Host *host)
Obtain the host's configuration template.
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_lookup_by_id_(uint32_t id)
Lookup a host by ID.
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
void GNUNET_TESTBED_operation_mark_failed(struct GNUNET_TESTBED_Operation *op)
Marks an operation as failed.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an 'operation' to be performed.
void GNUNET_TESTBED_operation_release_(struct GNUNET_TESTBED_Operation *op)
An operation is 'done' (was cancelled or finished); remove it from the queues and release associated ...
struct OperationQueue * GNUNET_TESTBED_operation_queue_create_(enum OperationQueueType type, unsigned int max_active)
Create an operation queue.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
void GNUNET_TESTBED_operation_queue_destroy_(struct OperationQueue *queue)
Destroys an operation 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
@ OPERATION_QUEUE_TYPE_FIXED
Operation queue which permits a fixed maximum number of operations to be active at any time.
void GNUNET_TESTBED_peer_deregister_(struct GNUNET_TESTBED_Peer *peer)
Removes a peer from the peer list.
void GNUNET_TESTBED_cleanup_peers_(void)
Frees all peers.
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_STOPPED
The peer is stopped.
@ TESTBED_PS_CREATED
The peer has been created.
@ TESTBED_PS_STARTED
The peer is running.
functions to calculate standard deviation
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.