GNUnet  0.11.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 169 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().

170 {
171  struct ExpireOperationEntry *entry;
172 
173  entry = GNUNET_new (struct ExpireOperationEntry);
174  entry->op = op;
176 }
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
Definition: testbed_api.c:160
static struct ExpireOperationEntry * exop_head
DLL head for list of operations marked for expiry.
Definition: testbed_api.c:155
#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:148
An entry in the stack for keeping operations which are about to expire.
Definition: testbed_api.c:133
#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:144
Here is the caller graph for this function:

◆ exop_check()

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

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

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

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

Definition at line 191 of file testbed_api.c.

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

192 {
193  struct ExpireOperationEntry *entry;
194  struct ExpireOperationEntry *entry2;
195  int found;
196 
197  found = GNUNET_NO;
198  entry = exop_head;
199  while (NULL != entry)
200  {
201  if (op == entry->op)
202  {
203  found = GNUNET_YES;
204  break;
205  }
206  entry = entry->next;
207  }
208  if (GNUNET_NO == found)
209  return GNUNET_NO;
210  /* Truncate the tail */
211  while (NULL != entry)
212  {
213  entry2 = entry->next;
215  GNUNET_free (entry);
216  entry = entry2;
217  }
218  return GNUNET_YES;
219 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static struct ExpireOperationEntry * exop_tail
DLL tail for list of operation marked for expiry.
Definition: testbed_api.c:160
static struct ExpireOperationEntry * exop_head
DLL head for list of operations marked for expiry.
Definition: testbed_api.c:155
#define GNUNET_NO
Definition: gnunet_common.h:78
const struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.c:148
An entry in the stack for keeping operations which are about to expire.
Definition: testbed_api.c:133
struct ExpireOperationEntry * next
DLL head; new entries are to be inserted here.
Definition: testbed_api.c:138
#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 249 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().

250 {
251  struct SearchContext *sc = cls;
252  struct OperationContext *opc = value;
253 
254  GNUNET_assert (NULL != opc);
255  GNUNET_assert (NULL == sc->opc);
256  if (opc->id != sc->id)
257  return GNUNET_YES;
258  sc->opc = opc;
259  return GNUNET_NO;
260 }
#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:161
static char * value
Value of the record to add/remove.
struct OperationContext * opc
The result of the search.
Definition: testbed_api.c:230
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:225
uint64_t id
The id of the operation context we are searching for.
Definition: testbed_api.c:235
#define GNUNET_YES
Definition: gnunet_common.h:77
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
Here is the caller graph for this function:

◆ find_opc()

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

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

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

Definition at line 272 of file testbed_api.c.

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

273 {
274  struct SearchContext sc;
275 
276  sc.id = id;
277  sc.opc = NULL;
278  GNUNET_assert (NULL != c->opc_map);
279  if (GNUNET_SYSERR !=
281  (uint32_t) id,
283  &sc))
284  return NULL;
285  return sc.opc;
286 }
#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:229
#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:249
Context information to be used while searching for operation contexts.
Definition: testbed_api.c:225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_TESTBED_insert_opc_()

void GNUNET_TESTBED_insert_opc_ ( struct GNUNET_TESTBED_Controller c,
struct OperationContext opc 
)

Inserts the given operation context into the operation context map of the given controller.

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

Parameters
cthe controller
opcthe operation context to be inserted

Definition at line 298 of file testbed_api.c.

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

300 {
301  if (NULL == c->opc_map)
304  c->opc_map,
305  (uint32_t) opc->id,
306  opc,
308 }
#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:161
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:229
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 319 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().

321 {
322  GNUNET_assert (NULL != c->opc_map);
325  (uint32_t) opc->id,
326  opc));
328  (NULL != c->opcq_empty_cb))
330 }
TESTBED_opcq_empty_cb opcq_empty_cb
If this callback is not NULL, schedule it as a task when opc_map gets empty.
Definition: testbed_api.h:234
#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:161
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:229
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:239
#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 341 of file testbed_api.c.

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

343 {
344  const char *emsg;
345  uint16_t msg_size;
346 
347  msg_size = ntohs (msg->header.size) - sizeof(*msg);
348  if (0 == msg_size)
349  return GNUNET_OK;
350  /* We have an error message */
351  emsg = (const char *) &msg[1];
352  if ('\0' != emsg[msg_size - 1])
353  {
354  GNUNET_break (0);
355  return GNUNET_SYSERR;
356  }
357  return GNUNET_OK;
358 }
#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:119

◆ handle_add_host_confirm()

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

Handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from controller (testbed service)

Parameters
clsthe controller handler
msgmessage received

Definition at line 369 of file testbed_api.c.

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.

371 {
372  struct GNUNET_TESTBED_Controller *c = cls;
374  const char *emsg;
375  uint16_t msg_size;
376 
377  if (NULL == rh)
378  return;
379  if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
380  {
381  LOG_DEBUG ("Mismatch in host id's %u, %u of host confirm msg\n",
383  ntohl (msg->host_id));
384  return;
385  }
386  c->rh = NULL;
387  msg_size = ntohs (msg->header.size) - sizeof(*msg);
388  if (0 == msg_size)
389  {
390  LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
392  rh->cc (rh->cc_cls, NULL);
393  GNUNET_free (rh);
394  return;
395  }
396  /* We have an error message */
397  emsg = (const char *) &msg[1];
399  _ ("Adding host %u failed with error: %s\n"),
400  ntohl (msg->host_id),
401  emsg);
402  rh->cc (rh->cc_cls, emsg);
403  GNUNET_free (rh);
404 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
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:224
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:124
#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:119
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 415 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().

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

