aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 f93f4e856a..0308011a66 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -1542,8 +1542,7 @@ struct GNUNET_FS_ProgressInfo
* field in the GNUNET_FS_ProgressInfo struct.
*/
typedef void *(*GNUNET_FS_ProgressCallback) (void *cls,
- const struct GNUNET_FS_ProgressInfo
- * info);
+ const struct GNUNET_FS_ProgressInfo *info);
/**
@@ -1570,30 +1569,31 @@ enum GNUNET_FS_Flags
GNUNET_FS_FLAGS_DO_PROBES = 2
};
+
/**
* Options specified in the VARARGs portion of GNUNET_FS_start.
*/
enum GNUNET_FS_OPTIONS
{
- /**
- * Last option in the VARARG list.
- */
+ /**
+ * Last option in the VARARG list.
+ */
GNUNET_FS_OPTIONS_END = 0,
- /**
- * Select the desired amount of parallelism (this option should be
- * followed by an "unsigned int" giving the desired maximum number
- * of parallel downloads).
- */
+ /**
+ * Select the desired amount of parallelism (this option should be
+ * followed by an "unsigned int" giving the desired maximum number
+ * of parallel downloads).
+ */
GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1,
- /**
- * Maximum number of requests that should be pending at a given
- * point in time (invidivual downloads may go above this, but
- * if we are above this threshold, we should not activate any
- * additional downloads.
- */
+ /**
+ * Maximum number of requests that should be pending at a given
+ * point in time (invidivual downloads may go above this, but
+ * if we are above this threshold, we should not activate any
+ * additional downloads.
+ */
GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2
};
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 92a7beb40e..ca7230504a 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,
/**
+ * Functions of this signature are called when a peer has been successfully
+ * started or stopped.
+ *
+ * @param cls the closure from GNUNET_TESTBED_peer_start/stop()
+ * @param emsg NULL on success; otherwise an error description
+ */
+typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls,
+ const char *emsg);
+
+
+/**
* Start the given peer.
*
* @param peer peer to start
+ * @param pcc function to call upon completion
+ * @param pcc_cls closure for 'pcc'
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer);
+GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerChurnCallback pcc,
+ void *pcc_cls);
/**
@@ -662,10 +677,14 @@ GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer);
* state of the peer).
*
* @param peer peer to stop
+ * @param pcc function to call upon completion
+ * @param pcc_cls closure for 'pcc'
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer);
+GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerChurnCallback pcc,
+ void *pcc_cls);
/**
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c
index b2a07650af..e44bf8b57e 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)
dht_handle = NULL;
GNUNET_assert (PEER_SERVICE_CONNECT == sub_test);
GNUNET_assert (NULL != operation);
- operation = GNUNET_TESTBED_peer_stop (peer);
+ operation = GNUNET_TESTBED_peer_stop (peer, NULL, NULL);
GNUNET_assert (NULL != operation);
}
@@ -355,7 +355,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
GNUNET_assert (NULL != peer_ptr);
*peer_ptr = peer;
GNUNET_TESTBED_operation_done (operation);
- operation = GNUNET_TESTBED_peer_start (peer);
+ operation = GNUNET_TESTBED_peer_start (peer, NULL, NULL);
GNUNET_assert (NULL != operation);
}
diff --git a/src/testbed/test_testbed_api_2peers.c b/src/testbed/test_testbed_api_2peers.c
index 63810187b4..43becddba7 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)
common_operation = NULL;
result = PEERS_CONNECTED;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
- peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer);
- peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer);
+ peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
+ peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
}
@@ -333,7 +333,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
GNUNET_assert (NULL == pc->peer);
pc->peer = peer;
GNUNET_TESTBED_operation_done (pc->operation);
- pc->operation = GNUNET_TESTBED_peer_start (pc->peer);
+ pc->operation = GNUNET_TESTBED_peer_start (pc->peer, NULL, NULL);
}
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c
index ee62bf1aa6..221de8f4d0 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)
switch (result)
{
case SLAVE1_PEER_START_SUCCESS:
- op = GNUNET_TESTBED_peer_stop (slave1_peer);
+ op = GNUNET_TESTBED_peer_stop (slave1_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
case SLAVE2_PEER_START_SUCCESS:
- op = GNUNET_TESTBED_peer_stop (slave2_peer);
+ op = GNUNET_TESTBED_peer_stop (slave2_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
default:
@@ -282,7 +282,7 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
result = SLAVE2_PEER_CREATE_SUCCESS;
slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
- op = GNUNET_TESTBED_peer_start (slave1_peer);
+ op = GNUNET_TESTBED_peer_start (slave1_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
default:
@@ -354,7 +354,7 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
GNUNET_assert (event->details.peer_stop.peer == slave1_peer);
GNUNET_TESTBED_operation_done (op);
result = SLAVE1_PEER_STOP_SUCCESS;
- op = GNUNET_TESTBED_peer_start (slave2_peer);
+ op = GNUNET_TESTBED_peer_start (slave2_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
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 b8bca508d8..82734d7e96 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)
{
result = GNUNET_OK;
GNUNET_assert (NULL != peers[0]);
- op = GNUNET_TESTBED_peer_stop (peers[0]);
+ op = GNUNET_TESTBED_peer_stop (peers[0], NULL, NULL);
GNUNET_assert (NULL != op);
}
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index 619212def3..86bc6f2e2e 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,
* Start the given peer.
*
* @param peer peer to start
+ * @param pcc function to call upon completion
+ * @param pcc_cls closure for 'pcc'
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer)
+GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerChurnCallback pcc,
+ void *pcc_cls)
{
struct OperationContext *opc;
-
+
+ // FIXME: keep and call pcc!
opc = GNUNET_malloc (sizeof (struct OperationContext));
opc->c = peer->controller;
opc->data = peer;
@@ -510,13 +515,18 @@ GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer)
* state of the peer).
*
* @param peer peer to stop
+ * @param pcc function to call upon completion
+ * @param pcc_cls closure for 'pcc'
* @return handle to the operation
*/
struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer)
+GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerChurnCallback pcc,
+ void *pcc_cls)
{
struct OperationContext *opc;
+ // FIXME: keep and call pcc!
opc = GNUNET_malloc (sizeof (struct OperationContext));
opc->c = peer->controller;
opc->data = peer;
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index bc89638a43..9a97dec26d 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)
for (peer = 0; peer < rc->num_peers; peer++)
{
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
- dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer]);
+ dll_op->op = GNUNET_TESTBED_peer_start (rc->peers[peer], NULL, NULL);
dll_op->cls = rc->peers[peer];
GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail, dll_op);
}
@@ -436,7 +436,7 @@ shutdown_run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
continue;
}
dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
- dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer]);
+ dll_op->op = GNUNET_TESTBED_peer_stop (rc->peers[peer], NULL, NULL);
dll_op->cls = rc->peers[peer];
GNUNET_CONTAINER_DLL_insert_tail (rc->dll_op_head, rc->dll_op_tail,
dll_op);