aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-27 16:15:33 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-27 16:15:33 +0000
commitf27f46409ec33cef42379006d561d33a2ae44682 (patch)
tree0d32d879b31feb0d9aa0d19e44b41a2146cb1973 /src/testbed/testbed_api.h
parent3a4870624812ac4286624d3946981cac6aef4e67 (diff)
downloadgnunet-f27f46409ec33cef42379006d561d33a2ae44682.tar.gz
gnunet-f27f46409ec33cef42379006d561d33a2ae44682.zip
convert testbed_api to MQ (not perfect, but working)
Diffstat (limited to 'src/testbed/testbed_api.h')
-rw-r--r--src/testbed/testbed_api.h78
1 files changed, 27 insertions, 51 deletions
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index cd3358c9a..82ff5918f 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -105,33 +105,28 @@ enum OperationType
105}; 105};
106 106
107 107
108/**
109 * The message queue for sending messages to the controller service
110 */
111struct MessageQueue;
112
113 108
114/** 109/**
115 * Enumeration of states of OperationContext 110 * Enumeration of states of OperationContext
116 */ 111 */
117enum OperationContextState 112enum OperationContextState
118{ 113{
119 /** 114 /**
120 * The initial state where the associated operation has just been created 115 * The initial state where the associated operation has just been created
121 * and is waiting in the operation queues to be started 116 * and is waiting in the operation queues to be started
122 */ 117 */
123 OPC_STATE_INIT = 0, 118 OPC_STATE_INIT = 0,
124 119
125 /** 120 /**
126 * The operation has been started. It may occupy some resources which are to 121 * The operation has been started. It may occupy some resources which are to
127 * be freed if cancelled. 122 * be freed if cancelled.
128 */ 123 */
129 OPC_STATE_STARTED, 124 OPC_STATE_STARTED,
130 125
131 /** 126 /**
132 * The operation has finished. The end results of this operation may occupy 127 * The operation has finished. The end results of this operation may occupy
133 * some resources which are to be freed by operation_done 128 * some resources which are to be freed by operation_done
134 */ 129 */
135 OPC_STATE_FINISHED 130 OPC_STATE_FINISHED
136}; 131};
137 132
@@ -219,24 +214,9 @@ struct GNUNET_TESTBED_Controller
219 struct GNUNET_CONFIGURATION_Handle *cfg; 214 struct GNUNET_CONFIGURATION_Handle *cfg;
220 215
221 /** 216 /**
222 * The client connection handle to the controller service 217 * The message queue to the controller service
223 */
224 struct GNUNET_CLIENT_Connection *client;
225
226 /**
227 * The head of the message queue
228 */
229 struct MessageQueue *mq_head;
230
231 /**
232 * The tail of the message queue
233 */ 218 */
234 struct MessageQueue *mq_tail; 219 struct GNUNET_MQ_Handle *mq;
235
236 /**
237 * The client transmit handle
238 */
239 struct GNUNET_CLIENT_TransmitHandle *th;
240 220
241 /** 221 /**
242 * The host registration handle; NULL if no current registration requests are 222 * The host registration handle; NULL if no current registration requests are
@@ -286,11 +266,6 @@ struct GNUNET_TESTBED_Controller
286 uint64_t event_mask; 266 uint64_t event_mask;
287 267
288 /** 268 /**
289 * Did we start the receive loop yet?
290 */
291 int in_receive;
292
293 /**
294 * The operation id counter. use current value and increment 269 * The operation id counter. use current value and increment
295 */ 270 */
296 uint32_t operation_counter; 271 uint32_t operation_counter;
@@ -341,6 +316,7 @@ struct GNUNET_TESTBED_Barrier
341 * 316 *
342 * @param controller the handle to the controller 317 * @param controller the handle to the controller
343 * @param msg the message to queue 318 * @param msg the message to queue
319 * @deprecated
344 */ 320 */
345void 321void
346GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller, 322GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
@@ -382,7 +358,8 @@ GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c,
382 * @return the size of the xconfig 358 * @return the size of the xconfig
383 */ 359 */
384size_t 360size_t
385GNUNET_TESTBED_compress_config_ (const char *config, size_t size, 361GNUNET_TESTBED_compress_config_ (const char *config,
362 size_t size,
386 char **xconfig); 363 char **xconfig);
387 364
388 365
@@ -397,7 +374,8 @@ GNUNET_TESTBED_compress_config_ (const char *config, size_t size,
397 */ 374 */
398char * 375char *
399GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg, 376GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg,
400 size_t *size, size_t *xsize); 377 size_t *size,
378 size_t *xsize);
401 379
402 380
403/** 381/**
@@ -414,9 +392,9 @@ GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg,
414 * @return the initialization message 392 * @return the initialization message
415 */ 393 */
416struct GNUNET_TESTBED_HelperInit * 394struct GNUNET_TESTBED_HelperInit *
417GNUNET_TESTBED_create_helper_init_msg_ (const char *cname, const char *hostname, 395GNUNET_TESTBED_create_helper_init_msg_ (const char *cname,
418 const struct GNUNET_CONFIGURATION_Handle 396 const char *hostname,
419 *cfg); 397 const struct GNUNET_CONFIGURATION_Handle *cfg);
420 398
421 399
422/** 400/**
@@ -434,8 +412,8 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *cname, const char *hostname,
434 * operation 412 * operation
435 */ 413 */
436struct OperationContext * 414struct OperationContext *
437GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller 415GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller *controller,
438 *controller, uint64_t operation_id, 416 uint64_t operation_id,
439 const struct GNUNET_MessageHeader *msg, 417 const struct GNUNET_MessageHeader *msg,
440 GNUNET_CLIENT_MessageHandler cc, 418 GNUNET_CLIENT_MessageHandler cc,
441 void *cc_cls); 419 void *cc_cls);
@@ -453,8 +431,8 @@ GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc);
453/** 431/**
454 * Generates configuration by uncompressing configuration in given message. The 432 * Generates configuration by uncompressing configuration in given message. The
455 * given message should be of the following types: 433 * given message should be of the following types:
456 * GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG, 434 * #GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG,
457 * GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG 435 * #GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG
458 * 436 *
459 * @param msg the message containing compressed configuration 437 * @param msg the message containing compressed configuration
460 * @return handle to the parsed configuration 438 * @return handle to the parsed configuration
@@ -471,9 +449,7 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg);
471 * @return the error message 449 * @return the error message
472 */ 450 */
473const char * 451const char *
474GNUNET_TESTBED_parse_error_string_ (const struct 452GNUNET_TESTBED_parse_error_string_ (const struct GNUNET_TESTBED_OperationFailureEventMessage *msg);
475 GNUNET_TESTBED_OperationFailureEventMessage
476 *msg);
477 453
478 454
479/** 455/**