442 {
443  struct GNUNET_TESTBED_Controller *c = cls;
444  struct OperationContext *opc;
446  void *op_comp_cb_cls;
447  struct GNUNET_TESTBED_EventInformation event;
448  uint64_t op_id;
449 
450  op_id = GNUNET_ntohll (msg->operation_id);
451  LOG_DEBUG ("Operation %lu successful\n", op_id);
452  if (NULL == (opc = find_opc (c, op_id)))
453  {
454  LOG_DEBUG ("Operation not found\n");
455  return;
456  }
458  event.op = opc->op;
459  event.op_cls = opc->op_cls;
460  event.details.operation_finished.emsg = NULL;
461  event.details.operation_finished.generic = NULL;
462  op_comp_cb = NULL;
463  op_comp_cb_cls = NULL;
464  switch (opc->type)
465  {
466  case OP_FORWARDED: {
468  opc,
469  (const struct
470  GNUNET_MessageHeader *) msg);
471  return;
472  }
473  break;
474 
475  case OP_PEER_DESTROY: {
476  struct GNUNET_TESTBED_Peer *peer;
477 
478  peer = opc->data;
480  GNUNET_free (peer);
481  opc->data = NULL;
482  // PEERDESTROYDATA
483  }
484  break;
485 
486  case OP_SHUTDOWN_PEERS: {
487  struct ShutdownPeersData *data;
488 
489  data = opc->data;
490  op_comp_cb = data->cb;
491  op_comp_cb_cls = data->cb_cls;
492  GNUNET_free (data);
493  opc->data = NULL;
495  }
496  break;
497 
498  case OP_MANAGE_SERVICE: {
499  struct ManageServiceData *data;
500 
501  GNUNET_assert (NULL != (data = opc->data));
502  op_comp_cb = data->cb;
503  op_comp_cb_cls = data->cb_cls;
504  GNUNET_free (data);
505  opc->data = NULL;
506  }
507  break;
508 
509  case OP_PEER_RECONFIGURE:
510  break;
511 
512  default:
513  GNUNET_assert (0);
514  }
515  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
516  opc->state = OPC_STATE_FINISHED;
517  exop_insert (event.op);
518  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
519  {
520  if (NULL != c->cc)
521  c->cc (c->cc_cls, &event);
522  if (GNUNET_NO == exop_check (event.op))
523  return;
524  }
525  else
526  LOG_DEBUG ("Not calling callback\n");
527  if (NULL != op_comp_cb)
528  op_comp_cb (op_comp_cb_cls, event.op, NULL);
529  /* You could have marked the operation as done by now */
530  GNUNET_break (GNUNET_NO == exop_check (event.op));
531 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
Definition: testbed_api.c:191
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
void * op_cls
The operation closure.
Definition: testbed_api.h:151
#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:99
#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:74
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:573
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:169
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:265
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
Peer destroy operation.
Definition: testbed_api.h:64
A requested testbed operation has been completed.
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
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:121
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
GNUNET_TESTBED_OperationCompletionCallback cb
Forwarded operation.
Definition: testbed_api.h:84
The operation has finished.
Definition: testbed_api.h:129
Date context for OP_SHUTDOWN_PEERS operations.
Definition: testbed_api.c:116
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:104
void * cb_cls
The closure for the above callback.
Definition: testbed_api.c:126
static struct OperationContext * find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
Returns the operation context with the given id if found in the Operation context queues of the contr...
Definition: testbed_api.c:272
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
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:415
A peer controlled by the testing framework.
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:136
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:319
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 542 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.

545 {
546  struct GNUNET_TESTBED_Controller *c = cls;
547  struct OperationContext *opc;
548  struct PeerCreateData *data;
549  struct GNUNET_TESTBED_Peer *peer;
552  void *cb_cls;
553  uint64_t op_id;
554 
556  ntohs (msg->header.size));
557  op_id = GNUNET_ntohll (msg->operation_id);
558  if (NULL == (opc = find_opc (c, op_id)))
559  {
560  LOG_DEBUG ("Operation context for PeerCreateSuccessEvent not found\n");
561  return;
562  }
563  if (OP_FORWARDED == opc->type)
564  {
566  opc,
567  (const struct GNUNET_MessageHeader *) msg);
568  return;
569  }
571  GNUNET_assert (NULL != opc->data);
572  data = opc->data;
573  GNUNET_assert (NULL != data->peer);
574  peer = data->peer;
575  GNUNET_assert (peer->unique_id == ntohl (msg->peer_id));
576  peer->state = TESTBED_PS_CREATED;
578  cb = data->cb;
579  cb_cls = data->cls;
580  op = opc->op;
581  GNUNET_free (opc->data);
582  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
583  opc->state = OPC_STATE_FINISHED;
584  exop_insert (op);
585  if (NULL != cb)
586  cb (cb_cls, peer, NULL);
587  /* You could have marked the operation as done by now */
589 }
void * cb_cls
Closure for callbacks.
Event notification from a controller to a client.
Definition: testbed.h:533
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
Definition: testbed_api.c:191
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
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:538
#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:543
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:169
#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:171
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
Forwarded operation.
Definition: testbed_api.h:84
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:548
The operation has finished.
Definition: testbed_api.h:129
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:272
Peer create operation.
Definition: testbed_api.h:49
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:415
static struct GNUNET_ARM_Operation * op
Current operation.
Definition: gnunet-arm.c:144
A peer controlled by the testing framework.
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:136
#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:319
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 600 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.

601 {
602  struct GNUNET_TESTBED_Controller *c = cls;
603  struct OperationContext *opc;
604  struct GNUNET_TESTBED_Peer *peer;
605  struct PeerEventData *data;
607  void *pcc_cls;
608  struct GNUNET_TESTBED_EventInformation event;
609  uint64_t op_id;
610  uint64_t mask;
611 
613  ntohs (msg->header.size));
614  op_id = GNUNET_ntohll (msg->operation_id);
615  if (NULL == (opc = find_opc (c, op_id)))
616  {
617  LOG_DEBUG ("Operation not found\n");
618  return;
619  }
620  if (OP_FORWARDED == opc->type)
621  {
623  opc,
624  (const struct GNUNET_MessageHeader *) msg);
625  return;
626  }
627  GNUNET_assert ((OP_PEER_START == opc->type) || (OP_PEER_STOP == opc->type));
628  data = opc->data;
629  GNUNET_assert (NULL != data);
630  peer = data->peer;
631  GNUNET_assert (NULL != peer);
632  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
633  event.op = opc->op;
634  event.op_cls = opc->op_cls;
635  switch (event.type)
636  {
638  peer->state = TESTBED_PS_STARTED;
639  event.details.peer_start.host = peer->host;
640  event.details.peer_start.peer = peer;
641  break;
642 
644  peer->state = TESTBED_PS_STOPPED;
645  event.details.peer_stop.peer = peer;
646  break;
647 
648  default:
649  GNUNET_assert (0); /* We should never reach this state */
650  }
651  pcc = data->pcc;
652  pcc_cls = data->pcc_cls;
653  GNUNET_free (data);
654  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
655  opc->state = OPC_STATE_FINISHED;
656  exop_insert (event.op);
657  mask = 1LL << GNUNET_TESTBED_ET_PEER_START;
658  mask |= 1LL << GNUNET_TESTBED_ET_PEER_STOP;
659  if (0 != (mask & c->event_mask))
660  {
661  if (NULL != c->cc)
662  c->cc (c->cc_cls, &event);
663  if (GNUNET_NO == exop_check (event.op))
664  return;
665  }
666  if (NULL != pcc)
667  pcc (pcc_cls, NULL);
668  /* You could have marked the operation as done by now */
669  GNUNET_break (GNUNET_NO == exop_check (event.op));
670 }
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:468
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
Definition: testbed_api.c:191
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
void * op_cls
The operation closure.
Definition: testbed_api.h:151
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Event notification from a controller to a client.
Definition: testbed.h:442
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:453
static void exop_insert(struct GNUNET_TESTBED_Operation *op)
Inserts an operation into the list of operations marked for expiry.
Definition: testbed_api.c:169
#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:265
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:171
Peer start operation.
Definition: testbed_api.h:54
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
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:84
The operation has finished.
Definition: testbed_api.h:129
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:59
static struct OperationContext * find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
Returns the operation context with the given id if found in the Operation context queues of the contr...
Definition: testbed_api.c:272
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT.
Definition: testbed.h:447
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
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:415
A peer controlled by the testing framework.
A peer has been stopped.
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:136
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:319
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 681 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.

