GNUnet  0.10.x
Data Structures | Macros | Functions | Variables
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 OperationFailureEventMessage 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 *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.

Referenced by handle_add_host_confirm().

◆ LOG_DEBUG

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

◆ 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 164 of file testbed_api.c.

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

165 {
166  struct ExpireOperationEntry *entry;
167 
168  entry = GNUNET_new(struct ExpireOperationEntry);
169  entry->op = op;
171 }
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
Definition: testbed_api.c:155
static struct ExpireOperationEntry * exop_head
DLL head for list of operations marked for expiry.
Definition: testbed_api.c:150
#define GNUNET_new(type)
Allocate a struct or union of the given type.
const struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.c:143
An entry in the stack for keeping operations which are about to expire.
Definition: testbed_api.c:129
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
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 186 of file testbed_api.c.

References exop_head, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NO, GNUNET_YES, ExpireOperationEntry::next, 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().

187 {
188  struct ExpireOperationEntry *entry;
189  struct ExpireOperationEntry *entry2;
190  int found;
191 
192  found = GNUNET_NO;
193  entry = exop_head;
194  while (NULL != entry)
195  {
196  if (op == entry->op)
197  {
198  found = GNUNET_YES;
199  break;
200  }
201  entry = entry->next;
202  }
203  if (GNUNET_NO == found)
204  return GNUNET_NO;
205  /* Truncate the tail */
206  while (NULL != entry)
207  {
208  entry2 = entry->next;
210  GNUNET_free(entry);
211  entry = entry2;
212  }
213  return GNUNET_YES;
214 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
Definition: testbed_api.c:155
static struct ExpireOperationEntry * exop_head
DLL head for list of operations marked for expiry.
Definition: testbed_api.c:150
#define GNUNET_NO
Definition: gnunet_common.h:78
const struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.c:143
An entry in the stack for keeping operations which are about to expire.
Definition: testbed_api.c:129
struct ExpireOperationEntry * next
DLL head; new entries are to be inserted here.
Definition: testbed_api.c:133
#define GNUNET_YES
Definition: gnunet_common.h:77
#define GNUNET_free(ptr)
Wrapper around free.
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 serach 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 243 of file testbed_api.c.

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

Referenced by find_opc().

244 {
245  struct SearchContext *sc = cls;
246  struct OperationContext *opc = value;
247 
248  GNUNET_assert(NULL != opc);
249  GNUNET_assert(NULL == sc->opc);
250  if (opc->id != sc->id)
251  return GNUNET_YES;
252  sc->opc = opc;
253  return GNUNET_NO;
254 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_NO
Definition: gnunet_common.h:78
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
static char * value
Value of the record to add/remove.
struct OperationContext * opc
The result of the search.
Definition: testbed_api.c:224
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
Context information to be used while searching for operation contexts.
Definition: testbed_api.c:220
uint64_t id
The id of the operation context we are searching for.
Definition: testbed_api.c:229
#define GNUNET_YES
Definition: gnunet_common.h:77
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
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 266 of file testbed_api.c.

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

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

267 {
268  struct SearchContext sc;
269 
270  sc.id = id;
271  sc.opc = NULL;
272  GNUNET_assert(NULL != c->opc_map);
273  if (GNUNET_SYSERR !=
275  (uint32_t)id,
277  &sc))
278  return NULL;
279  return sc.opc;
280 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
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_MulitHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:226
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
static int opc_search_iterator(void *cls, uint32_t key, void *value)
Search iterator for searching an operation context.
Definition: testbed_api.c:243
Context information to be used while searching for operation contexts.
Definition: testbed_api.c:220
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 292 of file testbed_api.c.

References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_create(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_OK, OperationContext::id, 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().

294 {
295  if (NULL == c->opc_map)
298  c->opc_map,
299  (uint32_t)opc->id,
300  opc,
302 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
int 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.
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:226
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
Allow multiple values with the same key.
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 313 of file testbed_api.c.

References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_CONTAINER_multihashmap32_size(), GNUNET_YES, OperationContext::id, 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().

315 {
316  GNUNET_assert(NULL != c->opc_map);
319  (uint32_t)opc->id,
320  opc));
322  (NULL != c->opcq_empty_cb))
324 }
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:231
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
int GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:226
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:236
#define GNUNET_YES
Definition: gnunet_common.h:77
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 335 of file testbed_api.c.

References GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_TESTBED_HostConfirmedMessage::header, and GNUNET_MessageHeader::size.

337 {
338  const char *emsg;
339  uint16_t msg_size;
340 
341  msg_size = ntohs(msg->header.size) - sizeof(*msg);
342  if (0 == msg_size)
343  return GNUNET_OK;
344  /* We have an error message */
345  emsg = (const char *)&msg[1];
346  if ('\0' != emsg[msg_size - 1])
347  {
348  GNUNET_break(0);
349  return GNUNET_SYSERR;
350  }
351  return GNUNET_OK;
352 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS.
Definition: testbed.h:116

◆ 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 363 of file testbed_api.c.

References _, 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_HostConfirmedMessage::header, GNUNET_TESTBED_HostRegistrationHandle::host, GNUNET_TESTBED_HostConfirmedMessage::host_id, LOG, LOG_DEBUG, GNUNET_TESTBED_Controller::rh, and GNUNET_MessageHeader::size.

365 {
366  struct GNUNET_TESTBED_Controller *c = cls;
368  const char *emsg;
369  uint16_t msg_size;
370 
371  if (NULL == rh)
372  return;
373  if (GNUNET_TESTBED_host_get_id_(rh->host) != ntohl(msg->host_id))
374  {
375  LOG_DEBUG("Mismatch in host id's %u, %u of host confirm msg\n",
377  ntohl(msg->host_id));
378  return;
379  }
380  c->rh = NULL;
381  msg_size = ntohs(msg->header.size) - sizeof(*msg);
382  if (0 == msg_size)
383  {
384  LOG_DEBUG("Host %u successfully registered\n", ntohl(msg->host_id));
386  rh->cc(rh->cc_cls, NULL);
387  GNUNET_free(rh);
388  return;
389  }
390  /* We have an error message */
391  emsg = (const char *)&msg[1];
393  _("Adding host %u failed with error: %s\n"),
394  ntohl(msg->host_id),
395  emsg);
396  rh->cc(rh->cc_cls, emsg);
397  GNUNET_free(rh);
398 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
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.
struct GNUNET_TESTBED_Host * host
The host being registered.
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:221
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
void * cc_cls
The closure for above callback.
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
uint32_t host_id
Unique ID for the host (in NBO).
Definition: testbed.h:121
#define LOG(kind,...)
Generic logging shorthand.
Definition: testbed_api.c:47
GNUNET_TESTBED_HostRegistrationCompletion cc
The Registartion completion callback.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS.
Definition: testbed.h:116
handle for host registration
#define GNUNET_free(ptr)
Wrapper around free.
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
cthe controller handle
opcthe opearation context
msgthe message

Definition at line 409 of file testbed_api.c.

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

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

412 {
413  struct GNUNET_TESTBED_Controller *c = cls;
414  struct ForwardedOperationData *fo_data;
415 
416  fo_data = opc->data;
417  if (NULL != fo_data->cc)
418  fo_data->cc(fo_data->cc_cls, msg);
420  GNUNET_free(fo_data);
421  GNUNET_free(opc);
422 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Definition: testbed_api.c:74
void * cc_cls
The closure for the above callback.
Definition: testbed_api.c:79
Context data for forwarded Operation.
Definition: testbed_api.c:70
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
#define GNUNET_free(ptr)
Wrapper around free.
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:313
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
cthe controller handler
msgmessage received

Definition at line 433 of file testbed_api.c.

References OperationContext::c, ShutdownPeersData::cb, ManageServiceData::cb, ShutdownPeersData::cb_cls, ManageServiceData::cb_cls, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, data, OperationContext::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, OperationContext::op, GNUNET_TESTBED_EventInformation::op, OperationContext::op_cls, OP_FORWARDED, OP_MANAGE_SERVICE, OP_PEER_DESTROY, OP_PEER_RECONFIGURE, OP_SHUTDOWN_PEERS, OPC_STATE_FINISHED, GNUNET_TESTBED_GenericOperationSuccessEventMessage::operation_id, peer, OperationContext::state, and OperationContext::type.

436 {
437  struct GNUNET_TESTBED_Controller *c = cls;
438  struct OperationContext *opc;
440  void *op_comp_cb_cls;
441  struct GNUNET_TESTBED_EventInformation event;
442  uint64_t op_id;
443 
444  op_id = GNUNET_ntohll(msg->operation_id);
445  LOG_DEBUG("Operation %lu successful\n", op_id);
446  if (NULL == (opc = find_opc(c, op_id)))
447  {
448  LOG_DEBUG("Operation not found\n");
449  return;
450  }
452  event.op = opc->op;
453  event.op_cls = opc->op_cls;
454  event.details.operation_finished.emsg = NULL;
455  event.details.operation_finished.generic = NULL;
456  op_comp_cb = NULL;
457  op_comp_cb_cls = NULL;
458  switch (opc->type)
459  {
460  case OP_FORWARDED: {
462  opc,
463  (const struct GNUNET_MessageHeader *)msg);
464  return;
465  }
466  break;
467 
468  case OP_PEER_DESTROY: {
469  struct GNUNET_TESTBED_Peer *peer;
470 
471  peer = opc->data;
473  GNUNET_free(peer);
474  opc->data = NULL;
475  //PEERDESTROYDATA
476  }
477  break;
478 
479  case OP_SHUTDOWN_PEERS: {
480  struct ShutdownPeersData *data;
481 
482  data = opc->data;
483  op_comp_cb = data->cb;
484  op_comp_cb_cls = data->cb_cls;
485  GNUNET_free(data);
486  opc->data = NULL;
488  }
489  break;
490 
491  case OP_MANAGE_SERVICE: {
492  struct ManageServiceData *data;
493 
494  GNUNET_assert(NULL != (data = opc->data));
495  op_comp_cb = data->cb;
496  op_comp_cb_cls = data->cb_cls;
497  GNUNET_free(data);
498  opc->data = NULL;
499  }
500  break;
501 
502  case OP_PEER_RECONFIGURE:
503  break;
504 
505  default:
506  GNUNET_assert(0);
507  }
508  GNUNET_TESTBED_remove_opc_(opc->c, opc);
509  opc->state = OPC_STATE_FINISHED;
510  exop_insert(event.op);
511  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
512  {
513  if (NULL != c->cc)
514  c->cc(c->cc_cls, &event);
515  if (GNUNET_NO == exop_check(event.op))
516  return;
517  }
518  else
519  LOG_DEBUG("Not calling callback\n");
520  if (NULL != op_comp_cb)
521  op_comp_cb(op_comp_cb_cls, event.op, NULL);
522  /* You could have marked the operation as done by now */
523  GNUNET_break(GNUNET_NO == exop_check(event.op));
524 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
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:186
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * op_cls
The operation closure.
Definition: testbed_api.h:149
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
Stop and destroy all peers.
Definition: testbed_api.h:98
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Reconfigure a peer.
Definition: testbed_api.h:73
void GNUNET_TESTBED_cleanup_peers_(void)
Frees all peers.
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:555
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:164
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
Peer destroy operation.
Definition: testbed_api.h:63
A requested testbed operation has been completed.
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
void GNUNET_TESTBED_peer_deregister_(struct GNUNET_TESTBED_Peer *peer)
Removes a peer from the peer list.
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call.
Definition: testbed_api.c:117
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
GNUNET_TESTBED_OperationCompletionCallback cb
Forwarded operation.
Definition: testbed_api.h:83
The operation has finished.
Definition: testbed_api.h:128
Date context for OP_SHUTDOWN_PEERS operations.
Definition: testbed_api.c:113
void(* GNUNET_TESTBED_OperationCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when an operation is completed.
Start/stop service at a peer.
Definition: testbed_api.h:103
void * cb_cls
The closure for the above callback.
Definition: testbed_api.c:122
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:266
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
Header for all communications.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
A peer controlled by the testing framework.
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
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:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
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:313
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
cthe controller handle
msgmessage received

Definition at line 535 of file testbed_api.c.

References OperationContext::c, PeerCreateData::cb, GNUNET_TESTBED_Operation::cb_cls, PeerCreateData::cls, data, OperationContext::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(), GNUNET_TESTBED_PeerCreateSuccessEventMessage::header, LOG_DEBUG, op, OperationContext::op, OP_FORWARDED, OP_PEER_CREATE, OPC_STATE_FINISHED, GNUNET_TESTBED_PeerCreateSuccessEventMessage::operation_id, peer, PeerCreateData::peer, GNUNET_TESTBED_PeerCreateSuccessEventMessage::peer_id, GNUNET_MessageHeader::size, GNUNET_TESTBED_Peer::state, OperationContext::state, TESTBED_PS_CREATED, OperationContext::type, and GNUNET_TESTBED_Peer::unique_id.

538 {
539  struct GNUNET_TESTBED_Controller *c = cls;
540  struct OperationContext *opc;
541  struct PeerCreateData *data;
542  struct GNUNET_TESTBED_Peer *peer;
545  void *cb_cls;
546  uint64_t op_id;
547 
549  ntohs(msg->header.size));
550  op_id = GNUNET_ntohll(msg->operation_id);
551  if (NULL == (opc = find_opc(c, op_id)))
552  {
553  LOG_DEBUG("Operation context for PeerCreateSuccessEvent not found\n");
554  return;
555  }
556  if (OP_FORWARDED == opc->type)
557  {
559  opc,
560  (const struct GNUNET_MessageHeader *)msg);
561  return;
562  }
564  GNUNET_assert(NULL != opc->data);
565  data = opc->data;
566  GNUNET_assert(NULL != data->peer);
567  peer = data->peer;
568  GNUNET_assert(peer->unique_id == ntohl(msg->peer_id));
569  peer->state = TESTBED_PS_CREATED;
571  cb = data->cb;
572  cb_cls = data->cls;
573  op = opc->op;
574  GNUNET_free(opc->data);
575  GNUNET_TESTBED_remove_opc_(opc->c, opc);
576  opc->state = OPC_STATE_FINISHED;
577  exop_insert(op);
578  if (NULL != cb)
579  cb(cb_cls, peer, NULL);
580  /* You could have marked the operation as done by now */
582 }
void * cb_cls
Closure for callbacks.
Event notification from a controller to a client.
Definition: testbed.h:517
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
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:186
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * cls
The closure for the above callback.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS.
Definition: testbed.h:521
#define GNUNET_NO
Definition: gnunet_common.h:78
GNUNET_TESTBED_PeerCreateCallback cb
The call back to call when we receive peer create success message.
void GNUNET_TESTBED_peer_register_(struct GNUNET_TESTBED_Peer *peer)
Adds a peer to the peer list.
uint32_t peer_id
Peer identity of the peer that was created.
Definition: testbed.h:526
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Opaque handle to an abstract operation to be executed by the testing framework.
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. ...
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:164
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
enum PeerState state
Peer&#39;s state.
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
Forwarded operation.
Definition: testbed_api.h:83
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:531
The operation has finished.
Definition: testbed_api.h:128
uint32_t unique_id
Globally unique ID of the peer.
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:266
Peer create operation.
Definition: testbed_api.h:48
struct GNUNET_TESTBED_Peer * peer
The peer structure to return when we get success message.
The peer has been created.
Header for all communications.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:139
A peer controlled by the testing framework.
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
Data for the OperationType OP_PEER_CREATE.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
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:313
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
cthe controller handler
msgmessage received

Definition at line 593 of file testbed_api.c.

References OperationContext::c, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, data, OperationContext::data, GNUNET_TESTBED_Controller::event_mask, GNUNET_TESTBED_PeerEventMessage::event_type, 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_PeerEventMessage::header, GNUNET_TESTBED_Peer::host, LOG_DEBUG, OperationContext::op, GNUNET_TESTBED_EventInformation::op, OperationContext::op_cls, OP_FORWARDED, OP_PEER_START, OP_PEER_STOP, OPC_STATE_FINISHED, GNUNET_TESTBED_PeerEventMessage::operation_id, PeerEventData::pcc, PeerEventData::pcc_cls, peer, PeerEventData::peer, GNUNET_MessageHeader::size, GNUNET_TESTBED_Peer::state, OperationContext::state, TESTBED_PS_STARTED, TESTBED_PS_STOPPED, OperationContext::type, and GNUNET_TESTBED_EventInformation::type.

594 {
595  struct GNUNET_TESTBED_Controller *c = cls;
596  struct OperationContext *opc;
597  struct GNUNET_TESTBED_Peer *peer;
598  struct PeerEventData *data;
600  void *pcc_cls;
601  struct GNUNET_TESTBED_EventInformation event;
602  uint64_t op_id;
603  uint64_t mask;
604 
606  ntohs(msg->header.size));
607  op_id = GNUNET_ntohll(msg->operation_id);
608  if (NULL == (opc = find_opc(c, op_id)))
609  {
610  LOG_DEBUG("Operation not found\n");
611  return;
612  }
613  if (OP_FORWARDED == opc->type)
614  {
616  opc,
617  (const struct GNUNET_MessageHeader *)msg);
618  return;
619  }
620  GNUNET_assert((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
621  data = opc->data;
622  GNUNET_assert(NULL != data);
623  peer = data->peer;
624  GNUNET_assert(NULL != peer);
625  event.type = (enum GNUNET_TESTBED_EventType)ntohl(msg->event_type);
626  event.op = opc->op;
627  event.op_cls = opc->op_cls;
628  switch (event.type)
629  {
631  peer->state = TESTBED_PS_STARTED;
632  event.details.peer_start.host = peer->host;
633  event.details.peer_start.peer = peer;
634  break;
635 
637  peer->state = TESTBED_PS_STOPPED;
638  event.details.peer_stop.peer = peer;
639  break;
640 
641  default:
642  GNUNET_assert(0); /* We should never reach this state */
643  }
644  pcc = data->pcc;
645  pcc_cls = data->pcc_cls;
646  GNUNET_free(data);
647  GNUNET_TESTBED_remove_opc_(opc->c, opc);
648  opc->state = OPC_STATE_FINISHED;
649  exop_insert(event.op);
650  mask = 1LL << GNUNET_TESTBED_ET_PEER_START;
651  mask |= 1LL << GNUNET_TESTBED_ET_PEER_STOP;
652  if (0 != (mask & c->event_mask))
653  {
654  if (NULL != c->cc)
655  c->cc(c->cc_cls, &event);
656  if (GNUNET_NO == exop_check(event.op))
657  return;
658  }
659  if (NULL != pcc)
660  pcc(pcc_cls, NULL);
661  /* You could have marked the operation as done by now */
662  GNUNET_break(GNUNET_NO == exop_check(event.op));
663 }
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:454
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
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:186
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * op_cls
The operation closure.
Definition: testbed_api.h:149
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Event notification from a controller to a client.
Definition: testbed.h:429
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
struct GNUNET_TESTBED_Peer * peer
The handle of the peer to start.
#define GNUNET_NO
Definition: gnunet_common.h:78
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Data for OperationType OP_PEER_START and OP_PEER_STOP.
int32_t event_type
enum GNUNET_TESTBED_EventType (in NBO); either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER...
Definition: testbed.h:439
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:164
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
enum PeerState state
Peer&#39;s state.
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
GNUNET_TESTBED_PeerChurnCallback pcc
The Peer churn callback to call when this operation is completed.
void * pcc_cls
Closure for the above callback.
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
Peer start operation.
Definition: testbed_api.h:53
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
struct GNUNET_TESTBED_Host * host
Which host does this peer run on?
void(* GNUNET_TESTBED_PeerChurnCallback)(void *cls, const char *emsg)
Functions of this signature are called when a peer has been successfully started or stopped...
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
The peer is stopped.
Forwarded operation.
Definition: testbed_api.h:83
The operation has finished.
Definition: testbed_api.h:128
GNUNET_TESTBED_EventType
Enumeration with (at most 64) possible event types that can be monitored using the testbed framework...
Peer stop operation.
Definition: testbed_api.h:58
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:266
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT.
Definition: testbed.h:433
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
Header for all communications.
The peer is running.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
A peer controlled by the testing framework.
A peer has been stopped.
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
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:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
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:313
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
cthe controller handler
msgmessage received

Definition at line 674 of file testbed_api.c.

References OperationContext::c, OverlayConnectData::cb, OverlayConnectData::cb_cls, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, data, OperationContext::data, GNUNET_TESTBED_Controller::event_mask, GNUNET_TESTBED_ConnectionEventMessage::event_type, 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, OperationContext::op, GNUNET_TESTBED_EventInformation::op, OperationContext::op_cls, OP_FORWARDED, OP_OVERLAY_CONNECT, OPC_STATE_FINISHED, GNUNET_TESTBED_ConnectionEventMessage::operation_id, OverlayConnectData::p1, OverlayConnectData::p2, GNUNET_TESTBED_ConnectionEventMessage::peer1, GNUNET_TESTBED_ConnectionEventMessage::peer2, OperationContext::state, OperationContext::type, GNUNET_TESTBED_EventInformation::type, and GNUNET_TESTBED_Peer::unique_id.

676 {
677  struct GNUNET_TESTBED_Controller *c = cls;
678  struct OperationContext *opc;
679  struct OverlayConnectData *data;
681  void *cb_cls;
682  struct GNUNET_TESTBED_EventInformation event;
683  uint64_t op_id;
684  uint64_t mask;
685 
686  op_id = GNUNET_ntohll(msg->operation_id);
687  if (NULL == (opc = find_opc(c, op_id)))
688  {
689  LOG_DEBUG("Operation not found\n");
690  return;
691  }
692  if (OP_FORWARDED == opc->type)
693  {
695  opc,
696  (const struct GNUNET_MessageHeader *)msg);
697  return;
698  }
700  GNUNET_assert(NULL != (data = opc->data));
701  GNUNET_assert((ntohl(msg->peer1) == data->p1->unique_id) &&
702  (ntohl(msg->peer2) == data->p2->unique_id));
703  event.type = (enum GNUNET_TESTBED_EventType)ntohl(msg->event_type);
704  event.op = opc->op;
705  event.op_cls = opc->op_cls;
706  switch (event.type)
707  {
709  event.details.peer_connect.peer1 = data->p1;
710  event.details.peer_connect.peer2 = data->p2;
711  break;
712 
714  GNUNET_assert(0); /* FIXME: implement */
715  break;
716 
717  default:
718  GNUNET_assert(0); /* Should never reach here */
719  break;
720  }
721  cb = data->cb;
722  cb_cls = data->cb_cls;
723  GNUNET_TESTBED_remove_opc_(opc->c, opc);
724  opc->state = OPC_STATE_FINISHED;
725  exop_insert(event.op);
726  mask = 1LL << GNUNET_TESTBED_ET_CONNECT;
727  mask |= 1LL << GNUNET_TESTBED_ET_DISCONNECT;
728  if (0 != (mask & c->event_mask))
729  {
730  if (NULL != c->cc)
731  c->cc(c->cc_cls, &event);
732  if (GNUNET_NO == exop_check(event.op))
733  return;
734  }
735  if (NULL != cb)
736  cb(cb_cls, opc->op, NULL);
737  /* You could have marked the operation as done by now */
738  GNUNET_break(GNUNET_NO == exop_check(event.op));
739 }
void * cb_cls
The closure for the above callback.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
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:186
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * op_cls
The operation closure.
Definition: testbed_api.h:149
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:164
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
uint32_t peer2
Second peer.
Definition: testbed.h:481
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:486
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call once this operation is done.
A connection between two peers was torn down.
Data structure for OperationType OP_OVERLAY_CONNECT.
uint32_t peer1
First peer.
Definition: testbed.h:476
struct GNUNET_TESTBED_Peer * p1
Peer A to connect to peer B.
Overlay connection operation.
Definition: testbed_api.h:78
Forwarded operation.
Definition: testbed_api.h:83
int32_t event_type
&#39;enum GNUNET_TESTBED_EventType&#39; (in NBO); either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCO...
Definition: testbed.h:471
A connection between two peers was established.
The operation has finished.
Definition: testbed_api.h:128
GNUNET_TESTBED_EventType
Enumeration with (at most 64) possible event types that can be monitored using the testbed framework...
void(* GNUNET_TESTBED_OperationCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when an operation is completed.
uint32_t unique_id
Globally unique ID of the peer.
struct GNUNET_TESTBED_Peer * p2
Peer B.
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:266
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
Header for all communications.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
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:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
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:313
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
cthe controller handler
msgmessage received

Definition at line 750 of file testbed_api.c.

References GNUNET_OK.

753 {
754  /* anything goes? */
755  return GNUNET_OK;
756 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75

◆ 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
cthe controller handler
msgmessage received

Definition at line 767 of file testbed_api.c.

References OperationContext::c, PeerInfoData::cb, PeerInfoData::cb_cls, GNUNET_TESTBED_PeerInformation::cfg, data, OperationContext::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_PeerConfigurationInformationMessage::header, GNUNET_TESTBED_PeerInformation::id, LOG_DEBUG, OperationContext::op, OP_FORWARDED, OPC_STATE_FINISHED, GNUNET_TESTBED_PeerConfigurationInformationMessage::operation_id, peer, PeerInfoData::peer, GNUNET_TESTBED_PeerConfigurationInformationMessage::peer_id, GNUNET_TESTBED_PeerConfigurationInformationMessage::peer_identity, PeerInfoData::pit, GNUNET_TESTBED_PeerInformation::pit, GNUNET_TESTBED_PeerInformation::result, OperationContext::state, OperationContext::type, and GNUNET_TESTBED_Peer::unique_id.

770 {
771  struct GNUNET_TESTBED_Controller *c = cls;
772  struct OperationContext *opc;
773  struct GNUNET_TESTBED_Peer *peer;
774  struct PeerInfoData *data;
775  struct GNUNET_TESTBED_PeerInformation *pinfo;
777  void *cb_cls;
778  uint64_t op_id;
779 
780  op_id = GNUNET_ntohll(msg->operation_id);
781  if (NULL == (opc = find_opc(c, op_id)))
782  {
783  LOG_DEBUG("Operation not found\n");
784  return;
785  }
786  if (OP_FORWARDED == opc->type)
787  {
788  handle_forwarded_operation_msg(c, opc, &msg->header);
789  return;
790  }
791  data = opc->data;
792  GNUNET_assert(NULL != data);
793  peer = data->peer;
794  GNUNET_assert(NULL != peer);
795  GNUNET_assert(ntohl(msg->peer_id) == peer->unique_id);
797  pinfo->pit = data->pit;
798  cb = data->cb;
799  cb_cls = data->cb_cls;
800  GNUNET_assert(NULL != cb);
801  GNUNET_free(data);
802  opc->data = NULL;
803  switch (pinfo->pit)
804  {
806  pinfo->result.id = GNUNET_new(struct GNUNET_PeerIdentity);
807  GNUNET_memcpy(pinfo->result.id,
808  &msg->peer_identity,
809  sizeof(struct GNUNET_PeerIdentity));
810  break;
811 
813  pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
815  break;
816 
818  GNUNET_assert(0); /* never reach here */
819  break;
820  }
821  opc->data = pinfo;
822  GNUNET_TESTBED_remove_opc_(opc->c, opc);
823  opc->state = OPC_STATE_FINISHED;
824  cb(cb_cls, opc->op, pinfo, NULL);
825  /* We dont check whether the operation is marked as done here as the
826  operation contains data (cfg/identify) which will be freed at a later point
827  */
828 }
uint32_t peer_id
The id of the peer relevant to this information.
Definition: testbed.h:593
Data for the OperationType OP_PEER_INFO.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
union GNUNET_TESTBED_PeerInformation::@64 result
The result of the get information operation; Choose according to the pit.
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * cb_cls
The closure for peer info callback.
enum GNUNET_TESTBED_PeerInformationType pit
Peer information type; captures which of the types in the &#39;op_result&#39; is actually in use...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION.
Definition: testbed.h:588
#define GNUNET_new(type)
Allocate a struct or union of the given type.
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:598
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:2059
GNUNET_TESTBED_PeerInfoCallback cb
The Peer info callback to call when this operation has completed.
struct GNUNET_PeerIdentity * id
The identity of the peer.
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
Special value (not valid for requesting information) that is used in the event struct if a &#39;generic&#39; ...
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
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...
What configuration is the peer using? Returns a &#39;const struct GNUNET_CONFIGURATION_Handle *&#39;...
struct GNUNET_PeerIdentity peer_identity
Identity of the peer.
Definition: testbed.h:603
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration of the peer.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
Forwarded operation.
Definition: testbed_api.h:83
The operation has finished.
Definition: testbed_api.h:128
uint32_t unique_id
Globally unique ID of the peer.
The identity of the host (wraps the signing key of the peer).
What is the identity of the peer? Returns a &#39;const struct GNUNET_PeerIdentity *&#39;. ...
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:266
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
enum GNUNET_TESTBED_PeerInformationType pit
The type of peer information requested.
A peer controlled by the testing framework.
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
struct GNUNET_TESTBED_Peer * peer
The peer whose information has been requested.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
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:313
Data returned from GNUNET_TESTBED_peer_get_information.
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
cthe controller handler
msgmessage received
Returns
GNUNET_OK if message is well-formed

Definition at line 840 of file testbed_api.c.

References GNUNET_OK.

843 {
844  /* we accept anything as a valid error message */
845  return GNUNET_OK;
846 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75

◆ 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
cthe controller handler
msgmessage received

Definition at line 857 of file testbed_api.c.

References OperationContext::c, PeerCreateData::cb, PeerInfoData::cb, OverlayConnectData::cb, ManageServiceData::cb, PeerInfoData::cb_cls, OverlayConnectData::cb_cls, ManageServiceData::cb_cls, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, PeerCreateData::cls, data, OperationContext::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_OPERATION_FINISHED, GNUNET_TESTBED_operation_mark_failed(), GNUNET_TESTBED_parse_error_string_(), GNUNET_TESTBED_remove_opc_(), handle_forwarded_operation_msg(), LOG_DEBUG, OperationContext::op, GNUNET_TESTBED_EventInformation::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, GNUNET_TESTBED_OperationFailureEventMessage::operation_id, PeerEventData::pcc, PeerEventData::pcc_cls, PeerCreateData::peer, OperationContext::state, and OperationContext::type.

860 {
861  struct GNUNET_TESTBED_Controller *c = cls;
862  struct OperationContext *opc;
863  const char *emsg;
864  uint64_t op_id;
865  uint64_t mask;
866  struct GNUNET_TESTBED_EventInformation event;
867 
868  op_id = GNUNET_ntohll(msg->operation_id);
869  if (NULL == (opc = find_opc(c, op_id)))
870  {
871  LOG_DEBUG("Operation not found\n");
872  return;
873  }
874  if (OP_FORWARDED == opc->type)
875  {
877  opc,
878  (const struct GNUNET_MessageHeader *)msg);
879  return;
880  }
881  GNUNET_TESTBED_remove_opc_(opc->c, opc);
882  opc->state = OPC_STATE_FINISHED;
884  if (NULL == emsg)
885  emsg = "Unknown error";
886  if (OP_PEER_INFO == opc->type)
887  {
888  struct PeerInfoData *data;
889 
890  data = opc->data;
891  if (NULL != data->cb)
892  data->cb(data->cb_cls, opc->op, NULL, emsg);
893  GNUNET_free(data);
894  return; /* We do not call controller callback for peer info */
895  }
897  event.op = opc->op;
898  event.op_cls = opc->op_cls;
899  event.details.operation_finished.emsg = emsg;
900  event.details.operation_finished.generic = NULL;
901  mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
902  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
903  {
904  exop_insert(event.op);
905  c->cc(c->cc_cls, &event);
906  if (GNUNET_NO == exop_check(event.op))
907  return;
908  }
909  switch (opc->type)
910  {
911  case OP_PEER_CREATE: {
912  struct PeerCreateData *data;
913 
914  data = opc->data;
915  GNUNET_free(data->peer);
916  if (NULL != data->cb)
917  data->cb(data->cls, NULL, emsg);
918  GNUNET_free(data);
919  }
920  break;
921 
922  case OP_PEER_START:
923  case OP_PEER_STOP: {
924  struct PeerEventData *data;
925 
926  data = opc->data;
927  if (NULL != data->pcc)
928  data->pcc(data->pcc_cls, emsg);
929  GNUNET_free(data);
930  }
931  break;
932 
933  case OP_PEER_DESTROY:
934  break;
935 
936  case OP_PEER_INFO:
937  GNUNET_assert(0);
938 
939  case OP_OVERLAY_CONNECT: {
940  struct OverlayConnectData *data;
941 
942  data = opc->data;
944  if (NULL != data->cb)
945  data->cb(data->cb_cls, opc->op, emsg);
946  }
947  break;
948 
949  case OP_FORWARDED:
950  GNUNET_assert(0);
951 
952  case OP_LINK_CONTROLLERS: /* No secondary callback */
953  break;
954 
955  case OP_SHUTDOWN_PEERS: {
956  struct ShutdownPeersData *data;
957 
958  data = opc->data;
959  GNUNET_free(data); /* FIXME: Decide whether we call data->op_cb */
960  opc->data = NULL;
961  }
962  break;
963 
964  case OP_MANAGE_SERVICE: {
965  struct ManageServiceData *data = opc->data;
967  void *cb_cls;
968 
969  GNUNET_assert(NULL != data);
970  cb = data->cb;
971  cb_cls = data->cb_cls;
972  GNUNET_free(data);
973  opc->data = NULL;
974  exop_insert(event.op);
975  if (NULL != cb)
976  cb(cb_cls, opc->op, emsg);
977  /* You could have marked the operation as done by now */
978  GNUNET_break(GNUNET_NO == exop_check(event.op));
979  }
980  break;
981 
982  default:
983  GNUNET_break(0);
984  }
985 }
void GNUNET_TESTBED_operation_mark_failed(struct GNUNET_TESTBED_Operation *op)
Marks an operation as failed.
Data for the OperationType OP_PEER_INFO.
void * cb_cls
The closure for the above callback.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
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:186
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * cb_cls
The closure for peer info callback.
void * op_cls
The operation closure.
Definition: testbed_api.h:149
void * cls
The closure for the above callback.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
Stop and destroy all peers.
Definition: testbed_api.h:98
#define GNUNET_NO
Definition: gnunet_common.h:78
GNUNET_TESTBED_PeerCreateCallback cb
The call back to call when we receive peer create success message.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Data for OperationType OP_PEER_START and OP_PEER_STOP.
GNUNET_TESTBED_PeerInfoCallback cb
The Peer info callback to call when this operation has completed.
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:164
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
GNUNET_TESTBED_PeerChurnCallback pcc
The Peer churn callback to call when this operation is completed.
Link controllers operation.
Definition: testbed_api.h:88
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:508
void * pcc_cls
Closure for the above callback.
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
Peer destroy operation.
Definition: testbed_api.h:63
A requested testbed operation has been completed.
Peer start operation.
Definition: testbed_api.h:53
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
GNUNET_TESTBED_OperationCompletionCallback cb
The operation completion callback to call once this operation is done.
Data structure for OperationType OP_OVERLAY_CONNECT.
GNUNET_TESTBED_OperationCompletionCallback cb
Overlay connection operation.
Definition: testbed_api.h:78
Forwarded operation.
Definition: testbed_api.h:83
The operation has finished.
Definition: testbed_api.h:128
Date context for OP_SHUTDOWN_PEERS operations.
Definition: testbed_api.c:113
Peer stop operation.
Definition: testbed_api.h:58
void(* GNUNET_TESTBED_OperationCompletionCallback)(void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
Callback to be called when an operation is completed.
Start/stop service at a peer.
Definition: testbed_api.h:103
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:266
Peer create operation.
Definition: testbed_api.h:48
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
struct GNUNET_TESTBED_Peer * peer
The peer structure to return when we get success message.
Header for all communications.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
Data for the OperationType OP_PEER_CREATE.
const char * GNUNET_TESTBED_parse_error_string_(const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Checks the integrity of the OperationFailureEventMessage and if good returns the error message it con...
Definition: testbed_api.c:2173
Get peer information operation.
Definition: testbed_api.h:68
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
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:313
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 996 of file testbed_api.c.

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

Referenced by opstart_get_slave_config().

997 {
999  uint16_t msize;
1000 
1001  msize = sizeof(struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
1002  msg = GNUNET_malloc(msize);
1003  msg->header.size = htons(msize);
1004  msg->header.type =
1006  msg->operation_id = GNUNET_htonll(op_id);
1007  msg->slave_id = htonl(slave_id);
1008  return msg;
1009 }
Message to request configuration of a slave controller.
Definition: testbed.h:617
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
Message to request configuration of a slave controller.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint64_t operation_id
Operation ID.
Definition: testbed.h:631
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION.
Definition: testbed.h:621
uint32_t slave_id
The id of the slave host.
Definition: testbed.h:626
#define GNUNET_malloc(size)
Wrapper around malloc.
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 1020 of file testbed_api.c.

References GNUNET_OK.

1022 {
1023  /* anything goes? */
1024  return GNUNET_OK;
1025 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75

◆ 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
cthe controller handler
msgmessage received

Definition at line 1036 of file testbed_api.c.

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_(), GNUNET_TESTBED_SlaveConfiguration::header, LOG_DEBUG, OperationContext::op, OperationContext::op_cls, OP_GET_SLAVE_CONFIG, OPC_STATE_FINISHED, GNUNET_TESTBED_SlaveConfiguration::operation_id, OperationContext::state, and OperationContext::type.

1038 {
1039  struct GNUNET_TESTBED_Controller *c = cls;
1040  struct OperationContext *opc;
1041  uint64_t op_id;
1042  uint64_t mask;
1043  struct GNUNET_TESTBED_EventInformation event;
1044 
1045  op_id = GNUNET_ntohll(msg->operation_id);
1046  if (NULL == (opc = find_opc(c, op_id)))
1047  {
1048  LOG_DEBUG("Operation not found\n");
1049  return;
1050  }
1051  if (OP_GET_SLAVE_CONFIG != opc->type)
1052  {
1053  GNUNET_break(0);
1054  return;
1055  }
1056  opc->state = OPC_STATE_FINISHED;
1057  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1059  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
1060  {
1063  event.op = opc->op;
1064  event.op_cls = opc->op_cls;
1065  event.details.operation_finished.generic = opc->data;
1066  event.details.operation_finished.emsg = NULL;
1067  c->cc(c->cc_cls, &event);
1068  }
1069 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * op_cls
The operation closure.
Definition: testbed_api.h:149
uint64_t operation_id
Operation ID.
Definition: testbed.h:652
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
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:2059
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
A requested testbed operation has been completed.
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
The operation has finished.
Definition: testbed_api.h:128
Get slave config operation.
Definition: testbed_api.h:93
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:266
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
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:313
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION.
Definition: testbed.h:642
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 1081 of file testbed_api.c.

References GNUNET_OK.

1084 {
1085  /* actual check to be implemented */
1086  return GNUNET_OK;
1087 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75

◆ 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
cthe controller handler
msgmessage received

Definition at line 1098 of file testbed_api.c.

References OperationContext::c, GNUNET_TESTBED_Controller::cc, GNUNET_TESTBED_Controller::cc_cls, cfg, GNUNET_TESTBED_ControllerLinkResponse::config_size, data, OperationContext::data, GNUNET_TESTBED_EventInformation::emsg, GNUNET_TESTBED_Controller::event_mask, find_opc(), GNUNET_assert, GNUNET_break, GNUNET_CONFIGURATION_destroy(), GNUNET_free, GNUNET_free_non_null, 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_ControllerLinkResponse::header, ControllerLinkData::host_id, LOG_DEBUG, OperationContext::op, OperationContext::op_cls, OP_FORWARDED, OP_LINK_CONTROLLERS, OPC_STATE_FINISHED, GNUNET_TESTBED_ControllerLinkResponse::operation_id, GNUNET_MessageHeader::size, OperationContext::state, GNUNET_TESTBED_ControllerLinkResponse::success, and OperationContext::type.

1101 {
1102  struct GNUNET_TESTBED_Controller *c = cls;
1103  struct OperationContext *opc;
1104  struct ControllerLinkData *data;
1106  struct GNUNET_TESTBED_Host *host;
1107  char *emsg;
1108  uint64_t op_id;
1109  struct GNUNET_TESTBED_EventInformation event;
1110 
1111  op_id = GNUNET_ntohll(msg->operation_id);
1112  if (NULL == (opc = find_opc(c, op_id)))
1113  {
1114  LOG_DEBUG("Operation not found\n");
1115  return;
1116  }
1117  if (OP_FORWARDED == opc->type)
1118  {
1120  opc,
1121  (const struct GNUNET_MessageHeader *)msg);
1122  return;
1123  }
1124  if (OP_LINK_CONTROLLERS != opc->type)
1125  {
1126  GNUNET_break(0);
1127  return;
1128  }
1129  GNUNET_assert(NULL != (data = opc->data));
1131  GNUNET_assert(NULL != host);
1132  GNUNET_free(data);
1133  opc->data = NULL;
1134  opc->state = OPC_STATE_FINISHED;
1135  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1137  event.op = opc->op;
1138  event.op_cls = opc->op_cls;
1139  event.details.operation_finished.emsg = NULL;
1140  event.details.operation_finished.generic = NULL;
1141  emsg = NULL;
1142  cfg = NULL;
1143  if (GNUNET_NO == ntohs(msg->success))
1144  {
1145  emsg =
1146  GNUNET_malloc(ntohs(msg->header.size) -
1147  sizeof(struct GNUNET_TESTBED_ControllerLinkResponse) + 1);
1148  GNUNET_memcpy(emsg,
1149  &msg[1],
1150  ntohs(msg->header.size) -
1151  sizeof(struct GNUNET_TESTBED_ControllerLinkResponse));
1152  event.details.operation_finished.emsg = emsg;
1153  }
1154  else
1155  {
1156  if (0 != ntohs(msg->config_size))
1157  {
1159  (const struct GNUNET_MessageHeader *)msg);
1160  GNUNET_assert(NULL != cfg);
1162  }
1163  }
1164  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
1165  {
1166  if (NULL != c->cc)
1167  c->cc(c->cc_cls, &event);
1168  }
1169  else
1170  LOG_DEBUG("Not calling callback\n");
1171  if (NULL != cfg)
1173  GNUNET_free_non_null(emsg);
1174 }
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:185
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * op_cls
The operation closure.
Definition: testbed_api.h:149
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:169
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Argument to GNUNET_TESTBED_ControllerCallback with details about the event.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_NO
Definition: gnunet_common.h:78
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
void GNUNET_TESTBED_host_replace_cfg_(struct GNUNET_TESTBED_Host *host, const struct GNUNET_CONFIGURATION_Handle *new_cfg)
Function to replace host&#39;s configuration.
const char * emsg
Error message for the operation, NULL on success.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Opaque handle to a host running experiments managed by the testing framework.
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:2059
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
Response message for ControllerLinkRequest message.
Definition: testbed.h:165
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
uint32_t host_id
The id of the host which is hosting the controller to be linked.
Definition: testbed_api.c:106
Link controllers operation.
Definition: testbed_api.h:88
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
A requested testbed operation has been completed.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
uint16_t success
Set to GNUNET_YES to signify SUCCESS; GNUNET_NO to signify failure.
Definition: testbed.h:180
Forwarded operation.
Definition: testbed_api.h:83
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:175
The operation has finished.
Definition: testbed_api.h:128
configuration data
Definition: configuration.c:83
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:266
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
Context data for controller link operations.
Definition: testbed_api.c:97
Header for all communications.
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:409
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
#define GNUNET_malloc(size)
Wrapper around malloc.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
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:313
struct GNUNET_TESTBED_Host * GNUNET_TESTBED_host_lookup_by_id_(uint32_t id)
Lookup a host by ID.
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 1187 of file testbed_api.c.

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

1189 {
1190  uint16_t msize;
1191  uint16_t name_len;
1192  int status;
1193  const char *name;
1194  size_t emsg_len;
1195 
1196  msize = ntohs(msg->header.size);
1197  name = msg->data;
1198  name_len = ntohs(msg->name_len);
1199 
1200  if (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) + name_len + 1 > msize)
1201  {
1202  GNUNET_break_op(0);
1203  return GNUNET_SYSERR;
1204  }
1205  if ('\0' != name[name_len])
1206  {
1207  GNUNET_break_op(0);
1208  return GNUNET_SYSERR;
1209  }
1210  status = ntohs(msg->status);
1211  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1212  {
1213  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) +
1214  name_len + 1); /* +1!? */
1215  if (0 == emsg_len)
1216  {
1217  GNUNET_break_op(0);
1218  return GNUNET_SYSERR;
1219  }
1220  }
1221  return GNUNET_OK;
1222 }
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:808
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS.
Definition: testbed.h:798
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
uint16_t status
status.
Definition: testbed.h:803
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
uint16_t status
See PRISM_STATUS_*-constants.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
char data[0]
the barrier name (0-terminated) concatenated with an error message (0-terminated) if the status were ...
Definition: testbed.h:814
const char * name
Message for signalling status changes of a barrier.
Definition: testbed.h:794

◆ 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 1233 of file testbed_api.c.

References GNUNET_TESTBED_Controller::barrier_map, GNUNET_TESTBED_Barrier::cb, cleanup(), GNUNET_TESTBED_Barrier::cls, GNUNET_TESTBED_BarrierStatusMsg::data, GNUNET_TESTBED_Barrier::echo, GNUNET_assert, GNUNET_break_op, GNUNET_CONTAINER_multihashmap_get(), GNUNET_copy_message(), GNUNET_CRYPTO_hash(), GNUNET_free_non_null, 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, GNUNET_TESTBED_BarrierStatusMsg::header, LOG_DEBUG, name, GNUNET_TESTBED_BarrierStatusMsg::name_len, GNUNET_MessageHeader::size, status, and GNUNET_TESTBED_BarrierStatusMsg::status.

1235 {
1236  struct GNUNET_TESTBED_Controller *c = cls;
1237  struct GNUNET_TESTBED_Barrier *barrier;
1238  char *emsg;
1239  const char *name;
1240  struct GNUNET_HashCode key;
1241  size_t emsg_len;
1242  int status;
1243  uint16_t msize;
1244  uint16_t name_len;
1245 
1246  emsg = NULL;
1247  barrier = NULL;
1248  msize = ntohs(msg->header.size);
1249  if (msize <= sizeof(struct GNUNET_TESTBED_BarrierStatusMsg))
1250  {
1251  GNUNET_break_op(0);
1252  goto cleanup;
1253  }
1254  name = msg->data;
1255  name_len = ntohs(msg->name_len);
1256  if (name_len >= //name_len is strlen(barrier_name)
1257  (msize - ((sizeof msg->header) + sizeof(msg->status))))
1258  {
1259  GNUNET_break_op(0);
1260  goto cleanup;
1261  }
1262  if ('\0' != name[name_len])
1263  {
1264  GNUNET_break_op(0);
1265  goto cleanup;
1266  }
1267  LOG_DEBUG("Received BARRIER_STATUS msg\n");
1268  status = ntohs(msg->status);
1269  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1270  {
1271  status = -1;
1272  //unlike name_len, emsg_len includes the trailing zero
1273  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) +
1274  (name_len + 1));
1275  if (0 == emsg_len)
1276  {
1277  GNUNET_break_op(0);
1278  goto cleanup;
1279  }
1280  if ('\0' != (msg->data[(name_len + 1) + (emsg_len - 1)]))
1281  {
1282  GNUNET_break_op(0);
1283  goto cleanup;
1284  }
1285  emsg = GNUNET_malloc(emsg_len);
1286  GNUNET_memcpy(emsg, msg->data + name_len + 1, emsg_len);
1287  }
1288  if (NULL == c->barrier_map)
1289  {
1290  GNUNET_break_op(0);
1291  goto cleanup;
1292  }
1293  GNUNET_CRYPTO_hash(name, name_len, &key);
1295  if (NULL == barrier)
1296  {
1297  GNUNET_break_op(0);
1298  goto cleanup;
1299  }
1300  GNUNET_assert(NULL != barrier->cb);
1301  if ((GNUNET_YES == barrier->echo) &&
1304  barrier->cb(barrier->cls, name, barrier, status, emsg);
1306  return; /* just initialised; skip cleanup */
1307 
1308 cleanup:
1309  GNUNET_free_non_null(emsg);
1316  if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
1318 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:808
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:303
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS.
Definition: testbed.h:798
void * cls
the closure for the above callback
Definition: testbed_api.h:298
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
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.
uint16_t status
status.
Definition: testbed.h:803
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
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:2327
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:44
uint16_t status
See PRISM_STATUS_*-constants.
static void cleanup(void *cls)
Function scheduled as very last function, cleans up after us.
Handle for barrier.
Definition: testbed_api.h:274
A 512-bit hashcode.
struct GNUNET_HashCode key
The key used in the DHT.
char data[0]
the barrier name (0-terminated) concatenated with an error message (0-terminated) if the status were ...
Definition: testbed.h:814
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:1328
const char * name
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:257
Barrier initialised successfully.
#define GNUNET_YES
Definition: gnunet_common.h:77
Message for signalling status changes of a barrier.
Definition: testbed.h:794
#define GNUNET_malloc(size)
Wrapper around malloc.
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:293
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
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 1328 of file testbed_api.c.

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, size, GNUNET_MessageHeader::size, type, and GNUNET_MessageHeader::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().

1330 {
1331  struct GNUNET_MQ_Envelope *env;
1332  struct GNUNET_MessageHeader *m2;
1333  uint16_t type;
1334  uint16_t size;
1335 
1336  type = ntohs(msg->type);
1337  size = ntohs(msg->size);
1340  env = GNUNET_MQ_msg_extra(m2, size - sizeof(*m2), type);
1341  GNUNET_memcpy(m2, msg, size);
1342  GNUNET_free(msg);
1343  GNUNET_MQ_send(controller->mq, env);
1344 }
#define GNUNET_MESSAGE_TYPE_TESTBED_MAX
Not really a message, but for careful checks on the testbed messages; Should always be the maximum an...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#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:52
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
static unsigned int size
Size of the "table".
Definition: peer.c:66
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:215
#define GNUNET_MESSAGE_TYPE_TESTBED_INIT
Initial message from a client to a testing control service.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Header for all communications.
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:351
#define GNUNET_free(ptr)
Wrapper around free.
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 1362 of file testbed_api.c.

References OperationContext::c, ForwardedOperationData::cc, ForwardedOperationData::cc_cls, data, OperationContext::data, env, GNUNET_memcpy, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_TESTBED_insert_opc_(), OperationContext::id, GNUNET_TESTBED_Controller::mq, OP_FORWARDED, size, GNUNET_MessageHeader::size, type, OperationContext::type, and GNUNET_MessageHeader::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().

1368 {
1369  struct OperationContext *opc;
1370  struct ForwardedOperationData *data;
1371  struct GNUNET_MQ_Envelope *env;
1372  struct GNUNET_MessageHeader *m2;
1373  uint16_t type = ntohs(msg->type);
1374  uint16_t size = ntohs(msg->size);
1375 
1376  env = GNUNET_MQ_msg_extra(m2, size - sizeof(*m2), type);
1377  GNUNET_memcpy(m2, msg, size);
1378  GNUNET_MQ_send(controller->mq, env);
1379  data = GNUNET_new(struct ForwardedOperationData);
1380  data->cc = cc;
1381  data->cc_cls = cc_cls;
1382  opc = GNUNET_new(struct OperationContext);
1383  opc->c = controller;
1384  opc->type = OP_FORWARDED;
1385  opc->data = data;
1386  opc->id = operation_id;
1387  GNUNET_TESTBED_insert_opc_(controller, opc);
1388  return opc;
1389 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
#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:52
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Definition: testbed_api.c:74
void * cc_cls
The closure for the above callback.
Definition: testbed_api.c:79
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
static unsigned int size
Size of the "table".
Definition: peer.c:66
Context data for forwarded Operation.
Definition: testbed_api.c:70
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
Forwarded operation.
Definition: testbed_api.h:83
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:215
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Header for all communications.
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:292
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:351
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
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 1399 of file testbed_api.c.

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

1400 {
1401  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1402  GNUNET_free(opc->data);
1403  GNUNET_free(opc);
1404 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
#define GNUNET_free(ptr)
Wrapper around free.
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:313
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 1414 of file testbed_api.c.

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

Referenced by GNUNET_TESTBED_controller_link().

1415 {
1416  struct OperationContext *opc = cls;
1417  struct ControllerLinkData *data;
1419 
1420  GNUNET_assert(NULL != opc->data);
1421  data = opc->data;
1422  msg = data->msg;
1423  data->msg = NULL;
1424  opc->state = OPC_STATE_STARTED;
1425  GNUNET_TESTBED_insert_opc_(opc->c, opc);
1426  GNUNET_TESTBED_queue_message_(opc->c, &msg->header);
1427 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
The operation has been started.
Definition: testbed_api.h:122
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
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:1328
Context data for controller link operations.
Definition: testbed_api.c:97
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:292
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS.
Definition: testbed.h:137
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
Client notifies controller that it should delegate requests for a particular client to a particular s...
Definition: testbed.h:133
struct GNUNET_TESTBED_ControllerLinkRequest * msg
The controller link message.
Definition: testbed_api.c:101
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 1436 of file testbed_api.c.

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

Referenced by GNUNET_TESTBED_controller_link().

1437 {
1438  struct OperationContext *opc = cls;
1439  struct ControllerLinkData *data;
1440 
1441  data = opc->data;
1442  switch (opc->state)
1443  {
1444  case OPC_STATE_INIT:
1445  GNUNET_free(data->msg);
1446  break;
1447 
1448  case OPC_STATE_STARTED:
1449  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1450  break;
1451 
1452  case OPC_STATE_FINISHED:
1453  break;
1454  }
1455  GNUNET_free_non_null(data);
1456  GNUNET_free(opc);
1457 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
The operation has been started.
Definition: testbed_api.h:122
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:116
The operation has finished.
Definition: testbed_api.h:128
Context data for controller link operations.
Definition: testbed_api.c:97
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
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:313
struct GNUNET_TESTBED_ControllerLinkRequest * msg
The controller link message.
Definition: testbed_api.c:101
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 1466 of file testbed_api.c.

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

Referenced by GNUNET_TESTBED_get_slave_config_().

1467 {
1468  struct OperationContext *opc = cls;
1469  struct GetSlaveConfigData *data = opc->data;
1471 
1472  GNUNET_assert(NULL != data);
1474  GNUNET_free(opc->data);
1475  data = NULL;
1476  opc->data = NULL;
1477  GNUNET_TESTBED_insert_opc_(opc->c, opc);
1478  GNUNET_TESTBED_queue_message_(opc->c, &msg->header);
1479  opc->state = OPC_STATE_STARTED;
1480 }
Message to request configuration of a slave controller.
Definition: testbed.h:617
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
The operation has been started.
Definition: testbed_api.h:122
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Context data for get slave config operations.
Definition: testbed_api.c:86
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:996
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
uint32_t slave_id
The id of the slave controller.
Definition: testbed_api.c:90
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:1328
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION.
Definition: testbed.h:621
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:292
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
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 1489 of file testbed_api.c.

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

1490 {
1491  struct OperationContext *opc = cls;
1492 
1493  switch (opc->state)
1494  {
1495  case OPC_STATE_INIT:
1496  GNUNET_free(opc->data);
1497  break;
1498 
1499  case OPC_STATE_STARTED:
1500  GNUNET_TESTBED_remove_opc_(opc->c, opc);
1501  break;
1502 
1503  case OPC_STATE_FINISHED:
1504  if (NULL != opc->data)
1506  break;
1507  }
1508  GNUNET_free(opc);
1509 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
The operation has been started.
Definition: testbed_api.h:122
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:116
The operation has finished.
Definition: testbed_api.h:128
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
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:313
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 1521 of file testbed_api.c.

References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and GNUNET_SCHEDULER_shutdown().

Referenced by GNUNET_TESTBED_controller_connect().

1522 {
1523  /* struct GNUNET_TESTBED_Controller *c = cls; */
1524 
1525  GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Encountered MQ error: %d\n", error);
1526  /* now what? */
1527  GNUNET_SCHEDULER_shutdown(); /* seems most reasonable */
1528 }
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:517
#define GNUNET_log(kind,...)
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 1691 of file testbed_api.c.

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

Referenced by GNUNET_TESTBED_controller_disconnect().

1692 {
1693  struct GNUNET_CONTAINER_MultiHashMap32 *map = cls;
1694  struct OperationContext *opc = value;
1695 
1696  GNUNET_assert(NULL != opc);
1697  GNUNET_break(0);
1700  GNUNET_free(opc);
1701  return GNUNET_YES;
1702 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_CONTAINER_MultiPeerMap * map
Handle to the map used to store old latency values for peers.
int GNUNET_CONTAINER_multihashmap32_remove(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value)
Remove the given key-value pair from the map.
static char * value
Value of the record to add/remove.
Internal representation of the hash map.
struct GNUNET_HashCode key
The key used in the DHT.
#define GNUNET_YES
Definition: gnunet_common.h:77
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
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 1750 of file testbed_api.c.

References GNUNET_assert, and GNUNET_malloc.

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

1753 {
1754  size_t xsize;
1755 
1756  xsize = compressBound((uLong)size);
1757  *xconfig = GNUNET_malloc(xsize);
1758  GNUNET_assert(Z_OK == compress2((Bytef *)*xconfig,
1759  (uLongf *)&xsize,
1760  (const Bytef *)config,
1761  (uLongf)size,
1762  Z_BEST_SPEED));
1763  return xsize;
1764 }
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static const struct GNUNET_CONFIGURATION_Handle * config
static unsigned int size
Size of the "table".
Definition: peer.c:66
#define GNUNET_malloc(size)
Wrapper around malloc.
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 1777 of file testbed_api.c.

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

Referenced by send_controller_link_response().

1780 {
1781  char *config;
1782  char *xconfig;
1783  size_t size_;
1784  size_t xsize_;
1785 
1786  config = GNUNET_CONFIGURATION_serialize(cfg, &size_);
1787  xsize_ = GNUNET_TESTBED_compress_config_(config, size_, &xconfig);
1788  GNUNET_free(config);
1789  *size = size_;
1790  *xsize = xsize_;
1791  return xconfig;
1792 }
static const struct GNUNET_CONFIGURATION_Handle * config
static unsigned int size
Size of the "table".
Definition: peer.c:66
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1750
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
#define GNUNET_free(ptr)
Wrapper around free.
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 1886 of file testbed_api.c.

References OperationContext::c, data, OperationContext::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(), GetSlaveConfigData::slave_id, OperationContext::state, and OperationContext::type.

Referenced by GNUNET_TESTBED_get_slave_config().

1889 {
1890  struct OperationContext *opc;
1891  struct GetSlaveConfigData *data;
1892 
1893  data = GNUNET_new(struct GetSlaveConfigData);
1894  data->slave_id = slave_host_id;
1895  opc = GNUNET_new(struct OperationContext);
1896  opc->state = OPC_STATE_INIT;
1897  opc->c = master;
1898  opc->id = GNUNET_TESTBED_get_next_op_id(master);
1899  opc->type = OP_GET_SLAVE_CONFIG;
1900  opc->data = data;
1901  opc->op_cls = op_cls;
1906  opc->op);
1908  return opc->op;
1909 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * op_cls
The operation closure.
Definition: testbed_api.h:149
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_operation_create_(void *cls, OperationStart start, OperationRelease release)
Create an &#39;operation&#39; to be performed.
Context data for get slave config operations.
Definition: testbed_api.c:86
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:2201
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void GNUNET_TESTBED_operation_queue_insert_(struct OperationQueue *queue, struct GNUNET_TESTBED_Operation *op)
Add an operation to a queue.
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:1489
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
uint32_t slave_id
The id of the slave controller.
Definition: testbed_api.c:90
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:116
Get slave config operation.
Definition: testbed_api.h:93
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:241
void GNUNET_TESTBED_operation_begin_wait_(struct GNUNET_TESTBED_Operation *op)
Marks the given operation as waiting on the queues.
static void opstart_get_slave_config(void *cls)
Function to be called when get slave config operation is ready.
Definition: testbed_api.c:1466
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
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

Definition at line 1973 of file testbed_api.c.

References 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, and msg.

Referenced by GNUNET_TESTBED_controller_start().

1977 {
1979  char *config;
1980  char *xconfig;
1981  size_t config_size;
1982  size_t xconfig_size;
1983  uint16_t trusted_ip_len;
1984  uint16_t hostname_len;
1985  uint16_t msg_size;
1986 
1987  config = GNUNET_CONFIGURATION_serialize(cfg, &config_size);
1988  GNUNET_assert(NULL != config);
1989  xconfig_size =
1990  GNUNET_TESTBED_compress_config_(config, config_size, &xconfig);
1991  GNUNET_free(config);
1992  trusted_ip_len = strlen(trusted_ip);
1993  hostname_len = (NULL == hostname) ? 0 : strlen(hostname);
1994  msg_size = xconfig_size + trusted_ip_len + 1 +
1995  sizeof(struct GNUNET_TESTBED_HelperInit);
1996  msg_size += hostname_len;
1997  msg = GNUNET_realloc(xconfig, msg_size);
1998  (void)memmove(((void *)&msg[1]) + trusted_ip_len + 1 + hostname_len,
1999  msg,
2000  xconfig_size);
2001  msg->header.size = htons(msg_size);
2002  msg->header.type = htons(GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
2003  msg->trusted_ip_size = htons(trusted_ip_len);
2004  msg->hostname_size = htons(hostname_len);
2005  msg->config_size = htons(config_size);
2006  (void)strcpy((char *)&msg[1], trusted_ip);
2007  if (0 != hostname_len)
2008  GNUNET_memcpy((char *)&msg[1] + trusted_ip_len + 1,
2009  hostname,
2010  hostname_len);
2011  return msg;
2012 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
Initialization message for gnunet-helper-testbed to start testbed service.
#define GNUNET_realloc(ptr, size)
Wrapper around realloc.
static const struct GNUNET_CONFIGURATION_Handle * config
#define GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT
The initialization message towards gnunet-testbed-helper.
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1750
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
static char * hostname
Our hostname; we give this to all the peers we start.
uint16_t config_size
The size of the uncompressed configuration.
#define GNUNET_free(ptr)
Wrapper around free.
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 2059 of file testbed_api.c.

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, ret, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.

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

2060 {
2062  Bytef *data;
2063  const Bytef *xdata;
2064  uLong data_len;
2065  uLong xdata_len;
2066  int ret;
2067 
2068  switch (ntohs(msg->type))
2069  {
2072 
2073  imsg =
2075  data_len = (uLong)ntohs(imsg->config_size);
2076  xdata_len =
2077  ntohs(imsg->header.size) -
2079  xdata = (const Bytef *)&imsg[1];
2080  }
2081  break;
2082 
2084  const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
2085 
2086  imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *)msg;
2087  data_len = (uLong)ntohs(imsg->config_size);
2088  xdata_len = ntohs(imsg->header.size) -
2089  sizeof(struct GNUNET_TESTBED_SlaveConfiguration);
2090  xdata = (const Bytef *)&imsg[1];
2091  }
2092  break;
2093 
2095  const struct GNUNET_TESTBED_AddHostMessage *imsg;
2096  uint16_t osize;
2097 
2098  imsg = (const struct GNUNET_TESTBED_AddHostMessage *)msg;
2099  data_len = (uLong)ntohs(imsg->config_size);
2100  osize = sizeof(struct GNUNET_TESTBED_AddHostMessage) +
2101  ntohs(imsg->username_length) + ntohs(imsg->hostname_length);
2102  xdata_len = ntohs(imsg->header.size) - osize;
2103  xdata = (const Bytef *)((const void *)imsg + osize);
2104  }
2105  break;
2106 
2108  const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
2109 
2110  imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *)msg;
2111  data_len = ntohs(imsg->config_size);
2112  xdata_len = ntohs(imsg->header.size) -
2113  sizeof(const struct GNUNET_TESTBED_ControllerLinkResponse);
2114  xdata = (const Bytef *)&imsg[1];
2115  }
2116  break;
2117 
2119  const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
2120 
2121  imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *)msg;
2122  data_len = ntohs(imsg->config_size);
2123  xdata_len = ntohs(imsg->header.size) -
2124  sizeof(struct GNUNET_TESTBED_PeerCreateMessage);
2125  xdata = (const Bytef *)&imsg[1];
2126  }
2127  break;
2128 
2130  const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
2131 
2132  imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *)msg;
2133  data_len = ntohs(imsg->config_size);
2134  xdata_len = ntohs(imsg->header.size) -
2136  xdata = (const Bytef *)&imsg[1];
2137  }
2138  break;
2139 
2140  default:
2141  GNUNET_assert(0);
2142  }
2143  data = GNUNET_malloc(data_len);
2144  if (Z_OK != (ret = uncompress(data, &data_len, xdata, xdata_len)))
2145  {
2146  GNUNET_free(data);
2147  GNUNET_break_op(0); /* Un-compression failure */
2148  return NULL;
2149  }
2152  (const char *)data,
2153  (size_t)data_len,
2154  NULL))
2155  {
2156  GNUNET_free(data);
2157  GNUNET_break_op(0); /* De-serialization failure */
2158  return NULL;
2159  }
2160  GNUNET_free(data);
2161  return cfg;
2162 }
#define GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
Message which contains the configuration of slave controller.
uint16_t username_length
Number of bytes in the user name that follows; 0 to use no user name; otherwise &#39;strlen (username)&#39;...
Definition: testbed.h:84
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER.
Definition: testbed.h:238
Message sent from client to testing service to reconfigure a (stopped) a peer.
Definition: testbed.h:234
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:169
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER.
Definition: testbed.h:203
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Notify the service about a host that we intend to use.
Definition: testbed.h:63
uint16_t config_size
The length of the uncompressed configuration.
Definition: testbed.h:95
Peer configuration and identity reply from controller to a client.
Definition: testbed.h:584
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:90
uint16_t config_size
The size of the configuration when uncompressed.
Definition: testbed.h:657
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION.
Definition: testbed.h:588
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
static int ret
Final status code.
Definition: gnunet-arm.c:89
Response message for ControllerLinkRequest message.
Definition: testbed.h:165
uint16_t config_size
The length of the serialized configuration when uncompressed.
Definition: testbed.h:253
uint16_t config_size
The size of configuration when uncompressed.
Definition: testbed.h:608
#define GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
Message to signal the result of GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS request.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
Message to reconfigure a peer.
#define GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
Message to add host.
#define GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
Message containing the peer&#39;s information.
Message sent from client to testing service to create (configure, but not start) a peer...
Definition: testbed.h:199
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message.
Definition: testbed.h:638
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:67
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:175
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
Message to create a peer at a host.
configuration data
Definition: configuration.c:83
int GNUNET_CONFIGURATION_deserialize(struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *basedir)
De-serializes configuration.
uint32_t data
The data value.
uint16_t config_size
Size of the uncompressed configuration.
Definition: testbed.h:223
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION.
Definition: testbed.h:642
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 OperationFailureEventMessage and if good returns the error message it contains.

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 2173 of file testbed_api.c.

