GNUnet  0.19.4
testbed_api.c File Reference

API for accessing the GNUnet testing service. More...

#include "platform.h"
#include "gnunet_testbed_service.h"
#include "gnunet_core_service.h"
#include "gnunet_constants.h"
#include "gnunet_transport_service.h"
#include "gnunet_hello_lib.h"
#include <zlib.h>
#include "testbed.h"
#include "testbed_api.h"
#include "testbed_api_hosts.h"
#include "testbed_api_peers.h"
#include "testbed_api_operations.h"
#include "testbed_api_sd.h"
Include dependency graph for testbed_api.c:

Go to the source code of this file.

Data Structures

struct  ForwardedOperationData
 Context data for forwarded Operation. More...
 
struct  GetSlaveConfigData
 Context data for get slave config operations. More...
 
struct  ControllerLinkData
 Context data for controller link operations. More...
 
struct  ShutdownPeersData
 Date context for OP_SHUTDOWN_PEERS operations. More...
 
struct  ExpireOperationEntry
 An entry in the stack for keeping operations which are about to expire. More...
 
struct  SearchContext
 Context information to be used while searching for operation contexts. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "testbed-api", __VA_ARGS__)
 Generic logging shorthand. More...
 
#define LOG_DEBUG(...)   LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
 Debug logging. More...
 
#define TIME_REL_SECS(sec)    GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
 Relative time seconds shorthand. More...
 
#define TIMEOUT_REL   TIME_REL_SECS (1)
 Default server message sending retry timeout. More...
 

Functions

static void exop_insert (struct GNUNET_TESTBED_Operation *op)
 Inserts an operation into the list of operations marked for expiry. More...
 
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. More...
 
static int opc_search_iterator (void *cls, uint32_t key, void *value)
 Search iterator for searching an operation context. More...
 
static struct OperationContextfind_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 controller. More...
 
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. More...
 
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. More...
 
static int check_add_host_confirm (void *cls, const struct GNUNET_TESTBED_HostConfirmedMessage *msg)
 Check #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message is well-formed. More...
 
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) More...
 
static void handle_forwarded_operation_msg (void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
 Handler for forwarded operations. More...
 
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) More...
 
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) More...
 
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) More...
 
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) More...
 
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) More...
 
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) More...
 
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) More...
 
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) More...
 
static struct GNUNET_TESTBED_SlaveGetConfigurationMessageGNUNET_TESTBED_generate_slavegetconfig_msg_ (uint64_t op_id, uint32_t slave_id)
 Function to build GET_SLAVE_CONFIG message. More...
 
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) More...
 
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) More...
 
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) More...
 
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 service) More...
 
static int check_barrier_status (void *cls, const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
 Validate GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS message. More...
 
static void handle_barrier_status (void *cls, const struct GNUNET_TESTBED_BarrierStatusMsg *msg)
 Handler for GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS messages. More...
 
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. More...
 
struct OperationContextGNUNET_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. More...
 
void GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc)
 Function to cancel an operation created by simply forwarding an operation message. More...
 
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 declare that the operation can be activated. More...
 
static void oprelease_link_controllers (void *cls)
 Callback which will be called when link-controllers type operation is released. More...
 
static void opstart_get_slave_config (void *cls)
 Function to be called when get slave config operation is ready. More...
 
static void oprelease_get_slave_config (void *cls)
 Function to be called when get slave config operation is cancelled or finished. More...
 
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 creation of the message queue. More...
 
struct GNUNET_TESTBED_ControllerGNUNET_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. More...
 
static int opc_free_iterator (void *cls, uint32_t key, void *value)
 Iterator to free opc map entries. More...
 
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). More...
 
size_t GNUNET_TESTBED_compress_config_ (const char *config, size_t size, char **xconfig)
 Compresses given configuration using zlib compress. More...
 
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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
struct GNUNET_TESTBED_OperationGNUNET_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. More...
 
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. More...
 
struct GNUNET_TESTBED_HelperInitGNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip, const char *hostname, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Creates a helper initialization message. More...
 
void GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
 This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) from an operation has been fully processed i.e. More...
 
struct GNUNET_CONFIGURATION_HandleGNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
 Generates configuration by uncompressing configuration in given message. More...
 
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 contains. More...
 
uint64_t GNUNET_TESTBED_get_next_op_id (struct GNUNET_TESTBED_Controller *controller)
 Function to return the operation id for a controller. More...
 
static void opstart_shutdown_peers (void *cls)
 Function called when a shutdown peers operation is ready. More...
 
static void oprelease_shutdown_peers (void *cls)
 Callback which will be called when shutdown peers operation is released. More...
 
struct GNUNET_TESTBED_OperationGNUNET_TESTBED_shutdown_peers (struct GNUNET_TESTBED_Controller *c, void *op_cls, GNUNET_TESTBED_OperationCompletionCallback cb, void *cb_cls)
 Stops and destroys all peers. More...
 
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. More...
 
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. More...
 
struct GNUNET_TESTBED_BarrierGNUNET_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 the barrier OR upon error. More...
 
struct GNUNET_TESTBED_BarrierGNUNET_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 the barrier OR upon error. More...
 
void GNUNET_TESTBED_barrier_cancel (struct GNUNET_TESTBED_Barrier *barrier)
 Cancel a barrier. More...
 

Variables

static struct ExpireOperationEntryexop_head
 DLL head for list of operations marked for expiry. More...
 
static struct ExpireOperationEntryexop_tail
 DLL tail for list of operation marked for expiry. More...
 

Detailed Description

API for accessing the GNUnet testing service.

This library is supposed to make it easier to write testcases and script large-scale benchmarks.

Author
Christian Grothoff
Sree Harsha Totakura

Definition in file testbed_api.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "testbed-api", __VA_ARGS__)

Generic logging shorthand.

Definition at line 47 of file testbed_api.c.

◆ LOG_DEBUG

#define LOG_DEBUG (   ...)    LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)

Debug logging.

Definition at line 52 of file testbed_api.c.

◆ TIME_REL_SECS

#define TIME_REL_SECS (   sec)     GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)

Relative time seconds shorthand.

Definition at line 57 of file testbed_api.c.

◆ TIMEOUT_REL

#define TIMEOUT_REL   TIME_REL_SECS (1)

Default server message sending retry timeout.

Definition at line 64 of file testbed_api.c.

Function Documentation

◆ exop_insert()

static void exop_insert ( struct GNUNET_TESTBED_Operation op)
static

Inserts an operation into the list of operations marked for expiry.

Parameters
opthe operation to insert

Definition at line 169 of file testbed_api.c.

170 {
171  struct ExpireOperationEntry *entry;
172 
173  entry = GNUNET_new (struct ExpireOperationEntry);
174  entry->op = op;
176 }
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
An entry in the stack for keeping operations which are about to expire.
Definition: testbed_api.c:134
const struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.c:148
static struct ExpireOperationEntry * exop_head
DLL head for list of operations marked for expiry.
Definition: testbed_api.c:155
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
Definition: testbed_api.c:160

References exop_head, exop_tail, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_new, op, and ExpireOperationEntry::op.

Referenced by handle_op_fail_event(), handle_opsuccess(), handle_peer_conevent(), handle_peer_create_success(), and handle_peer_event().

Here is the caller graph for this function:

◆ exop_check()

static int exop_check ( const struct GNUNET_TESTBED_Operation *const  op)
static

Checks if an operation is present in the list of operations marked for expiry.

If the operation is found, it and the tail of operations after it are removed from the list.

Parameters
opthe operation to check
Returns
GNUNET_NO if the operation is not present in the list; GNUNET_YES if the operation is found in the list (the operation is then removed from the list – calling this function again with the same paramenter will return GNUNET_NO)

Definition at line 191 of file testbed_api.c.

192 {
193  struct ExpireOperationEntry *entry;
194  struct ExpireOperationEntry *entry2;
195  int found;
196 
197  found = GNUNET_NO;
198  entry = exop_head;
199  while (NULL != entry)
200  {
201  if (op == entry->op)
202  {
203  found = GNUNET_YES;
204  break;
205  }
206  entry = entry->next;
207  }
208  if (GNUNET_NO == found)
209  return GNUNET_NO;
210  /* Truncate the tail */
211  while (NULL != entry)
212  {
213  entry2 = entry->next;
215  GNUNET_free (entry);
216  entry = entry2;
217  }
218  return GNUNET_YES;
219 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
@ GNUNET_YES
@ GNUNET_NO
#define GNUNET_free(ptr)
Wrapper around free.
struct ExpireOperationEntry * next
DLL head; new entries are to be inserted here.
Definition: testbed_api.c:138

References exop_head, exop_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_YES, ExpireOperationEntry::next, op, and ExpireOperationEntry::op.

Referenced by GNUNET_TESTBED_operation_done(), handle_op_fail_event(), handle_opsuccess(), handle_peer_conevent(), handle_peer_create_success(), and handle_peer_event().

Here is the caller graph for this function:

◆ opc_search_iterator()

static int opc_search_iterator ( void *  cls,
uint32_t  key,
void *  value 
)
static

Search iterator for searching an operation context.

Parameters
clsthe search context
keycurrent key code
valuevalue in the hash map
Returns
GNUNET_YES if we should continue to iterate, GNUNET_NO if not.

Definition at line 249 of file testbed_api.c.

250 {
251  struct SearchContext *sc = cls;
252  struct OperationContext *opc = value;
253 
254  GNUNET_assert (NULL != opc);
255  GNUNET_assert (NULL == sc->opc);
256  if (opc->id != sc->id)
257  return GNUNET_YES;
258  sc->opc = opc;
259  return GNUNET_NO;
260 }
static char * value
Value of the record to add/remove.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:137
uint64_t id
The id of the operation.
Definition: testbed_api.h:161
Context information to be used while searching for operation contexts.
Definition: testbed_api.c:226

References GNUNET_assert, GNUNET_NO, GNUNET_YES, OperationContext::id, sc, and value.

Referenced by find_opc().

Here is the caller graph for this function:

◆ find_opc()

static struct OperationContext* find_opc ( const struct GNUNET_TESTBED_Controller c,
const uint64_t  id 
)
static

Returns the operation context with the given id if found in the Operation context queues of the controller.

Parameters
cthe controller whose operation context map is searched
idthe id which has to be checked
Returns
the matching operation context; NULL if no match found

Definition at line 272 of file testbed_api.c.

273 {
274  struct SearchContext sc;
275 
276  sc.id = id;
277  sc.opc = NULL;
278  GNUNET_assert (NULL != c->opc_map);
279  if (GNUNET_SYSERR !=
281  (uint32_t) id,
283  &sc))
284  return NULL;
285  return sc.opc;
286 }
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
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.
@ GNUNET_SYSERR
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:229
static int opc_search_iterator(void *cls, uint32_t key, void *value)
Search iterator for searching an operation context.
Definition: testbed_api.c:249