683 {
684  struct GNUNET_TESTBED_Controller *c = cls;
685  struct OperationContext *opc;
686  struct OverlayConnectData *data;
688  void *cb_cls;
689  struct GNUNET_TESTBED_EventInformation event;
690  uint64_t op_id;
691  uint64_t mask;
692 
693  op_id = GNUNET_ntohll (msg->operation_id);
694  if (NULL == (opc = find_opc (c, op_id)))
695  {
696  LOG_DEBUG ("Operation not found\n");
697  return;
698  }
699  if (OP_FORWARDED == opc->type)
700  {
702  opc,
703  (const struct GNUNET_MessageHeader *) msg);
704  return;
705  }
707  GNUNET_assert (NULL != (data = opc->data));
708  GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id) &&
709  (ntohl (msg->peer2) == data->p2->unique_id));
710  event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
711  event.op = opc->op;
712  event.op_cls = opc->op_cls;
713  switch (event.type)
714  {
716  event.details.peer_connect.peer1 = data->p1;
717  event.details.peer_connect.peer2 = data->p2;
718  break;
719 
721  GNUNET_assert (0); /* FIXME: implement */
722  break;
723 
724  default:
725  GNUNET_assert (0); /* Should never reach here */
726  break;
727  }
728  cb = data->cb;
729  cb_cls = data->cb_cls;
730  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
731  opc->state = OPC_STATE_FINISHED;
732  exop_insert (event.op);
733  mask = 1LL << GNUNET_TESTBED_ET_CONNECT;
734  mask |= 1LL << GNUNET_TESTBED_ET_DISCONNECT;
735  if (0 != (mask & c->event_mask))
736  {
737  if (NULL != c->cc)
738  c->cc (c->cc_cls, &event);
739  if (GNUNET_NO == exop_check (event.op))
740  return;
741  }
742  if (NULL != cb)
743  cb (cb_cls, opc->op, NULL);
744  /* You could have marked the operation as done by now */
745  GNUNET_break (GNUNET_NO == exop_check (event.op));
746 }
void * cb_cls
The closure for the above callback.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
Definition: testbed_api.c:191
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
void * op_cls
The operation closure.
Definition: testbed_api.h:151
#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:169
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:265
uint32_t peer2
Second peer.
Definition: testbed.h:496
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
uint64_t operation_id
Operation ID that is used to identify this operation.
Definition: testbed.h:501
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
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:491
struct GNUNET_TESTBED_Peer * p1
Peer A to connect to peer B.
Overlay connection operation.
Definition: testbed_api.h:79
Forwarded operation.
Definition: testbed_api.h:84
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:486
A connection between two peers was established.
The operation has finished.
Definition: testbed_api.h:129
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:272
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
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:415
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:136
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:319
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 757 of file testbed_api.c.

References GNUNET_OK.

760 {
761  /* anything goes? */
762  return GNUNET_OK;
763 }
#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 774 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.

777 {
778  struct GNUNET_TESTBED_Controller *c = cls;
779  struct OperationContext *opc;
780  struct GNUNET_TESTBED_Peer *peer;
781  struct PeerInfoData *data;
782  struct GNUNET_TESTBED_PeerInformation *pinfo;
784  void *cb_cls;
785  uint64_t op_id;
786 
787  op_id = GNUNET_ntohll (msg->operation_id);
788  if (NULL == (opc = find_opc (c, op_id)))
789  {
790  LOG_DEBUG ("Operation not found\n");
791  return;
792  }
793  if (OP_FORWARDED == opc->type)
794  {
795  handle_forwarded_operation_msg (c, opc, &msg->header);
796  return;
797  }
798  data = opc->data;
799  GNUNET_assert (NULL != data);
800  peer = data->peer;
801  GNUNET_assert (NULL != peer);
802  GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id);
804  pinfo->pit = data->pit;
805  cb = data->cb;
806  cb_cls = data->cb_cls;
807  GNUNET_assert (NULL != cb);
808  GNUNET_free (data);
809  opc->data = NULL;
810  switch (pinfo->pit)
811  {
813  pinfo->result.id = GNUNET_new (struct GNUNET_PeerIdentity);
814  GNUNET_memcpy (pinfo->result.id,
815  &msg->peer_identity,
816  sizeof(struct GNUNET_PeerIdentity));
817  break;
818 
820  pinfo->result.cfg = /* Freed in oprelease_peer_getinfo */
822  break;
823 
825  GNUNET_assert (0); /* never reach here */
826  break;
827  }
828  opc->data = pinfo;
829  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
830  opc->state = OPC_STATE_FINISHED;
831  cb (cb_cls, opc->op, pinfo, NULL);
832  /* We dont check whether the operation is marked as done here as the
833  operation contains data (cfg/identify) which will be freed at a later point
834  */
835 }
uint32_t peer_id
The id of the peer relevant to this information.
Definition: testbed.h:613
Data for the OperationType OP_PEER_INFO.
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
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:608
#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:618
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:2066
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:171
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:623
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
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:84
The operation has finished.
Definition: testbed_api.h:129
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:272
static void handle_forwarded_operation_msg(void *cls, struct OperationContext *opc, const struct GNUNET_MessageHeader *msg)
Handler for forwarded operations.
Definition: testbed_api.c:415
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:156
uint32_t data
The data value.
union GNUNET_TESTBED_PeerInformation::@61 result
The result of the get information operation; Choose according to the pit.
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:136
#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:319
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 847 of file testbed_api.c.

References GNUNET_OK.

850 {
851  /* we accept anything as a valid error message */
852  return GNUNET_OK;
853 }
#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 864 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.

