diff options
Diffstat (limited to 'src/testbed/testbed_api.h')
-rw-r--r-- | src/testbed/testbed_api.h | 134 |
1 files changed, 64 insertions, 70 deletions
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h index a9c2a0b71..c79c35a5e 100644 --- a/src/testbed/testbed_api.h +++ b/src/testbed/testbed_api.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 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/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -41,31 +41,30 @@ | |||
41 | /** | 41 | /** |
42 | * Enumeration of operations | 42 | * Enumeration of operations |
43 | */ | 43 | */ |
44 | enum OperationType | 44 | enum OperationType { |
45 | { | 45 | /** |
46 | /** | 46 | * Peer create operation |
47 | * Peer create operation | 47 | */ |
48 | */ | ||
49 | OP_PEER_CREATE, | 48 | OP_PEER_CREATE, |
50 | 49 | ||
51 | /** | 50 | /** |
52 | * Peer start operation | 51 | * Peer start operation |
53 | */ | 52 | */ |
54 | OP_PEER_START, | 53 | OP_PEER_START, |
55 | 54 | ||
56 | /** | 55 | /** |
57 | * Peer stop operation | 56 | * Peer stop operation |
58 | */ | 57 | */ |
59 | OP_PEER_STOP, | 58 | OP_PEER_STOP, |
60 | 59 | ||
61 | /** | 60 | /** |
62 | * Peer destroy operation | 61 | * Peer destroy operation |
63 | */ | 62 | */ |
64 | OP_PEER_DESTROY, | 63 | OP_PEER_DESTROY, |
65 | 64 | ||
66 | /** | 65 | /** |
67 | * Get peer information operation | 66 | * Get peer information operation |
68 | */ | 67 | */ |
69 | OP_PEER_INFO, | 68 | OP_PEER_INFO, |
70 | 69 | ||
71 | /** | 70 | /** |
@@ -73,19 +72,19 @@ enum OperationType | |||
73 | */ | 72 | */ |
74 | OP_PEER_RECONFIGURE, | 73 | OP_PEER_RECONFIGURE, |
75 | 74 | ||
76 | /** | 75 | /** |
77 | * Overlay connection operation | 76 | * Overlay connection operation |
78 | */ | 77 | */ |
79 | OP_OVERLAY_CONNECT, | 78 | OP_OVERLAY_CONNECT, |
80 | 79 | ||
81 | /** | 80 | /** |
82 | * Forwarded operation | 81 | * Forwarded operation |
83 | */ | 82 | */ |
84 | OP_FORWARDED, | 83 | OP_FORWARDED, |
85 | 84 | ||
86 | /** | 85 | /** |
87 | * Link controllers operation | 86 | * Link controllers operation |
88 | */ | 87 | */ |
89 | OP_LINK_CONTROLLERS, | 88 | OP_LINK_CONTROLLERS, |
90 | 89 | ||
91 | /** | 90 | /** |
@@ -109,8 +108,7 @@ enum OperationType | |||
109 | /** | 108 | /** |
110 | * Enumeration of states of OperationContext | 109 | * Enumeration of states of OperationContext |
111 | */ | 110 | */ |
112 | enum OperationContextState | 111 | enum OperationContextState { |
113 | { | ||
114 | /** | 112 | /** |
115 | * The initial state where the associated operation has just been created | 113 | * The initial state where the associated operation has just been created |
116 | * and is waiting in the operation queues to be started | 114 | * and is waiting in the operation queues to be started |
@@ -134,8 +132,7 @@ enum OperationContextState | |||
134 | /** | 132 | /** |
135 | * Context information for GNUNET_TESTBED_Operation | 133 | * Context information for GNUNET_TESTBED_Operation |
136 | */ | 134 | */ |
137 | struct OperationContext | 135 | struct OperationContext { |
138 | { | ||
139 | /** | 136 | /** |
140 | * The controller to which this operation context belongs to | 137 | * The controller to which this operation context belongs to |
141 | */ | 138 | */ |
@@ -191,8 +188,7 @@ typedef void | |||
191 | * controllers can interact with each other (in a P2P fashion); those | 188 | * controllers can interact with each other (in a P2P fashion); those |
192 | * links are established via TCP/IP on the controller's service port. | 189 | * links are established via TCP/IP on the controller's service port. |
193 | */ | 190 | */ |
194 | struct GNUNET_TESTBED_Controller | 191 | struct GNUNET_TESTBED_Controller { |
195 | { | ||
196 | /** | 192 | /** |
197 | * The host where the controller is running | 193 | * The host where the controller is running |
198 | */ | 194 | */ |
@@ -269,15 +265,13 @@ struct GNUNET_TESTBED_Controller | |||
269 | * The operation id counter. use current value and increment | 265 | * The operation id counter. use current value and increment |
270 | */ | 266 | */ |
271 | uint32_t operation_counter; | 267 | uint32_t operation_counter; |
272 | |||
273 | }; | 268 | }; |
274 | 269 | ||
275 | 270 | ||
276 | /** | 271 | /** |
277 | * Handle for barrier | 272 | * Handle for barrier |
278 | */ | 273 | */ |
279 | struct GNUNET_TESTBED_Barrier | 274 | struct GNUNET_TESTBED_Barrier { |
280 | { | ||
281 | /** | 275 | /** |
282 | * hashcode identifying this barrier in the hashmap | 276 | * hashcode identifying this barrier in the hashmap |
283 | */ | 277 | */ |
@@ -319,8 +313,8 @@ struct GNUNET_TESTBED_Barrier | |||
319 | * @deprecated | 313 | * @deprecated |
320 | */ | 314 | */ |
321 | void | 315 | void |
322 | GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller, | 316 | GNUNET_TESTBED_queue_message_(struct GNUNET_TESTBED_Controller *controller, |
323 | struct GNUNET_MessageHeader *msg); | 317 | struct GNUNET_MessageHeader *msg); |
324 | 318 | ||
325 | 319 | ||
326 | /** | 320 | /** |
@@ -332,8 +326,8 @@ GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller, | |||
332 | * @param opc the operation context to be inserted | 326 | * @param opc the operation context to be inserted |
333 | */ | 327 | */ |
334 | void | 328 | void |
335 | GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c, | 329 | GNUNET_TESTBED_insert_opc_(struct GNUNET_TESTBED_Controller *c, |
336 | struct OperationContext *opc); | 330 | struct OperationContext *opc); |
337 | 331 | ||
338 | 332 | ||
339 | /** | 333 | /** |
@@ -344,8 +338,8 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c, | |||
344 | * @param opc the operation context to remove | 338 | * @param opc the operation context to remove |
345 | */ | 339 | */ |
346 | void | 340 | void |
347 | GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c, | 341 | GNUNET_TESTBED_remove_opc_(const struct GNUNET_TESTBED_Controller *c, |
348 | struct OperationContext *opc); | 342 | struct OperationContext *opc); |
349 | 343 | ||
350 | 344 | ||
351 | /** | 345 | /** |
@@ -358,9 +352,9 @@ GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c, | |||
358 | * @return the size of the xconfig | 352 | * @return the size of the xconfig |
359 | */ | 353 | */ |
360 | size_t | 354 | size_t |
361 | GNUNET_TESTBED_compress_config_ (const char *config, | 355 | GNUNET_TESTBED_compress_config_(const char *config, |
362 | size_t size, | 356 | size_t size, |
363 | char **xconfig); | 357 | char **xconfig); |
364 | 358 | ||
365 | 359 | ||
366 | /** | 360 | /** |
@@ -373,9 +367,9 @@ GNUNET_TESTBED_compress_config_ (const char *config, | |||
373 | * @return the serialized and compressed configuration | 367 | * @return the serialized and compressed configuration |
374 | */ | 368 | */ |
375 | char * | 369 | char * |
376 | GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg, | 370 | GNUNET_TESTBED_compress_cfg_(const struct GNUNET_CONFIGURATION_Handle *cfg, |
377 | size_t *size, | 371 | size_t *size, |
378 | size_t *xsize); | 372 | size_t *xsize); |
379 | 373 | ||
380 | 374 | ||
381 | /** | 375 | /** |
@@ -392,9 +386,9 @@ GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
392 | * @return the initialization message | 386 | * @return the initialization message |
393 | */ | 387 | */ |
394 | struct GNUNET_TESTBED_HelperInit * | 388 | struct GNUNET_TESTBED_HelperInit * |
395 | GNUNET_TESTBED_create_helper_init_msg_ (const char *cname, | 389 | GNUNET_TESTBED_create_helper_init_msg_(const char *cname, |
396 | const char *hostname, | 390 | const char *hostname, |
397 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 391 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
398 | 392 | ||
399 | 393 | ||
400 | /** | 394 | /** |
@@ -412,11 +406,11 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *cname, | |||
412 | * operation | 406 | * operation |
413 | */ | 407 | */ |
414 | struct OperationContext * | 408 | struct OperationContext * |
415 | GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller *controller, | 409 | GNUNET_TESTBED_forward_operation_msg_(struct GNUNET_TESTBED_Controller *controller, |
416 | uint64_t operation_id, | 410 | uint64_t operation_id, |
417 | const struct GNUNET_MessageHeader *msg, | 411 | const struct GNUNET_MessageHeader *msg, |
418 | GNUNET_MQ_MessageCallback cc, | 412 | GNUNET_MQ_MessageCallback cc, |
419 | void *cc_cls); | 413 | void *cc_cls); |
420 | 414 | ||
421 | /** | 415 | /** |
422 | * Function to cancel an operation created by simply forwarding an operation | 416 | * Function to cancel an operation created by simply forwarding an operation |
@@ -425,7 +419,7 @@ GNUNET_TESTBED_forward_operation_msg_ (struct GNUNET_TESTBED_Controller *control | |||
425 | * @param opc the operation context from GNUNET_TESTBED_forward_operation_msg_() | 419 | * @param opc the operation context from GNUNET_TESTBED_forward_operation_msg_() |
426 | */ | 420 | */ |
427 | void | 421 | void |
428 | GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc); | 422 | GNUNET_TESTBED_forward_operation_msg_cancel_(struct OperationContext *opc); |
429 | 423 | ||
430 | 424 | ||
431 | /** | 425 | /** |
@@ -438,7 +432,7 @@ GNUNET_TESTBED_forward_operation_msg_cancel_ (struct OperationContext *opc); | |||
438 | * @return handle to the parsed configuration | 432 | * @return handle to the parsed configuration |
439 | */ | 433 | */ |
440 | struct GNUNET_CONFIGURATION_Handle * | 434 | struct GNUNET_CONFIGURATION_Handle * |
441 | GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg); | 435 | GNUNET_TESTBED_extract_config_(const struct GNUNET_MessageHeader *msg); |
442 | 436 | ||
443 | 437 | ||
444 | /** | 438 | /** |
@@ -449,7 +443,7 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg); | |||
449 | * @return the error message | 443 | * @return the error message |
450 | */ | 444 | */ |
451 | const char * | 445 | const char * |
452 | GNUNET_TESTBED_parse_error_string_ (const struct GNUNET_TESTBED_OperationFailureEventMessage *msg); | 446 | GNUNET_TESTBED_parse_error_string_(const struct GNUNET_TESTBED_OperationFailureEventMessage *msg); |
453 | 447 | ||
454 | 448 | ||
455 | /** | 449 | /** |
@@ -460,7 +454,7 @@ GNUNET_TESTBED_parse_error_string_ (const struct GNUNET_TESTBED_OperationFailure | |||
460 | * @return the incremented operation id. | 454 | * @return the incremented operation id. |
461 | */ | 455 | */ |
462 | uint64_t | 456 | uint64_t |
463 | GNUNET_TESTBED_get_next_op_id (struct GNUNET_TESTBED_Controller *controller); | 457 | GNUNET_TESTBED_get_next_op_id(struct GNUNET_TESTBED_Controller *controller); |
464 | 458 | ||
465 | 459 | ||
466 | /** | 460 | /** |
@@ -476,9 +470,9 @@ GNUNET_TESTBED_get_next_op_id (struct GNUNET_TESTBED_Controller *controller); | |||
476 | * @return the operation handle; | 470 | * @return the operation handle; |
477 | */ | 471 | */ |
478 | struct GNUNET_TESTBED_Operation * | 472 | struct GNUNET_TESTBED_Operation * |
479 | GNUNET_TESTBED_get_slave_config_ (void *op_cls, | 473 | GNUNET_TESTBED_get_slave_config_(void *op_cls, |
480 | struct GNUNET_TESTBED_Controller *master, | 474 | struct GNUNET_TESTBED_Controller *master, |
481 | uint32_t slave_host_id); | 475 | uint32_t slave_host_id); |
482 | 476 | ||
483 | 477 | ||
484 | 478 | ||
@@ -499,12 +493,12 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls, | |||
499 | * @return barrier handle; NULL upon error | 493 | * @return barrier handle; NULL upon error |
500 | */ | 494 | */ |
501 | struct GNUNET_TESTBED_Barrier * | 495 | struct GNUNET_TESTBED_Barrier * |
502 | GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller, | 496 | GNUNET_TESTBED_barrier_init_(struct GNUNET_TESTBED_Controller *controller, |
503 | const char *name, | 497 | const char *name, |
504 | unsigned int quorum, | 498 | unsigned int quorum, |
505 | GNUNET_TESTBED_barrier_status_cb cb, | 499 | GNUNET_TESTBED_barrier_status_cb cb, |
506 | void *cls, | 500 | void *cls, |
507 | int echo); | 501 | int echo); |
508 | 502 | ||
509 | 503 | ||
510 | /** | 504 | /** |
@@ -514,7 +508,7 @@ GNUNET_TESTBED_barrier_init_ (struct GNUNET_TESTBED_Controller *controller, | |||
514 | * @param barrier the barrier to remove | 508 | * @param barrier the barrier to remove |
515 | */ | 509 | */ |
516 | void | 510 | void |
517 | GNUNET_TESTBED_barrier_remove_ (struct GNUNET_TESTBED_Barrier *barrier); | 511 | GNUNET_TESTBED_barrier_remove_(struct GNUNET_TESTBED_Barrier *barrier); |
518 | 512 | ||
519 | 513 | ||
520 | 514 | ||