References GNUNET_break, GNUNET_TESTBED_OperationFailureEventMessage::header, and GNUNET_MessageHeader::size.

Referenced by configuration_receiver(), and handle_op_fail_event().

2175 {
2176  uint16_t msize;
2177  const char *emsg;
2178 
2179  msize = ntohs(msg->header.size);
2180  if (sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
2181  return NULL;
2182  msize -= sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage);
2183  emsg = (const char *)&msg[1];
2184  if ('\0' != emsg[msize - 1])
2185  {
2186  GNUNET_break(0);
2187  return NULL;
2188  }
2189  return emsg;
2190 }
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT.
Definition: testbed.h:497
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format...
Event notification from a controller to a client.
Definition: testbed.h:493
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
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 2201 of file testbed_api.c.

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

2202 {
2203  uint64_t op_id;
2204 
2205  op_id = (uint64_t)GNUNET_TESTBED_host_get_id_(controller->host);
2206  op_id = op_id << 32;
2207  op_id |= (uint64_t)controller->operation_counter++;
2208  return op_id;
2209 }
uint32_t operation_counter
The operation id counter.
Definition: testbed_api.h:267
uint32_t GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host)
Obtain the host&#39;s unique global ID.
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:195
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 2218 of file testbed_api.c.

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, GNUNET_TESTBED_ShutdownPeersMessage::operation_id, and OperationContext::state.