867 {
868  struct GNUNET_TESTBED_Controller *c = cls;
869  struct OperationContext *opc;
870  const char *emsg;
871  uint64_t op_id;
872  uint64_t mask;
873  struct GNUNET_TESTBED_EventInformation event;
874 
875  op_id = GNUNET_ntohll (msg->operation_id);
876  if (NULL == (opc = find_opc (c, op_id)))
877  {
878  LOG_DEBUG ("Operation not found\n");
879  return;
880  }
881  if (OP_FORWARDED == opc->type)
882  {
884  opc,
885  (const struct GNUNET_MessageHeader *) msg);
886  return;
887  }
888  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
889  opc->state = OPC_STATE_FINISHED;
891  if (NULL == emsg)
892  emsg = "Unknown error";
893  if (OP_PEER_INFO == opc->type)
894  {
895  struct PeerInfoData *data;
896 
897  data = opc->data;
898  if (NULL != data->cb)
899  data->cb (data->cb_cls, opc->op, NULL, emsg);
900  GNUNET_free (data);
901  return; /* We do not call controller callback for peer info */
902  }
904  event.op = opc->op;
905  event.op_cls = opc->op_cls;
906  event.details.operation_finished.emsg = emsg;
907  event.details.operation_finished.generic = NULL;
908  mask = (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
909  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
910  {
911  exop_insert (event.op);
912  c->cc (c->cc_cls, &event);
913  if (GNUNET_NO == exop_check (event.op))
914  return;
915  }
916  switch (opc->type)
917  {
918  case OP_PEER_CREATE: {
919  struct PeerCreateData *data;
920 
921  data = opc->data;
922  GNUNET_free (data->peer);
923  if (NULL != data->cb)
924  data->cb (data->cls, NULL, emsg);
925  GNUNET_free (data);
926  }
927  break;
928 
929  case OP_PEER_START:
930  case OP_PEER_STOP: {
931  struct PeerEventData *data;
932 
933  data = opc->data;
934  if (NULL != data->pcc)
935  data->pcc (data->pcc_cls, emsg);
936  GNUNET_free (data);
937  }
938  break;
939 
940  case OP_PEER_DESTROY:
941  break;
942 
943  case OP_PEER_INFO:
944  GNUNET_assert (0);
945 
946  case OP_OVERLAY_CONNECT: {
947  struct OverlayConnectData *data;
948 
949  data = opc->data;
951  if (NULL != data->cb)
952  data->cb (data->cb_cls, opc->op, emsg);
953  }
954  break;
955 
956  case OP_FORWARDED:
957  GNUNET_assert (0);
958 
959  case OP_LINK_CONTROLLERS: /* No secondary callback */
960  break;
961 
962  case OP_SHUTDOWN_PEERS: {
963  struct ShutdownPeersData *data;
964 
965  data = opc->data;
966  GNUNET_free (data); /* FIXME: Decide whether we call data->op_cb */
967  opc->data = NULL;
968  }
969  break;
970 
971  case OP_MANAGE_SERVICE: {
972  struct ManageServiceData *data = opc->data;
974  void *cb_cls;
975 
976  GNUNET_assert (NULL != data);
977  cb = data->cb;
978  cb_cls = data->cb_cls;
979  GNUNET_free (data);
980  opc->data = NULL;
981  exop_insert (event.op);
982  if (NULL != cb)
983  cb (cb_cls, opc->op, emsg);
984  /* You could have marked the operation as done by now */
985  GNUNET_break (GNUNET_NO == exop_check (event.op));
986  }
987  break;
988 
989  default:
990  GNUNET_break (0);
991  }
992 }
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:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
static int exop_check(const struct GNUNET_TESTBED_Operation *const op)
Checks if an operation is present in the list of operations marked for expiry.
Definition: testbed_api.c:191
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
void * cb_cls
The closure for peer info callback.
void * op_cls
The operation closure.
Definition: testbed_api.h:151
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:99
#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:169
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:265
GNUNET_TESTBED_PeerChurnCallback pcc
The Peer churn callback to call when this operation is completed.
Link controllers operation.
Definition: testbed_api.h:89
uint64_t operation_id
Operation ID of the operation that created this event.
Definition: testbed.h:524
void * pcc_cls
Closure for the above callback.
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
Peer destroy operation.
Definition: testbed_api.h:64
A requested testbed operation has been completed.
Peer start operation.
Definition: testbed_api.h:54
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
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:79
Forwarded operation.
Definition: testbed_api.h:84
The operation has finished.
Definition: testbed_api.h:129
Date context for OP_SHUTDOWN_PEERS operations.
Definition: testbed_api.c:116
Peer stop operation.
Definition: testbed_api.h:59
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:104
static struct OperationContext * find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
Returns the operation context with the given id if found in the Operation context queues of the contr...
Definition: testbed_api.c:272
Peer create operation.
Definition: testbed_api.h:49
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
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:415
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:2180
Get peer information operation.
Definition: testbed_api.h:69
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:136
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:319
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 1003 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().

1004 {
1006  uint16_t msize;
1007 
1008  msize = sizeof(struct GNUNET_TESTBED_SlaveGetConfigurationMessage);
1009  msg = GNUNET_malloc (msize);
1010  msg->header.size = htons (msize);
1011  msg->header.type =
1013  msg->operation_id = GNUNET_htonll (op_id);
1014  msg->slave_id = htonl (slave_id);
1015  return msg;
1016 }
Message to request configuration of a slave controller.
Definition: testbed.h:637
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:652
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:642
uint32_t slave_id
The id of the slave host.
Definition: testbed.h:647
#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 1027 of file testbed_api.c.

References GNUNET_OK.

1029 {
1030  /* anything goes? */
1031  return GNUNET_OK;
1032 }
#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 1043 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.