References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_get_multiple(), GNUNET_SYSERR, id, GNUNET_TESTBED_Controller::opc_map, opc_search_iterator(), and sc.

Referenced by handle_link_controllers_result(), handle_op_fail_event(), handle_opsuccess(), handle_peer_conevent(), handle_peer_config(), handle_peer_create_success(), handle_peer_event(), and handle_slave_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_insert_opc_()

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.

Creates the operation context map if one does not exist for the controller

Parameters
cthe controller
opcthe operation context to be inserted

Definition at line 298 of file testbed_api.c.

300 {
301  if (NULL == c->opc_map)
304  c->opc_map,
305  (uint32_t) opc->id,
306  opc,
308 }
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.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ GNUNET_OK

References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_create(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_OK, OperationContext::id, SearchContext::opc, and GNUNET_TESTBED_Controller::opc_map.

Referenced by GNUNET_TESTBED_forward_operation_msg_(), opstart_get_slave_config(), opstart_link_controllers(), opstart_manage_service(), opstart_overlay_connect(), opstart_peer_create(), opstart_peer_destroy(), opstart_peer_getinfo(), opstart_peer_reconfigure(), opstart_peer_start(), opstart_peer_stop(), and opstart_shutdown_peers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_remove_opc_()

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.

Parameters
cthe controller
opcthe operation context to remove

Definition at line 319 of file testbed_api.c.

321 {
322  GNUNET_assert (NULL != c->opc_map);
325  (uint32_t) opc->id,
326  opc));
328  (NULL != c->opcq_empty_cb))
330 }
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.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:239
TESTBED_opcq_empty_cb opcq_empty_cb
If this callback is not NULL, schedule it as a task when opc_map gets empty.
Definition: testbed_api.h:234

References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_YES, OperationContext::id, SearchContext::opc, GNUNET_TESTBED_Controller::opc_map, GNUNET_TESTBED_Controller::opcq_empty_cb, and GNUNET_TESTBED_Controller::opcq_empty_cls.

Referenced by GNUNET_TESTBED_forward_operation_msg_cancel_(), handle_forwarded_operation_msg(), handle_link_controllers_result(), handle_op_fail_event(), handle_opsuccess(), handle_peer_conevent(), handle_peer_config(), handle_peer_create_success(), handle_peer_event(), handle_slave_config(), oprelease_get_slave_config(), oprelease_link_controllers(), oprelease_manage_service(), oprelease_overlay_connect(), oprelease_peer_create(), oprelease_peer_destroy(), oprelease_peer_getinfo(), oprelease_peer_reconfigure(), oprelease_peer_start(), oprelease_peer_stop(), and oprelease_shutdown_peers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_add_host_confirm()

static int check_add_host_confirm ( void *  cls,
const struct GNUNET_TESTBED_HostConfirmedMessage msg 
)
static

Check #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message is well-formed.

Parameters
clsthe controller handler
msgmessage received
Returns
GNUNET_OK if message is well-formed

Definition at line 341 of file testbed_api.c.

343 {
344  const char *emsg;
345  uint16_t msg_size;
346 
347  msg_size = ntohs (msg->header.size) - sizeof(*msg);
348  if (0 == msg_size)
349  return GNUNET_OK;
350  /* We have an error message */
351  emsg = (const char *) &msg[1];
352  if ('\0' != emsg[msg_size - 1])
353  {
354  GNUNET_break (0);
355  return GNUNET_SYSERR;
356  }
357  return GNUNET_OK;
358 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.

◆ handle_add_host_confirm()

static void handle_add_host_confirm ( void *  cls,
const struct GNUNET_TESTBED_HostConfirmedMessage msg 
)
static

Handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 369 of file testbed_api.c.

371 {
372  struct GNUNET_TESTBED_Controller *c = cls;
374  const char *emsg;
375  uint16_t msg_size;
376 
377  if (NULL == rh)
378  return;
379  if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
380  {
381  LOG_DEBUG ("Mismatch in host id's %u, %u of host confirm msg\n",
383  ntohl (msg->host_id));
384  return;
385  }
386  c->rh = NULL;
387  msg_size = ntohs (msg->header.size) - sizeof(*msg);
388  if (0 == msg_size)
389  {
390  LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
392  rh->cc (rh->cc_cls, NULL);
393  GNUNET_free (rh);
394  return;
395  }
396  /* We have an error message */
397  emsg = (const char *) &msg[1];
399  _ ("Adding host %u failed with error: %s\n"),
400  ntohl (msg->host_id),
401  emsg);
402  rh->cc (rh->cc_cls, emsg);
403  GNUNET_free (rh);
404 }
@ GNUNET_ERROR_TYPE_ERROR
#define _(String)
GNU gettext support macro.
Definition: platform.h:177
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:194
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:224
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.
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
#define LOG(kind,...)
Generic logging shorthand.
Definition: testbed_api.c:47
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.
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain a host's unique global ID.

References _, GNUNET_TESTBED_HostRegistrationHandle::c, GNUNET_TESTBED_HostRegistrationHandle::cc, GNUNET_TESTBED_HostRegistrationHandle::cc_cls, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_mark_host_registered_at_(), GNUNET_TESTBED_HostRegistrationHandle::host, LOG, LOG_DEBUG, msg, GNUNET_TESTBED_Controller::rh, and GNUNET_MessageHeader::size.

Here is the call graph for this function:

◆ handle_forwarded_operation_msg()

static void handle_forwarded_operation_msg ( void *  cls,
struct OperationContext opc,
const struct GNUNET_MessageHeader msg 
)
static

Handler for forwarded operations.

Parameters
clsthe controller handle
opcthe operation context
msgthe message

Definition at line 415 of file testbed_api.c.

418 {
419  struct GNUNET_TESTBED_Controller *c = cls;
420  struct ForwardedOperationData *fo_data;
421 
422  fo_data = opc->data;
423  if (NULL != fo_data->cc)
424  fo_data->cc (fo_data->cc_cls, msg);
426  GNUNET_free (fo_data);
427  GNUNET_free (opc);
428 }
Context data for forwarded Operation.
Definition: testbed_api.c:71
void * cc_cls
The closure for the above callback.
Definition: testbed_api.c:80
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Definition: testbed_api.c:75
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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.
Definition: testbed_api.c:319

References ForwardedOperationData::cc, ForwardedOperationData::cc_cls, OperationContext::data, GNUNET_free, GNUNET_TESTBED_remove_opc_(), and msg.

Referenced by handle_link_controllers_result(), handle_op_fail_event(), handle_opsuccess(), handle_peer_conevent(), handle_peer_config(), handle_peer_create_success(), and handle_peer_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_opsuccess()

static void handle_opsuccess ( void *  cls,
const struct GNUNET_TESTBED_GenericOperationSuccessEventMessage msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 439 of file testbed_api.c.

442 {
443  struct GNUNET_TESTBED_Controller *c = cls;
444  struct OperationContext *opc;
446  void *op_comp_cb_cls;
447  struct GNUNET_TESTBED_EventInformation event;
448  uint64_t op_id;
449 
450  op_id = GNUNET_ntohll (msg->operation_id);
451  LOG_DEBUG ("Operation %llu successful\n",
452  (unsigned long long) op_id);
453  if (NULL == (opc = find_opc (c, op_id)))
454  {
455  LOG_DEBUG ("Operation not found\n");
456  return;
457  }
459  event.op = opc->op;
460  event.op_cls = opc->op_cls;
461  event.details.operation_finished.emsg = NULL;
462  event.details.operation_finished.generic = NULL;
463  op_comp_cb = NULL;
464  op_comp_cb_cls = NULL;
465  switch (opc->type)
466  {
467  case OP_FORWARDED: {
469  opc,
470  (const struct
472  return;
473  }
474  break;
475 
476  case OP_PEER_DESTROY: {
477  struct GNUNET_TESTBED_Peer *peer;
478 
479  peer = opc->data;
481  GNUNET_free (peer);
482  opc->data = NULL;
483  // PEERDESTROYDATA
484  }
485  break;
486 
487  case OP_SHUTDOWN_PEERS: {
488  struct ShutdownPeersData *data;
489 
490  data = opc->data;
491  op_comp_cb = data->cb;
492  op_comp_cb_cls = data->cb_cls;
493  GNUNET_free (data);
494  opc->data = NULL;
496  }
497  break;
498 
499  case OP_MANAGE_SERVICE: {
500  struct ManageServiceData *data;
501 
502  GNUNET_assert (NULL != (data = opc->data));
503  op_comp_cb = data->cb;
504  op_comp_cb_cls = data->cb_cls;
505  GNUNET_free (data);
506  opc->data = NULL;
507  }
508  break;
509 
510  case OP_PEER_RECONFIGURE:
511  break;
512 
513  default:
514  GNUNET_assert (0);
515  }
516  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
517  opc->state = OPC_STATE_FINISHED;
518  exop_insert (event.op);
519  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
520  {
521  if (NULL != c->cc)
522  c->cc (c->cc_cls, &event);
523  if (GNUNET_NO == exop_check (event.op))
524  return;
525  }
526  else
527  LOG_DEBUG ("Not calling callback\n");
528  if (NULL != op_comp_cb)
529  op_comp_cb (op_comp_cb_cls, event.op, NULL);
530  /* You could have marked the operation as done by now */
531  GNUNET_break (GNUNET_NO == exop_check (event.op));
532 }
uint32_t data
The data value.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:54
void(* GNUNET_TESTBED_OperationCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when an operation is completed.
@ GNUNET_TESTBED_ET_OPERATION_FINISHED
A requested testbed operation has been completed.
Header for all communications.
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:265
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
A peer controlled by the testing framework.
void * op_cls
The operation closure.
Definition: testbed_api.h:151
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
Date context for OP_SHUTDOWN_PEERS operations.
Definition: testbed_api.c:117
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:415
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.
Definition: testbed_api.c:191
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...
Definition: testbed_api.c:272
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:169
@ OP_PEER_RECONFIGURE
Reconfigure a peer.
Definition: testbed_api.h:74
@ OP_FORWARDED
Forwarded operation.
Definition: testbed_api.h:84
@ OP_SHUTDOWN_PEERS
Stop and destroy all peers.
Definition: testbed_api.h:99
@ OP_MANAGE_SERVICE
Start/stop service at a peer.
Definition: testbed_api.h:104
@ OP_PEER_DESTROY
Peer destroy operation.
Definition: testbed_api.h:64
@ OPC_STATE_FINISHED
The operation has finished.
Definition: testbed_api.h:129
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.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.

References OperationContext::c, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, OperationContext::data, data, GNUNET_TESTBED_Controller::event_mask, exop_check(), exop_insert(), find_opc(), GNUNET_assert, GNUNET_break, GNUNET_free, GNUNET_NO, GNUNET_ntohll(), GNUNET_TESTBED_cleanup_peers_(), GNUNET_TESTBED_ET_OPERATION_FINISHED, GNUNET_TESTBED_peer_deregister_(), GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), LOG_DEBUG, msg, GNUNET_TESTBED_EventInformation::op, OperationContext::op, OperationContext::op_cls, OP_FORWARDED, OP_MANAGE_SERVICE, OP_PEER_DESTROY, OP_PEER_RECONFIGURE, OP_SHUTDOWN_PEERS, OPC_STATE_FINISHED, peer, OperationContext::state, and OperationContext::type.

Here is the call graph for this function:

◆ handle_peer_create_success()

static void handle_peer_create_success ( void *  cls,
const struct GNUNET_TESTBED_PeerCreateSuccessEventMessage msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS message from controller (testbed service)

Parameters
clsthe controller handle
msgmessage received

Definition at line 543 of file testbed_api.c.

546 {
547  struct GNUNET_TESTBED_Controller *c = cls;
548  struct OperationContext *opc;
549  struct PeerCreateData *data;
550  struct GNUNET_TESTBED_Peer *peer;
553  void *cb_cls;
554  uint64_t op_id;
555 
557  ntohs (msg->header.size));
558  op_id = GNUNET_ntohll (msg->operation_id);
559  if (NULL == (opc = find_opc (c, op_id)))
560  {
561  LOG_DEBUG ("Operation context for PeerCreateSuccessEvent not found\n");
562  return;
563  }
564  if (OP_FORWARDED == opc->type)
565  {
567  opc,
568  (const struct GNUNET_MessageHeader *) msg);
569  return;
570  }
572  GNUNET_assert (NULL != opc->data);
573  data = opc->data;
574  GNUNET_assert (NULL != data->peer);
575  peer = data->peer;
576  GNUNET_assert (peer->unique_id == ntohl (msg->peer_id));
579  cb = data->cb;
580  cb_cls = data->cls;
581  op = opc->op;
582  GNUNET_free (opc->data);
583  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
584  opc->state = OPC_STATE_FINISHED;
585  exop_insert (op);
586  if (NULL != cb)
587  cb (cb_cls, peer, NULL);
588  /* You could have marked the operation as done by now */
590 }
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.
Opaque handle to an abstract operation to be executed by the testing framework.
void * cb_cls
Closure for callbacks.
Event notification from a controller to a client.
Definition: testbed.h:534
enum PeerState state
Peer's state.
uint32_t unique_id
Globally unique ID of the peer.
Data for the OperationType OP_PEER_CREATE.
@ OP_PEER_CREATE
Peer create operation.
Definition: testbed_api.h:49
void GNUNET_TESTBED_peer_register_(struct GNUNET_TESTBED_Peer *peer)
Adds a peer to the peer list.
@ TESTBED_PS_CREATED
The peer has been created.

References OperationContext::c, GNUNET_TESTBED_Operation::cb_cls, OperationContext::data, data, exop_check(), exop_insert(), find_opc(), GNUNET_assert, GNUNET_break, GNUNET_free, GNUNET_NO, GNUNET_ntohll(), GNUNET_TESTBED_peer_register_(), GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), LOG_DEBUG, msg, op, OperationContext::op, OP_FORWARDED, OP_PEER_CREATE, OPC_STATE_FINISHED, peer, GNUNET_MessageHeader::size, OperationContext::state, GNUNET_TESTBED_Peer::state, TESTBED_PS_CREATED, OperationContext::type, and GNUNET_TESTBED_Peer::unique_id.

