aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-12-10 12:41:05 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-12-10 12:41:05 +0000
commitb66f3385442b7f18c35488b300991da8467f5960 (patch)
treed14d5ffe0478c61d5e0c4e1a326c628c756f2529
parent4a2e78d14cbce252601d20f2f0795dd03aa34ef9 (diff)
downloadgnunet-b66f3385442b7f18c35488b300991da8467f5960.tar.gz
gnunet-b66f3385442b7f18c35488b300991da8467f5960.zip
- cleanup
-rw-r--r--src/include/gnunet_testbed_service.h2
-rw-r--r--src/testbed/testbed_api_peers.c64
-rw-r--r--src/testbed/testbed_api_peers.h42
3 files changed, 10 insertions, 98 deletions
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index ca39d26a7..645bfa37c 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -727,7 +727,7 @@ typedef void (*GNUNET_TESTBED_PeerCreateCallback) (void *cls,
727 * 'GNUNET_TESTBED_peer_get_information'. 727 * 'GNUNET_TESTBED_peer_get_information'.
728 * 728 *
729 * @param controller controller process to use 729 * @param controller controller process to use
730 * @param host host to run the peer on 730 * @param host host to run the peer on; cannot be NULL
731 * @param cfg Template configuration to use for the peer. Should exist until 731 * @param cfg Template configuration to use for the peer. Should exist until
732 * operation is cancelled or GNUNET_TESTBED_operation_done() is called 732 * operation is cancelled or GNUNET_TESTBED_operation_done() is called
733 * @param cb the callback to call when the peer has been created 733 * @param cb the callback to call when the peer has been created
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 */
421struct GNUNET_TESTBED_Operation * 418struct GNUNET_TESTBED_Operation *
422GNUNET_TESTBED_peer_create_with_id_ (uint32_t unique_id, 419GNUNET_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 */
489struct GNUNET_TESTBED_Operation *
490GNUNET_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
diff --git a/src/testbed/testbed_api_peers.h b/src/testbed/testbed_api_peers.h
index f16dd8a30..13eb1d036 100644
--- a/src/testbed/testbed_api_peers.h
+++ b/src/testbed/testbed_api_peers.h
@@ -248,48 +248,6 @@ struct OverlayConnectData
248}; 248};
249 249
250 250
251
252/**
253 * Create the given peer at the specified host using the given
254 * controller. If the given controller is not running on the target
255 * host, it should find or create a controller at the target host and
256 * delegate creating the peer. Explicit delegation paths can be setup
257 * using 'GNUNET_TESTBED_controller_link'. If no explicit delegation
258 * path exists, a direct link with a subordinate controller is setup
259 * for the first delegated peer to a particular host; the subordinate
260 * controller is then destroyed once the last peer that was delegated
261 * to the remote host is stopped. This function is used in particular
262 * if some other controller has already assigned a unique ID to the
263 * peer.
264 *
265 * Creating the peer only creates the handle to manipulate and further
266 * configure the peer; use "GNUNET_TESTBED_peer_start" and
267 * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's
268 * processes.
269 *
270 * Note that the given configuration will be adjusted by the
271 * controller to avoid port/path conflicts with other peers.
272 * The "final" configuration can be obtained using
273 * 'GNUNET_TESTBED_peer_get_information'.
274 *
275 * @param unique_id unique ID for this peer
276 * @param controller controller process to use
277 * @param host host to run the peer on
278 * @param cfg configuration to use for the peer
279 * @param cb the callback to call when the peer has been created
280 * @param cls the closure to the above callback
281 * @return the operation handle
282 */
283struct GNUNET_TESTBED_Operation *
284GNUNET_TESTBED_peer_create_with_id_ (uint32_t unique_id,
285 struct GNUNET_TESTBED_Controller
286 *controller,
287 struct GNUNET_TESTBED_Host *host,
288 const struct GNUNET_CONFIGURATION_Handle
289 *cfg, GNUNET_TESTBED_PeerCreateCallback cb,
290 void *cls);
291
292
293/** 251/**
294 * Generate PeerGetConfigurationMessage 252 * Generate PeerGetConfigurationMessage
295 * 253 *