1045 {
1046  struct GNUNET_TESTBED_Controller *c = cls;
1047  struct OperationContext *opc;
1048  uint64_t op_id;
1049  uint64_t mask;
1050  struct GNUNET_TESTBED_EventInformation event;
1051 
1052  op_id = GNUNET_ntohll (msg->operation_id);
1053  if (NULL == (opc = find_opc (c, op_id)))
1054  {
1055  LOG_DEBUG ("Operation not found\n");
1056  return;
1057  }
1058  if (OP_GET_SLAVE_CONFIG != opc->type)
1059  {
1060  GNUNET_break (0);
1061  return;
1062  }
1063  opc->state = OPC_STATE_FINISHED;
1064  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1066  if ((0 != (mask & c->event_mask)) && (NULL != c->cc))
1067  {
1070  event.op = opc->op;
1071  event.op_cls = opc->op_cls;
1072  event.details.operation_finished.generic = opc->data;
1073  event.details.operation_finished.emsg = NULL;
1074  c->cc (c->cc_cls, &event);
1075  }
1076 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
void * op_cls
The operation closure.
Definition: testbed_api.h:151
uint64_t operation_id
Operation ID.
Definition: testbed.h:674
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:2066
#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:265
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
A requested testbed operation has been completed.
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
The operation has finished.
Definition: testbed_api.h:129
Get slave config operation.
Definition: testbed_api.h:94
static struct OperationContext * find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
Returns the operation context with the given id if found in the Operation context queues of the contr...
Definition: testbed_api.c:272
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:136
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:319
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION.
Definition: testbed.h:664
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 1088 of file testbed_api.c.

References GNUNET_OK.

1091 {
1092  /* actual check to be implemented */
1093  return GNUNET_OK;
1094 }
#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 1105 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.

1108 {
1109  struct GNUNET_TESTBED_Controller *c = cls;
1110  struct OperationContext *opc;
1111  struct ControllerLinkData *data;
1113  struct GNUNET_TESTBED_Host *host;
1114  char *emsg;
1115  uint64_t op_id;
1116  struct GNUNET_TESTBED_EventInformation event;
1117 
1118  op_id = GNUNET_ntohll (msg->operation_id);
1119  if (NULL == (opc = find_opc (c, op_id)))
1120  {
1121  LOG_DEBUG ("Operation not found\n");
1122  return;
1123  }
1124  if (OP_FORWARDED == opc->type)
1125  {
1127  opc,
1128  (const struct GNUNET_MessageHeader *) msg);
1129  return;
1130  }
1131  if (OP_LINK_CONTROLLERS != opc->type)
1132  {
1133  GNUNET_break (0);
1134  return;
1135  }
1136  GNUNET_assert (NULL != (data = opc->data));
1138  GNUNET_assert (NULL != host);
1139  GNUNET_free (data);
1140  opc->data = NULL;
1141  opc->state = OPC_STATE_FINISHED;
1142  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1144  event.op = opc->op;
1145  event.op_cls = opc->op_cls;
1146  event.details.operation_finished.emsg = NULL;
1147  event.details.operation_finished.generic = NULL;
1148  emsg = NULL;
1149  cfg = NULL;
1150  if (GNUNET_NO == ntohs (msg->success))
1151  {
1152  emsg =
1153  GNUNET_malloc (ntohs (msg->header.size)
1154  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse)
1155  + 1);
1156  GNUNET_memcpy (emsg,
1157  &msg[1],
1158  ntohs (msg->header.size)
1159  - sizeof(struct GNUNET_TESTBED_ControllerLinkResponse));
1160  event.details.operation_finished.emsg = emsg;
1161  }
1162  else
1163  {
1164  if (0 != ntohs (msg->config_size))
1165  {
1167  (const struct GNUNET_MessageHeader *) msg);
1168  GNUNET_assert (NULL != cfg);
1170  }
1171  }
1172  if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
1173  {
1174  if (NULL != c->cc)
1175  c->cc (c->cc_cls, &event);
1176  }
1177  else
1178  LOG_DEBUG ("Not calling callback\n");
1179  if (NULL != cfg)
1181  GNUNET_free_non_null (emsg);
1182 }
uint64_t operation_id
The id of the operation which created this message.
Definition: testbed.h:190
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
void * op_cls
The operation closure.
Definition: testbed_api.h:151
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:174
#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:2066
#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:169
#define LOG_DEBUG(...)
Debug logging.
Definition: testbed_api.c:52
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:265
uint32_t host_id
The id of the host which is hosting the controller to be linked.
Definition: testbed_api.c:109
Link controllers operation.
Definition: testbed_api.h:89
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
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:166
uint16_t success
Set to GNUNET_YES to signify SUCCESS; GNUNET_NO to signify failure.
Definition: testbed.h:185
Forwarded operation.
Definition: testbed_api.h:84
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:180
The operation has finished.
Definition: testbed_api.h:129
configuration data
Definition: configuration.c:85
static struct OperationContext * find_opc(const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
Returns the operation context with the given id if found in the Operation context queues of the contr...
Definition: testbed_api.c:272
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
Context data for controller link operations.
Definition: testbed_api.c:99
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:415
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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:136
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:319
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 1195 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.

1197 {
1198  uint16_t msize;
1199  uint16_t name_len;
1200  int status;
1201  const char *name;
1202  size_t emsg_len;
1203 
1204  msize = ntohs (msg->header.size);
1205  name = msg->data;
1206  name_len = ntohs (msg->name_len);
1207 
1208  if (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg) + name_len + 1 > msize)
1209  {
1210  GNUNET_break_op (0);
1211  return GNUNET_SYSERR;
1212  }
1213  if ('\0' != name[name_len])
1214  {
1215  GNUNET_break_op (0);
1216  return GNUNET_SYSERR;
1217  }
1218  status = ntohs (msg->status);
1219  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1220  {
1221  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1222  + name_len + 1); /* +1!? */
1223  if (0 == emsg_len)
1224  {
1225  GNUNET_break_op (0);
1226  return GNUNET_SYSERR;
1227  }
1228  }
1229  return GNUNET_OK;
1230 }
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:836
#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:826
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:831
#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:842
const char * name
Message for signalling status changes of a barrier.
Definition: testbed.h:821

◆ 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 1241 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.

1243 {
1244  struct GNUNET_TESTBED_Controller *c = cls;
1245  struct GNUNET_TESTBED_Barrier *barrier;
1246  char *emsg;
1247  const char *name;
1248  struct GNUNET_HashCode key;
1249  size_t emsg_len;
1250  int status;
1251  uint16_t msize;
1252  uint16_t name_len;
1253 
1254  emsg = NULL;
1255  barrier = NULL;
1256  msize = ntohs (msg->header.size);
1257  if (msize <= sizeof(struct GNUNET_TESTBED_BarrierStatusMsg))
1258  {
1259  GNUNET_break_op (0);
1260  goto cleanup;
1261  }
1262  name = msg->data;
1263  name_len = ntohs (msg->name_len);
1264  if (name_len >= // name_len is strlen(barrier_name)
1265  (msize - ((sizeof msg->header) + sizeof(msg->status))))
1266  {
1267  GNUNET_break_op (0);
1268  goto cleanup;
1269  }
1270  if ('\0' != name[name_len])
1271  {
1272  GNUNET_break_op (0);
1273  goto cleanup;
1274  }
1275  LOG_DEBUG ("Received BARRIER_STATUS msg\n");
1276  status = ntohs (msg->status);
1277  if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status)
1278  {
1279  status = -1;
1280  // unlike name_len, emsg_len includes the trailing zero
1281  emsg_len = msize - (sizeof(struct GNUNET_TESTBED_BarrierStatusMsg)
1282  + (name_len + 1));
1283  if (0 == emsg_len)
1284  {
1285  GNUNET_break_op (0);
1286  goto cleanup;
1287  }
1288  if ('\0' != (msg->data[(name_len + 1) + (emsg_len - 1)]))
1289  {
1290  GNUNET_break_op (0);
1291  goto cleanup;
1292  }
1293  emsg = GNUNET_malloc (emsg_len);
1294  GNUNET_memcpy (emsg, msg->data + name_len + 1, emsg_len);
1295  }
1296  if (NULL == c->barrier_map)
1297  {
1298  GNUNET_break_op (0);
1299  goto cleanup;
1300  }
1301  GNUNET_CRYPTO_hash (name, name_len, &key);
1303  if (NULL == barrier)
1304  {
1305  GNUNET_break_op (0);
1306  goto cleanup;
1307  }
1308  GNUNET_assert (NULL != barrier->cb);
1309  if ((GNUNET_YES == barrier->echo) &&
1312  barrier->cb (barrier->cls, name, barrier, status, emsg);
1314  return; /* just initialised; skip cleanup */
1315 
1316 cleanup:
1317  GNUNET_free_non_null (emsg);if ((NULL != barrier) && (GNUNET_YES == barrier->echo))
1325 }
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:193
uint16_t name_len
strlen of the barrier name
Definition: testbed.h:836
#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:307
#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:826
void * cls
the closure for the above callback
Definition: testbed_api.h:302
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:831
#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:2334
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
Definition: crypto_hash.c:48
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:277
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:842
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:1335
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:260
Barrier initialised successfully.
#define GNUNET_YES
Definition: gnunet_common.h:77
Message for signalling status changes of a barrier.
Definition: testbed.h:821
#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:297
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 1335 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().