Here is the call graph for this function:

◆ handle_peer_event()

static void handle_peer_event ( void *  cls,
const struct GNUNET_TESTBED_PeerEventMessage msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 601 of file testbed_api.c.

602 {
603  struct GNUNET_TESTBED_Controller *c = cls;
604  struct OperationContext *opc;
605  struct GNUNET_TESTBED_Peer *peer;
606  struct PeerEventData *data;
608  void *pcc_cls;
609  struct GNUNET_TESTBED_EventInformation event;
610  uint64_t op_id;
611  uint64_t mask;
612 
614  ntohs (msg->header.size));
615  op_id = GNUNET_ntohll (msg->operation_id);
616  if (NULL == (opc = find_opc (c, op_id)))
617  {
618  LOG_DEBUG ("Operation not found\n");
619  return;
620  }
621  if (OP_FORWARDED == opc->type)
622  {
624  opc,
625  (const struct GNUNET_MessageHeader *) msg);
626  return;
627  }
628  GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
629  data = opc->data;
630  GNUNET_assert (NULL != data);
631  peer = data->peer;
632  GNUNET_assert (NULL != peer);
633  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
634  event.op = opc->op;
635  event.op_cls = opc->op_cls;
636  switch (event.type)
637  {
640  event.details.peer_start.host = peer->host;
641  event.details.peer_start.peer = peer;
642  break;
643 
646  event.details.peer_stop.peer = peer;
647  break;
648 
649  default:
650  GNUNET_assert (0); /* We should never reach this state */
651  }
652  pcc = data->pcc;
653  pcc_cls = data->pcc_cls;
654  GNUNET_free (data);
655  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
656  opc->state = OPC_STATE_FINISHED;
657  exop_insert (event.op);
658  mask = 1LL << GNUNET_TESTBED_ET_PEER_START;
659  mask |= 1LL << GNUNET_TESTBED_ET_PEER_STOP;
660  if (0 != (mask & c->event_mask))
661  {
662  if (NULL != c->cc)
663  c->cc (c->cc_cls, &event);
664  if (GNUNET_NO == exop_check (event.op))
665  return;
666  }
667  if (NULL != pcc)
668  pcc (pcc_cls, NULL);
669  /* You could have marked the operation as done by now */
670  GNUNET_break (GNUNET_NO == exop_check (event.op));
671 }
void(* GNUNET_TESTBED_PeerChurnCallback)(void *cls, const char *emsg)
Functions of this signature are called when a peer has been successfully started or stopped.
GNUNET_TESTBED_EventType
Enumeration with (at most 64) possible event types that can be monitored using the testbed framework.
@ GNUNET_TESTBED_ET_PEER_START
A peer has been started.
@ GNUNET_TESTBED_ET_PEER_STOP
A peer has been stopped.
Event notification from a controller to a client.
Definition: testbed.h:443
struct GNUNET_TESTBED_Host * host
Which host does this peer run on?
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.
@ OP_PEER_START
Peer start operation.
Definition: testbed_api.h:54
@ OP_PEER_STOP
Peer stop operation.
Definition: testbed_api.h:59
@ TESTBED_PS_STOPPED
The peer is stopped.
@ TESTBED_PS_STARTED
The peer is running.

References OperationContext::c, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, OperationContext::data, data, GNUNET_TESTBED_Controller::event_mask, exop_check(), exop_insert(), find_opc(), GNUNET_assert, GNUNET_break, GNUNET_free, GNUNET_NO, GNUNET_ntohll(), GNUNET_TESTBED_ET_PEER_START, GNUNET_TESTBED_ET_PEER_STOP, GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), GNUNET_TESTBED_Peer::host, LOG_DEBUG, msg, GNUNET_TESTBED_EventInformation::op, OperationContext::op, OperationContext::op_cls, OP_FORWARDED, OP_PEER_START, OP_PEER_STOP, OPC_STATE_FINISHED, PeerEventData::pcc, PeerEventData::pcc_cls, peer, GNUNET_MessageHeader::size, OperationContext::state, GNUNET_TESTBED_Peer::state, TESTBED_PS_STARTED, TESTBED_PS_STOPPED, GNUNET_TESTBED_EventInformation::type, and OperationContext::type.

Here is the call graph for this function:

◆ handle_peer_conevent()

static void handle_peer_conevent ( void *  cls,
const struct GNUNET_TESTBED_ConnectionEventMessage msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 682 of file testbed_api.c.

684 {
685  struct GNUNET_TESTBED_Controller *c = cls;
686  struct OperationContext *opc;
687  struct OverlayConnectData *data;
689  void *cb_cls;
690  struct GNUNET_TESTBED_EventInformation event;
691  uint64_t op_id;
692  uint64_t mask;
693 
694  op_id = GNUNET_ntohll (msg->operation_id);
695  if (NULL == (opc = find_opc (c, op_id)))
696  {
697  LOG_DEBUG ("Operation not found\n");
698  return;
699  }
700  if (OP_FORWARDED == opc->type)
701  {
703  opc,
704  (const struct GNUNET_MessageHeader *) msg);
705  return;
706  }
708  GNUNET_assert (NULL != (data = opc->data));
709  GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id) &&
710  (ntohl (msg->peer2) == data->p2->unique_id));
711  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
712  event.op = opc->op;
713  event.op_cls = opc->op_cls;
714  switch (event.type)
715  {
717  event.details.peer_connect.peer1 = data->p1;
718  event.details.peer_connect.peer2 = data->p2;
719  break;
720 
722  GNUNET_assert (0); /* FIXME: implement */
723  break;
724 
725  default:
726  GNUNET_assert (0); /* Should never reach here */
727  break;
728  }
729  cb = data->cb;
730  cb_cls = data->cb_cls;
731  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
732  opc->state = OPC_STATE_FINISHED;
733  exop_insert (event.op);
734  mask = 1LL << GNUNET_TESTBED_ET_CONNECT;
735  mask |= 1LL << GNUNET_TESTBED_ET_DISCONNECT;
736  if (0 != (mask & c->event_mask))
737  {
738  if (NULL != c->cc)
739  c->cc (c->cc_cls, &event);
740  if (GNUNET_NO == exop_check (event.op))
741  return;
742  }
743  if (NULL != cb)
744  cb (cb_cls, opc->op, NULL);
745  /* You could have marked the operation as done by now */
746  GNUNET_break (GNUNET_NO == exop_check (event.op));
747 }
@ GNUNET_TESTBED_ET_CONNECT
A connection between two peers was established.
@ GNUNET_TESTBED_ET_DISCONNECT
A connection between two peers was torn down.
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.
@ OP_OVERLAY_CONNECT
Overlay connection operation.
Definition: testbed_api.h:79

References OperationContext::c, OverlayConnectData::cb, OverlayConnectData::cb_cls, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, OperationContext::data, data, GNUNET_TESTBED_Controller::event_mask, exop_check(), exop_insert(), find_opc(), GNUNET_assert, GNUNET_break, GNUNET_NO, GNUNET_ntohll(), GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_DISCONNECT, GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), LOG_DEBUG, msg, GNUNET_TESTBED_EventInformation::op, OperationContext::op, OperationContext::op_cls, OP_FORWARDED, OP_OVERLAY_CONNECT, OPC_STATE_FINISHED, OperationContext::state, GNUNET_TESTBED_EventInformation::type, and OperationContext::type.

Here is the call graph for this function:

◆ check_peer_config()

static int check_peer_config ( void *  cls,
const struct GNUNET_TESTBED_PeerConfigurationInformationMessage msg 
)
static

