diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-10 12:41:05 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-10 12:41:05 +0000 |
commit | b66f3385442b7f18c35488b300991da8467f5960 (patch) | |
tree | d14d5ffe0478c61d5e0c4e1a326c628c756f2529 /src/testbed/testbed_api_peers.c | |
parent | 4a2e78d14cbce252601d20f2f0795dd03aa34ef9 (diff) | |
download | gnunet-b66f3385442b7f18c35488b300991da8467f5960.tar.gz gnunet-b66f3385442b7f18c35488b300991da8467f5960.zip |
- cleanup
Diffstat (limited to 'src/testbed/testbed_api_peers.c')
-rw-r--r-- | src/testbed/testbed_api_peers.c | 64 |
1 files changed, 9 insertions, 55 deletions
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c index 472e93dbb..cee50bbff 100644 --- a/src/testbed/testbed_api_peers.c +++ b/src/testbed/testbed_api_peers.c | |||
@@ -395,9 +395,7 @@ GNUNET_TESTBED_peer_lookup_by_id_ (uint32_t id) | |||
395 | * path exists, a direct link with a subordinate controller is setup | 395 | * path exists, a direct link with a subordinate controller is setup |
396 | * for the first delegated peer to a particular host; the subordinate | 396 | * for the first delegated peer to a particular host; the subordinate |
397 | * controller is then destroyed once the last peer that was delegated | 397 | * controller is then destroyed once the last peer that was delegated |
398 | * to the remote host is stopped. This function is used in particular | 398 | * to the remote host is stopped. |
399 | * if some other controller has already assigned a unique ID to the | ||
400 | * peer. | ||
401 | * | 399 | * |
402 | * Creating the peer only creates the handle to manipulate and further | 400 | * Creating the peer only creates the handle to manipulate and further |
403 | * configure the peer; use "GNUNET_TESTBED_peer_start" and | 401 | * configure the peer; use "GNUNET_TESTBED_peer_start" and |
@@ -409,9 +407,8 @@ GNUNET_TESTBED_peer_lookup_by_id_ (uint32_t id) | |||
409 | * The "final" configuration can be obtained using | 407 | * The "final" configuration can be obtained using |
410 | * 'GNUNET_TESTBED_peer_get_information'. | 408 | * 'GNUNET_TESTBED_peer_get_information'. |
411 | * | 409 | * |
412 | * @param unique_id unique ID for this peer | ||
413 | * @param controller controller process to use | 410 | * @param controller controller process to use |
414 | * @param host host to run the peer on | 411 | * @param host host to run the peer on; cannot be NULL |
415 | * @param cfg Template configuration to use for the peer. Should exist until | 412 | * @param cfg Template configuration to use for the peer. Should exist until |
416 | * operation is cancelled or GNUNET_TESTBED_operation_done() is called | 413 | * operation is cancelled or GNUNET_TESTBED_operation_done() is called |
417 | * @param cb the callback to call when the peer has been created | 414 | * @param cb the callback to call when the peer has been created |
@@ -419,22 +416,21 @@ GNUNET_TESTBED_peer_lookup_by_id_ (uint32_t id) | |||
419 | * @return the operation handle | 416 | * @return the operation handle |
420 | */ | 417 | */ |
421 | struct GNUNET_TESTBED_Operation * | 418 | struct GNUNET_TESTBED_Operation * |
422 | GNUNET_TESTBED_peer_create_with_id_ (uint32_t unique_id, | 419 | GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, |
423 | struct GNUNET_TESTBED_Controller | 420 | struct GNUNET_TESTBED_Host *host, |
424 | *controller, | 421 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
425 | struct GNUNET_TESTBED_Host *host, | 422 | GNUNET_TESTBED_PeerCreateCallback cb, void *cls) |
426 | const struct GNUNET_CONFIGURATION_Handle | ||
427 | *cfg, GNUNET_TESTBED_PeerCreateCallback cb, | ||
428 | void *cls) | ||
429 | { | 423 | { |
424 | |||
430 | struct GNUNET_TESTBED_Peer *peer; | 425 | struct GNUNET_TESTBED_Peer *peer; |
431 | struct PeerCreateData *data; | 426 | struct PeerCreateData *data; |
432 | struct OperationContext *opc; | 427 | struct OperationContext *opc; |
428 | static uint32_t id_gen; | ||
433 | 429 | ||
434 | peer = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer)); | 430 | peer = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer)); |
435 | peer->controller = controller; | 431 | peer->controller = controller; |
436 | peer->host = host; | 432 | peer->host = host; |
437 | peer->unique_id = unique_id; | 433 | peer->unique_id = id_gen++; |
438 | peer->state = PS_INVALID; | 434 | peer->state = PS_INVALID; |
439 | data = GNUNET_malloc (sizeof (struct PeerCreateData)); | 435 | data = GNUNET_malloc (sizeof (struct PeerCreateData)); |
440 | data->host = host; | 436 | data->host = host; |
@@ -458,48 +454,6 @@ GNUNET_TESTBED_peer_create_with_id_ (uint32_t unique_id, | |||
458 | 454 | ||
459 | 455 | ||
460 | /** | 456 | /** |
461 | * Create the given peer at the specified host using the given | ||
462 | * controller. If the given controller is not running on the target | ||
463 | * host, it should find or create a controller at the target host and | ||
464 | * delegate creating the peer. Explicit delegation paths can be setup | ||
465 | * using 'GNUNET_TESTBED_controller_link'. If no explicit delegation | ||
466 | * path exists, a direct link with a subordinate controller is setup | ||
467 | * for the first delegated peer to a particular host; the subordinate | ||
468 | * controller is then destroyed once the last peer that was delegated | ||
469 | * to the remote host is stopped. | ||
470 | * | ||
471 | * Creating the peer only creates the handle to manipulate and further | ||
472 | * configure the peer; use "GNUNET_TESTBED_peer_start" and | ||
473 | * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's | ||
474 | * processes. | ||
475 | * | ||
476 | * Note that the given configuration will be adjusted by the | ||
477 | * controller to avoid port/path conflicts with other peers. | ||
478 | * The "final" configuration can be obtained using | ||
479 | * 'GNUNET_TESTBED_peer_get_information'. | ||
480 | * | ||
481 | * @param controller controller process to use | ||
482 | * @param host host to run the peer on | ||
483 | * @param cfg Template configuration to use for the peer. Should exist until | ||
484 | * operation is cancelled or GNUNET_TESTBED_operation_done() is called | ||
485 | * @param cb the callback to call when the peer has been created | ||
486 | * @param cls the closure to the above callback | ||
487 | * @return the operation handle | ||
488 | */ | ||
489 | struct GNUNET_TESTBED_Operation * | ||
490 | GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller, | ||
491 | struct GNUNET_TESTBED_Host *host, | ||
492 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
493 | GNUNET_TESTBED_PeerCreateCallback cb, void *cls) | ||
494 | { | ||
495 | static uint32_t id_gen; | ||
496 | |||
497 | return GNUNET_TESTBED_peer_create_with_id_ (id_gen++, controller, host, cfg, | ||
498 | cb, cls); | ||
499 | } | ||
500 | |||
501 | |||
502 | /** | ||
503 | * Start the given peer. | 457 | * Start the given peer. |
504 | * | 458 | * |
505 | * @param op_cls the closure for this operation; will be set in | 459 | * @param op_cls the closure for this operation; will be set in |