GNUnet  0.11.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 
43 #define HELPER_CMDS_BINARY "./../testbed/gnunet-cmds-helper"
44 
45 
50 {
55 
60 
65 
70 
75 
80 
85 
90 
95 
100 
105 
110 };
111 
112 
117 {
123 
129 
135 };
136 
137 
142 {
147 
152 
156  void *op_cls;
157 
161  void *data;
162 
166  uint64_t id;
167 
172 
177 };
178 
179 
185 typedef void
186 (*TESTBED_opcq_empty_cb) (void *cls);
187 
198 {
203 
208 
212  void *cc_cls;
213 
218 
223 
229 
234 
239 
244 
249 
254 
259 
265 
269  uint64_t event_mask;
270 
275 };
276 
277 
282 {
287 
292 
296  char *name;
297 
302 
306  void *cls;
307 
311  int echo;
312 };
313 
314 
322 void
324  struct GNUNET_MessageHeader *msg);
325 
326 
335 void
337  struct OperationContext *opc);
338 
339 
347 void
349  struct OperationContext *opc);
350 
351 
361 size_t
363  size_t size,
364  char **xconfig);
365 
366 
376 char *
378  size_t *size,
379  size_t *xsize);
380 
381 
396 GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
397  const char *hostname,
398  const struct
400 
401 
416 struct OperationContext *
418  GNUNET_TESTBED_Controller *controller,
419  uint64_t operation_id,
420  const struct GNUNET_MessageHeader *msg,
422  void *cc_cls);
423 
430 void
432 
433 
445 
446 
454 const char *
457  *msg);
458 
459 
467 uint64_t
469 
470 
485  struct GNUNET_TESTBED_Controller *master,
486  uint32_t slave_host_id);
487 
488 
505 struct GNUNET_TESTBED_Barrier *
507  const char *name,
508  unsigned int quorum,
510  void *cls,
511  int echo);
512 
513 
520 void
522 
523 
524 #endif
525 /* 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:2371
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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:1785
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:197
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:146
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:151
void * op_cls
The operation closure.
Definition: testbed_api.h:156
The operation has been started.
Definition: testbed_api.h:128
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:217
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:238
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:228
static int echo
Request echo service.
Definition: gnunet-cadet.c:67
Stop and destroy all peers.
Definition: testbed_api.h:104
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:2181
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:311
void * cls
the closure for the above callback
Definition: testbed_api.h:306
Opaque handle to a host running experiments managed by the testing framework.
Event notification from a controller to a client.
Definition: testbed.h:508
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:274
Opaque handle to an abstract operation to be executed by the testing framework.
Reconfigure a peer.
Definition: testbed_api.h:79
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
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:269
Link controllers operation.
Definition: testbed_api.h:94
uint64_t id
The id of the operation.
Definition: testbed_api.h:166
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:253
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:176
Peer destroy operation.
Definition: testbed_api.h:69
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:233
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:1894
Peer start operation.
Definition: testbed_api.h:59
char * name
The name of the barrier.
Definition: testbed_api.h:296
Internal representation of the hash map.
enum OperationType type
The type of operation.
Definition: testbed_api.h:171
Handle for barrier.
Definition: testbed_api.h:281
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:1336
struct OperationQueue * opq_parallel_topology_config_operations
Operation queue for simultaneous topology configuration operations.
Definition: testbed_api.h:258
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:1370
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:67
Overlay connection operation.
Definition: testbed_api.h:84
Forwarded operation.
Definition: testbed_api.h:89
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:122
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:134
Peer stop operation.
Definition: testbed_api.h:64
struct GNUNET_TESTBED_Controller * c
The controller handle given while initialising this barrier.
Definition: testbed_api.h:291
Handle to a message queue.
Definition: mq.c:85
Get slave config operation.
Definition: testbed_api.h:99
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:243
Start/stop service at a peer.
Definition: testbed_api.h:109
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:186
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:248
static char * hostname
Our hostname; we give this to all the peers we start.
configuration data
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:2335
const char * name
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:1407
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:222
Peer create operation.
Definition: testbed_api.h:54
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:212
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:264
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:202
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1758
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:319
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:116
void * data
Data relevant to the operation.
Definition: testbed_api.h:161
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:2209
Get peer information operation.
Definition: testbed_api.h:74
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:141
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:1981
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:301
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:207
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:2067