1337 {
1338  struct GNUNET_MQ_Envelope *env;
1339  struct GNUNET_MessageHeader *m2;
1340  uint16_t type;
1341  uint16_t size;
1342 
1343  type = ntohs (msg->type);
1344  size = ntohs (msg->size);
1347  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1348  GNUNET_memcpy (m2, msg, size);
1349  GNUNET_free (msg);
1350  GNUNET_MQ_send (controller->mq, env);
1351 }
#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:67
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:218
#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:353
#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 1369 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().

1375 {
1376  struct OperationContext *opc;
1377  struct ForwardedOperationData *data;
1378  struct GNUNET_MQ_Envelope *env;
1379  struct GNUNET_MessageHeader *m2;
1380  uint16_t type = ntohs (msg->type);
1381  uint16_t size = ntohs (msg->size);
1382 
1383  env = GNUNET_MQ_msg_extra (m2, size - sizeof(*m2), type);
1384  GNUNET_memcpy (m2, msg, size);
1385  GNUNET_MQ_send (controller->mq, env);
1386  data = GNUNET_new (struct ForwardedOperationData);
1387  data->cc = cc;
1388  data->cc_cls = cc_cls;
1389  opc = GNUNET_new (struct OperationContext);
1390  opc->c = controller;
1391  opc->type = OP_FORWARDED;
1392  opc->data = data;
1393  opc->id = operation_id;
1394  GNUNET_TESTBED_insert_opc_ (controller, opc);
1395  return opc;
1396 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
#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:161
GNUNET_MQ_MessageCallback cc
The callback to call when reply is available.
Definition: testbed_api.c:75
void * cc_cls
The closure for the above callback.
Definition: testbed_api.c:80
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
static unsigned int size
Size of the "table".
Definition: peer.c:67
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:84
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:218
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
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:298
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:353
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
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 1406 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().

1407 {
1408  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1409  GNUNET_free (opc->data);
1410  GNUNET_free (opc);
1411 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
#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:319
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 1421 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().

1422 {
1423  struct OperationContext *opc = cls;
1424  struct ControllerLinkData *data;
1426 
1427  GNUNET_assert (NULL != opc->data);
1428  data = opc->data;
1429  msg = data->msg;
1430  data->msg = NULL;
1431  opc->state = OPC_STATE_STARTED;
1432  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1433  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1434 }
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:141
The operation has been started.
Definition: testbed_api.h:123
#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:171
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:1335
Context data for controller link operations.
Definition: testbed_api.c:99
void GNUNET_TESTBED_insert_opc_(struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Inserts the given operation context into the operation context map of the given controller.
Definition: testbed_api.c:298
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
uint32_t data
The data value.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS.
Definition: testbed.h:141
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
Client notifies controller that it should delegate requests for a particular client to a particular s...
Definition: testbed.h:136
struct GNUNET_TESTBED_ControllerLinkRequest * msg
The controller link message.
Definition: testbed_api.c:104
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 1443 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().

1444 {
1445  struct OperationContext *opc = cls;
1446  struct ControllerLinkData *data;
1447 
1448  data = opc->data;
1449  switch (opc->state)
1450  {
1451  case OPC_STATE_INIT:
1452  GNUNET_free (data->msg);
1453  break;
1454 
1455  case OPC_STATE_STARTED:
1456  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1457  break;
1458 
1459  case OPC_STATE_FINISHED:
1460  break;
1461  }
1462  GNUNET_free_non_null (data);
1463  GNUNET_free (opc);
1464 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
The operation has been started.
Definition: testbed_api.h:123
#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:171
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:117
The operation has finished.
Definition: testbed_api.h:129
Context data for controller link operations.
Definition: testbed_api.c:99
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
#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:319
struct GNUNET_TESTBED_ControllerLinkRequest * msg
The controller link message.
Definition: testbed_api.c:104
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 1473 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_().

1474 {
1475  struct OperationContext *opc = cls;
1476  struct GetSlaveConfigData *data = opc->data;
1478 
1479  GNUNET_assert (NULL != data);
1481  GNUNET_free (opc->data);
1482  data = NULL;
1483  opc->data = NULL;
1484  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
1485  GNUNET_TESTBED_queue_message_ (opc->c, &msg->header);
1486  opc->state = OPC_STATE_STARTED;
1487 }
Message to request configuration of a slave controller.
Definition: testbed.h:637
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:141
The operation has been started.
Definition: testbed_api.h:123
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
Context data for get slave config operations.
Definition: testbed_api.c:87
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:1003
uint64_t id
The id of the opearation.
Definition: testbed_api.h:161
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
uint32_t slave_id
The id of the slave controller.
Definition: testbed_api.c:92
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:1335
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION.
Definition: testbed.h:642
void GNUNET_TESTBED_insert_opc_(struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Inserts the given operation context into the operation context map of the given controller.
Definition: testbed_api.c:298
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
#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 1496 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_().

1497 {
1498  struct OperationContext *opc = cls;
1499 
1500  switch (opc->state)
1501  {
1502  case OPC_STATE_INIT:
1503  GNUNET_free (opc->data);
1504  break;
1505 
1506  case OPC_STATE_STARTED:
1507  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
1508  break;
1509 
1510  case OPC_STATE_FINISHED:
1511  if (NULL != opc->data)
1513  break;
1514  }
1515  GNUNET_free (opc);
1516 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
The operation has been started.
Definition: testbed_api.h:123
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
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:117
The operation has finished.
Definition: testbed_api.h:129
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
#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:319
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 1528 of file testbed_api.c.

References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, and GNUNET_SCHEDULER_shutdown().

Referenced by GNUNET_TESTBED_controller_connect().

1529 {
1530  /* struct GNUNET_TESTBED_Controller *c = cls; */
1531 
1532  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Encountered MQ error: %d\n", error);
1533  /* now what? */
1534  GNUNET_SCHEDULER_shutdown (); /* seems most reasonable */
1535 }
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:526
#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 1698 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().

1699 {
1700  struct GNUNET_CONTAINER_MultiHashMap32 *map = cls;
1701  struct OperationContext *opc = value;
1702 
1703  GNUNET_assert (NULL != opc);
1704  GNUNET_break (0);
1707  GNUNET_free (opc);
1708  return GNUNET_YES;
1709 }
#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:136
#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 1757 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().

1760 {
1761  size_t xsize;
1762 
1763  xsize = compressBound ((uLong) size);
1764  *xconfig = GNUNET_malloc (xsize);
1765  GNUNET_assert (Z_OK == compress2 ((Bytef *) *xconfig,
1766  (uLongf *) &xsize,
1767  (const Bytef *) config,
1768  (uLongf) size,
1769  Z_BEST_SPEED));
1770  return xsize;
1771 }
#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:67
#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 1784 of file testbed_api.c.

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

Referenced by send_controller_link_response().

1787 {
1788  char *config;
1789  char *xconfig;
1790  size_t size_;
1791  size_t xsize_;
1792 
1793  config = GNUNET_CONFIGURATION_serialize (cfg, &size_);
1794  xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig);
1795  GNUNET_free (config);
1796  *size = size_;
1797  *xsize = xsize_;
1798  return xconfig;
1799 }
static const struct GNUNET_CONFIGURATION_Handle * config
static unsigned int size
Size of the "table".
Definition: peer.c:67
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1757
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 1893 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().

1896 {
1897  struct OperationContext *opc;
1898  struct GetSlaveConfigData *data;
1899 
1900  data = GNUNET_new (struct GetSlaveConfigData);
1901  data->slave_id = slave_host_id;
1902  opc = GNUNET_new (struct OperationContext);
1903  opc->state = OPC_STATE_INIT;
1904  opc->c = master;
1905  opc->id = GNUNET_TESTBED_get_next_op_id (master);
1906  opc->type = OP_GET_SLAVE_CONFIG;
1907  opc->data = data;
1908  opc->op_cls = op_cls;
1913  opc->op);
1915  return opc->op;
1916 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:146
void * op_cls
The operation closure.
Definition: testbed_api.h:151
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:87
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:2208
#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:1496
uint64_t id
The id of the opearation.
Definition: testbed_api.h:161
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
uint32_t slave_id
The id of the slave controller.
Definition: testbed_api.c:92
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:117
Get slave config operation.
Definition: testbed_api.h:94
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:244
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:1473
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
uint32_t data
The data value.
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
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 1980 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().

1984 {
1986  char *config;
1987  char *xconfig;
1988  size_t config_size;
1989  size_t xconfig_size;
1990  uint16_t trusted_ip_len;
1991  uint16_t hostname_len;
1992  uint16_t msg_size;
1993 
1994  config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
1995  GNUNET_assert (NULL != config);
1996  xconfig_size =
1997  GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
1998  GNUNET_free (config);
1999  trusted_ip_len = strlen (trusted_ip);
2000  hostname_len = (NULL == hostname) ? 0 : strlen (hostname);
2001  msg_size = xconfig_size + trusted_ip_len + 1
2002  + sizeof(struct GNUNET_TESTBED_HelperInit);
2003  msg_size += hostname_len;
2004  msg = GNUNET_realloc (xconfig, msg_size);
2005  (void) memmove (((void *) &msg[1]) + trusted_ip_len + 1 + hostname_len,
2006  msg,
2007  xconfig_size);
2008  msg->header.size = htons (msg_size);
2009  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_INIT);
2010  msg->trusted_ip_size = htons (trusted_ip_len);
2011  msg->hostname_size = htons (hostname_len);
2012  msg->config_size = htons (config_size);
2013  (void) strcpy ((char *) &msg[1], trusted_ip);
2014  if (0 != hostname_len)
2015  GNUNET_memcpy ((char *) &msg[1] + trusted_ip_len + 1,
2016  hostname,
2017  hostname_len);
2018  return msg;
2019 }
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:1757
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 2066 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().

2067 {
2069  Bytef *data;
2070  const Bytef *xdata;
2071  uLong data_len;
2072  uLong xdata_len;
2073  int ret;
2074 
2075  switch (ntohs (msg->type))
2076  {
2079 
2080  imsg =
2082  data_len = (uLong) ntohs (imsg->config_size);
2083  xdata_len =
2084  ntohs (imsg->header.size)
2086  xdata = (const Bytef *) &imsg[1];
2087  }
2088  break;
2089 
2091  const struct GNUNET_TESTBED_SlaveConfiguration *imsg;
2092 
2093  imsg = (const struct GNUNET_TESTBED_SlaveConfiguration *) msg;
2094  data_len = (uLong) ntohs (imsg->config_size);
2095  xdata_len = ntohs (imsg->header.size)
2096  - sizeof(struct GNUNET_TESTBED_SlaveConfiguration);
2097  xdata = (const Bytef *) &imsg[1];
2098  }
2099  break;
2100 
2102  const struct GNUNET_TESTBED_AddHostMessage *imsg;
2103  uint16_t osize;
2104 
2105  imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
2106  data_len = (uLong) ntohs (imsg->config_size);
2107  osize = sizeof(struct GNUNET_TESTBED_AddHostMessage)
2108  + ntohs (imsg->username_length) + ntohs (imsg->hostname_length);
2109  xdata_len = ntohs (imsg->header.size) - osize;
2110  xdata = (const Bytef *) ((const void *) imsg + osize);
2111  }
2112  break;
2113 
2115  const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
2116 
2117  imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg;
2118  data_len = ntohs (imsg->config_size);
2119  xdata_len = ntohs (imsg->header.size)
2120  - sizeof(const struct GNUNET_TESTBED_ControllerLinkResponse);
2121  xdata = (const Bytef *) &imsg[1];
2122  }
2123  break;
2124 
2126  const struct GNUNET_TESTBED_PeerCreateMessage *imsg;
2127 
2128  imsg = (const struct GNUNET_TESTBED_PeerCreateMessage *) msg;
2129  data_len = ntohs (imsg->config_size);
2130  xdata_len = ntohs (imsg->header.size)
2131  - sizeof(struct GNUNET_TESTBED_PeerCreateMessage);
2132  xdata = (const Bytef *) &imsg[1];
2133  }
2134  break;
2135 
2137  const struct GNUNET_TESTBED_PeerReconfigureMessage *imsg;
2138 
2139  imsg = (const struct GNUNET_TESTBED_PeerReconfigureMessage *) msg;
2140  data_len = ntohs (imsg->config_size);
2141  xdata_len = ntohs (imsg->header.size)
2142  - sizeof(struct GNUNET_TESTBED_PeerReconfigureMessage);
2143  xdata = (const Bytef *) &imsg[1];
2144  }
2145  break;
2146 
2147  default:
2148  GNUNET_assert (0);
2149  }
2150  data = GNUNET_malloc (data_len);
2151  if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
2152  {
2153  GNUNET_free (data);
2154  GNUNET_break_op (0); /* Un-compression failure */
2155  return NULL;
2156  }
2157  cfg = GNUNET_CONFIGURATION_create ();
2159  (const char *) data,
2160  (size_t) data_len,
2161  NULL))
2162  {
2163  GNUNET_free (data);
2164  GNUNET_break_op (0); /* De-serialization failure */
2165  return NULL;
2166  }
2167  GNUNET_free (data);
2168  return cfg;
2169 }
#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:86
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER.
Definition: testbed.h:245
Message sent from client to testing service to reconfigure a (stopped) a peer.
Definition: testbed.h:240
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT.
Definition: testbed.h:174
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER.
Definition: testbed.h:209
#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:64
uint16_t config_size
The length of the uncompressed configuration.
Definition: testbed.h:97
Peer configuration and identity reply from controller to a client.
Definition: testbed.h:603
uint16_t hostname_length
Number of bytes in the host name (excluding 0-termination) that follows the user name; cannot be 0...
Definition: testbed.h:92
uint16_t config_size
The size of the configuration when uncompressed.
Definition: testbed.h:679
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION.
Definition: testbed.h:608
#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...
Response message for ControllerLinkRequest message.
Definition: testbed.h:169
uint16_t config_size
The length of the serialized configuration when uncompressed.
Definition: testbed.h:260
uint16_t config_size
The size of configuration when uncompressed.
Definition: testbed.h:628
#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:204
Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message.
Definition: testbed.h:659
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST.
Definition: testbed.h:69
uint16_t config_size
The size of the compressed configuration.
Definition: testbed.h:180
#define GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
Message to create a peer at a host.
configuration data
Definition: configuration.c:85
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:229
#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:664
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 2180 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().

