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 
40 
45 {
50 
55 
60 
65 
70 
75 
80 
85 
90 
95 
100 
105 };
106 
107 
112 {
118 
124 
130 };
131 
132 
137 {
142 
147 
151  void *op_cls;
152 
156  void *data;
157 
161  uint64_t id;
162 
167 
172 };
173 
174 
180 typedef void
181 (*TESTBED_opcq_empty_cb) (void *cls);
182 
183 
194 {
199 
204 
208  void *cc_cls;
209 
214 
219 
225 
230 
235 
240 
245 
250 
255 
261 
265  uint64_t event_mask;
266 
271 };
272 
273 
278 {
283 
288 
292  char *name;
293 
298 
302  void *cls;
303 
307  int echo;
308 };
309 
310 
318 void
320  struct GNUNET_MessageHeader *msg);
321 
322 
331 void
333  struct OperationContext *opc);
334 
335 
343 void
345  struct OperationContext *opc);
346 
347 
357 size_t
359  size_t size,
360  char **xconfig);
361 
362 
372 char *
374  size_t *size,
375  size_t *xsize);
376 
377 
392 GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
393  const char *hostname,
394  const struct
396 
397 
412 struct OperationContext *
414  GNUNET_TESTBED_Controller *controller,
415  uint64_t operation_id,
416  const struct GNUNET_MessageHeader *msg,
418  void *cc_cls);
419 
426 void
428 
429 
441 
442 
450 const char *
453  *msg);
454 
455 
463 uint64_t
465 
466 
481  struct GNUNET_TESTBED_Controller *master,
482  uint32_t slave_host_id);
483 
484 
501 struct GNUNET_TESTBED_Barrier *
503  const char *name,
504  unsigned int quorum,
506  void *cls,
507  int echo);
508 
509 
516 void
518 
519 
520 #endif
521 /* 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:2370
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:1784
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
The operation has been started.
Definition: testbed_api.h:123
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:213
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:234
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:224
static int echo
Request echo service.
Definition: gnunet-cadet.c:67
Stop and destroy all peers.
Definition: testbed_api.h:99
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:2180
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:307
void * cls
the closure for the above callback
Definition: testbed_api.h:302
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:270
Opaque handle to an abstract operation to be executed by the testing framework.
Reconfigure a peer.
Definition: testbed_api.h:74
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:265
Link controllers operation.
Definition: testbed_api.h:89
uint64_t id
The id of the opearation.
Definition: testbed_api.h:161
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:249
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:171
Peer destroy operation.
Definition: testbed_api.h:64
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:229
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:1893
Peer start operation.
Definition: testbed_api.h:54
char * name
The name of the barrier.
Definition: testbed_api.h:292
Internal representation of the hash map.
enum OperationType type
The type of operation.
Definition: testbed_api.h:166
Handle for barrier.
Definition: testbed_api.h:277
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:1335
struct OperationQueue * opq_parallel_topology_config_operations
Operation queue for simultaneous topology configuration operations.
Definition: testbed_api.h:254
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:1369
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:79
Forwarded operation.
Definition: testbed_api.h:84
The initial state where the associated operation has just been created and is waiting in the operatio...
Definition: testbed_api.h:117
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:129
Peer stop operation.
Definition: testbed_api.h:59
struct GNUNET_TESTBED_Controller * c
The controller handle given while initiliasing this barrier.
Definition: testbed_api.h:287
Handle to a message queue.
Definition: mq.c:85
Get slave config operation.
Definition: testbed_api.h:94
void * opcq_empty_cls
Closure for the above task.
Definition: testbed_api.h:239
Start/stop service at a peer.
Definition: testbed_api.h:104
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:181
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:244
static char * hostname
Our hostname; we give this to all the peers we start.
configuration data
Definition: configuration.c:85
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
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:1406
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:218
Peer create operation.
Definition: testbed_api.h:49
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:208
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_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:198
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
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:111
void * data
Data relevant to the operation.
Definition: testbed_api.h:156
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
Get peer information operation.
Definition: testbed_api.h:69
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:136
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:1980
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:297
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:203
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