Referenced by GNUNET_TESTBED_shutdown_peers().

2219 {
2220  struct OperationContext *opc = cls;
2221  struct GNUNET_MQ_Envelope *env;
2223 
2224  opc->state = OPC_STATE_STARTED;
2226  msg->operation_id = GNUNET_htonll(opc->id);
2227  GNUNET_TESTBED_insert_opc_(opc->c, opc);
2228  GNUNET_MQ_send(opc->c->mq, env);
2229 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
The operation has been started.
Definition: testbed_api.h:122
Shutdown peers message.
Definition: testbed.h:666
#define GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
A controller receiving this message floods it to its directly-connected sub-controllers and then stop...
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
uint64_t operation_id
Operation ID.
Definition: testbed.h:675
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:215
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:292
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:351
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
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 2238 of file testbed_api.c.

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

Referenced by GNUNET_TESTBED_shutdown_peers().

2239 {
2240  struct OperationContext *opc = cls;
2241 
2242  switch (opc->state)
2243  {
2244  case OPC_STATE_STARTED:
2245  GNUNET_TESTBED_remove_opc_(opc->c, opc);
2246 
2247  /* no break; continue */
2248  case OPC_STATE_INIT:
2249  GNUNET_free(opc->data);
2250  break;
2251 
2252  case OPC_STATE_FINISHED:
2253  break;
2254  }
2255  GNUNET_free(opc);
2256 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
The operation has been started.
Definition: testbed_api.h:122
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:116
The operation has finished.
Definition: testbed_api.h:128
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
#define GNUNET_free(ptr)
Wrapper around free.
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:313
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 2327 of file testbed_api.c.

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

2328 {
2329  struct GNUNET_TESTBED_Controller *c = barrier->c;
2330 
2331  GNUNET_assert(NULL != c->barrier_map); /* No barriers present */
2334  &barrier->key,
2335  barrier));
2336  GNUNET_free(barrier->name);
2337  GNUNET_free(barrier);
2339  {
2341  c->barrier_map = NULL;
2342  }
2343 }
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
int 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.
char * name
The name of the barrier.
Definition: testbed_api.h:288
struct GNUNET_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:283
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:278
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:257
#define GNUNET_free(ptr)
Wrapper around free.
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 2363 of file testbed_api.c.

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, GNUNET_TESTBED_Barrier::key, LOG_DEBUG, GNUNET_TESTBED_Controller::mq, msg, GNUNET_TESTBED_Barrier::name, GNUNET_TESTBED_BarrierInit::name, and GNUNET_TESTBED_BarrierInit::quorum.

