2 This file is part of GNUnet
3 (C) 2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file testbed/testbed_api.h
23 * @brief Interface for functions internally exported from testbed_api.c
24 * @author Sree Harsha Totakura
32 * Enumeration of operations
37 * Peer create operation
42 * Peer start operation
52 * Peer destroy operation
57 * Get peer information operation
62 * Overlay connection operation
70 * Testbed operation structure
72 struct GNUNET_TESTBED_Operation
75 * next pointer for DLL
77 struct GNUNET_TESTBED_Operation *next;
80 * prev pointer for DLL
82 struct GNUNET_TESTBED_Operation *prev;
85 * The controller on which this operation operates
87 struct GNUNET_TESTBED_Controller *controller;
90 * The ID for the operation;
92 uint64_t operation_id;
95 * The type of operation
97 enum OperationType type;
100 * Data specific to OperationType
107 * The message queue for sending messages to the controller service
112 * Structure for a controller link
114 struct ControllerLink;
117 * Context information for GNUNET_TESTBED_Operation
119 struct OperationContext
124 struct OperationContext *next;
129 struct OperationContext *prev;
132 * The controller to which this operation context belongs to
134 struct GNUNET_TESTBED_Controller *c;
139 struct GNUNET_TESTBED_Operation *op;
142 * Data relevant to the operation
147 * The id of the opearation
152 * The type of operation
154 enum OperationType type;
160 * Handle to interact with a GNUnet testbed controller. Each
161 * controller has at least one master handle which is created when the
162 * controller is created; this master handle interacts with the
163 * controller process, destroying it destroys the controller (by
164 * closing stdin of the controller process). Additionally,
165 * controllers can interact with each other (in a P2P fashion); those
166 * links are established via TCP/IP on the controller's service port.
168 struct GNUNET_TESTBED_Controller
172 * The host where the controller is running
174 struct GNUNET_TESTBED_Host *host;
177 * The controller callback
179 GNUNET_TESTBED_ControllerCallback cc;
182 * The closure for controller callback
187 * The configuration to use while connecting to controller
189 struct GNUNET_CONFIGURATION_Handle *cfg;
192 * The client connection handle to the controller service
194 struct GNUNET_CLIENT_Connection *client;
197 * The head of the message queue
199 struct MessageQueue *mq_head;
202 * The tail of the message queue
204 struct MessageQueue *mq_tail;
207 * The head of the ControllerLink list
209 struct ControllerLink *cl_head;
212 * The tail of the ControllerLink list
214 struct ControllerLink *cl_tail;
217 * The client transmit handle
219 struct GNUNET_CLIENT_TransmitHandle *th;
222 * The host registration handle; NULL if no current registration requests are
225 struct GNUNET_TESTBED_HostRegistrationHandle *rh;
228 * The head of the operation queue (FIXME: Remove, use ocq)
230 struct GNUNET_TESTBED_Operation *op_head;
233 * The tail of the operation queue (FIXME: Remove, use ocq)
235 struct GNUNET_TESTBED_Operation *op_tail;
238 * The head of the opeartion context queue
240 struct OperationContext *ocq_head;
243 * The tail of the operation context queue
245 struct OperationContext *ocq_tail;
248 * Operation queue for simultaneous peer creations
250 struct OperationQueue *opq_peer_create;
253 * The operation id counter. use current value and increment
255 uint64_t operation_counter;
258 * The controller event mask
263 * Did we start the receive loop yet?
268 * Did we create the host for this?
275 * Queues a message in send queue for sending to the service
277 * @param controller the handle to the controller
278 * @param msg the message to queue
281 GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
282 struct GNUNET_MessageHeader *msg);
286 * Compresses given configuration using zlib compress
288 * @param config the serialized configuration
289 * @param size the size of config
290 * @param xconfig will be set to the compressed configuration (memory is fresly
292 * @return the size of the xconfig
295 GNUNET_TESTBED_compress_config_ (const char *config, size_t size,
300 * Adds an operation to the queue of operations
302 * @param op the operation to add
305 GNUNET_TESTBED_operation_add_ (struct GNUNET_TESTBED_Operation *op);
309 * Creates a helper initialization message. Only for testing.
311 * @param cname the ip address of the controlling host
312 * @param cfg the configuration that has to used to start the testbed service
314 * @return the initialization message
316 struct GNUNET_TESTBED_HelperInit *
317 GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
318 const struct GNUNET_CONFIGURATION_Handle *cfg);