Validate GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 758 of file testbed_api.c.

761 {
762  /* anything goes? */
763  return GNUNET_OK;
764 }

References GNUNET_OK.

◆ handle_peer_config()

static void handle_peer_config ( void *  cls,
const struct GNUNET_TESTBED_PeerConfigurationInformationMessage msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 775 of file testbed_api.c.

778 {
779  struct GNUNET_TESTBED_Controller *c = cls;
780  struct OperationContext *opc;
781  struct GNUNET_TESTBED_Peer *peer;
782  struct PeerInfoData *data;
783  struct GNUNET_TESTBED_PeerInformation *pinfo;
785  void *cb_cls;
786  uint64_t op_id;
787 
788  op_id = GNUNET_ntohll (msg->operation_id);
789  if (NULL == (opc = find_opc (c, op_id)))
790  {
791  LOG_DEBUG ("Operation not found\n");
792  return;
793  }
794  if (OP_FORWARDED == opc->type)
795  {
796  handle_forwarded_operation_msg (c, opc, &msg->header);
797  return;
798  }
799  data = opc->data;
800  GNUNET_assert (NULL != data);
801  peer = data->peer;
802  GNUNET_assert (NULL != peer);
803  GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id);
805  pinfo->pit = data->pit;
806  cb = data->cb;
807  cb_cls = data->cb_cls;
808  GNUNET_assert (NULL != cb);
809  GNUNET_free (data);
810  opc->data = NULL;
811  switch (pinfo->pit)
812  {
814  pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity);
815  GNUNET_memcpy (pinfo->result.id,
816  &msg->peer_identity,
817  sizeof(struct GNUNET_PeerIdentity));
818  break;
819 
821  pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
823  break;
824 
826  GNUNET_assert (0); /* never reach here */
827  break;
828  }
829  opc->data = pinfo;
830  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
831  opc->state = OPC_STATE_FINISHED;
832  cb (cb_cls, opc->op, pinfo, NULL);
833  /* We dont check whether the operation is marked as done here as the
834  operation contains data (cfg/identify) which will be freed at a later point
835  */
836 }
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
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_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' ...
The identity of the host (wraps the signing key of the peer).
Data returned from GNUNET_TESTBED_peer_get_information.
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration of the peer.
union GNUNET_TESTBED_PeerInformation::@49 result
The result of the get information operation; Choose according to the pit.
enum GNUNET_TESTBED_PeerInformationType pit
Peer information type; captures which of the types in the 'op_result' is actually in use.
struct GNUNET_PeerIdentity * id
The identity of the peer.
Data for the OperationType OP_PEER_INFO.
struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_extract_config_(const struct GNUNET_MessageHeader *msg)
Generates configuration by uncompressing configuration in given message.
Definition: testbed_api.c:2043

References OperationContext::c, GNUNET_TESTBED_PeerInformation::cfg, OperationContext::data, data, find_opc(), GNUNET_assert, GNUNET_free, GNUNET_memcpy, GNUNET_new, GNUNET_ntohll(), GNUNET_TESTBED_extract_config_(), GNUNET_TESTBED_PIT_CONFIGURATION, GNUNET_TESTBED_PIT_GENERIC, GNUNET_TESTBED_PIT_IDENTITY, GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), GNUNET_TESTBED_PeerInformation::id, LOG_DEBUG, msg, OperationContext::op, OP_FORWARDED, OPC_STATE_FINISHED, peer, GNUNET_TESTBED_PeerInformation::pit, GNUNET_TESTBED_PeerInformation::result, OperationContext::state, OperationContext::type, and GNUNET_TESTBED_Peer::unique_id.

Here is the call graph for this function:

◆ check_op_fail_event()

static int check_op_fail_event ( void *  cls,
const struct GNUNET_TESTBED_OperationFailureEventMessage msg 
)
static

Validate GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received
Returns
GNUNET_OK if message is well-formed

Definition at line 848 of file testbed_api.c.

851 {
852  /* we accept anything as a valid error message */
853  return GNUNET_OK;
854 }

References GNUNET_OK.

◆ handle_op_fail_event()

static void handle_op_fail_event ( void *  cls,
const struct GNUNET_TESTBED_OperationFailureEventMessage msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 865 of file testbed_api.c.

868 {
869  struct GNUNET_TESTBED_Controller *c = cls;
870  struct OperationContext *opc;
871  const char *emsg;
872  uint64_t op_id;
873  uint64_t mask;
874  struct GNUNET_TESTBED_EventInformation event;
875 
876  op_id = GNUNET_ntohll (msg->operation_id);
877  if (NULL == (opc = find_opc (c, op_id)))
878  {
879  LOG_DEBUG ("Operation not found\n");
880  return;
881  }
882  if (OP_FORWARDED == opc->type)
883  {
885  opc,
886  (const struct GNUNET_MessageHeader *) msg);
887  return;
888  }
889  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
890  opc->state = OPC_STATE_FINISHED;
892  if (NULL == emsg)
893  emsg = "Unknown error";
894  if (OP_PEER_INFO == opc->type)
895  {
896  struct PeerInfoData *data;
897 
898  data = opc->data;
899  if (NULL != data->cb)
900  data->cb (data->cb_cls, opc->op, NULL, emsg);
901  GNUNET_free (data);
902  return; /* We do not call controller callback for peer info */
903  }
905  event.op = opc->op;
906  event.op_cls = opc->op_cls;
907  event.details.operation_finished.emsg = emsg;
908  event.details.operation_finished.generic = NULL;
909  mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
910  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
911  {
912  exop_insert (event.op);
913  c->cc (c->cc_cls, &event);
914  if (GNUNET_NO == exop_check (event.op))
915  return;
916  }
917  switch (opc->type)
918  {
919  case OP_PEER_CREATE: {
920  struct PeerCreateData *data;
921 
922  data = opc->data;
923  GNUNET_free (data->peer);
924  if (NULL != data->cb)
925  data->cb (data->cls, NULL, emsg);
926  GNUNET_free (data);
927  }
928  break;
929 
930  case OP_PEER_START:
931  case OP_PEER_STOP: {
932  struct PeerEventData *data;
933 
934  data = opc->data;
935  if (NULL != data->pcc)
936  data->pcc (data->pcc_cls, emsg);
937  GNUNET_free (data);
938  }
939  break;
940 
941  case OP_PEER_DESTROY:
942  break;
943 
944  case OP_PEER_INFO:
945  GNUNET_assert (0);
946 
947  case OP_OVERLAY_CONNECT: {
948  struct OverlayConnectData *data;
949 
950  data = opc->data;
952  if (NULL != data->cb)
953  data->cb (data->cb_cls, opc->op, emsg);
954  }
955  break;
956 
957  case OP_FORWARDED:
958  GNUNET_assert (0);
959 
960  case OP_LINK_CONTROLLERS: /* No secondary callback */
961  break;
962 
963  case OP_SHUTDOWN_PEERS: {
964  struct ShutdownPeersData *data;
965 
966  data = opc->data;
967  GNUNET_free (data); /* FIXME: Decide whether we call data->op_cb */
968  opc->data = NULL;
969  }
970  break;
971 
972  case OP_MANAGE_SERVICE: {
973  struct ManageServiceData *data = opc->data;
975  void *cb_cls;
976 
977  GNUNET_assert (NULL != data);
978  cb = data->cb;
979  cb_cls = data->cb_cls;
980  GNUNET_free (data);
981  opc->data = NULL;
982  exop_insert (event.op);
983  if (NULL != cb)
984  cb (cb_cls, opc->op, emsg);
985  /* You could have marked the operation as done by now */
986  GNUNET_break (GNUNET_NO == exop_check (event.op));
987  }
988  break;
989 
990  default:
991  GNUNET_break (0);
992  }
993 }
const char * emsg
Error message for the operation, NULL on success.
GNUNET_TESTBED_OperationCompletionCallback cb
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...
Definition: testbed_api.c:2150
@ OP_PEER_INFO
Get peer information operation.
Definition: testbed_api.h:69
@ OP_LINK_CONTROLLERS
Link controllers operation.
Definition: testbed_api.h:89
void GNUNET_TESTBED_operation_mark_failed(struct GNUNET_TESTBED_Operation *op)
Marks an operation as failed.

References OperationContext::c, ManageServiceData::cb, ManageServiceData::cb_cls, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, OperationContext::data, data, GNUNET_TESTBED_EventInformation::emsg, GNUNET_TESTBED_Controller::event_mask, exop_check(), exop_insert(), find_opc(), GNUNET_assert, GNUNET_break, GNUNET_free, GNUNET_NO, GNUNET_ntohll(), GNUNET_TESTBED_ET_OPERATION_FINISHED, GNUNET_TESTBED_operation_mark_failed(), GNUNET_TESTBED_parse_error_string_(), GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), LOG_DEBUG, msg, GNUNET_TESTBED_EventInformation::op, OperationContext::op, OperationContext::op_cls, OP_FORWARDED, OP_LINK_CONTROLLERS, OP_MANAGE_SERVICE, OP_OVERLAY_CONNECT, OP_PEER_CREATE, OP_PEER_DESTROY, OP_PEER_INFO, OP_PEER_START, OP_PEER_STOP, OP_SHUTDOWN_PEERS, OPC_STATE_FINISHED, OperationContext::state, and OperationContext::type.

Here is the call graph for this function:

◆ GNUNET_TESTBED_generate_slavegetconfig_msg_()

static struct GNUNET_TESTBED_SlaveGetConfigurationMessage* GNUNET_TESTBED_generate_slavegetconfig_msg_ ( uint64_t  op_id,
uint32_t  slave_id 
)
static

Function to build GET_SLAVE_CONFIG message.

Parameters
op_idthe id this message should contain in its operation id field
slave_idthe id this message should contain in its slave id field
Returns
newly allocated SlaveGetConfigurationMessage

Definition at line 1004 of file testbed_api.c.