Referenced by GNUNET_TESTBED_barrier_init(), and handle_barrier_init().

2369 {
2371  struct GNUNET_MQ_Envelope *env;
2372  struct GNUNET_TESTBED_Barrier *barrier;
2373  struct GNUNET_HashCode key;
2374  size_t name_len;
2375 
2376  GNUNET_assert(quorum <= 100);
2377  GNUNET_assert(NULL != cb);
2378  name_len = strlen(name);
2379  GNUNET_assert(0 < name_len);
2380  GNUNET_CRYPTO_hash(name, name_len, &key);
2381  if (NULL == controller->barrier_map)
2382  controller->barrier_map =
2384  if (GNUNET_YES ==
2386  {
2387  GNUNET_break(0);
2388  return NULL;
2389  }
2390  LOG_DEBUG("Initialising barrier `%s'\n", name);
2391  barrier = GNUNET_new(struct GNUNET_TESTBED_Barrier);
2392  barrier->c = controller;
2393  barrier->name = GNUNET_strdup(name);
2394  barrier->cb = cb;
2395  barrier->cls = cls;
2396  barrier->echo = echo;
2397  GNUNET_memcpy(&barrier->key, &key, sizeof(struct GNUNET_HashCode));
2400  controller->barrier_map,
2401  &barrier->key,
2402  barrier,
2404 
2405  env = GNUNET_MQ_msg_extra(msg,
2406  name_len,
2408  msg->quorum = (uint8_t)quorum;
2409  GNUNET_memcpy(msg->name, barrier->name, name_len);
2410  GNUNET_MQ_send(barrier->c->mq, env);
2411  return barrier;
2412 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static int echo
Request echo service.
Definition: gnunet-cadet.c:67
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:303
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void * cls
the closure for the above callback
Definition: testbed_api.h:298
int 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)...
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
#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:52
, &#39; bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_...
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:44
char * name
The name of the barrier.
Definition: testbed_api.h:288
Handle for barrier.
Definition: testbed_api.h:274
A 512-bit hashcode.
struct GNUNET_HashCode key
The key used in the DHT.
const char * name
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
int 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_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:283
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:278
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:215
uint8_t quorum
The quorum percentage needed for crossing the barrier.
Definition: testbed.h:766
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:257
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_YES
Definition: gnunet_common.h:77
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:351
char name[0]
name of the barrier.
Definition: testbed.h:771
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
Message to initialise a barrier.
Message to initialise a barrier.
Definition: testbed.h:757
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:293
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 150 of file testbed_api.c.

Referenced by exop_check().

◆ exop_tail

struct ExpireOperationEntry* exop_tail
static

DLL tail for list of operation marked for expiry.

Definition at line 155 of file testbed_api.c.