diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-08-31 16:23:53 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-08-31 16:23:53 +0000 |
commit | e0d211f88998bd642ee8ba9db9a43e7879e6c3e8 (patch) | |
tree | e18336354c1e2bbdbbc124e659dc0493890de327 /src/testbed | |
parent | 68c5a07292f624ae1f55751a8d815d01715ed9cb (diff) | |
download | gnunet-e0d211f88998bd642ee8ba9db9a43e7879e6c3e8.tar.gz gnunet-e0d211f88998bd642ee8ba9db9a43e7879e6c3e8.zip |
restructuring and checks
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 160 |
1 files changed, 81 insertions, 79 deletions
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index f9b67676e..d841caab3 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c | |||
@@ -182,82 +182,6 @@ struct RunContext | |||
182 | }; | 182 | }; |
183 | 183 | ||
184 | 184 | ||
185 | |||
186 | |||
187 | /** | ||
188 | * Configure and run a testbed using the given | ||
189 | * master controller on 'num_hosts' starting | ||
190 | * 'num_peers' using the given peer configuration. | ||
191 | * | ||
192 | * @param controller master controller for the testbed | ||
193 | * (must not be destroyed until after the | ||
194 | * testbed is destroyed). | ||
195 | * @param num_hosts number of hosts in 'hosts', 0 to only | ||
196 | * use 'localhost' | ||
197 | * @param hosts list of hosts to use for the testbed | ||
198 | * @param num_peers number of peers to start | ||
199 | * @param peer_cfg peer configuration template to use | ||
200 | * @param underlay_topology underlay topology to create | ||
201 | * @param va topology-specific options | ||
202 | * @return handle to the testbed | ||
203 | */ | ||
204 | struct GNUNET_TESTBED_Testbed * | ||
205 | GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller, | ||
206 | unsigned int num_hosts, | ||
207 | struct GNUNET_TESTBED_Host **hosts, | ||
208 | unsigned int num_peers, | ||
209 | const struct GNUNET_CONFIGURATION_Handle *peer_cfg, | ||
210 | enum GNUNET_TESTBED_TopologyOption underlay_topology, | ||
211 | va_list va) | ||
212 | { | ||
213 | GNUNET_break (0); | ||
214 | return NULL; | ||
215 | } | ||
216 | |||
217 | |||
218 | /** | ||
219 | * Configure and run a testbed using the given | ||
220 | * master controller on 'num_hosts' starting | ||
221 | * 'num_peers' using the given peer configuration. | ||
222 | * | ||
223 | * @param controller master controller for the testbed | ||
224 | * (must not be destroyed until after the | ||
225 | * testbed is destroyed). | ||
226 | * @param num_hosts number of hosts in 'hosts', 0 to only | ||
227 | * use 'localhost' | ||
228 | * @param hosts list of hosts to use for the testbed | ||
229 | * @param num_peers number of peers to start | ||
230 | * @param peer_cfg peer configuration template to use | ||
231 | * @param underlay_topology underlay topology to create | ||
232 | * @param ... topology-specific options | ||
233 | */ | ||
234 | struct GNUNET_TESTBED_Testbed * | ||
235 | GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller, | ||
236 | unsigned int num_hosts, | ||
237 | struct GNUNET_TESTBED_Host **hosts, | ||
238 | unsigned int num_peers, | ||
239 | const struct GNUNET_CONFIGURATION_Handle *peer_cfg, | ||
240 | enum GNUNET_TESTBED_TopologyOption underlay_topology, | ||
241 | ...) | ||
242 | { | ||
243 | GNUNET_break (0); | ||
244 | return NULL; | ||
245 | } | ||
246 | |||
247 | |||
248 | /** | ||
249 | * Destroy a testbed. Stops all running peers and then | ||
250 | * destroys all peers. Does NOT destroy the master controller. | ||
251 | * | ||
252 | * @param testbed testbed to destroy | ||
253 | */ | ||
254 | void | ||
255 | GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed) | ||
256 | { | ||
257 | GNUNET_break (0); | ||
258 | } | ||
259 | |||
260 | |||
261 | /** | 185 | /** |
262 | * Task for starting peers | 186 | * Task for starting peers |
263 | * | 187 | * |
@@ -419,7 +343,8 @@ event_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
419 | } | 343 | } |
420 | 344 | ||
421 | call_cc: | 345 | call_cc: |
422 | rc->cc (rc->cc_cls, event); | 346 | if (NULL != rc->cc) |
347 | rc->cc (rc->cc_cls, event); | ||
423 | if (GNUNET_TESTBED_ET_PEER_START != event->type) | 348 | if (GNUNET_TESTBED_ET_PEER_START != event->type) |
424 | return; | 349 | return; |
425 | for (dll_op = rc->dll_op_head; NULL != dll_op; dll_op = dll_op->next) | 350 | for (dll_op = rc->dll_op_head; NULL != dll_op; dll_op = dll_op->next) |
@@ -435,8 +360,9 @@ call_cc: | |||
435 | return; | 360 | return; |
436 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers started successfully\n"); | 361 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers started successfully\n"); |
437 | rc->state = RC_PEERS_STARTED; | 362 | rc->state = RC_PEERS_STARTED; |
438 | GNUNET_SCHEDULER_add_continuation (rc->master, rc->master_cls, | 363 | if (NULL != rc->master) |
439 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 364 | GNUNET_SCHEDULER_add_continuation (rc->master, rc->master_cls, |
365 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
440 | } | 366 | } |
441 | 367 | ||
442 | 368 | ||
@@ -558,6 +484,7 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
558 | rc = GNUNET_malloc (sizeof (struct RunContext)); | 484 | rc = GNUNET_malloc (sizeof (struct RunContext)); |
559 | GNUNET_break (NULL == host_filename); /* Currently we do not support host | 485 | GNUNET_break (NULL == host_filename); /* Currently we do not support host |
560 | * files */ | 486 | * files */ |
487 | GNUNET_assert (NULL != cc); | ||
561 | host_filename = NULL; | 488 | host_filename = NULL; |
562 | rc->h = GNUNET_TESTBED_host_create (NULL, NULL, 0); | 489 | rc->h = GNUNET_TESTBED_host_create (NULL, NULL, 0); |
563 | GNUNET_assert (NULL != rc->h); | 490 | GNUNET_assert (NULL != rc->h); |
@@ -576,4 +503,79 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
576 | &shutdown_run_task, rc); | 503 | &shutdown_run_task, rc); |
577 | } | 504 | } |
578 | 505 | ||
506 | |||
507 | /** | ||
508 | * Configure and run a testbed using the given | ||
509 | * master controller on 'num_hosts' starting | ||
510 | * 'num_peers' using the given peer configuration. | ||
511 | * | ||
512 | * @param controller master controller for the testbed | ||
513 | * (must not be destroyed until after the | ||
514 | * testbed is destroyed). | ||
515 | * @param num_hosts number of hosts in 'hosts', 0 to only | ||
516 | * use 'localhost' | ||
517 | * @param hosts list of hosts to use for the testbed | ||
518 | * @param num_peers number of peers to start | ||
519 | * @param peer_cfg peer configuration template to use | ||
520 | * @param underlay_topology underlay topology to create | ||
521 | * @param va topology-specific options | ||
522 | * @return handle to the testbed | ||
523 | */ | ||
524 | struct GNUNET_TESTBED_Testbed * | ||
525 | GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller, | ||
526 | unsigned int num_hosts, | ||
527 | struct GNUNET_TESTBED_Host **hosts, | ||
528 | unsigned int num_peers, | ||
529 | const struct GNUNET_CONFIGURATION_Handle *peer_cfg, | ||
530 | enum GNUNET_TESTBED_TopologyOption underlay_topology, | ||
531 | va_list va) | ||
532 | { | ||
533 | GNUNET_break (0); | ||
534 | return NULL; | ||
535 | } | ||
536 | |||
537 | |||
538 | /** | ||
539 | * Configure and run a testbed using the given | ||
540 | * master controller on 'num_hosts' starting | ||
541 | * 'num_peers' using the given peer configuration. | ||
542 | * | ||
543 | * @param controller master controller for the testbed | ||
544 | * (must not be destroyed until after the | ||
545 | * testbed is destroyed). | ||
546 | * @param num_hosts number of hosts in 'hosts', 0 to only | ||
547 | * use 'localhost' | ||
548 | * @param hosts list of hosts to use for the testbed | ||
549 | * @param num_peers number of peers to start | ||
550 | * @param peer_cfg peer configuration template to use | ||
551 | * @param underlay_topology underlay topology to create | ||
552 | * @param ... topology-specific options | ||
553 | */ | ||
554 | struct GNUNET_TESTBED_Testbed * | ||
555 | GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller, | ||
556 | unsigned int num_hosts, | ||
557 | struct GNUNET_TESTBED_Host **hosts, | ||
558 | unsigned int num_peers, | ||
559 | const struct GNUNET_CONFIGURATION_Handle *peer_cfg, | ||
560 | enum GNUNET_TESTBED_TopologyOption underlay_topology, | ||
561 | ...) | ||
562 | { | ||
563 | GNUNET_break (0); | ||
564 | return NULL; | ||
565 | } | ||
566 | |||
567 | |||
568 | /** | ||
569 | * Destroy a testbed. Stops all running peers and then | ||
570 | * destroys all peers. Does NOT destroy the master controller. | ||
571 | * | ||
572 | * @param testbed testbed to destroy | ||
573 | */ | ||
574 | void | ||
575 | GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed) | ||
576 | { | ||
577 | GNUNET_break (0); | ||
578 | } | ||
579 | |||
580 | |||
579 | /* end of testbed_api_testbed.c */ | 581 | /* end of testbed_api_testbed.c */ |