1005 {
1007  uint16_t msize;
1008 
1009  msize = sizeof(struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
1010  msg = GNUNET_malloc (msize);
1011  msg->header.size = htons (msize);
1012  msg->header.type =
1014  msg->operation_id = GNUNET_htonll (op_id);
1015  msg->slave_id = htonl (slave_id);
1016  return msg;
1017 }
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:37
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
Message to request configuration of a slave controller.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
Message to request configuration of a slave controller.
Definition: testbed.h:638
uint32_t slave_id
The id of the slave host.
Definition: testbed.h:647

References GNUNET_htonll(), GNUNET_malloc, GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION, msg, GNUNET_MessageHeader::size, GNUNET_TESTBED_SlaveGetConfigurationMessage::slave_id, and GNUNET_MessageHeader::type.

Referenced by opstart_get_slave_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_slave_config()

static int check_slave_config ( void *  cls,
const struct GNUNET_TESTBED_SlaveConfiguration msg 
)
static

Validate #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_INFORMATION message from controller (testbed service)

Parameters
cthe controller handler
msgmessage received

Definition at line 1028 of file testbed_api.c.

1030 {
1031  /* anything goes? */
1032  return GNUNET_OK;
1033 }

References GNUNET_OK.

◆ handle_slave_config()

static void handle_slave_config ( void *  cls,
const struct GNUNET_TESTBED_SlaveConfiguration msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 1044 of file testbed_api.c.

1046 {
1047  struct GNUNET_TESTBED_Controller *c = cls;
1048  struct OperationContext *opc;
1049  uint64_t op_id;
1050  uint64_t mask;
1051  struct GNUNET_TESTBED_EventInformation event;
1052 
1053  op_id = GNUNET_ntohll (msg->operation_id);
1054  if (NULL == (opc = find_opc (c, op_id)))
1055  {
1056  LOG_DEBUG ("Operation not found\n");
1057  return;
1058  }
1059  if (OP_GET_SLAVE_CONFIG != opc->type)
1060  {
1061  GNUNET_break (0);
1062  return;
1063  }
1064  opc->state = OPC_STATE_FINISHED;
1065  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1067  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
1068  {
1069  opc->data = GNUNET_TESTBED_extract_config_ (&msg->header);
1071  event.op = opc->op;
1072  event.op_cls = opc->op_cls;
1073  event.details.operation_finished.generic = opc->data;
1074  event.details.operation_finished.emsg = NULL;
1075  c->cc (c->cc_cls, &event);
1076  }
1077 }
@ OP_GET_SLAVE_CONFIG
Get slave config operation.
Definition: testbed_api.h:94

References OperationContext::c, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, OperationContext::data, GNUNET_TESTBED_Controller::event_mask, find_opc(), GNUNET_break, GNUNET_ntohll(), GNUNET_TESTBED_ET_OPERATION_FINISHED, GNUNET_TESTBED_extract_config_(), GNUNET_TESTBED_remove_opc_(), LOG_DEBUG, msg, OperationContext::op, OperationContext::op_cls, OP_GET_SLAVE_CONFIG, OPC_STATE_FINISHED, OperationContext::state, and OperationContext::type.

Here is the call graph for this function:

◆ check_link_controllers_result()

static int check_link_controllers_result ( void *  cls,
const struct GNUNET_TESTBED_ControllerLinkResponse msg 
)
static

Check GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller (testbed service)

Parameters
cthe controller handler
msgmessage received
Returns
GNUNET_OK if msg is well-formed

Definition at line 1089 of file testbed_api.c.

1092 {
1093  /* actual check to be implemented */
1094  return GNUNET_OK;
1095 }

References GNUNET_OK.

◆ handle_link_controllers_result()

static void handle_link_controllers_result ( void *  cls,
const struct GNUNET_TESTBED_ControllerLinkResponse msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 1106 of file testbed_api.c.

1109 {
1110  struct GNUNET_TESTBED_Controller *c = cls;
1111  struct OperationContext *opc;
1112  struct ControllerLinkData *data;
1114  struct GNUNET_TESTBED_Host *host;
1115  char *emsg;
1116  uint64_t op_id;
1117  struct GNUNET_TESTBED_EventInformation event;
1118 
1119  op_id = GNUNET_ntohll (msg->operation_id);
1120  if (NULL == (opc = find_opc (c, op_id)))
1121  {
1122  LOG_DEBUG ("Operation not found\n");
1123  return;
1124  }
1125  if (OP_FORWARDED == opc->type)
1126  {
1128  opc,
1129  (const struct GNUNET_MessageHeader *) msg);
1130  return;
1131  }
1132  if (OP_LINK_CONTROLLERS != opc->type)
1133  {
1134  GNUNET_break (0);
1135  return;
1136  }
1137  GNUNET_assert (NULL != (data = opc->data));
1139  GNUNET_assert (NULL != host);
1140  GNUNET_free (data);
1141  opc->data = NULL;
1142  opc->state = OPC_STATE_FINISHED;
1143  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1145  event.op = opc->op;
1146  event.op_cls = opc->op_cls;
1147  event.details.operation_finished.emsg = NULL;
1148  event.details.operation_finished.generic = NULL;
1149  emsg = NULL;
1150  cfg = NULL;
1151  if (GNUNET_NO == ntohs (msg->success))
1152  {
1153  emsg =
1154  GNUNET_malloc (ntohs (msg->header.size)
1155  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse)
1156  + 1);
1158  &msg[1],
1159  ntohs (msg->header.size)
1160  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse));
1161  event.details.operation_finished.emsg = emsg;
1162  }
1163  else
1164  {
1165  if (0 != ntohs (msg->config_size))
1166  {
1168  (const struct GNUNET_MessageHeader *) msg);
1169  GNUNET_assert (NULL != cfg);
1171  }
1172  }
1173  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
1174  {
1175  if (NULL != c->cc)
1176  c->cc (c->cc_cls, &event);
1177  }
1178  else
1179  LOG_DEBUG ("Not calling callback\n");
1180  if (NULL != cfg)
1182  GNUNET_free (emsg);
1183 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
Context data for controller link operations.
Definition: testbed_api.c:100
Response message for ControllerLinkRequest message.
Definition: testbed.h:170
struct GNUNET_TESTBED_Host * host
Handle for the host where the peer was started.
Opaque handle to a host running experiments managed by the testing framework.
void GNUNET_TESTBED_host_replace_cfg_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_CONFIGURATION_Handle *new_cfg)
Function to replace host's configuration.
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_lookup_by_id_(uint32_t id)
Lookup a host by ID.

References OperationContext::c, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, cfg, OperationContext::data, data, GNUNET_TESTBED_EventInformation::emsg, GNUNET_TESTBED_Controller::event_mask, find_opc(), GNUNET_assert, GNUNET_break, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_ntohll(), GNUNET_TESTBED_ET_OPERATION_FINISHED, GNUNET_TESTBED_extract_config_(), GNUNET_TESTBED_host_lookup_by_id_(), GNUNET_TESTBED_host_replace_cfg_(), GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), GNUNET_TESTBED_EventInformation::host, LOG_DEBUG, msg, OperationContext::op, OperationContext::op_cls, OP_FORWARDED, OP_LINK_CONTROLLERS, OPC_STATE_FINISHED, GNUNET_MessageHeader::size, OperationContext::state, and OperationContext::type.

Here is the call graph for this function:

◆ check_barrier_status()

static int check_barrier_status ( void *  cls,
const struct GNUNET_TESTBED_BarrierStatusMsg msg 
)
static

Validate GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS message.

Parameters
clsthe controller handle to determine the connection this message belongs to
msgthe barrier status message
Returns
GNUNET_OK if the message is valid; GNUNET_SYSERR to tear it down signalling an error (message malformed)

Definition at line 1196 of file testbed_api.c.

1198 {
1199  uint16_t msize;
1200  uint16_t name_len;
1201  int status;
1202  const char *name;
1203  size_t emsg_len;
1204 
1205  msize = ntohs (msg->header.size);
1206  name = msg->data;
1207  name_len = ntohs (msg->name_len);
1208 
1209  if (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) + name_len + 1 > msize)
1210  {
1211  GNUNET_break_op (0);
1212  return GNUNET_SYSERR;
1213  }
1214  if ('\0' != name[name_len])
1215  {
1216  GNUNET_break_op (0);
1217  return GNUNET_SYSERR;
1218  }
1219  status = ntohs (msg->status);
1221  {
1222  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1223  + name_len + 1); /* +1!? */
1224  if (0 == emsg_len)
1225  {
1226  GNUNET_break_op (0);
1227  return GNUNET_SYSERR;
1228  }
1229  }
1230  return GNUNET_OK;
1231 }
uint16_t status
See PRISM_STATUS_*-constants.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
@ GNUNET_TESTBED_BARRIERSTATUS_ERROR
Error status.
const char * name
Message for signalling status changes of a barrier.
Definition: testbed.h:822
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:836

References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_BARRIERSTATUS_ERROR, msg, name, GNUNET_TESTBED_BarrierStatusMsg::name_len, GNUNET_MessageHeader::size, and status.

◆ handle_barrier_status()

static void handle_barrier_status ( void *  cls,
const struct GNUNET_TESTBED_BarrierStatusMsg msg 
)
static

Handler for GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS messages.

Parameters
clsthe controller handle to determine the connection this message belongs to
msgthe barrier status message

Do not remove the barrier if we did not echo the status back; this is required at the chained testbed controller setup to ensure the only the test-driver echos the status and the controller hierarchy properly propagates the status.

Definition at line 1242 of file testbed_api.c.

1244 {
1245  struct GNUNET_TESTBED_Controller *c = cls;
1246  struct GNUNET_TESTBED_Barrier *barrier;
1247  char *emsg;
1248  const char *name;
1249  struct GNUNET_HashCode key;
1250  size_t emsg_len;
1251  int status;
1252  uint16_t msize;
1253  uint16_t name_len;
1254 
1255  emsg = NULL;
1256  barrier = NULL;
1257  msize = ntohs (msg->header.size);
1258  if (msize <= sizeof(struct GNUNET_TESTBED_BarrierStatusMsg))
1259  {
1260  GNUNET_break_op (0);
1261  goto cleanup;
1262  }
1263  name = msg->data;
1264  name_len = ntohs (msg->name_len);
1265  if (name_len >= // name_len is strlen(barrier_name)
1266  (msize - ((sizeof msg->header) + sizeof(msg->status))))
1267  {
1268  GNUNET_break_op (0);
1269  goto cleanup;
1270  }
1271  if ('\0' != name[name_len])
1272  {
1273  GNUNET_break_op (0);
1274  goto cleanup;
1275  }
1276  LOG_DEBUG ("Received BARRIER_STATUS msg\n");
1277  status = ntohs (msg->status);
1279  {
1280  status = -1;
1281  // unlike name_len, emsg_len includes the trailing zero
1282  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1283  + (name_len + 1));
1284  if (0 == emsg_len)
1285  {
1286  GNUNET_break_op (0);
1287  goto cleanup;
1288  }
1289  if ('\0' != (msg->data[(name_len + 1) + (emsg_len - 1)]))
1290  {
1291  GNUNET_break_op (0);
1292  goto cleanup;
1293  }
1294  emsg = GNUNET_malloc (emsg_len);
1295  GNUNET_memcpy (emsg, msg->data + name_len + 1, emsg_len);
1296  }
1297  if (NULL == c->barrier_map)
1298  {
1299  GNUNET_break_op (0);
1300  goto cleanup;
1301  }
1304  if (NULL == barrier)
1305  {
1306  GNUNET_break_op (0);
1307  goto cleanup;
1308  }
1309  GNUNET_assert (NULL != barrier->cb);
1310  if ((GNUNET_YES == barrier->echo) &&
1313  barrier->cb (barrier->cls, name, barrier, status, emsg);
1315  return; /* just initialised; skip cleanup */
1316 
1317 cleanup:
1318  GNUNET_free (emsg);if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
1326 }
static void cleanup(void *cls)
Function scheduled as very last function, cleans up after us.
struct GNUNET_HashCode key
The key used in the DHT.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:41
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.
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
@ GNUNET_TESTBED_BARRIERSTATUS_CROSSED
Barrier is crossed.
@ GNUNET_TESTBED_BARRIERSTATUS_INITIALISED
Barrier initialised successfully.
A 512-bit hashcode.
Handle for barrier.
Definition: testbed_api.h:278
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:297
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:307
void * cls
the closure for the above callback
Definition: testbed_api.h:302
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:260
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.
Definition: testbed_api.c:1336
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.
Definition: testbed_api.c:2304