2182 {
2183  uint16_t msize;
2184  const char *emsg;
2185 
2186  msize = ntohs (msg->header.size);
2187  if (sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage) >= msize)
2188  return NULL;
2189  msize -= sizeof(struct GNUNET_TESTBED_OperationFailureEventMessage);
2190  emsg = (const char *) &msg[1];
2191  if ('\0' != emsg[msize - 1])
2192  {
2193  GNUNET_break (0);
2194  return NULL;
2195  }
2196  return emsg;
2197 }
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT.
Definition: testbed.h:513
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:508
#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 2208 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().

2209 {
2210  uint64_t op_id;
2211 
2212  op_id = (uint64_t) GNUNET_TESTBED_host_get_id_ (controller->host);
2213  op_id = op_id << 32;
2214  op_id |= (uint64_t) controller->operation_counter++;
2215  return op_id;
2216 }
uint32_t operation_counter
The operation id counter.
Definition: testbed_api.h:270
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:198
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 2225 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().

2226 {
2227  struct OperationContext *opc = cls;
2228  struct GNUNET_MQ_Envelope *env;
2230 
2231  opc->state = OPC_STATE_STARTED;
2233  msg->operation_id = GNUNET_htonll (opc->id);
2234  GNUNET_TESTBED_insert_opc_ (opc->c, opc);
2235  GNUNET_MQ_send (opc->c->mq, env);
2236 }
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:141
The operation has been started.
Definition: testbed_api.h:123
Shutdown peers message.
Definition: testbed.h:688
#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:698
uint64_t id
The id of the opearation.
Definition: testbed_api.h:161
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
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:218
void GNUNET_TESTBED_insert_opc_(struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Inserts the given operation context into the operation context map of the given controller.
Definition: testbed_api.c:298
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:353
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
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 2245 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().

2246 {
2247  struct OperationContext *opc = cls;
2248 
2249  switch (opc->state)
2250  {
2251  case OPC_STATE_STARTED:
2252  GNUNET_TESTBED_remove_opc_ (opc->c, opc);
2253 
2254  /* no break; continue */
2255  case OPC_STATE_INIT:
2256  GNUNET_free (opc->data);
2257  break;
2258 
2259  case OPC_STATE_FINISHED:
2260  break;
2261  }
2262  GNUNET_free (opc);
2263 }
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:141
The operation has been started.
Definition: testbed_api.h:123
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:117
The operation has finished.
Definition: testbed_api.h:129
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
#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:319
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 2334 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().

2335 {
2336  struct GNUNET_TESTBED_Controller *c = barrier->c;
2337 
2338  GNUNET_assert (NULL != c->barrier_map); /* No barriers present */
2341  &barrier->key,
2342  barrier));
2343  GNUNET_free (barrier->name);
2344  GNUNET_free (barrier);
2346  {
2348  c->barrier_map = NULL;
2349  }
2350 }
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:193
#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:292
struct GNUNET_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:287
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:282
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:260
#define 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 2370 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().

