aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/gnunet_fs_service.h32
-rw-r--r--src/include/gnunet_testbed_service.h23
-rw-r--r--src/testbed/test_testbed_api.c4
-rw-r--r--src/testbed/test_testbed_api_2peers.c6
-rw-r--r--src/testbed/test_testbed_api_controllerlink.c8
-rw-r--r--src/testbed/test_testbed_api_testbed_run.c2
-rw-r--r--src/testbed/testbed_api_peers.c16
-rw-r--r--src/testbed/testbed_api_testbed.c4
8 files changed, 62 insertions, 33 deletions
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index f93f4e856..0308011a6 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -1542,8 +1542,7 @@ struct GNUNET_FS_ProgressInfo
1542 * field in the GNUNET_FS_ProgressInfo struct. 1542 * field in the GNUNET_FS_ProgressInfo struct.
1543 */ 1543 */
1544typedef void *(*GNUNET_FS_ProgressCallback) (void *cls, 1544typedef void *(*GNUNET_FS_ProgressCallback) (void *cls,
1545 const struct GNUNET_FS_ProgressInfo 1545 const struct GNUNET_FS_ProgressInfo *info);
1546 * info);
1547 1546
1548 1547
1549/** 1548/**
@@ -1570,30 +1569,31 @@ enum GNUNET_FS_Flags
1570 GNUNET_FS_FLAGS_DO_PROBES = 2 1569 GNUNET_FS_FLAGS_DO_PROBES = 2
1571}; 1570};
1572 1571
1572
1573/** 1573/**
1574 * Options specified in the VARARGs portion of GNUNET_FS_start. 1574 * Options specified in the VARARGs portion of GNUNET_FS_start.
1575 */ 1575 */
1576enum GNUNET_FS_OPTIONS 1576enum GNUNET_FS_OPTIONS
1577{ 1577{
1578 1578
1579 /** 1579 /**
1580 * Last option in the VARARG list. 1580 * Last option in the VARARG list.
1581 */ 1581 */
1582 GNUNET_FS_OPTIONS_END = 0, 1582 GNUNET_FS_OPTIONS_END = 0,
1583 1583
1584 /** 1584 /**
1585 * Select the desired amount of parallelism (this option should be 1585 * Select the desired amount of parallelism (this option should be
1586 * followed by an "unsigned int" giving the desired maximum number 1586 * followed by an "unsigned int" giving the desired maximum number
1587 * of parallel downloads). 1587 * of parallel downloads).
1588 */ 1588 */
1589 GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, 1589 GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1,
1590 1590
1591 /** 1591 /**
1592 * Maximum number of requests that should be pending at a given 1592 * Maximum number of requests that should be pending at a given
1593 * point in time (invidivual downloads may go above this, but 1593 * point in time (invidivual downloads may go above this, but
1594 * if we are above this threshold, we should not activate any 1594 * if we are above this threshold, we should not activate any
1595 * additional downloads. 1595 * additional downloads.
1596 */ 1596 */
1597 GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 1597 GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2
1598}; 1598};
1599 1599
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 92a7beb40..ca7230504 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -647,13 +647,28 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
647 647
648 648
649/** 649/**
650 * Functions of this signature are called when a peer has been successfully
651 * started or stopped.
652 *
653 * @param cls the closure from GNUNET_TESTBED_peer_start/stop()
654 * @param emsg NULL on success; otherwise an error description
655 */
656typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls,
657 const char *emsg);
658
659
660/**
650 * Start the given peer. 661 * Start the given peer.
651 * 662 *
652 * @param peer peer to start 663 * @param peer peer to start
664 * @param pcc function to call upon completion
665 * @param pcc_cls closure for 'pcc'
653 * @return handle to the operation 666 * @return handle to the operation
654 */ 667 */
655struct GNUNET_TESTBED_Operation * 668struct GNUNET_TESTBED_Operation *
656GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer); 669GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer,
670 GNUNET_TESTBED_PeerChurnCallback pcc,
671 void *pcc_cls);
657 672
658 673
659/** 674/**
@@ -662,10 +677,14 @@ GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer);
662 * state of the peer). 677 * state of the peer).
663 * 678 *
664 * @param peer peer to stop 679 * @param peer peer to stop
680 * @param pcc function to call upon completion
681 * @param pcc_cls closure for 'pcc'
665 * @return handle to the operation 682 * @return handle to the operation
666 */ 683 */
667struct GNUNET_TESTBED_Operation * 684struct GNUNET_TESTBED_Operation *
668GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer); 685GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
686 GNUNET_TESTBED_PeerChurnCallback pcc,
687 void *pcc_cls);
669 688
670 689
671/** 690/**
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c
index b2a07650a..e44bf8b57 100644
--- a/src/testbed/test_testbed_api.c
+++ b/src/testbed/test_testbed_api.c
@@ -204,7 +204,7 @@ dht_disconnect_adapter (void *cls, void *op_result)
204 dht_handle = NULL; 204 dht_handle = NULL;
205 GNUNET_assert (PEER_SERVICE_CONNECT == sub_test); 205 GNUNET_assert (PEER_SERVICE_CONNECT == sub_test);
206 GNUNET_assert (NULL != operation); 206 GNUNET_assert (NULL != operation);
207 operation = GNUNET_TESTBED_peer_stop (peer); 207 operation = GNUNET_TESTBED_peer_stop (peer, NULL, NULL);
208 GNUNET_assert (NULL != operation); 208 GNUNET_assert (NULL != operation);
209} 209}
210 210
@@ -355,7 +355,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
355 GNUNET_assert (NULL != peer_ptr); 355 GNUNET_assert (NULL != peer_ptr);
356 *peer_ptr = peer; 356 *peer_ptr = peer;
357 GNUNET_TESTBED_operation_done (operation); 357 GNUNET_TESTBED_operation_done (operation);
358 operation = GNUNET_TESTBED_peer_start (peer); 358 operation = GNUNET_TESTBED_peer_start (peer, NULL, NULL);
359 GNUNET_assert (NULL != operation); 359 GNUNET_assert (NULL != operation);
360} 360}
361 361
diff --git a/src/testbed/test_testbed_api_2peers.c b/src/testbed/test_testbed_api_2peers.c
index 63810187b..43becddba 100644
--- a/src/testbed/test_testbed_api_2peers.c
+++ b/src/testbed/test_testbed_api_2peers.c
@@ -214,8 +214,8 @@ op_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, const char *emsg)
214 common_operation = NULL; 214 common_operation = NULL;
215 result = PEERS_CONNECTED; 215 result = PEERS_CONNECTED;
216 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n"); 216 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
217 peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer); 217 peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
218 peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer); 218 peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
219} 219}
220 220
221 221
@@ -333,7 +333,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
333 GNUNET_assert (NULL == pc->peer); 333 GNUNET_assert (NULL == pc->peer);
334 pc->peer = peer; 334 pc->peer = peer;
335 GNUNET_TESTBED_operation_done (pc->operation); 335 GNUNET_TESTBED_operation_done (pc->operation);
336 pc->operation = GNUNET_TESTBED_peer_start (pc->peer); 336 pc->operation = GNUNET_TESTBED_peer_start (pc->peer, NULL, NULL);
337} 337}
338 338
339 339
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c
index ee62bf1aa..221de8f4d 100644
--- a/src/testbed/test_testbed_api_controllerlink.c
+++ b/src/testbed/test_testbed_api_controllerlink.c
@@ -240,11 +240,11 @@ delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
240 switch (result) 240 switch (result)
241 { 241 {
242 case SLAVE1_PEER_START_SUCCESS: 242 case SLAVE1_PEER_START_SUCCESS:
243 op = GNUNET_TESTBED_peer_stop (slave1_peer); 243 op = GNUNET_TESTBED_peer_stop (slave1_peer, NULL, NULL);
244 GNUNET_assert (NULL != op); 244 GNUNET_assert (NULL != op);
245 break; 245 break;
246 case SLAVE2_PEER_START_SUCCESS: 246 case SLAVE2_PEER_START_SUCCESS:
247 op = GNUNET_TESTBED_peer_stop (slave2_peer); 247 op = GNUNET_TESTBED_peer_stop (slave2_peer, NULL, NULL);
248 GNUNET_assert (NULL != op); 248 GNUNET_assert (NULL != op);
249 break; 249 break;
250 default: 250 default:
@@ -282,7 +282,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
282 result = SLAVE2_PEER_CREATE_SUCCESS; 282 result = SLAVE2_PEER_CREATE_SUCCESS;
283 slave2_peer = peer; 283 slave2_peer = peer;
284 GNUNET_TESTBED_operation_done (op); 284 GNUNET_TESTBED_operation_done (op);
285 op = GNUNET_TESTBED_peer_start (slave1_peer); 285 op = GNUNET_TESTBED_peer_start (slave1_peer, NULL, NULL);
286 GNUNET_assert (NULL != op); 286 GNUNET_assert (NULL != op);
287 break; 287 break;
288 default: 288 default:
@@ -354,7 +354,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
354 GNUNET_assert (event->details.peer_stop.peer == slave1_peer); 354 GNUNET_assert (event->details.peer_stop.peer == slave1_peer);
355 GNUNET_TESTBED_operation_done (op); 355 GNUNET_TESTBED_operation_done (op);
356 result = SLAVE1_PEER_STOP_SUCCESS; 356 result = SLAVE1_PEER_STOP_SUCCESS;
357 op = GNUNET_TESTBED_peer_start (slave2_peer); 357 op = GNUNET_TESTBED_peer_start (slave2_peer, NULL, NULL);
358 GNUNET_assert (NULL != op); 358 GNUNET_assert (NULL != op);
359 break; 359 break;
360 case SLAVE1_PEER_STOP_SUCCESS: 360 case SLAVE1_PEER_STOP_SUCCESS:
diff --git a/src/testbed/test_testbed_api_testbed_run.c b/src/testbed/test_testbed_api_testbed_run.c
index b8bca508d..82734d7e9 100644
--- a/src/testbed/test_testbed_api_testbed_run.c
+++ b/src/testbed/test_testbed_api_testbed_run.c
@@ -101,7 +101,7 @@ master_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101{ 101{
102 result = GNUNET_OK; 102 result = GNUNET_OK;
103 GNUNET_assert (NULL != peers[0]); 103 GNUNET_assert (NULL != peers[0]);
104 op = GNUNET_TESTBED_peer_stop (peers[0]); 104 op = GNUNET_TESTBED_peer_stop (peers[0], NULL, NULL);
105 GNUNET_assert (NULL != op); 105 GNUNET_assert (NULL != op);
106} 106}
107 107
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index 619212def..86bc6f2e2 100644
--- a/src/testbed/testbed_api_peers.c
+++ b/src/testbed/testbed_api_peers.c
@@ -483,13 +483,18 @@ GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
483 * Start the given peer. 483 * Start the given peer.
484 * 484 *
485 * @param peer peer to start 485 * @param peer peer to start
486 * @param pcc function to call upon completion
487 * @param pcc_cls closure for 'pcc'
486 * @return handle to the operation 488 * @return handle to the operation
487 */ 489 */
488struct GNUNET_TESTBED_Operation * 490struct GNUNET_TESTBED_Operation *
489GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer) 491GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer,
492 GNUNET_TESTBED_PeerChurnCallback pcc,
493 void *pcc_cls)
490{ 494{
491 struct OperationContext *opc; 495 struct OperationContext *opc;
492 496
497 // FIXME: keep and call pcc!
493 opc = GNUNET_malloc (sizeof (struct OperationContext)); 498 opc = GNUNET_malloc (sizeof (struct OperationContext));
494 opc->c = peer->controller; 499 opc->c = peer->controller;
495 opc->data = peer; 500 opc->data = peer;
@@ -510,13 +515,18 @@ GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer)
510 * state of the peer). 515 * state of the peer).
511 * 516 *
512 * @param peer peer to stop 517 * @param peer peer to stop
518 * @param pcc function to call upon completion
519 * @param pcc_cls closure for 'pcc'
513 * @return handle to the operation 520 * @return handle to the operation
514 */ 521 */
515struct GNUNET_TESTBED_Operation * 522struct GNUNET_TESTBED_Operation *
516GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer) 523GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
524 GNUNET_TESTBED_PeerChurnCallback pcc,
525 void *pcc_cls)
517{ 526{
518 struct OperationContext *opc; 527 struct OperationContext *opc;
519 528
529 // FIXME: keep and call pcc!
520 opc = GNUNET_malloc (sizeof (struct OperationContext)); 530 opc = GNUNET_malloc (sizeof (struct OperationContext));
521 opc->c = peer->controller; 531 opc->c = peer->controller;
522 opc->data = peer; 532 opc->data = peer;
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index bc89638a4..9a97dec26 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -199,7 +199,7 @@ start_peers_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
199 for (peer = 0; peer < rc->num_peers; peer++) 199 for (peer = 0; peer < rc->num_peers; peer++)
200 { 200 {
201 dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); 201 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
202 dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer]); 202 dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer], NULL, NULL);
203 dll_op->cls = rc->peers[peer]; 203 dll_op->cls = rc->peers[peer];
204 GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op); 204 GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op);
205 } 205 }
@@ -436,7 +436,7 @@ shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
436 continue; 436 continue;
437 } 437 }
438 dll_op = GNUNET_malloc (sizeof (struct DLLOperation)); 438 dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
439 dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer]); 439 dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer], NULL, NULL);
440 dll_op->cls = rc->peers[peer]; 440 dll_op->cls = rc->peers[peer];
441 GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, 441 GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
442 dll_op); 442 dll_op);