References GNUNET_TESTBED_Controller::barrier_map, GNUNET_TESTBED_Barrier::cb, cleanup(), GNUNET_TESTBED_Barrier::cls, GNUNET_TESTBED_Barrier::echo, GNUNET_assert, GNUNET_break_op, GNUNET_CONTAINER_multihashmap_get(), GNUNET_copy_message(), GNUNET_CRYPTO_hash(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_TESTBED_barrier_remove_(), GNUNET_TESTBED_BARRIERSTATUS_CROSSED, GNUNET_TESTBED_BARRIERSTATUS_ERROR, GNUNET_TESTBED_BARRIERSTATUS_INITIALISED, GNUNET_TESTBED_queue_message_(), GNUNET_YES, key, LOG_DEBUG, msg, name, GNUNET_TESTBED_BarrierStatusMsg::name_len, GNUNET_MessageHeader::size, and status.

Here is the call graph for this function:

◆ GNUNET_TESTBED_queue_message_()

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.

Parameters
controllerthe handle to the controller
msgthe message to queue

Definition at line 1336 of file testbed_api.c.

1338 {
1339  struct GNUNET_MQ_Envelope *env;
1340  struct GNUNET_MessageHeader *m2;
1341  uint16_t type;
1342  uint16_t size;
1343 
1344  type = ntohs (msg->type);
1345  size = ntohs (msg->size);
1348  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1349  GNUNET_memcpy (m2, msg, size);
1350  GNUNET_free (msg);
1351  GNUNET_MQ_send (controller->mq, env);
1352 }
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:304
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:62
#define GNUNET_MESSAGE_TYPE_TESTBED_INIT
Initial message from a client to a testing control service.
#define GNUNET_MESSAGE_TYPE_TESTBED_MAX
Not really a message, but for careful checks on the testbed messages; Should always be the maximum an...
static unsigned int size
Size of the "table".
Definition: peer.c:68
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:218
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model

References env, GNUNET_assert, GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_INIT, GNUNET_MESSAGE_TYPE_TESTBED_MAX, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_TESTBED_Controller::mq, msg, GNUNET_MessageHeader::size, size, GNUNET_MessageHeader::type, and type.

Referenced by GNUNET_TESTBED_register_host(), handle_barrier_status(), handle_remote_overlay_connect(), opstart_get_slave_config(), opstart_link_controllers(), opstart_peer_getinfo(), and send_hello_thru_rocc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_forward_operation_msg_()

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.

The given callback is called when a reply for the operation is available. Call GNUNET_TESTBED_forward_operation_msg_cancel_() to cleanup the returned operation context if the cc hasn't been called

Parameters
controllerthe controller to which the message has to be sent
operation_idthe operation id of the message
msgthe message to send
ccthe callback to call when reply is available
cc_clsthe closure for the above callback
Returns
the operation context which can be used to cancel the forwarded operation

Definition at line 1370 of file testbed_api.c.

1376 {
1377  struct OperationContext *opc;
1378  struct ForwardedOperationData *data;
1379  struct GNUNET_MQ_Envelope *env;
1380  struct GNUNET_MessageHeader *m2;
1381  uint16_t type = ntohs (msg->type);
1382  uint16_t size = ntohs (msg->size);
1383 
1384  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1385  GNUNET_memcpy (m2, msg, size);
1386  GNUNET_MQ_send (controller->mq, env);
1388  data->cc = cc;
1389  data->cc_cls = cc_cls;
1390  opc = GNUNET_new (struct OperationContext);
1391  opc->c = controller;
1392  opc->type = OP_FORWARDED;
1393  opc->data = data;
1394  opc->id = operation_id;
1395  GNUNET_TESTBED_insert_opc_ (controller, opc);
1396  return opc;
1397 }
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.
Definition: testbed_api.c:298

References OperationContext::c, OperationContext::data, data, env, GNUNET_memcpy, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OP_FORWARDED, GNUNET_MessageHeader::size, size, GNUNET_MessageHeader::type, OperationContext::type, and type.

Referenced by forward_overlay_connect(), GST_process_next_focc(), handle_manage_peer_service(), handle_peer_create(), handle_peer_destroy(), handle_peer_get_config(), handle_peer_reconfigure(), handle_peer_start(), handle_peer_stop(), handle_shutdown_peers(), opstart_service_connect(), and p2_controller_connect_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_forward_operation_msg_cancel_()

void GNUNET_TESTBED_forward_operation_msg_cancel_ ( struct OperationContext opc)

Function to cancel an operation created by simply forwarding an operation message.

Parameters
opcthe operation context from GNUNET_TESTBED_forward_operation_msg_()

Definition at line 1407 of file testbed_api.c.

1408 {
1409  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1410  GNUNET_free (opc->data);
1411  GNUNET_free (opc);
1412 }

References OperationContext::c, OperationContext::data, GNUNET_free, and GNUNET_TESTBED_remove_opc_().

Referenced by cleanup_occ_rp2c(), GST_clear_fopcq(), GST_forwarded_operation_timeout(), and oprelease_service_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opstart_link_controllers()

static void opstart_link_controllers ( void *  cls)
static

Function to call to start a link-controllers type operation once all queues the operation is part of declare that the operation can be activated.

Parameters
clsthe closure from GNUNET_TESTBED_operation_create_()

Definition at line 1422 of file testbed_api.c.

1423 {
1424  struct OperationContext *opc = cls;
1425  struct ControllerLinkData *data;
1427 
1428  GNUNET_assert (NULL != opc->data);
1429  data = opc->data;
1430  msg = data->msg;
1431  data->msg = NULL;
1432  opc->state = OPC_STATE_STARTED;
1433  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1434  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1435 }
Client notifies controller that it should delegate requests for a particular client to a particular s...
Definition: testbed.h:137
@ OPC_STATE_STARTED
The operation has been started.
Definition: testbed_api.h:123

References OperationContext::c, OperationContext::data, data, GNUNET_assert, GNUNET_TESTBED_insert_opc_(), GNUNET_TESTBED_queue_message_(), msg, OPC_STATE_STARTED, and OperationContext::state.

Referenced by GNUNET_TESTBED_controller_link().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ oprelease_link_controllers()

static void oprelease_link_controllers ( void *  cls)
static

Callback which will be called when link-controllers type operation is released.

Parameters
clsthe closure from GNUNET_TESTBED_operation_create_()

Definition at line 1444 of file testbed_api.c.

1445 {
1446  struct OperationContext *opc = cls;
1447  struct ControllerLinkData *data;
1448 
1449  data = opc->data;
1450  switch (opc->state)
1451  {
1452  case OPC_STATE_INIT:
1453  GNUNET_free (data->msg);
1454  break;
1455 
1456  case OPC_STATE_STARTED:
1457  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1458  break;
1459 
1460  case OPC_STATE_FINISHED:
1461  break;
1462  }
1463  GNUNET_free (data);
1464  GNUNET_free (opc);
1465 }
@ OPC_STATE_INIT
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:117

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_controller_link().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opstart_get_slave_config()

static void opstart_get_slave_config ( void *  cls)
static

Function to be called when get slave config operation is ready.

Parameters
clsthe OperationContext of type OP_GET_SLAVE_CONFIG

Definition at line 1474 of file testbed_api.c.

1475 {
1476  struct OperationContext *opc = cls;
1477  struct GetSlaveConfigData *data = opc->data;
1479 
1480  GNUNET_assert (NULL != data);
1482  GNUNET_free (opc->data);
1483  data = NULL;
1484  opc->data = NULL;
1485  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1486  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1487  opc->state = OPC_STATE_STARTED;
1488 }
Context data for get slave config operations.
Definition: testbed_api.c:88
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.
Definition: testbed_api.c:1004

References OperationContext::c, OperationContext::data, data, GNUNET_assert, GNUNET_free, GNUNET_TESTBED_generate_slavegetconfig_msg_(), GNUNET_TESTBED_insert_opc_(), GNUNET_TESTBED_queue_message_(), OperationContext::id, msg, OPC_STATE_STARTED, and OperationContext::state.

Referenced by GNUNET_TESTBED_get_slave_config_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ oprelease_get_slave_config()

static void oprelease_get_slave_config ( void *  cls)
static

Function to be called when get slave config operation is cancelled or finished.

Parameters
clsthe OperationContext of type OP_GET_SLAVE_CONFIG

Definition at line 1497 of file testbed_api.c.

1498 {
1499  struct OperationContext *opc = cls;
1500 
1501  switch (opc->state)
1502  {
1503  case OPC_STATE_INIT:
1504  GNUNET_free (opc->data);
1505  break;
1506 
1507  case OPC_STATE_STARTED:
1508  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1509  break;
1510 
1511  case OPC_STATE_FINISHED:
1512  if (NULL != opc->data)
1514  break;
1515  }
1516  GNUNET_free (opc);
1517 }

References OperationContext::c, OperationContext::data, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_TESTBED_remove_opc_(), OPC_STATE_FINISHED, OPC_STATE_INIT, OPC_STATE_STARTED, and OperationContext::state.

Referenced by GNUNET_TESTBED_get_slave_config_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mq_error_handler()

static void mq_error_handler ( void *  cls,
enum GNUNET_MQ_Error  error 
)
static

Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.

Not every message queue implementation supports an error handler.

Parameters
clsclosure, a struct GNUNET_TESTBED_Controller *
errorerror code

Definition at line 1529 of file testbed_api.c.

1530 {
1531  /* struct GNUNET_TESTBED_Controller *c = cls; */
1532 
1533  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Encountered MQ error: %d\n", error);
1534  /* now what? */
1535  GNUNET_SCHEDULER_shutdown (); /* seems most reasonable */
1536 }
#define GNUNET_log(kind,...)
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:562

References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and GNUNET_SCHEDULER_shutdown().

Referenced by GNUNET_TESTBED_controller_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opc_free_iterator()

static int opc_free_iterator ( void *  cls,
uint32_t  key,
void *  value 
)
static

Iterator to free opc map entries.

Parameters
clsclosure
keycurrent key code
valuevalue in the hash map
Returns
GNUNET_YES if we should continue to iterate, GNUNET_NO if not.

Definition at line 1699 of file testbed_api.c.

1700 {
1701  struct GNUNET_CONTAINER_MultiHashMap32 *map = cls;
1702  struct OperationContext *opc = value;
1703 
1704  GNUNET_assert (NULL != opc);
1705  GNUNET_break (0);
1708  GNUNET_free (opc);
1709  return GNUNET_YES;
1710 }
static struct GNUNET_CONTAINER_MultiPeerMap * map
Handle to the map used to store old latency values for peers.
Internal representation of the hash map.

References GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_free, GNUNET_YES, key, map, and value.

Referenced by GNUNET_TESTBED_controller_disconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_compress_config_()

size_t GNUNET_TESTBED_compress_config_ ( const char *  config,
size_t  size,
char **  xconfig 
)

Compresses given configuration using zlib compress.

Parameters
configthe serialized configuration
sizethe size of config
xconfigwill be set to the compressed configuration (memory is fresly allocated)
Returns
the size of the xconfig

Definition at line 1758 of file testbed_api.c.

1761 {
1762  size_t xsize;
1763 
1764  xsize = compressBound ((uLong) size);
1765  *xconfig = GNUNET_malloc (xsize);
1766  GNUNET_assert (Z_OK == compress2 ((Bytef *) *xconfig,
1767  (uLongf *) &xsize,
1768  (const Bytef *) config,
1769  (uLongf) size,
1770  Z_BEST_SPEED));
1771  return xsize;
1772 }
static const struct GNUNET_CONFIGURATION_Handle * config

References config, GNUNET_assert, GNUNET_malloc, and size.

Referenced by GNUNET_TESTBED_compress_cfg_(), GNUNET_TESTBED_create_helper_init_msg_(), GNUNET_TESTBED_register_host(), handle_peer_get_config(), handle_slave_get_config(), opstart_peer_create(), opstart_peer_reconfigure(), and tokenizer_cb().

Here is the caller graph for this function:

◆ GNUNET_TESTBED_compress_cfg_()

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.

Parameters
cfgthe configuration
sizethe size of configuration when serialize. Will be set on success.
xsizethe sizeo of the compressed configuration. Will be set on success.
Returns
the serialized and compressed configuration

Definition at line 1785 of file testbed_api.c.

1788 {
1789  char *config;
1790  char *xconfig;
1791  size_t size_;
1792  size_t xsize_;
1793 
1795  xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig);
1796  GNUNET_free (config);
1797  *size = size_;
1798  *xsize = xsize_;
1799  return xconfig;
1800 }
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1758