2376 {
2378  struct GNUNET_MQ_Envelope *env;
2379  struct GNUNET_TESTBED_Barrier *barrier;
2380  struct GNUNET_HashCode key;
2381  size_t name_len;
2382 
2383  GNUNET_assert (quorum <= 100);
2384  GNUNET_assert (NULL != cb);
2385  name_len = strlen (name);
2386  GNUNET_assert (0 < name_len);
2387  GNUNET_CRYPTO_hash (name, name_len, &key);
2388  if (NULL == controller->barrier_map)
2389  controller->barrier_map =
2391  if (GNUNET_YES ==
2393  {
2394  GNUNET_break (0);
2395  return NULL;
2396  }
2397  LOG_DEBUG ("Initialising barrier `%s'\n", name);
2398  barrier = GNUNET_new (struct GNUNET_TESTBED_Barrier);
2399  barrier->c = controller;
2400  barrier->name = GNUNET_strdup (name);
2401  barrier->cb = cb;
2402  barrier->cls = cls;
2403  barrier->echo = echo;
2404  GNUNET_memcpy (&barrier->key, &key, sizeof(struct GNUNET_HashCode));
2407  controller->barrier_map,
2408  &barrier->key,
2409  barrier,
2411 
2412  env = GNUNET_MQ_msg_extra (msg,
2413  name_len,
2415  msg->quorum = (uint8_t) quorum;
2416  GNUNET_memcpy (msg->name, barrier->name, name_len);
2417  GNUNET_MQ_send (barrier->c->mq, env);
2418  return barrier;
2419 }
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:307
#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:302
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:48
char * name
The name of the barrier.
Definition: testbed_api.h:292
Handle for barrier.
Definition: testbed_api.h:277
A 512-bit hashcode.
struct GNUNET_HashCode key
The key used in the DHT.
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:287
struct GNUNET_HashCode key
hashcode identifying this barrier in the hashmap
Definition: testbed_api.h:282
const char * name
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:218
uint8_t quorum
The quorum percentage needed for crossing the barrier.
Definition: testbed.h:792
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:260
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:353
char name[0]
name of the barrier.
Definition: testbed.h:797
#define GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
Message to initialise a barrier.
Message to initialise a barrier.
Definition: testbed.h:782
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:297
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ exop_head

struct ExpireOperationEntry* exop_head
static

DLL head for list of operations marked for expiry.

Definition at line 155 of file testbed_api.c.

Referenced by exop_check().

◆ exop_tail

struct ExpireOperationEntry* exop_tail
static

DLL tail for list of operation marked for expiry.

Definition at line 160 of file testbed_api.c.