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 
45 {
50 
55 
60 
65 
70 
75 
80 
85 
90 
95 
100 
105 };
106 
107 
108 
113 {
119 
125 
131 };
132 
133 
138 {
143 
148 
152  void *op_cls;
153 
157  void *data;
158 
162  uint64_t id;
163 
168 
173 };
174 
175 
181 typedef void
182 (*TESTBED_opcq_empty_cb) (void *cls);
183 
184 
195 {
200 
205 
209  void *cc_cls;
210 
215 
220 
226 
231 
236 
241 
246 
251 
256 
262 
266  uint64_t event_mask;
267 
272 
273 };
274 
275 
280 {
285 
290 
294  char *name;
295 
300 
304  void *cls;
305 
309  int echo;
310 };
311 
312 
313 
321 void
323  struct GNUNET_MessageHeader *msg);
324 
325 
334 void
336  struct OperationContext *opc);
337 
338 
346 void
348  struct OperationContext *opc);
349 
350 
360 size_t
362  size_t size,
363  char **xconfig);
364 
365 
375 char *
377  size_t *size,
378  size_t *xsize);
379 
380 
395 GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
396  const char *hostname,
397  const struct GNUNET_CONFIGURATION_Handle *cfg);
398 
399 
414 struct OperationContext *
416  uint64_t operation_id,
417  const struct GNUNET_MessageHeader *msg,
419  void *cc_cls);
420 
427 void
429 
430 
442 
443 
451 const char *
453 
454 
462 uint64_t
464 
465 
480  struct GNUNET_TESTBED_Controller *master,
481  uint32_t slave_host_id);
482 
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 
521 #endif
522 /* 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:2338
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:1760
Handle to interact with a GNUnet testbed controller.
Definition: testbed_api.h:194
struct GNUNET_TESTBED_Controller * c
The controller to which this operation context belongs to.
Definition: testbed_api.h:142
struct GNUNET_TESTBED_Operation * op
The operation.
Definition: testbed_api.h:147
void * op_cls
The operation closure.
Definition: testbed_api.h:152
The operation has been started.
Definition: testbed_api.h:124
struct GNUNET_CONFIGURATION_Handle * cfg
The configuration to use while connecting to controller.
Definition: testbed_api.h:214
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:235
struct GNUNET_TESTBED_HostRegistrationHandle * rh
The host registration handle; NULL if no current registration requests are present.
Definition: testbed_api.h:225
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:2150
int echo
Should the barrier crossed status message be echoed back to the controller?
Definition: testbed_api.h:309
void * cls
the closure for the above callback
Definition: testbed_api.h:304
Opaque handle to a host running experiments managed by the testing framework.
Event notification from a controller to a client.
Definition: testbed.h:536
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:271
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:299
uint64_t event_mask
The controller event mask.
Definition: testbed_api.h:266
Link controllers operation.
Definition: testbed_api.h:89
uint64_t id
The id of the opearation.
Definition: testbed_api.h:162
struct OperationQueue * opq_parallel_service_connections
Operation queue for simultaneous service connections.
Definition: testbed_api.h:250
enum OperationContextState state
The state of the operation.
Definition: testbed_api.h:172
Peer destroy operation.
Definition: testbed_api.h:64
struct GNUNET_CONTAINER_MultiHashMap32 * opc_map
The map of active operation contexts.
Definition: testbed_api.h:230
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:1869
Peer start operation.
Definition: testbed_api.h:54
char * name
The name of the barrier.
Definition: testbed_api.h:294
Internal representation of the hash map.
enum OperationType type
The type of operation.
Definition: testbed_api.h:167
Handle for barrier.
Definition: testbed_api.h:279
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:1315
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:255
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:1349
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
const char * name
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:118
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:130
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:289
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:240
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:182
struct OperationQueue * opq_parallel_operations
Operation queue for simultaneous operations.
Definition: testbed_api.h:245
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:2302
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:1386
struct GNUNET_MQ_Handle * mq
The message queue to the controller service.
Definition: testbed_api.h:219
Peer create operation.
Definition: testbed_api.h:49
void * cc_cls
The closure for controller callback.
Definition: testbed_api.h:209
struct GNUNET_CONTAINER_MultiHashMap * barrier_map
handle for hashtable of barrier handles, values are of type struct GNUNET_TESTBED_Barrier.
Definition: testbed_api.h:261
struct GNUNET_TESTBED_Host * host
The host where the controller is running.
Definition: testbed_api.h:199
size_t GNUNET_TESTBED_compress_config_(const char *config, size_t size, char **xconfig)
Compresses given configuration using zlib compress.
Definition: testbed_api.c:1733
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:320
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:112
void * data
Data relevant to the operation.
Definition: testbed_api.h:157
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:2178
Get peer information operation.
Definition: testbed_api.h:69
Context information for GNUNET_TESTBED_Operation.
Definition: testbed_api.h:137
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:1956
GNUNET_TESTBED_barrier_status_cb cb
The continuation callback to call when we have a status update on this.
Definition: testbed_api.h:299
GNUNET_TESTBED_ControllerCallback cc
The controller callback.
Definition: testbed_api.h:204
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:2042