References cfg, config, GNUNET_CONFIGURATION_serialize(), GNUNET_free, GNUNET_TESTBED_compress_config_(), and size.

Referenced by send_controller_link_response().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_get_slave_config_()

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.

Another difference is that this function takes the id of the slave host.

Parameters
op_clsthe closure for the operation
masterthe handle to master controller
slave_host_idid of the host where the slave controller is running to the slave_host should remain valid until this operation is cancelled or marked as finished
Returns
the operation handle;

Definition at line 1894 of file testbed_api.c.

1897 {
1898  struct OperationContext *opc;
1899  struct GetSlaveConfigData *data;
1900 
1901  data = GNUNET_new (struct GetSlaveConfigData);
1902  data->slave_id = slave_host_id;
1903  opc = GNUNET_new (struct OperationContext);
1904  opc->state = OPC_STATE_INIT;
1905  opc->c = master;
1906  opc->id = GNUNET_TESTBED_get_next_op_id (master);
1907  opc->type = OP_GET_SLAVE_CONFIG;
1908  opc->data = data;
1909  opc->op_cls = op_cls;
1914  opc->op);
1916  return opc->op;
1917 }
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:244
uint64_t GNUNET_TESTBED_get_next_op_id(struct GNUNET_TESTBED_Controller *controller)
Function to return the operation id for a controller.
Definition: testbed_api.c:2178
static void opstart_get_slave_config(void *cls)
Function to be called when get slave config operation is ready.
Definition: testbed_api.c:1474
static void oprelease_get_slave_config(void *cls)
Function to be called when get slave config operation is cancelled or finished.
Definition: testbed_api.c:1497
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.

References OperationContext::c, OperationContext::data, data, GNUNET_new, GNUNET_TESTBED_get_next_op_id(), GNUNET_TESTBED_operation_begin_wait_(), GNUNET_TESTBED_operation_create_(), GNUNET_TESTBED_operation_queue_insert_(), OperationContext::id, OperationContext::op, OperationContext::op_cls, OP_GET_SLAVE_CONFIG, OPC_STATE_INIT, GNUNET_TESTBED_Controller::opq_parallel_operations, oprelease_get_slave_config(), opstart_get_slave_config(), OperationContext::state, and OperationContext::type.

Referenced by GNUNET_TESTBED_get_slave_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_create_helper_init_msg_()

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.

This function is here because we want to use this in testing

Parameters
trusted_ipthe ip address of the controller which will be set as TRUSTED HOST(all connections from this ip are permitted by the testbed) when starting testbed controller at host. This can either be a single ip address or a network address in CIDR notation.
hostnamethe hostname of the destination this message is intended for
cfgthe configuration that has to used to start the testbed service thru helper
Returns
the initialization message

Definition at line 1957 of file testbed_api.c.

1961 {
1963  char *config;
1964  char *xconfig;
1965  size_t config_size;
1966  size_t xconfig_size;
1967  uint16_t trusted_ip_len;
1968  uint16_t hostname_len;
1969  uint16_t msg_size;
1970 
1972  GNUNET_assert (NULL != config);
1973  xconfig_size =
1975  GNUNET_free (config);
1976  trusted_ip_len = strlen (trusted_ip);
1977  hostname_len = (NULL == hostname) ? 0 : strlen (hostname);
1978  msg_size = xconfig_size + trusted_ip_len + 1
1979  + sizeof(struct GNUNET_TESTBED_HelperInit);
1980  msg_size += hostname_len;
1981  msg = GNUNET_realloc (xconfig, msg_size);
1982  (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len,
1983  msg,
1984  xconfig_size);
1985  msg->header.size = htons (msg_size);
1987  msg->trusted_ip_size = htons (trusted_ip_len);
1988  msg->hostname_size = htons (hostname_len);
1989  msg->config_size = htons (config_size);
1990  (void) strcpy ((char *) &msg[1], trusted_ip);
1991  if (0 != hostname_len)
1992  GNUNET_memcpy ((char *) &msg[1] + trusted_ip_len + 1,
1993  hostname,
1994  hostname_len);
1995  return msg;
1996 }
static char * hostname
Our hostname; we give this to all the peers we start.
#define GNUNET_realloc(ptr, size)
Wrapper around realloc.
#define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT
The initialization message towards gnunet-testbed-helper.
Initialization message for gnunet-helper-testbed to start testbed service.
uint16_t config_size
The size of the uncompressed configuration.

References cfg, config, GNUNET_TESTBED_HelperInit::config_size, GNUNET_assert, GNUNET_CONFIGURATION_serialize(), GNUNET_free, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT, GNUNET_realloc, GNUNET_TESTBED_compress_config_(), hostname, msg, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.

Referenced by GNUNET_TESTBED_controller_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_extract_config_()

struct GNUNET_CONFIGURATION_Handle* GNUNET_TESTBED_extract_config_ ( const struct GNUNET_MessageHeader msg)

Generates configuration by uncompressing configuration in given message.

The given message should be of the following types: GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION, GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT,

FIXME: This API is incredibly ugly.

Parameters
msgthe message containing compressed configuration
Returns
handle to the parsed configuration; NULL upon error while parsing the message

Definition at line 2043 of file testbed_api.c.

2044 {
2046  Bytef *data;
2047  const Bytef *xdata;
2048  uLong data_len;
2049  uLong xdata_len;
2050  int ret;
2051 
2052  switch (ntohs (msg->type))
2053  {
2056 
2057  imsg =
2059  data_len = (uLong) ntohs (imsg->config_size);
2060  xdata_len =
2061  ntohs (imsg->header.size)
2063  xdata = (const Bytef *) &imsg[1];
2064  }
2065  break;
2066 
2068  const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
2069 
2070  imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *) msg;
2071  data_len = (uLong) ntohs (imsg->config_size);
2072  xdata_len = ntohs (imsg->header.size)
2073  - sizeof(struct GNUNET_TESTBED_SlaveConfiguration);
2074  xdata = (const Bytef *) &imsg[1];
2075  }
2076  break;
2077 
2079  const struct GNUNET_TESTBED_AddHostMessage *imsg;
2080  uint16_t osize;
2081 
2082  imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
2083  data_len = (uLong) ntohs (imsg->config_size);
2084  osize = sizeof(struct GNUNET_TESTBED_AddHostMessage)
2085  + ntohs (imsg->username_length) + ntohs (imsg->hostname_length);
2086  xdata_len = ntohs (imsg->header.size) - osize;
2087  xdata = (const Bytef *) ((const void *) imsg + osize);
2088  }
2089  break;
2090 
2092  const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
2093 
2094  imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg;
2095  data_len = ntohs (imsg->config_size);
2096  xdata_len = ntohs (imsg->header.size)
2097  - sizeof(const struct GNUNET_TESTBED_ControllerLinkResponse);
2098  xdata = (const Bytef *) &imsg[1];
2099  }
2100  break;
2101 
2103  const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
2104 
2105  imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *) msg;
2106  data_len = ntohs (imsg->config_size);
2107  xdata_len = ntohs (imsg->header.size)
2108  - sizeof(struct GNUNET_TESTBED_PeerCreateMessage);
2109  xdata = (const Bytef *) &imsg[1];
2110  }
2111  break;
2112 
2114  const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
2115 
2116  imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *) msg;
2117  data_len = ntohs (imsg->config_size);
2118  xdata_len = ntohs (imsg->header.size)
2119  - sizeof(struct GNUNET_TESTBED_PeerReconfigureMessage);
2120  xdata = (const Bytef *) &imsg[1];
2121  }
2122  break;
2123 
2124  default:
2125  GNUNET_assert (0);
2126  }
2127  data = GNUNET_malloc (data_len);
2128  if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
2129  {
2130  GNUNET_free (data);
2131  GNUNET_break_op (0); /* Un-compression failure */
2132  return NULL;
2133  }
2136  (const char *) data,
2137  (size_t) data_len,
2138  NULL))
2139  {
2140  GNUNET_free (data);
2141  GNUNET_break_op (0); /* De-serialization failure */
2142  return NULL;
2143  }
2144  GNUNET_free (data);
2145  return cfg;
2146 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new 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.
#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_ADD_HOST
Message to add host.
#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
Message which contains the configuration of 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_PEER_INFORMATION
Message containing the peer's information.
Notify the service about a host that we intend to use.
Definition: testbed.h:65
uint16_t username_length
Number of bytes in the user name that follows; 0 to use no user name; otherwise 'strlen (username)',...
Definition: testbed.h:86
uint16_t hostname_length
Number of bytes in the host name (excluding 0-termination) that follows the user name; cannot be 0.
Definition: testbed.h:92
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:69
uint16_t config_size
The length of the uncompressed configuration.
Definition: testbed.h:97
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:180
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:174
Peer configuration and identity reply from controller to a client.
Definition: testbed.h:604
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION.
Definition: testbed.h:608
uint16_t config_size
The size of configuration when uncompressed.
Definition: testbed.h:628
Message sent from client to testing service to create (configure, but not start) a peer.
Definition: testbed.h:205
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER.
Definition: testbed.h:209
uint16_t config_size
Size of the uncompressed configuration.
Definition: testbed.h:229
Message sent from client to testing service to reconfigure a (stopped) a peer.
Definition: testbed.h:241
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER.
Definition: testbed.h:245
uint16_t config_size
The length of the serialized configuration when uncompressed.
Definition: testbed.h:260
Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message.
Definition: testbed.h:660
uint16_t config_size
The size of the configuration when uncompressed.
Definition: testbed.h:679
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION.
Definition: testbed.h:664

