aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testbed_service.h
diff options
context:
space:
mode:
authorMaximilian Szengel <gnunet@maxsz.de>2012-10-18 16:38:52 +0000
committerMaximilian Szengel <gnunet@maxsz.de>2012-10-18 16:38:52 +0000
commit44f92861e676181ca60892c76654bb5e69651637 (patch)
tree292a2ac699e041b768120ff27982da76c53b42b5 /src/include/gnunet_testbed_service.h
parent47032db495464716a0d0c94ce4c830e146ceee9c (diff)
downloadgnunet-44f92861e676181ca60892c76654bb5e69651637.tar.gz
gnunet-44f92861e676181ca60892c76654bb5e69651637.zip
Exposing GNUNET_TESTBED_host_get_hostname
Diffstat (limited to 'src/include/gnunet_testbed_service.h')
-rw-r--r--src/include/gnunet_testbed_service.h354
1 files changed, 182 insertions, 172 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 7953feb6e..ed7251ed3 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -50,7 +50,7 @@ struct GNUNET_TESTBED_Host;
50/** 50/**
51 * Opaque handle to a peer controlled by the testbed framework. A peer runs 51 * Opaque handle to a peer controlled by the testbed framework. A peer runs
52 * at a particular host. 52 * at a particular host.
53 */ 53 */
54struct GNUNET_TESTBED_Peer; 54struct GNUNET_TESTBED_Peer;
55 55
56/** 56/**
@@ -77,7 +77,7 @@ struct GNUNET_TESTBED_Testbed;
77 77
78/** 78/**
79 * Create a host to run peers and controllers on. 79 * Create a host to run peers and controllers on.
80 * 80 *
81 * @param hostname name of the host, use "NULL" for localhost 81 * @param hostname name of the host, use "NULL" for localhost
82 * @param username username to use for the login; may be NULL 82 * @param username username to use for the login; may be NULL
83 * @param port port number to use for ssh; use 0 to let ssh decide 83 * @param port port number to use for ssh; use 0 to let ssh decide
@@ -85,16 +85,16 @@ struct GNUNET_TESTBED_Testbed;
85 */ 85 */
86struct GNUNET_TESTBED_Host * 86struct GNUNET_TESTBED_Host *
87GNUNET_TESTBED_host_create (const char *hostname, 87GNUNET_TESTBED_host_create (const char *hostname,
88 const char *username, 88 const char *username,
89 uint16_t port); 89 uint16_t port);
90 90
91 91
92 92
93/** 93/**
94 * Create a host to run peers and controllers on. This function is used 94 * Create a host to run peers and controllers on. This function is used
95 * if a peer learns about a host via IPC between controllers (and thus 95 * if a peer learns about a host via IPC between controllers (and thus
96 * some higher-level controller has already determined the unique IDs). 96 * some higher-level controller has already determined the unique IDs).
97 * 97 *
98 * @param id global host ID assigned to the host; 0 is 98 * @param id global host ID assigned to the host; 0 is
99 * reserved to always mean 'localhost' 99 * reserved to always mean 'localhost'
100 * @param hostname name of the host, use "NULL" for localhost 100 * @param hostname name of the host, use "NULL" for localhost
@@ -104,9 +104,9 @@ GNUNET_TESTBED_host_create (const char *hostname,
104 */ 104 */
105struct GNUNET_TESTBED_Host * 105struct GNUNET_TESTBED_Host *
106GNUNET_TESTBED_host_create_with_id (uint32_t id, 106GNUNET_TESTBED_host_create_with_id (uint32_t id,
107 const char *hostname, 107 const char *hostname,
108 const char *username, 108 const char *username,
109 uint16_t port); 109 uint16_t port);
110 110
111 111
112/** 112/**
@@ -119,7 +119,7 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id,
119 */ 119 */
120unsigned int 120unsigned int
121GNUNET_TESTBED_hosts_load_from_file (const char *filename, 121GNUNET_TESTBED_hosts_load_from_file (const char *filename,
122 struct GNUNET_TESTBED_Host ***hosts); 122 struct GNUNET_TESTBED_Host ***hosts);
123 123
124 124
125/** 125/**
@@ -144,6 +144,16 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host);
144 144
145 145
146/** 146/**
147 * Obtain the host's hostname.
148 *
149 * @param host handle to the host, NULL means 'localhost'
150 * @return hostname of the host
151 */
152const char *
153GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host);
154
155
156/**
147 * Enumeration with (at most 64) possible event types that 157 * Enumeration with (at most 64) possible event types that
148 * can be monitored using the testbed framework. 158 * can be monitored using the testbed framework.
149 */ 159 */
@@ -221,7 +231,7 @@ enum GNUNET_TESTBED_PeerInformationType
221 */ 231 */
222struct GNUNET_TESTBED_EventInformation 232struct GNUNET_TESTBED_EventInformation
223{ 233{
224 234
225 /** 235 /**
226 * Type of the event. 236 * Type of the event.
227 */ 237 */
@@ -232,10 +242,10 @@ struct GNUNET_TESTBED_EventInformation
232 */ 242 */
233 union 243 union
234 { 244 {
235 245
236 /** 246 /**
237 * Details about peer start event. 247 * Details about peer start event.
238 */ 248 */
239 struct 249 struct
240 { 250 {
241 /** 251 /**
@@ -248,12 +258,12 @@ struct GNUNET_TESTBED_EventInformation
248 * Handle for the peer that was started. 258 * Handle for the peer that was started.
249 */ 259 */
250 struct GNUNET_TESTBED_Peer *peer; 260 struct GNUNET_TESTBED_Peer *peer;
251 261
252 } peer_start; 262 } peer_start;
253 263
254 /** 264 /**
255 * Details about peer stop event. 265 * Details about peer stop event.
256 */ 266 */
257 struct 267 struct
258 { 268 {
259 269
@@ -261,12 +271,12 @@ struct GNUNET_TESTBED_EventInformation
261 * Handle for the peer that was started. 271 * Handle for the peer that was started.
262 */ 272 */
263 struct GNUNET_TESTBED_Peer *peer; 273 struct GNUNET_TESTBED_Peer *peer;
264 274
265 } peer_stop; 275 } peer_stop;
266 276
267 /** 277 /**
268 * Details about connect event. 278 * Details about connect event.
269 */ 279 */
270 struct 280 struct
271 { 281 {
272 /** 282 /**
@@ -283,7 +293,7 @@ struct GNUNET_TESTBED_EventInformation
283 293
284 /** 294 /**
285 * Details about disconnect event. 295 * Details about disconnect event.
286 */ 296 */
287 struct 297 struct
288 { 298 {
289 /** 299 /**
@@ -295,13 +305,13 @@ struct GNUNET_TESTBED_EventInformation
295 * Handle for one of the disconnected peers. 305 * Handle for one of the disconnected peers.
296 */ 306 */
297 struct GNUNET_TESTBED_Peer *peer2; 307 struct GNUNET_TESTBED_Peer *peer2;
298 308
299 } peer_disconnect; 309 } peer_disconnect;
300 310
301 /** 311 /**
302 * Details about an operation finished event. 312 * Details about an operation finished event.
303 */ 313 */
304 struct 314 struct
305 { 315 {
306 316
307 /** 317 /**
@@ -317,7 +327,7 @@ struct GNUNET_TESTBED_EventInformation
317 327
318 /** 328 /**
319 * Error message for the operation, NULL on success. 329 * Error message for the operation, NULL on success.
320 */ 330 */
321 const char *emsg; 331 const char *emsg;
322 332
323 /** 333 /**
@@ -325,18 +335,18 @@ struct GNUNET_TESTBED_EventInformation
325 * (whatever the GNUNET_TESTBED_ConnectAdapter returned). 335 * (whatever the GNUNET_TESTBED_ConnectAdapter returned).
326 */ 336 */
327 void *generic; 337 void *generic;
328 338
329 } operation_finished; 339 } operation_finished;
330 340
331 /** 341 /**
332 * Details about an testbed run completed event. 342 * Details about an testbed run completed event.
333 */ 343 */
334 struct 344 struct
335 { 345 {
336 346
337 /** 347 /**
338 * Error message for the operation, NULL on success. 348 * Error message for the operation, NULL on success.
339 */ 349 */
340 const char *emsg; 350 const char *emsg;
341 351
342 /** 352 /**
@@ -351,8 +361,8 @@ struct GNUNET_TESTBED_EventInformation
351 * Size of the 'peers' array. 361 * Size of the 'peers' array.
352 */ 362 */
353 unsigned int num_peers; 363 unsigned int num_peers;
354 364
355 } testbed_run_finished; 365 } testbed_run_finished;
356 366
357 } details; 367 } details;
358 368
@@ -367,7 +377,7 @@ struct GNUNET_TESTBED_EventInformation
367 * @param event information about the event 377 * @param event information about the event
368 */ 378 */
369typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls, 379typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls,
370 const struct GNUNET_TESTBED_EventInformation *event); 380 const struct GNUNET_TESTBED_EventInformation *event);
371 381
372 382
373/** 383/**
@@ -385,13 +395,13 @@ struct GNUNET_TESTBED_ControllerProc;
385 * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not, 395 * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
386 * GNUNET_TESTBED_controller_stop() shouldn't be called in this case 396 * GNUNET_TESTBED_controller_stop() shouldn't be called in this case
387 */ 397 */
388typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls, 398typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls,
389 const struct GNUNET_CONFIGURATION_Handle *cfg, 399 const struct GNUNET_CONFIGURATION_Handle *cfg,
390 int status); 400 int status);
391 401
392 402
393/** 403/**
394 * Starts a controller process at the host. 404 * Starts a controller process at the host.
395 * 405 *
396 * @param controller_ip the ip address of the controller. Will be set as TRUSTED 406 * @param controller_ip the ip address of the controller. Will be set as TRUSTED
397 * host when starting testbed controller at host 407 * host when starting testbed controller at host
@@ -412,10 +422,10 @@ typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls,
412 */ 422 */
413struct GNUNET_TESTBED_ControllerProc * 423struct GNUNET_TESTBED_ControllerProc *
414GNUNET_TESTBED_controller_start (const char *controller_ip, 424GNUNET_TESTBED_controller_start (const char *controller_ip,
415 struct GNUNET_TESTBED_Host *host, 425 struct GNUNET_TESTBED_Host *host,
416 const struct GNUNET_CONFIGURATION_Handle *cfg, 426 const struct GNUNET_CONFIGURATION_Handle *cfg,
417 GNUNET_TESTBED_ControllerStatusCallback cb, 427 GNUNET_TESTBED_ControllerStatusCallback cb,
418 void *cls); 428 void *cls);
419 429
420 430
421/** 431/**
@@ -449,10 +459,10 @@ GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_ControllerProc *cproc);
449 */ 459 */
450struct GNUNET_TESTBED_Controller * 460struct GNUNET_TESTBED_Controller *
451GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 461GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
452 struct GNUNET_TESTBED_Host *host, 462 struct GNUNET_TESTBED_Host *host,
453 uint64_t event_mask, 463 uint64_t event_mask,
454 GNUNET_TESTBED_ControllerCallback cc, 464 GNUNET_TESTBED_ControllerCallback cc,
455 void *cc_cls); 465 void *cc_cls);
456 466
457 467
458/** 468/**
@@ -461,7 +471,7 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle *cfg
461 * should not be run for each peer but instead be shared 471 * should not be run for each peer but instead be shared
462 * across N peers on the specified host. This function 472 * across N peers on the specified host. This function
463 * must be called before any peers are created at the host. 473 * must be called before any peers are created at the host.
464 * 474 *
465 * @param controller controller to configure 475 * @param controller controller to configure
466 * @param service_name name of the service to share 476 * @param service_name name of the service to share
467 * @param num_peers number of peers that should share one instance 477 * @param num_peers number of peers that should share one instance
@@ -470,13 +480,13 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle *cfg
470 */ 480 */
471void 481void
472GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controller *controller, 482GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controller *controller,
473 const char *service_name, 483 const char *service_name,
474 uint32_t num_peers); 484 uint32_t num_peers);
475 485
476 486
477/** 487/**
478 * Stop the given controller (also will terminate all peers and 488 * Stop the given controller (also will terminate all peers and
479 * controllers dependent on this controller). This function 489 * controllers dependent on this controller). This function
480 * blocks until the testbed has been fully terminated (!). 490 * blocks until the testbed has been fully terminated (!).
481 * 491 *
482 * @param controller handle to controller to stop 492 * @param controller handle to controller to stop
@@ -497,7 +507,7 @@ struct GNUNET_TESTBED_HostRegistrationHandle;
497 * @param cls the closure 507 * @param cls the closure
498 * @param emsg the error message; NULL if host registration is successful 508 * @param emsg the error message; NULL if host registration is successful
499 */ 509 */
500typedef void (* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls, 510typedef void (* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls,
501 const char *emsg); 511 const char *emsg);
502 512
503 513
@@ -581,12 +591,12 @@ typedef void (*GNUNET_TESTBED_OperationCompletionCallback) (void *cls,
581 */ 591 */
582struct GNUNET_TESTBED_Operation * 592struct GNUNET_TESTBED_Operation *
583GNUNET_TESTBED_controller_link (void *op_cls, 593GNUNET_TESTBED_controller_link (void *op_cls,
584 struct GNUNET_TESTBED_Controller *master, 594 struct GNUNET_TESTBED_Controller *master,
585 struct GNUNET_TESTBED_Host *delegated_host, 595 struct GNUNET_TESTBED_Host *delegated_host,
586 struct GNUNET_TESTBED_Host *slave_host, 596 struct GNUNET_TESTBED_Host *slave_host,
587 const struct GNUNET_CONFIGURATION_Handle 597 const struct GNUNET_CONFIGURATION_Handle
588 *slave_cfg, 598 *slave_cfg,
589 int is_subordinate); 599 int is_subordinate);
590 600
591 601
592/** 602/**
@@ -610,13 +620,13 @@ GNUNET_TESTBED_controller_link (void *op_cls,
610 */ 620 */
611struct GNUNET_TESTBED_Operation * 621struct GNUNET_TESTBED_Operation *
612GNUNET_TESTBED_controller_link_2 (void *op_cls, 622GNUNET_TESTBED_controller_link_2 (void *op_cls,
613 struct GNUNET_TESTBED_Controller *master, 623 struct GNUNET_TESTBED_Controller *master,
614 struct GNUNET_TESTBED_Host *delegated_host, 624 struct GNUNET_TESTBED_Host *delegated_host,
615 struct GNUNET_TESTBED_Host *slave_host, 625 struct GNUNET_TESTBED_Host *slave_host,
616 const char *sxcfg, 626 const char *sxcfg,
617 size_t sxcfg_size, 627 size_t sxcfg_size,
618 size_t scfg_size, 628 size_t scfg_size,
619 int is_subordinate); 629 int is_subordinate);
620 630
621 631
622/** 632/**
@@ -650,8 +660,8 @@ GNUNET_TESTBED_get_slave_config (void *op_cls,
650 * @param emsg NULL if peer is not NULL; else MAY contain the error description 660 * @param emsg NULL if peer is not NULL; else MAY contain the error description
651 */ 661 */
652typedef void (*GNUNET_TESTBED_PeerCreateCallback) (void *cls, 662typedef void (*GNUNET_TESTBED_PeerCreateCallback) (void *cls,
653 struct GNUNET_TESTBED_Peer *peer, 663 struct GNUNET_TESTBED_Peer *peer,
654 const char *emsg); 664 const char *emsg);
655 665
656 666
657/** 667/**
@@ -685,10 +695,10 @@ typedef void (*GNUNET_TESTBED_PeerCreateCallback) (void *cls,
685 */ 695 */
686struct GNUNET_TESTBED_Operation * 696struct GNUNET_TESTBED_Operation *
687GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, 697GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
688 struct GNUNET_TESTBED_Host *host, 698 struct GNUNET_TESTBED_Host *host,
689 const struct GNUNET_CONFIGURATION_Handle *cfg, 699 const struct GNUNET_CONFIGURATION_Handle *cfg,
690 GNUNET_TESTBED_PeerCreateCallback cb, 700 GNUNET_TESTBED_PeerCreateCallback cb,
691 void *cls); 701 void *cls);
692 702
693 703
694/** 704/**
@@ -699,7 +709,7 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
699 * @param emsg NULL on success; otherwise an error description 709 * @param emsg NULL on success; otherwise an error description
700 */ 710 */
701typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls, 711typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls,
702 const char *emsg); 712 const char *emsg);
703 713
704 714
705/** 715/**
@@ -714,14 +724,14 @@ typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls,
714 */ 724 */
715struct GNUNET_TESTBED_Operation * 725struct GNUNET_TESTBED_Operation *
716GNUNET_TESTBED_peer_start (void *op_cls, 726GNUNET_TESTBED_peer_start (void *op_cls,
717 struct GNUNET_TESTBED_Peer *peer, 727 struct GNUNET_TESTBED_Peer *peer,
718 GNUNET_TESTBED_PeerChurnCallback pcc, 728 GNUNET_TESTBED_PeerChurnCallback pcc,
719 void *pcc_cls); 729 void *pcc_cls);
720 730
721 731
722/** 732/**
723 * Stop the given peer. The handle remains valid (use 733 * Stop the given peer. The handle remains valid (use
724 * "GNUNET_TESTBED_peer_destroy" to fully clean up the 734 * "GNUNET_TESTBED_peer_destroy" to fully clean up the
725 * state of the peer). 735 * state of the peer).
726 * 736 *
727 * @param peer peer to stop 737 * @param peer peer to stop
@@ -731,8 +741,8 @@ GNUNET_TESTBED_peer_start (void *op_cls,
731 */ 741 */
732struct GNUNET_TESTBED_Operation * 742struct GNUNET_TESTBED_Operation *
733GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer, 743GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
734 GNUNET_TESTBED_PeerChurnCallback pcc, 744 GNUNET_TESTBED_PeerChurnCallback pcc,
735 void *pcc_cls); 745 void *pcc_cls);
736 746
737 747
738/** 748/**
@@ -745,17 +755,17 @@ struct GNUNET_TESTBED_PeerInformation
745 * in the 'op_result' is actually in use. 755 * in the 'op_result' is actually in use.
746 */ 756 */
747 enum GNUNET_TESTBED_PeerInformationType pit; 757 enum GNUNET_TESTBED_PeerInformationType pit;
748 758
749 /** 759 /**
750 * The result of the get information operation; Choose according to the pit 760 * The result of the get information operation; Choose according to the pit
751 */ 761 */
752 union 762 union
753 { 763 {
754 /** 764 /**
755 * The configuration of the peer 765 * The configuration of the peer
756 */ 766 */
757 struct GNUNET_CONFIGURATION_Handle *cfg; 767 struct GNUNET_CONFIGURATION_Handle *cfg;
758 768
759 /** 769 /**
760 * The identity of the peer 770 * The identity of the peer
761 */ 771 */
@@ -774,12 +784,12 @@ struct GNUNET_TESTBED_PeerInformation
774 * operation is successfull 784 * operation is successfull
775 */ 785 */
776typedef void (*GNUNET_TESTBED_PeerInfoCallback) (void *cb_cls, 786typedef void (*GNUNET_TESTBED_PeerInfoCallback) (void *cb_cls,
777 struct GNUNET_TESTBED_Operation 787 struct GNUNET_TESTBED_Operation
778 *op, 788 *op,
779 const struct 789 const struct
780 GNUNET_TESTBED_PeerInformation 790 GNUNET_TESTBED_PeerInformation
781 *pinfo, 791 *pinfo,
782 const char *emsg); 792 const char *emsg);
783 793
784 794
785/** 795/**
@@ -797,10 +807,10 @@ typedef void (*GNUNET_TESTBED_PeerInfoCallback) (void *cb_cls,
797 */ 807 */
798struct GNUNET_TESTBED_Operation * 808struct GNUNET_TESTBED_Operation *
799GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer, 809GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer,
800 enum GNUNET_TESTBED_PeerInformationType 810 enum GNUNET_TESTBED_PeerInformationType
801 pit, 811 pit,
802 GNUNET_TESTBED_PeerInfoCallback cb, 812 GNUNET_TESTBED_PeerInfoCallback cb,
803 void *cb_cls); 813 void *cb_cls);
804 814
805 815
806/** 816/**
@@ -815,7 +825,7 @@ GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer,
815 */ 825 */
816struct GNUNET_TESTBED_Operation * 826struct GNUNET_TESTBED_Operation *
817GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer, 827GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer,
818 const struct GNUNET_CONFIGURATION_Handle *cfg); 828 const struct GNUNET_CONFIGURATION_Handle *cfg);
819 829
820 830
821/** 831/**
@@ -838,28 +848,28 @@ enum GNUNET_TESTBED_ConnectOption
838 * No option (not valid as an argument). 848 * No option (not valid as an argument).
839 */ 849 */
840 GNUNET_TESTBED_CO_NONE = 0, 850 GNUNET_TESTBED_CO_NONE = 0,
841 851
842 /** 852 /**
843 * Allow or disallow a connection between the specified peers. 853 * Allow or disallow a connection between the specified peers.
844 * Followed by GNUNET_NO (int) if a connection is disallowed 854 * Followed by GNUNET_NO (int) if a connection is disallowed
845 * or GNUNET_YES if a connection is allowed. Note that the 855 * or GNUNET_YES if a connection is allowed. Note that the
846 * default (all connections allowed or disallowed) is 856 * default (all connections allowed or disallowed) is
847 * specified in the configuration of the controller. 857 * specified in the configuration of the controller.
848 */ 858 */
849 GNUNET_TESTBED_CO_ALLOW = 1, 859 GNUNET_TESTBED_CO_ALLOW = 1,
850 860
851 /** 861 /**
852 * FIXME: add (and implement) options to limit connection to 862 * FIXME: add (and implement) options to limit connection to
853 * particular transports, force simulation of particular latencies 863 * particular transports, force simulation of particular latencies
854 * or message loss rates, or set bandwidth limitations. 864 * or message loss rates, or set bandwidth limitations.
855 */ 865 */
856 866
857}; 867};
858 868
859 869
860/** 870/**
861 * Manipulate the P2P underlay topology by configuring a link 871 * Manipulate the P2P underlay topology by configuring a link
862 * between two peers. 872 * between two peers.
863 * 873 *
864 * @param op_cls closure argument to give with the operation event 874 * @param op_cls closure argument to give with the operation event
865 * @param p1 first peer 875 * @param p1 first peer
@@ -871,15 +881,15 @@ enum GNUNET_TESTBED_ConnectOption
871 */ 881 */
872struct GNUNET_TESTBED_Operation * 882struct GNUNET_TESTBED_Operation *
873GNUNET_TESTBED_underlay_configure_link_va (void *op_cls, 883GNUNET_TESTBED_underlay_configure_link_va (void *op_cls,
874 struct GNUNET_TESTBED_Peer *p1, 884 struct GNUNET_TESTBED_Peer *p1,
875 struct GNUNET_TESTBED_Peer *p2, 885 struct GNUNET_TESTBED_Peer *p2,
876 enum GNUNET_TESTBED_ConnectOption co, 886 enum GNUNET_TESTBED_ConnectOption co,
877 va_list ap); 887 va_list ap);
878 888
879 889
880/** 890/**
881 * Manipulate the P2P underlay topology by configuring a link 891 * Manipulate the P2P underlay topology by configuring a link
882 * between two peers. 892 * between two peers.
883 * 893 *
884 * @param op_cls closure argument to give with the operation event 894 * @param op_cls closure argument to give with the operation event
885 * @param p1 first peer 895 * @param p1 first peer
@@ -891,9 +901,9 @@ GNUNET_TESTBED_underlay_configure_link_va (void *op_cls,
891 */ 901 */
892struct GNUNET_TESTBED_Operation * 902struct GNUNET_TESTBED_Operation *
893GNUNET_TESTBED_underlay_configure_link (void *op_cls, 903GNUNET_TESTBED_underlay_configure_link (void *op_cls,
894 struct GNUNET_TESTBED_Peer *p1, 904 struct GNUNET_TESTBED_Peer *p1,
895 struct GNUNET_TESTBED_Peer *p2, 905 struct GNUNET_TESTBED_Peer *p2,
896 enum GNUNET_TESTBED_ConnectOption co, ...); 906 enum GNUNET_TESTBED_ConnectOption co, ...);
897 907
898 908
899 909
@@ -978,10 +988,10 @@ enum GNUNET_TESTBED_TopologyOption
978 */ 988 */
979struct GNUNET_TESTBED_Operation * 989struct GNUNET_TESTBED_Operation *
980GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls, 990GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls,
981 unsigned int num_peers, 991 unsigned int num_peers,
982 struct GNUNET_TESTBED_Peer **peers, 992 struct GNUNET_TESTBED_Peer **peers,
983 enum GNUNET_TESTBED_TopologyOption topo, 993 enum GNUNET_TESTBED_TopologyOption topo,
984 va_list ap); 994 va_list ap);
985 995
986 996
987/** 997/**
@@ -997,10 +1007,10 @@ GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls,
997 */ 1007 */
998struct GNUNET_TESTBED_Operation * 1008struct GNUNET_TESTBED_Operation *
999GNUNET_TESTBED_underlay_configure_topology (void *op_cls, 1009GNUNET_TESTBED_underlay_configure_topology (void *op_cls,
1000 unsigned int num_peers, 1010 unsigned int num_peers,
1001 struct GNUNET_TESTBED_Peer **peers, 1011 struct GNUNET_TESTBED_Peer **peers,
1002 enum GNUNET_TESTBED_TopologyOption topo, 1012 enum GNUNET_TESTBED_TopologyOption topo,
1003 ...); 1013 ...);
1004 1014
1005 1015
1006/** 1016/**
@@ -1021,8 +1031,8 @@ struct GNUNET_TESTBED_Operation *
1021GNUNET_TESTBED_overlay_connect (void *op_cls, 1031GNUNET_TESTBED_overlay_connect (void *op_cls,
1022 GNUNET_TESTBED_OperationCompletionCallback cb, 1032 GNUNET_TESTBED_OperationCompletionCallback cb,
1023 void *cb_cls, 1033 void *cb_cls,
1024 struct GNUNET_TESTBED_Peer *p1, 1034 struct GNUNET_TESTBED_Peer *p1,
1025 struct GNUNET_TESTBED_Peer *p2); 1035 struct GNUNET_TESTBED_Peer *p2);
1026 1036
1027 1037
1028/** 1038/**
@@ -1035,16 +1045,16 @@ GNUNET_TESTBED_overlay_connect (void *op_cls,
1035 * @param peers array of 'num_peers' with the peers to configure 1045 * @param peers array of 'num_peers' with the peers to configure
1036 * @param topo desired underlay topology to use 1046 * @param topo desired underlay topology to use
1037 * @param va topology-specific options 1047 * @param va topology-specific options
1038 * @return handle to the operation, NULL if connecting these 1048 * @return handle to the operation, NULL if connecting these
1039 * peers is fundamentally not possible at this time (peers 1049 * peers is fundamentally not possible at this time (peers
1040 * not running or underlay disallows) or if num_peers is less than 2 1050 * not running or underlay disallows) or if num_peers is less than 2
1041 */ 1051 */
1042struct GNUNET_TESTBED_Operation * 1052struct GNUNET_TESTBED_Operation *
1043GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls, 1053GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
1044 unsigned int num_peers, 1054 unsigned int num_peers,
1045 struct GNUNET_TESTBED_Peer **peers, 1055 struct GNUNET_TESTBED_Peer **peers,
1046 enum GNUNET_TESTBED_TopologyOption topo, 1056 enum GNUNET_TESTBED_TopologyOption topo,
1047 va_list va); 1057 va_list va);
1048 1058
1049 1059
1050/** 1060/**
@@ -1057,16 +1067,16 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
1057 * @param peers array of 'num_peers' with the peers to configure 1067 * @param peers array of 'num_peers' with the peers to configure
1058 * @param topo desired underlay topology to use 1068 * @param topo desired underlay topology to use
1059 * @param ... topology-specific options 1069 * @param ... topology-specific options
1060 * @return handle to the operation, NULL if connecting these 1070 * @return handle to the operation, NULL if connecting these
1061 * peers is fundamentally not possible at this time (peers 1071 * peers is fundamentally not possible at this time (peers
1062 * not running or underlay disallows) or if num_peers is less than 2 1072 * not running or underlay disallows) or if num_peers is less than 2
1063 */ 1073 */
1064struct GNUNET_TESTBED_Operation * 1074struct GNUNET_TESTBED_Operation *
1065GNUNET_TESTBED_overlay_configure_topology (void *op_cls, 1075GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
1066 unsigned int num_peers, 1076 unsigned int num_peers,
1067 struct GNUNET_TESTBED_Peer **peers, 1077 struct GNUNET_TESTBED_Peer **peers,
1068 enum GNUNET_TESTBED_TopologyOption topo, 1078 enum GNUNET_TESTBED_TopologyOption topo,
1069 ...); 1079 ...);
1070 1080
1071 1081
1072/** 1082/**
@@ -1081,13 +1091,13 @@ GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
1081 */ 1091 */
1082void 1092void
1083GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Controller *controller, 1093GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Controller *controller,
1084 const char *filename); 1094 const char *filename);
1085 1095
1086 1096
1087/** 1097/**
1088 * Adapter function called to establish a connection to 1098 * Adapter function called to establish a connection to
1089 * a service. 1099 * a service.
1090 * 1100 *
1091 * @param cls closure 1101 * @param cls closure
1092 * @param cfg configuration of the peer to connect to; will be available until 1102 * @param cfg configuration of the peer to connect to; will be available until
1093 * GNUNET_TESTBED_operation_done() is called on the operation returned 1103 * GNUNET_TESTBED_operation_done() is called on the operation returned
@@ -1095,18 +1105,18 @@ GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Controller
1095 * @return service handle to return in 'op_result', NULL on error 1105 * @return service handle to return in 'op_result', NULL on error
1096 */ 1106 */
1097typedef void * (*GNUNET_TESTBED_ConnectAdapter)(void *cls, 1107typedef void * (*GNUNET_TESTBED_ConnectAdapter)(void *cls,
1098 const struct GNUNET_CONFIGURATION_Handle *cfg); 1108 const struct GNUNET_CONFIGURATION_Handle *cfg);
1099 1109
1100 1110
1101/** 1111/**
1102 * Adapter function called to destroy a connection to 1112 * Adapter function called to destroy a connection to
1103 * a service. 1113 * a service.
1104 * 1114 *
1105 * @param cls closure 1115 * @param cls closure
1106 * @param op_result service handle returned from the connect adapter 1116 * @param op_result service handle returned from the connect adapter
1107 */ 1117 */
1108typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls, 1118typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls,
1109 void *op_result); 1119 void *op_result);
1110 1120
1111 1121
1112/** 1122/**
@@ -1119,13 +1129,13 @@ typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls,
1119 * operation has executed successfully. 1129 * operation has executed successfully.
1120 */ 1130 */
1121typedef void (*GNUNET_TESTBED_ServiceConnectCompletionCallback) (void *cls, 1131typedef void (*GNUNET_TESTBED_ServiceConnectCompletionCallback) (void *cls,
1122 struct 1132 struct
1123 GNUNET_TESTBED_Operation 1133 GNUNET_TESTBED_Operation
1124 *op, 1134 *op,
1125 void 1135 void
1126 *ca_result, 1136 *ca_result,
1127 const char 1137 const char
1128 *emsg ); 1138 *emsg );
1129 1139
1130 1140
1131/** 1141/**
@@ -1134,7 +1144,7 @@ typedef void (*GNUNET_TESTBED_ServiceConnectCompletionCallback) (void *cls,
1134 * maintain connections with other systems. The actual service 1144 * maintain connections with other systems. The actual service
1135 * handle is then returned via the 'op_result' member in the event 1145 * handle is then returned via the 'op_result' member in the event
1136 * callback. The 'ca' callback is used to create the connection 1146 * callback. The 'ca' callback is used to create the connection
1137 * when the time is right; the 'da' callback will be used to 1147 * when the time is right; the 'da' callback will be used to
1138 * destroy the connection (upon 'GNUNET_TESTBED_operation_done'). 1148 * destroy the connection (upon 'GNUNET_TESTBED_operation_done').
1139 * 'GNUNET_TESTBED_operation_cancel' can be used to abort this 1149 * 'GNUNET_TESTBED_operation_cancel' can be used to abort this
1140 * operation until the event callback has been called. 1150 * operation until the event callback has been called.
@@ -1151,13 +1161,13 @@ typedef void (*GNUNET_TESTBED_ServiceConnectCompletionCallback) (void *cls,
1151 */ 1161 */
1152struct GNUNET_TESTBED_Operation * 1162struct GNUNET_TESTBED_Operation *
1153GNUNET_TESTBED_service_connect (void *op_cls, 1163GNUNET_TESTBED_service_connect (void *op_cls,
1154 struct GNUNET_TESTBED_Peer *peer, 1164 struct GNUNET_TESTBED_Peer *peer,
1155 const char *service_name, 1165 const char *service_name,
1156 GNUNET_TESTBED_ServiceConnectCompletionCallback cb, 1166 GNUNET_TESTBED_ServiceConnectCompletionCallback cb,
1157 void *cb_cls, 1167 void *cb_cls,
1158 GNUNET_TESTBED_ConnectAdapter ca, 1168 GNUNET_TESTBED_ConnectAdapter ca,
1159 GNUNET_TESTBED_DisconnectAdapter da, 1169 GNUNET_TESTBED_DisconnectAdapter da,
1160 void *cada_cls); 1170 void *cada_cls);
1161 1171
1162 1172
1163/** 1173/**
@@ -1165,8 +1175,8 @@ GNUNET_TESTBED_service_connect (void *op_cls,
1165 * of the operation and will ensure that no event 1175 * of the operation and will ensure that no event
1166 * is generated for the operation. Does NOT guarantee 1176 * is generated for the operation. Does NOT guarantee
1167 * that the operation will be fully undone (or that 1177 * that the operation will be fully undone (or that
1168 * nothing ever happened). 1178 * nothing ever happened).
1169 * 1179 *
1170 * @param operation operation to cancel 1180 * @param operation operation to cancel
1171 */ 1181 */
1172void 1182void
@@ -1179,7 +1189,7 @@ GNUNET_TESTBED_operation_cancel (struct GNUNET_TESTBED_Operation *operation);
1179 * of type 'operation_finished' to fully remove the operation 1189 * of type 'operation_finished' to fully remove the operation
1180 * from the operation queue. After calling this function, the 1190 * from the operation queue. After calling this function, the
1181 * 'op_result' becomes invalid (!). 1191 * 'op_result' becomes invalid (!).
1182 * 1192 *
1183 * @param operation operation to signal completion for 1193 * @param operation operation to signal completion for
1184 */ 1194 */
1185void 1195void
@@ -1205,12 +1215,12 @@ GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation);
1205 */ 1215 */
1206struct GNUNET_TESTBED_Testbed * 1216struct GNUNET_TESTBED_Testbed *
1207GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller, 1217GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller,
1208 unsigned int num_hosts, 1218 unsigned int num_hosts,
1209 struct GNUNET_TESTBED_Host **hosts, 1219 struct GNUNET_TESTBED_Host **hosts,
1210 unsigned int num_peers, 1220 unsigned int num_peers,
1211 const struct GNUNET_CONFIGURATION_Handle *peer_cfg, 1221 const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
1212 enum GNUNET_TESTBED_TopologyOption underlay_topology, 1222 enum GNUNET_TESTBED_TopologyOption underlay_topology,
1213 va_list va); 1223 va_list va);
1214 1224
1215 1225
1216/** 1226/**
@@ -1231,12 +1241,12 @@ GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller,
1231 */ 1241 */
1232struct GNUNET_TESTBED_Testbed * 1242struct GNUNET_TESTBED_Testbed *
1233GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller, 1243GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller,
1234 unsigned int num_hosts, 1244 unsigned int num_hosts,
1235 struct GNUNET_TESTBED_Host **hosts, 1245 struct GNUNET_TESTBED_Host **hosts,
1236 unsigned int num_peers, 1246 unsigned int num_peers,
1237 const struct GNUNET_CONFIGURATION_Handle *peer_cfg, 1247 const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
1238 enum GNUNET_TESTBED_TopologyOption underlay_topology, 1248 enum GNUNET_TESTBED_TopologyOption underlay_topology,
1239 ...); 1249 ...);
1240 1250
1241 1251
1242/** 1252/**
@@ -1261,15 +1271,15 @@ GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed);
1261 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration 1271 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
1262 */ 1272 */
1263typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls, 1273typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls,
1264 const struct GNUNET_TESTBED_Peer *peer, 1274 const struct GNUNET_TESTBED_Peer *peer,
1265 const char *subsystem, 1275 const char *subsystem,
1266 const char *name, 1276 const char *name,
1267 uint64_t value, 1277 uint64_t value,
1268 int is_persistent); 1278 int is_persistent);
1269 1279
1270 1280
1271/** 1281/**
1272 * Convenience method that iterates over all (running) peers 1282 * Convenience method that iterates over all (running) peers
1273 * and retrieves all statistics from each peer. 1283 * and retrieves all statistics from each peer.
1274 * 1284 *
1275 * @param num_peers number of peers to iterate over 1285 * @param num_peers number of peers to iterate over
@@ -1281,7 +1291,7 @@ typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls,
1281 */ 1291 */
1282struct GNUNET_TESTBED_Operation * 1292struct GNUNET_TESTBED_Operation *
1283GNUNET_TESTBED_get_statistics (unsigned int num_peers, 1293GNUNET_TESTBED_get_statistics (unsigned int num_peers,
1284 struct GNUNET_TESTBED_Peer **peers, 1294 struct GNUNET_TESTBED_Peer **peers,
1285 GNUNET_TESTBED_StatisticsIterator proc, 1295 GNUNET_TESTBED_StatisticsIterator proc,
1286 GNUNET_TESTBED_OperationCompletionCallback cont, 1296 GNUNET_TESTBED_OperationCompletionCallback cont,
1287 void *cls); 1297 void *cls);
@@ -1317,26 +1327,26 @@ GNUNET_TESTBED_get_statistics (unsigned int num_peers,
1317 */ 1327 */
1318void 1328void
1319GNUNET_TESTBED_run (const char *host_filename, 1329GNUNET_TESTBED_run (const char *host_filename,
1320 const struct GNUNET_CONFIGURATION_Handle *cfg, 1330 const struct GNUNET_CONFIGURATION_Handle *cfg,
1321 unsigned int num_peers, 1331 unsigned int num_peers,
1322 uint64_t event_mask, 1332 uint64_t event_mask,
1323 GNUNET_TESTBED_ControllerCallback cc, 1333 GNUNET_TESTBED_ControllerCallback cc,
1324 void *cc_cls, 1334 void *cc_cls,
1325 GNUNET_SCHEDULER_Task master, 1335 GNUNET_SCHEDULER_Task master,
1326 void *master_cls); 1336 void *master_cls);
1327 1337
1328 1338
1329/** 1339/**
1330 * Signature of a main function for a testcase. 1340 * Signature of a main function for a testcase.
1331 * 1341 *
1332 * @param cls closure 1342 * @param cls closure
1333 * @param num_peers number of peers in 'peers' 1343 * @param num_peers number of peers in 'peers'
1334 * @param peers handle to peers run in the testbed 1344 * @param peers handle to peers run in the testbed
1335 */ 1345 */
1336typedef void (*GNUNET_TESTBED_TestMaster)(void *cls, 1346typedef void (*GNUNET_TESTBED_TestMaster)(void *cls,
1337 unsigned int num_peers, 1347 unsigned int num_peers,
1338 struct GNUNET_TESTBED_Peer **peers); 1348 struct GNUNET_TESTBED_Peer **peers);
1339 1349
1340 1350
1341/** 1351/**
1342 * Convenience method for running a "simple" test on the local system 1352 * Convenience method for running a "simple" test on the local system
@@ -1372,13 +1382,13 @@ typedef void (*GNUNET_TESTBED_TestMaster)(void *cls,
1372 */ 1382 */
1373void 1383void
1374GNUNET_TESTBED_test_run (const char *testname, 1384GNUNET_TESTBED_test_run (const char *testname,
1375 const char *cfg_filename, 1385 const char *cfg_filename,
1376 unsigned int num_peers, 1386 unsigned int num_peers,
1377 uint64_t event_mask, 1387 uint64_t event_mask,
1378 GNUNET_TESTBED_ControllerCallback cc, 1388 GNUNET_TESTBED_ControllerCallback cc,
1379 void *cc_cls, 1389 void *cc_cls,
1380 GNUNET_TESTBED_TestMaster test_master, 1390 GNUNET_TESTBED_TestMaster test_master,
1381 void *test_master_cls); 1391 void *test_master_cls);
1382 1392
1383 1393
1384#if 0 /* keep Emacsens' auto-indent happy */ 1394#if 0 /* keep Emacsens' auto-indent happy */