GNUnet  0.19.4
testbed_api.h File Reference

Interface for functions internally exported from testbed_api.c. More...

#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "testbed.h"
#include "testbed_helper.h"
Include dependency graph for testbed_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  OperationContext
 Context information for GNUNET_TESTBED_Operation. More...
 
struct  GNUNET_TESTBED_Controller
 Handle to interact with a GNUnet testbed controller. More...
 
struct  GNUNET_TESTBED_Barrier
 Handle for barrier. More...
 

Macros

#define HELPER_TESTBED_BINARY   "gnunet-helper-testbed"
 Testbed Helper binary name. More...
 

Typedefs

typedef void(* TESTBED_opcq_empty_cb) (void *cls)
 Operation empty callback. More...
 

Enumerations

enum  OperationType {
  SOLVER_OP_ADD_ADDRESS , SOLVER_OP_DEL_ADDRESS , SOLVER_OP_START_SET_PROPERTY , SOLVER_OP_STOP_SET_PROPERTY ,
  SOLVER_OP_START_SET_PREFERENCE , SOLVER_OP_STOP_SET_PREFERENCE , SOLVER_OP_START_REQUEST , SOLVER_OP_STOP_REQUEST ,
  OP_PEER_CREATE , OP_PEER_START , OP_PEER_STOP , OP_PEER_DESTROY ,
  OP_PEER_INFO , OP_PEER_RECONFIGURE , OP_OVERLAY_CONNECT , OP_FORWARDED ,
  OP_LINK_CONTROLLERS , OP_GET_SLAVE_CONFIG , OP_SHUTDOWN_PEERS , OP_MANAGE_SERVICE
}
 Enumeration of operations. More...
 
enum  OperationContextState { OPC_STATE_INIT = 0 , OPC_STATE_STARTED , OPC_STATE_FINISHED }
 Enumeration of states of OperationContext. More...
 

Functions

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...
 
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...
 
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_HelperInitGNUNET_TESTBED_create_helper_init_msg_ (const char *cname, const char *hostname, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Creates a helper initialization message. 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...
 
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...
 
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_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...
 
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...
 

Detailed Description

Interface for functions internally exported from testbed_api.c.

Author
Sree Harsha Totakura

Definition in file testbed_api.h.

Macro Definition Documentation

◆ HELPER_TESTBED_BINARY

#define HELPER_TESTBED_BINARY   "gnunet-helper-testbed"

Testbed Helper binary name.

Definition at line 38 of file testbed_api.h.

Typedef Documentation

◆ TESTBED_opcq_empty_cb

typedef void(* TESTBED_opcq_empty_cb) (void *cls)

Operation empty callback.

Parameters
clsclosure

Definition at line 180 of file testbed_api.h.

Enumeration Type Documentation

◆ OperationType

Enumeration of operations.

Enumerator
SOLVER_OP_ADD_ADDRESS 
SOLVER_OP_DEL_ADDRESS 
SOLVER_OP_START_SET_PROPERTY 
SOLVER_OP_STOP_SET_PROPERTY 
SOLVER_OP_START_SET_PREFERENCE 
SOLVER_OP_STOP_SET_PREFERENCE 
SOLVER_OP_START_REQUEST 
SOLVER_OP_STOP_REQUEST 
OP_PEER_CREATE 

Peer create operation.

OP_PEER_START 

Peer start operation.

OP_PEER_STOP 

Peer stop operation.

OP_PEER_DESTROY 

Peer destroy operation.

OP_PEER_INFO 

Get peer information operation.

OP_PEER_RECONFIGURE 

Reconfigure a peer.

OP_OVERLAY_CONNECT 

Overlay connection operation.

OP_FORWARDED 

Forwarded operation.

OP_LINK_CONTROLLERS 

Link controllers operation.

OP_GET_SLAVE_CONFIG 

Get slave config operation.

OP_SHUTDOWN_PEERS 

Stop and destroy all peers.

OP_MANAGE_SERVICE 

Start/stop service at a peer.

Definition at line 44 of file testbed_api.h.

45 {
50 
55 
60 
65 
70 
75 
80 
85 
90 
95 
100 
105 };
@ OP_GET_SLAVE_CONFIG
Get slave config operation.
Definition: testbed_api.h:94
@ OP_PEER_RECONFIGURE
Reconfigure a peer.
Definition: testbed_api.h:74
@ OP_FORWARDED
Forwarded operation.
Definition: testbed_api.h:84
@ OP_PEER_START
Peer start operation.
Definition: testbed_api.h:54
@ OP_PEER_INFO
Get peer information operation.
Definition: testbed_api.h:69
@ 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
@ OP_OVERLAY_CONNECT
Overlay connection operation.
Definition: testbed_api.h:79
@ OP_LINK_CONTROLLERS
Link controllers operation.
Definition: testbed_api.h:89
@ OP_PEER_STOP
Peer stop operation.
Definition: testbed_api.h:59
@ OP_PEER_CREATE
Peer create operation.
Definition: testbed_api.h:49

◆ OperationContextState

Enumeration of states of OperationContext.

Enumerator
OPC_STATE_INIT 

The initial state where the associated operation has just been created and is waiting in the operation queues to be started.

OPC_STATE_STARTED 

The operation has been started.

It may occupy some resources which are to be freed if cancelled.

OPC_STATE_FINISHED 

The operation has finished.

The end results of this operation may occupy some resources which are to be freed by operation_done

Definition at line 111 of file testbed_api.h.

112 {
117  OPC_STATE_INIT = 0,
118 
124 
130 };
@ 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
@ OPC_STATE_STARTED
The operation has been started.
Definition: testbed_api.h:123
@ OPC_STATE_FINISHED
The operation has finished.
Definition: testbed_api.h:129

Function Documentation

◆ 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
Deprecated:
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_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
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
Header for all communications.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
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_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
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:229
uint64_t id
The id of the operation.
Definition: testbed_api.h:161

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.
@ GNUNET_YES
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:

◆ 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
#define GNUNET_malloc(size)
Wrapper around malloc.

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 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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_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 form 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

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_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 }
uint32_t data
The data value.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Context data for forwarded Operation.
Definition: testbed_api.c:71
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:137
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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 }
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 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:

◆ 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_PEERCONFIG, #GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG

Parameters
msgthe message containing compressed configuration
Returns
handle to the parsed configuration

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_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#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
Response message for ControllerLinkRequest message.
Definition: testbed.h:170
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 }
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
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
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain a host's unique global ID.

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:

◆ 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
Context data for get slave config operations.
Definition: testbed_api.c:88
void * op_cls
The operation closure.
Definition: testbed_api.h:151
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
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_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
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
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.
const char * name
A 512-bit hashcode.
Message to initialise a barrier.
Definition: testbed.h:783
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
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
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
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52

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:

◆ 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.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:194

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: