*/
/**
- * Aim of test_scalarproduct_api : This test creates two peers. Peer1 is the
+ * Aim of test_scalarproduct_api : This test creates two peers. Peer1 is the
* responder peer, Bob and Peer2 is the initiator peer, Alice. Both peers
* connect to VectorProduct Service, and use the API to issue requests to
* service. Test passes, when the expected scalar product is received from the
/**
* Shutdown a peer
- *
+ *
* @param cls pointer to "struct PeerData" of the peer to be disconnected
* @param tc Task Context
*/
const struct GNUNET_TESTBED_EventInformation *event)
{
GNUNET_assert (event->type == GNUNET_TESTBED_ET_OPERATION_FINISHED);
-
+
switch (setup_state)
{
case PEER1_SCALARPRODUCT_CONNECT:
{
LOG (GNUNET_ERROR_TYPE_INFO, "Requester Client expected response received!\n");
product_len = ntohl(msg->product_length);
-
+
if (0 < product_len)
{
gcry_mpi_t result;
{
uint16_t i = 0;
- // calculate expected product
+ // calculate expected product
gcry_mpi_t expected_result;
gcry_mpi_t v1;
gcry_mpi_t v2;
gcry_mpi_release (v1_v2_prod);
}
-
+
// compare the result
if (!gcry_mpi_cmp (expected_result, result))
{
}
/**
- * Prepare the message to be sent by peer2 to its scalarproduct service, to
+ * Prepare the message to be sent by peer2 to its scalarproduct service, to
* initiate a request to peer1.
*/
static struct GNUNET_SCALARPRODUCT_QueueEntry *
int32_t element;
struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
struct GNUNET_HashCode key;
-
+
GNUNET_assert (peer2.vh != NULL);
-
+
GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
/* Read input_elements_peer2, and put in elements_peer2 array */
while (!exit_loop && element_count_peer2 < max_mids);
GNUNET_assert (elements_peer2 != NULL);
GNUNET_assert (element_count_peer2 >= 1);
-
+
/* Read input_mask_peer2 and read in mask_peer2 array */
mask_length = element_count_peer2 / 8 + (element_count_peer2 % 8 ? 1 : 0);
mask_peer2 = GNUNET_malloc ((element_count_peer2 / 8) + 2);
int32_t element;
struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
struct GNUNET_HashCode key;
-
+
GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
/* Read input_elements_peer1, and put in elements_peer1 array */
/**
* Scheduler task to initiate requester client
- *
+ *
* @param cls void* to struct PeerData
* @param tc Task Context
*/
/**
* Scheduler task to initiate responder client
- *
+ *
* @param cls void* to struct PeerData
* @param tc Task Context
*/
prepare_response_task(void *cls,
const struct GNUNET_SCHEDULER_TaskContext
* tc)
-{
+{
responder_prepare_response();
return;
}
* a service. This function is called when GNUNET_TESTBED_operation_done is
* called for peer->op, which holds the handle for GNUNET_TESTBED_service_connect
* operation.
- *
+ *
* @param cls closure
* @param op_result service handle returned from the connect adapter
*/
{
struct PeerData* peer = (struct PeerData*) cls;
- GNUNET_SCALARPRODUCT_disconnect (peer->vh);
+ GNUNET_SCALARPRODUCT_cancel (peer->vh);
return;
}
/**
* Adapter function called to establish a connection to
* a service. This function is called to by GNUNET_TESTBED_service_connect.
- *
+ *
* @param cls closure
* @param cfg configuration of the peer to connect to; will be available until
* GNUNET_TESTBED_operation_done() is called on the operation returned
GNUNET_SCHEDULER_add_now(&prepare_response_task, &peer1);
GNUNET_SCHEDULER_add_now(&request_task, &peer2);
}
-
+
return peer2.vh;
default:
GNUNET_assert (0);
GNUNET_TESTBED_PIT_IDENTITY,
&peerinfo_cb, NULL);
setup_state = PEER1_GET_IDENTITY;
-
+
/* Abort task for stopping test on timeout */
abort_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
NUM_PEERS, event_mask, &controller_event_cb,
NULL,
&test_master, NULL);
-
+
if (GNUNET_SYSERR == ok)
{
LOG (GNUNET_ERROR_TYPE_ERROR, "Test failing due to some error before calling API for request or prepare_response\n");