GNUnet  0.10.x
testbed_api.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2008--2013 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
27 #ifndef TESTBED_API_H
28 #define TESTBED_API_H
29 
30 #include "gnunet_util_lib.h"
31 #include "gnunet_testbed_service.h"
32 #include "testbed.h"
33 #include "testbed_helper.h"
34 
38 #define HELPER_TESTBED_BINARY "gnunet-helper-testbed"
39 
40 
49 
54 
59 
64 
69 
74 
79 
84 
89 
94 
99 
104 };
105 
106 
107 
117 
123 
129 };
130 
131 
140 
145 
149  void *op_cls;
150 
154  void *data;
155 
159  uint64_t id;
160 
165 
170 };
171 
172 
178 typedef void
179 (*TESTBED_opcq_empty_cb) (void *cls);
180 
181 
196 
201 
205  void *cc_cls;
206 
211 
216 
222 
227 
232 
237 
242 
247 
252 
258 
262  uint64_t event_mask;
263 
268 };
269 
270 
279 
284 
288  char *name;
289 
294 
298  void *cls;
299 
303  int echo;
304 };
305 
306 
307 
315 void
317  struct GNUNET_MessageHeader *msg);
318 
319 
328 void
330  struct OperationContext *opc);
331 
332 
340 void
342  struct OperationContext *opc);
343 
344 
354 size_t
356  size_t size,
357  char **xconfig);
358 
359 
369 char *
371  size_t *size,
372  size_t *xsize);
373 
374 
390  const char *hostname,
391  const struct GNUNET_CONFIGURATION_Handle *cfg);
392 
393 
408 struct OperationContext *
410  uint64_t operation_id,
411  const struct GNUNET_MessageHeader *msg,
413  void *cc_cls);
414 
421 void
423 
424 
436 
437 
445 const char *
447 
448 
456 uint64_t
458 
459 
474  struct GNUNET_TESTBED_Controller *master,
475  uint32_t slave_host_id);
476 
477 
478 
495 struct GNUNET_TESTBED_Barrier *
497  const char *name,
498  unsigned int quorum,
500  void *cls,
501  int echo);
502 
503 
510 void
512 
513 
514 
515 #endif
516 /* end of testbed_api.h */
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...
Definition: testbed_api.c:2363
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
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...
Definition: testbed_api.c:1777
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:191
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:139
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:144
void * op_cls
The operation closure.
Definition: testbed_api.h:149
The operation has been started.
Definition: testbed_api.h:122
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:210
void(* GNUNET_TESTBED_barrier_status_cb)(void *cls, const char *name, struct GNUNET_TESTBED_Barrier *barrier, enum GNUNET_TESTBED_BarrierStatus status, const char *emsg)
Functions of this type are to be given as callback argument to GNUNET_TESTBED_barrier_init().
TESTBED_opcq_empty_cb opcq_empty_cb
If this callback is not NULL, schedule it as a task when opc_map gets empty.
Definition: testbed_api.h:231
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:221
static int echo
Request echo service.
Definition: gnunet-cadet.c:67
Stop and destroy all peers.
Definition: testbed_api.h:98
IPC messages between testing API and service ("controller")
void(* GNUNET_TESTBED_ControllerCallback)(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Signature of the event handler function called by the respective event controller.
const char * GNUNET_TESTBED_parse_error_string_(const struct GNUNET_TESTBED_OperationFailureEventMessage *msg)
Checks the integrity of the OpeationFailureEventMessage and if good returns the error message it cont...
Definition: testbed_api.c:2173
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:303
void * cls
the closure for the above callback
Definition: testbed_api.h:298
Opaque handle to a host running experiments managed by the testing framework.
Event notification from a controller to a client.
Definition: testbed.h:493
Initialization message for gnunet-helper-testbed to start testbed service.
Internal representation of the hash map.
uint32_t operation_counter
The operation id counter.
Definition: testbed_api.h:267
Opaque handle to an abstract operation to be executed by the testing framework.
Reconfigure a peer.
Definition: testbed_api.h:73
void GNUNET_TESTBED_insert_opc_(struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Inserts the given operation context into the operation context map of the given controller.
Definition: testbed_api.c:292
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:262
Link controllers operation.
Definition: testbed_api.h:88
uint64_t id
The id of the opearation.
Definition: testbed_api.h:159
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:246
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:169
Peer destroy operation.
Definition: testbed_api.h:63
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:226
static const struct GNUNET_CONFIGURATION_Handle * 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.
Definition: testbed_api.c:1886
Peer start operation.
Definition: testbed_api.h:53
char * name
The name of the barrier.
Definition: testbed_api.h:288
Internal representation of the hash map.
enum OperationType type
The type of operation.
Definition: testbed_api.h:164
Handle for barrier.
Definition: testbed_api.h:274
A 512-bit hashcode.
void GNUNET_TESTBED_queue_message_(struct GNUNET_TESTBED_Controller *controller, struct GNUNET_MessageHeader *msg)
Queues a message in send queue for sending to the service.
Definition: testbed_api.c:1328
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
struct OperationQueue * opq_parallel_topology_config_operations
Operation queue for simultaneous topology configuration operations.
Definition: testbed_api.h:251
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.
Definition: testbed_api.c:1362
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:66
Overlay connection operation.
Definition: testbed_api.h:78
const char * name
Forwarded operation.
Definition: testbed_api.h:83
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:116
void(* GNUNET_MQ_MessageCallback)(void *cls, const struct GNUNET_MessageHeader *msg)
Called when a message has been received.
The operation has finished.
Definition: testbed_api.h:128
Peer stop operation.
Definition: testbed_api.h:58
struct GNUNET_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:283
Handle to a message queue.
Definition: mq.c:84
Get slave config operation.
Definition: testbed_api.h:93
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:236
Start/stop service at a peer.
Definition: testbed_api.h:103
Queue of operations where we can only support a certain number of concurrent operations of a particul...
void(* TESTBED_opcq_empty_cb)(void *cls)
Operation empty callback.
Definition: testbed_api.h:179
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:241
static char * hostname
Our hostname; we give this to all the peers we start.
configuration data
Definition: configuration.c:83
void GNUNET_TESTBED_barrier_remove_(struct GNUNET_TESTBED_Barrier *barrier)
Remove a barrier and it was the last one in the barrier hash map, destroy the hash map...
Definition: testbed_api.c:2327
void GNUNET_TESTBED_forward_operation_msg_cancel_(struct OperationContext *opc)
Function to cancel an operation created by simply forwarding an operation message.
Definition: testbed_api.c:1399
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:215
Peer create operation.
Definition: testbed_api.h:48
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:205
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:257
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:195
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1750
handle for host registration
void GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, struct OperationContext *opc)
Removes the given operation context from the operation context map of the given controller.
Definition: testbed_api.c:313
Header for all communications.
Message formats for communication between testbed api and gnunet-helper-testbed process.
OperationContextState
Enumeration of states of OperationContext.
Definition: testbed_api.h:111
void * data
Data relevant to the operation.
Definition: testbed_api.h:154
uint64_t GNUNET_TESTBED_get_next_op_id(struct GNUNET_TESTBED_Controller *controller)
Function to return the operation id for a controller.
Definition: testbed_api.c:2201
Get peer information operation.
Definition: testbed_api.h:68
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:135
struct GNUNET_TESTBED_HelperInit * GNUNET_TESTBED_create_helper_init_msg_(const char *cname, const char *hostname, const struct GNUNET_CONFIGURATION_Handle *cfg)
Creates a helper initialization message.
Definition: testbed_api.c:1973
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:293
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:200
struct GNUNET_CONFIGURATION_Handle * GNUNET_TESTBED_extract_config_(const struct GNUNET_MessageHeader *msg)
Generates configuration by uncompressing configuration in given message.
Definition: testbed_api.c:2059