References cfg, GNUNET_TESTBED_AddHostMessage::config_size, GNUNET_TESTBED_ControllerLinkResponse::config_size, GNUNET_TESTBED_PeerCreateMessage::config_size, GNUNET_TESTBED_PeerReconfigureMessage::config_size, GNUNET_TESTBED_PeerConfigurationInformationMessage::config_size, GNUNET_TESTBED_SlaveConfiguration::config_size, data, GNUNET_assert, GNUNET_break_op, GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_deserialize(), GNUNET_free, GNUNET_malloc, GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER, GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT, GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION, GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER, GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION, GNUNET_OK, GNUNET_TESTBED_AddHostMessage::header, GNUNET_TESTBED_ControllerLinkResponse::header, GNUNET_TESTBED_PeerCreateMessage::header, GNUNET_TESTBED_PeerReconfigureMessage::header, GNUNET_TESTBED_PeerConfigurationInformationMessage::header, GNUNET_TESTBED_SlaveConfiguration::header, GNUNET_TESTBED_AddHostMessage::hostname_length, msg, ret, GNUNET_MessageHeader::size, GNUNET_MessageHeader::type, and GNUNET_TESTBED_AddHostMessage::username_length.

Referenced by configuration_receiver(), handle_add_host(), handle_link_controllers_result(), handle_peer_config(), handle_peer_create(), handle_peer_reconfigure(), and handle_slave_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_parse_error_string_()

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 contains.

Parameters
msgthe OperationFailureEventMessage
Returns
the error message

Definition at line 2150 of file testbed_api.c.

2152 {
2153  uint16_t msize;
2154  const char *emsg;
2155 
2156  msize = ntohs (msg->header.size);
2157  if (sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
2158  return NULL;
2159  msize -= sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage);
2160  emsg = (const char *) &msg[1];
2161  if ('\0' != emsg[msize - 1])
2162  {
2163  GNUNET_break (0);
2164  return NULL;
2165  }
2166  return emsg;
2167 }
Event notification from a controller to a client.
Definition: testbed.h:509

References GNUNET_break, msg, and GNUNET_MessageHeader::size.

Referenced by configuration_receiver(), and handle_op_fail_event().

Here is the caller graph for this function:

◆ GNUNET_TESTBED_get_next_op_id()

uint64_t GNUNET_TESTBED_get_next_op_id ( struct GNUNET_TESTBED_Controller controller)

Function to return the operation id for a controller.

The operation id is created from the controllers host id and its internal operation counter.

Parameters
controllerthe handle to the controller whose operation id has to be incremented
Returns
the incremented operation id.

Definition at line 2178 of file testbed_api.c.

2179 {
2180  uint64_t op_id;
2181 
2182  op_id = (uint64_t) GNUNET_TESTBED_host_get_id_ (controller->host);
2183  op_id = op_id << 32;
2184  op_id |= (uint64_t) controller->operation_counter++;
2185  return op_id;
2186 }
uint32_t operation_counter
The operation id counter.
Definition: testbed_api.h:270
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:198

References GNUNET_TESTBED_host_get_id_(), GNUNET_TESTBED_Controller::host, and GNUNET_TESTBED_Controller::operation_counter.

Referenced by GNUNET_TESTBED_controller_link(), GNUNET_TESTBED_get_slave_config_(), GNUNET_TESTBED_overlay_connect(), GNUNET_TESTBED_peer_create(), GNUNET_TESTBED_peer_destroy(), GNUNET_TESTBED_peer_get_information(), GNUNET_TESTBED_peer_manage_service(), GNUNET_TESTBED_peer_start(), GNUNET_TESTBED_peer_stop(), GNUNET_TESTBED_peer_update_configuration(), GNUNET_TESTBED_shutdown_peers(), and opstart_service_connect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opstart_shutdown_peers()

static void opstart_shutdown_peers ( void *  cls)
static

Function called when a shutdown peers operation is ready.

Parameters
clsthe closure from GNUNET_TESTBED_operation_create_()

Definition at line 2195 of file testbed_api.c.

2196 {
2197  struct OperationContext *opc = cls;
2198  struct GNUNET_MQ_Envelope *env;
2200 
2201  opc->state = OPC_STATE_STARTED;
2203  msg->operation_id = GNUNET_htonll (opc->id);
2204  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
2205  GNUNET_MQ_send (opc->c->mq, env);
2206 }
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:77
#define GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
A controller receiving this message floods it to its directly-connected sub-controllers and then stop...
Shutdown peers message.
Definition: testbed.h:689

References OperationContext::c, env, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, msg, OPC_STATE_STARTED, and OperationContext::state.

Referenced by GNUNET_TESTBED_shutdown_peers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ oprelease_shutdown_peers()

static void oprelease_shutdown_peers ( void *  cls)
static

Callback which will be called when shutdown peers operation is released.

Parameters
clsthe closure from GNUNET_TESTBED_operation_create_()

Definition at line 2215 of file testbed_api.c.

2216 {
2217  struct OperationContext *opc = cls;
2218 
2219  switch (opc->state)
2220  {
2221  case OPC_STATE_STARTED:
2222  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
2223 
2224  /* no break; continue */
2225  case OPC_STATE_INIT:
2226  GNUNET_free (opc->data);
2227  break;
2228 
2229  case OPC_STATE_FINISHED:
2230  break;
2231  }
2232  GNUNET_free (opc);
2233 }

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_shutdown_peers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_barrier_remove_()

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.

Parameters
barrierthe barrier to remove

Definition at line 2304 of file testbed_api.c.

2305 {
2306  struct GNUNET_TESTBED_Controller *c = barrier->c;
2307 
2308  GNUNET_assert (NULL != c->barrier_map); /* No barriers present */
2311  &barrier->key,
2312  barrier));
2313  GNUNET_free (barrier->name);
2314  GNUNET_free (barrier);
2316  {
2318  c->barrier_map = NULL;
2319  }
2320 }
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_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_TESTBED_Controller * c
The controller handle given while initialising this barrier.
Definition: testbed_api.h:287
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:282
char * name
The name of the barrier.
Definition: testbed_api.h:292

References GNUNET_TESTBED_Controller::barrier_map, GNUNET_TESTBED_Barrier::c, GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_free, GNUNET_OK, GNUNET_TESTBED_Barrier::key, and GNUNET_TESTBED_Barrier::name.

Referenced by GNUNET_TESTBED_barrier_cancel(), and handle_barrier_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_barrier_init_()

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 the barrier OR upon error.

Parameters
controllerthe handle to the controller
nameidentification name of the barrier
quorumthe percentage of peers that is required to reach the barrier. Peers signal reaching a barrier by calling GNUNET_TESTBED_barrier_reached().
cbthe callback to call when the barrier is reached or upon error. Cannot be NULL.
clsclosure for the above callback
echoGNUNET_YES to echo the barrier crossed status message back to the controller
Returns
barrier handle; NULL upon error

Definition at line 2324 of file testbed_api.c.

2330 {
2332  struct GNUNET_MQ_Envelope *env;
2333  struct GNUNET_TESTBED_Barrier *barrier;
2334  struct GNUNET_HashCode key;
2335  size_t name_len;
2336 
2337  GNUNET_assert (quorum <= 100);
2338  GNUNET_assert (NULL != cb);
2339  name_len = strlen (name);
2340  GNUNET_assert (0 < name_len);
2341  GNUNET_CRYPTO_hash (name, name_len, &key);
2342  if (NULL == controller->barrier_map)
2343  controller->barrier_map =
2345  if (GNUNET_YES ==
2347  {
2348  GNUNET_break (0);
2349  return NULL;
2350  }
2351  LOG_DEBUG ("Initialising barrier `%s'\n", name);
2352  barrier = GNUNET_new (struct GNUNET_TESTBED_Barrier);
2353  barrier->c = controller;
2354  barrier->name = GNUNET_strdup (name);
2355  barrier->cb = cb;
2356  barrier->cls = cls;
2357  barrier->echo = echo;
2358  GNUNET_memcpy (&barrier->key, &key, sizeof(struct GNUNET_HashCode));
2361  controller->barrier_map,
2362  &barrier->key,
2363  barrier,
2365 
2367  name_len,
2369  msg->quorum = (uint8_t) quorum;
2370  GNUNET_memcpy (msg->name, barrier->name, name_len);
2371  GNUNET_MQ_send (barrier->c->mq, env);
2372  return barrier;
2373 }
static int echo
Request echo service.
Definition: gnunet-cadet.c:67
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).
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.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
Message to initialise a barrier.
Message to initialise a barrier.
Definition: testbed.h:783

References GNUNET_TESTBED_Controller::barrier_map, GNUNET_TESTBED_Barrier::c, GNUNET_TESTBED_Barrier::cb, GNUNET_TESTBED_Barrier::cls, echo, GNUNET_TESTBED_Barrier::echo, env, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CRYPTO_hash(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, GNUNET_strdup, GNUNET_YES, key, GNUNET_TESTBED_Barrier::key, LOG_DEBUG, GNUNET_TESTBED_Controller::mq, msg, name, and GNUNET_TESTBED_Barrier::name.

Referenced by GNUNET_TESTBED_barrier_init(), and handle_barrier_init().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ exop_head

struct ExpireOperationEntry* exop_head
static

DLL head for list of operations marked for expiry.

Definition at line 155 of file testbed_api.c.

Referenced by exop_check(), and exop_insert().

◆ exop_tail

struct ExpireOperationEntry* exop_tail
static

DLL tail for list of operation marked for expiry.

Definition at line 160 of file testbed_api.c.

Referenced by exop_check(), and exop_insert().