aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/scalarproduct_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalarproduct/scalarproduct_api.c')
-rw-r--r--src/scalarproduct/scalarproduct_api.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c
index a6d32f9ab..0f8a409cc 100644
--- a/src/scalarproduct/scalarproduct_api.c
+++ b/src/scalarproduct/scalarproduct_api.c
@@ -23,7 +23,7 @@
23 * @brief API for the scalarproduct 23 * @brief API for the scalarproduct
24 * @author Christian Fuchs 24 * @author Christian Fuchs
25 * @author Gaurav Kukreja 25 * @author Gaurav Kukreja
26 * 26 *
27 */ 27 */
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
@@ -145,9 +145,9 @@ GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h);
145 145
146 146
147/** 147/**
148 * Handles the RESULT received in reply of prepare_response from the 148 * Handles the RESULT received in reply of prepare_response from the
149 * service 149 * service
150 * 150 *
151 * @param cls Handle to the Master Context 151 * @param cls Handle to the Master Context
152 * @param msg Pointer to the response received 152 * @param msg Pointer to the response received
153 */ 153 */
@@ -163,9 +163,9 @@ process_status_message (void *cls,
163 163
164 164
165/** 165/**
166 * Handles the RESULT received in reply of prepare_response from the 166 * Handles the RESULT received in reply of prepare_response from the
167 * service 167 * service
168 * 168 *
169 * @param cls Handle to the Master Context 169 * @param cls Handle to the Master Context
170 * @param msg Pointer to the response received 170 * @param msg Pointer to the response received
171 */ 171 */
@@ -215,7 +215,7 @@ process_result_message (void *cls,
215 * Called when a response is received from the service. After basic check 215 * Called when a response is received from the service. After basic check
216 * handler in qe->response_proc is called. This functions handles the response 216 * handler in qe->response_proc is called. This functions handles the response
217 * to the client which used the API. 217 * to the client which used the API.
218 * 218 *
219 * @param cls Pointer to the Master Context 219 * @param cls Pointer to the Master Context
220 * @param msg Pointer to the data received in response 220 * @param msg Pointer to the data received in response
221 */ 221 */
@@ -245,7 +245,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
245 245
246 status = GNUNET_SCALARPRODUCT_Status_Success; 246 status = GNUNET_SCALARPRODUCT_Status_Success;
247 } 247 }
248 248
249 if (qe->cont_datum != NULL) 249 if (qe->cont_datum != NULL)
250 qe->response_proc (qe, msg, status); 250 qe->response_proc (qe, msg, status);
251 251
@@ -256,11 +256,11 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
256 256
257/** 257/**
258 * Transmits the request to the VectorProduct Sevice 258 * Transmits the request to the VectorProduct Sevice
259 * 259 *
260 * @param cls Closure 260 * @param cls Closure
261 * @param size Size of the buffer 261 * @param size Size of the buffer
262 * @param buf Pointer to the buffer 262 * @param buf Pointer to the buffer
263 * 263 *
264 * @return Size of the message sent 264 * @return Size of the message sent
265 */ 265 */
266static size_t 266static size_t
@@ -279,7 +279,7 @@ transmit_request (void *cls, size_t size,
279 // notify caller about the error, done here. 279 // notify caller about the error, done here.
280 if (qe->cont_datum != NULL) 280 if (qe->cont_datum != NULL)
281 qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure); 281 qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure);
282 282
283 GNUNET_SCALARPRODUCT_cancel (cls); 283 GNUNET_SCALARPRODUCT_cancel (cls);
284 return 0; 284 return 0;
285 } 285 }
@@ -307,8 +307,8 @@ transmit_request (void *cls, size_t size,
307 307
308 308
309/** 309/**
310 * Used by Bob's client to cooperate with Alice, 310 * Used by Bob's client to cooperate with Alice,
311 * 311 *
312 * @param h handle to the master context 312 * @param h handle to the master context
313 * @param key Session key - unique to the requesting client 313 * @param key Session key - unique to the requesting client
314 * @param elements Array of elements of the vector 314 * @param elements Array of elements of the vector
@@ -358,7 +358,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg,
358 h->response_proc = &process_status_message; 358 h->response_proc = &process_status_message;
359 h->cfg = cfg; 359 h->cfg = cfg;
360 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); 360 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode));
361 361
362 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); 362 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size);
363 h->msg = msg; 363 h->msg = msg;
364 msg->header.size = htons (size); 364 msg->header.size = htons (size);
@@ -393,7 +393,7 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg,
393 393
394/** 394/**
395 * Request by Alice's client for computing a scalar product 395 * Request by Alice's client for computing a scalar product
396 * 396 *
397 * @param h handle to the master context 397 * @param h handle to the master context
398 * @param key Session key - unique to the requesting client 398 * @param key Session key - unique to the requesting client
399 * @param peer PeerID of the other peer 399 * @param peer PeerID of the other peer
@@ -451,7 +451,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
451 h->response_proc = &process_result_message; 451 h->response_proc = &process_result_message;
452 h->cfg = cfg; 452 h->cfg = cfg;
453 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); 453 memcpy (&h->key, key, sizeof (struct GNUNET_HashCode));
454 454
455 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); 455 msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size);
456 h->msg = msg; 456 h->msg = msg;
457 msg->header.size = htons (size); 457 msg->header.size = htons (size);
@@ -463,7 +463,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
463 // copy each element over to the message 463 // copy each element over to the message
464 for (i = 0; i < element_count; i++) 464 for (i = 0; i < element_count; i++)
465 vector[i] = htonl (elements[i]); 465 vector[i] = htonl (elements[i]);
466 466
467 memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); 467 memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity));
468 memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode)); 468 memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode));
469 memcpy (&vector[element_count], mask, mask_bytes); 469 memcpy (&vector[element_count], mask, mask_bytes);
@@ -489,7 +489,7 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg,
489 489
490/** 490/**
491 * Disconnect from the scalarproduct service. 491 * Disconnect from the scalarproduct service.
492 * 492 *
493 * @param h a computation handle to cancel 493 * @param h a computation handle to cancel
494 */ 494 */
495void 495void