aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/scalarproduct_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-23 13:43:02 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-23 13:43:02 +0000
commit5a0e57891c7f33f03bb25a3ab6b83d0f0b26a05e (patch)
treefe9e0c8c1ffbe9867b0c03839df6c1fab288e292 /src/scalarproduct/scalarproduct_api.c
parent33b89b07e0ea833955f64d07b7e54e64aab500e9 (diff)
downloadgnunet-5a0e57891c7f33f03bb25a3ab6b83d0f0b26a05e.tar.gz
gnunet-5a0e57891c7f33f03bb25a3ab6b83d0f0b26a05e.zip
-more vector -> scalar renaming
Diffstat (limited to 'src/scalarproduct/scalarproduct_api.c')
-rw-r--r--src/scalarproduct/scalarproduct_api.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c
index 4f8cde8fe..2518e146c 100644
--- a/src/scalarproduct/scalarproduct_api.c
+++ b/src/scalarproduct/scalarproduct_api.c
@@ -19,8 +19,8 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file vectorproduct/vectorproduct_api.c 22 * @file scalarproduct/scalarproduct_api.c
23 * @brief API for the vectorproduct 23 * @brief API for the scalarproduct
24 * @author Christian Fuchs 24 * @author Christian Fuchs
25 * @author Gaurav Kukreja 25 * @author Gaurav Kukreja
26 * 26 *
@@ -28,10 +28,10 @@
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
31#include "gnunet_vectorproduct_service.h" 31#include "gnunet_scalarproduct_service.h"
32#include "gnunet_protocols.h" 32#include "gnunet_protocols.h"
33 33
34#define LOG(kind,...) GNUNET_log_from (kind, "vectorproduct-api",__VA_ARGS__) 34#define LOG(kind,...) GNUNET_log_from (kind, "scalarproduct-api",__VA_ARGS__)
35 35
36/************************************************************** 36/**************************************************************
37 *** Datatype Declarations ********** 37 *** Datatype Declarations **********
@@ -40,22 +40,22 @@
40/** 40/**
41 * Entry in the request queue per client 41 * Entry in the request queue per client
42 */ 42 */
43struct GNUNET_VECTORPRODUCT_QueueEntry 43struct GNUNET_SCALARPRODUCT_QueueEntry
44{ 44{
45 /** 45 /**
46 * This is a linked list. 46 * This is a linked list.
47 */ 47 */
48 struct GNUNET_VECTORPRODUCT_QueueEntry *next; 48 struct GNUNET_SCALARPRODUCT_QueueEntry *next;
49 49
50 /** 50 /**
51 * This is a linked list. 51 * This is a linked list.
52 */ 52 */
53 struct GNUNET_VECTORPRODUCT_QueueEntry *prev; 53 struct GNUNET_SCALARPRODUCT_QueueEntry *prev;
54 54
55 /** 55 /**
56 * Handle to the master context. 56 * Handle to the master context.
57 */ 57 */
58 struct GNUNET_VECTORPRODUCT_Handle *h; 58 struct GNUNET_SCALARPRODUCT_Handle *h;
59 59
60 /** 60 /**
61 * Size of the message 61 * Size of the message
@@ -63,21 +63,21 @@ struct GNUNET_VECTORPRODUCT_QueueEntry
63 uint16_t message_size; 63 uint16_t message_size;
64 64
65 /** 65 /**
66 * Message to be sent to the vectorproduct service 66 * Message to be sent to the scalarproduct service
67 */ 67 */
68 struct GNUNET_VECTORPRODUCT_client_request* msg; 68 struct GNUNET_SCALARPRODUCT_client_request* msg;
69 69
70 union 70 union
71 { 71 {
72 /** 72 /**
73 * Function to call after transmission of the request. 73 * Function to call after transmission of the request.
74 */ 74 */
75 GNUNET_VECTORPRODUCT_ContinuationWithStatus cont_status; 75 GNUNET_SCALARPRODUCT_ContinuationWithStatus cont_status;
76 76
77 /** 77 /**
78 * Function to call after transmission of the request. 78 * Function to call after transmission of the request.
79 */ 79 */
80 GNUNET_VECTORPRODUCT_DatumProcessor cont_datum; 80 GNUNET_SCALARPRODUCT_DatumProcessor cont_datum;
81 }; 81 };
82 82
83 /** 83 /**
@@ -107,7 +107,7 @@ struct GNUNET_VECTORPRODUCT_QueueEntry
107 * Response Processor for response from the service. This function calls the 107 * Response Processor for response from the service. This function calls the
108 * continuation function provided by the client. 108 * continuation function provided by the client.
109 */ 109 */
110 GNUNET_VECTORPRODUCT_ResponseMessageHandler response_proc; 110 GNUNET_SCALARPRODUCT_ResponseMessageHandler response_proc;
111}; 111};
112 112
113/************************************************************** 113/**************************************************************
@@ -121,16 +121,16 @@ struct GNUNET_VECTORPRODUCT_QueueEntry
121 * 121 *
122 * @return pointer to the entry 122 * @return pointer to the entry
123 */ 123 */
124static struct GNUNET_VECTORPRODUCT_QueueEntry * 124static struct GNUNET_SCALARPRODUCT_QueueEntry *
125make_queue_entry (struct GNUNET_VECTORPRODUCT_Handle *h); 125make_queue_entry (struct GNUNET_SCALARPRODUCT_Handle *h);
126 126
127/** 127/**
128 * Removes the head entry from the queue 128 * Removes the head entry from the queue
129 * 129 *
130 * @param h Handle to the master context 130 * @param h Handle to the master context
131 */ 131 */
132static struct GNUNET_VECTORPRODUCT_QueueEntry * 132static struct GNUNET_SCALARPRODUCT_QueueEntry *
133free_queue_head_entry (struct GNUNET_VECTORPRODUCT_Handle * h); 133free_queue_head_entry (struct GNUNET_SCALARPRODUCT_Handle * h);
134 134
135/** 135/**
136 * Triggered when timeout occurs for a request in queue 136 * Triggered when timeout occurs for a request in queue
@@ -170,7 +170,7 @@ static size_t transmit_request (void *cls, size_t size,
170 * @param h handle to the master context 170 * @param h handle to the master context
171 */ 171 */
172static void 172static void
173process_queue (struct GNUNET_VECTORPRODUCT_Handle *h); 173process_queue (struct GNUNET_SCALARPRODUCT_Handle *h);
174 174
175/************************************************************** 175/**************************************************************
176 *** Static Function Declarations ********** 176 *** Static Function Declarations **********
@@ -184,12 +184,12 @@ process_queue (struct GNUNET_VECTORPRODUCT_Handle *h);
184 * 184 *
185 * @return pointer to the entry 185 * @return pointer to the entry
186 */ 186 */
187static struct GNUNET_VECTORPRODUCT_QueueEntry * 187static struct GNUNET_SCALARPRODUCT_QueueEntry *
188make_queue_entry (struct GNUNET_VECTORPRODUCT_Handle *h) 188make_queue_entry (struct GNUNET_SCALARPRODUCT_Handle *h)
189{ 189{
190 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 190 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
191 191
192 qe = GNUNET_new (struct GNUNET_VECTORPRODUCT_QueueEntry); 192 qe = GNUNET_new (struct GNUNET_SCALARPRODUCT_QueueEntry);
193 193
194 // if queue empty 194 // if queue empty
195 if (NULL == h->queue_head && NULL == h->queue_tail) 195 if (NULL == h->queue_head && NULL == h->queue_tail)
@@ -215,10 +215,10 @@ make_queue_entry (struct GNUNET_VECTORPRODUCT_Handle *h)
215 * 215 *
216 * @param h Handle to the master context 216 * @param h Handle to the master context
217 */ 217 */
218static struct GNUNET_VECTORPRODUCT_QueueEntry * 218static struct GNUNET_SCALARPRODUCT_QueueEntry *
219free_queue_head_entry (struct GNUNET_VECTORPRODUCT_Handle * h) 219free_queue_head_entry (struct GNUNET_SCALARPRODUCT_Handle * h)
220{ 220{
221 struct GNUNET_VECTORPRODUCT_QueueEntry * qe = NULL; 221 struct GNUNET_SCALARPRODUCT_QueueEntry * qe = NULL;
222 222
223 GNUNET_assert (NULL != h); 223 GNUNET_assert (NULL != h);
224 if (NULL == h->queue_head && NULL == h->queue_tail) 224 if (NULL == h->queue_head && NULL == h->queue_tail)
@@ -255,7 +255,7 @@ free_queue_head_entry (struct GNUNET_VECTORPRODUCT_Handle * h)
255static void 255static void
256timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 256timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
257{ 257{
258 struct GNUNET_VECTORPRODUCT_QueueEntry * qe = cls; 258 struct GNUNET_SCALARPRODUCT_QueueEntry * qe = cls;
259 259
260 // Update Statistics 260 // Update Statistics
261 GNUNET_STATISTICS_update (qe->h->stats, 261 GNUNET_STATISTICS_update (qe->h->stats,
@@ -273,7 +273,7 @@ timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
273 273
274 // remove the queue_entry for the queue 274 // remove the queue_entry for the queue
275 GNUNET_CONTAINER_DLL_remove (qe->h->queue_head, qe->h->queue_tail, qe); 275 GNUNET_CONTAINER_DLL_remove (qe->h->queue_head, qe->h->queue_tail, qe);
276 qe->response_proc (qe, NULL, GNUNET_VECTORPRODUCT_Status_Timeout); 276 qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Timeout);
277} 277}
278 278
279 279
@@ -287,9 +287,9 @@ timeout_queue_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
287static void 287static void
288process_status_message (void *cls, 288process_status_message (void *cls,
289 const struct GNUNET_MessageHeader *msg, 289 const struct GNUNET_MessageHeader *msg,
290 enum GNUNET_VECTORPRODUCT_ResponseStatus status) 290 enum GNUNET_SCALARPRODUCT_ResponseStatus status)
291{ 291{
292 struct GNUNET_VECTORPRODUCT_QueueEntry *qe = cls; 292 struct GNUNET_SCALARPRODUCT_QueueEntry *qe = cls;
293 293
294 GNUNET_assert (qe != NULL); 294 GNUNET_assert (qe != NULL);
295 295
@@ -308,9 +308,9 @@ process_status_message (void *cls,
308static void 308static void
309process_result_message (void *cls, 309process_result_message (void *cls,
310 const struct GNUNET_MessageHeader *msg, 310 const struct GNUNET_MessageHeader *msg,
311 enum GNUNET_VECTORPRODUCT_ResponseStatus status) 311 enum GNUNET_SCALARPRODUCT_ResponseStatus status)
312{ 312{
313 struct GNUNET_VECTORPRODUCT_QueueEntry *qe = cls; 313 struct GNUNET_SCALARPRODUCT_QueueEntry *qe = cls;
314 314
315 GNUNET_assert (qe != NULL); 315 GNUNET_assert (qe != NULL);
316 316
@@ -320,7 +320,7 @@ process_result_message (void *cls,
320 } 320 }
321 if (qe->cont_datum != NULL) 321 if (qe->cont_datum != NULL)
322 { 322 {
323 qe->cont_datum (qe->cont_cls, &qe->msg->key, &qe->msg->peer, status, (struct GNUNET_VECTORPRODUCT_client_response *) msg); 323 qe->cont_datum (qe->cont_cls, &qe->msg->key, &qe->msg->peer, status, (struct GNUNET_SCALARPRODUCT_client_response *) msg);
324 } 324 }
325} 325}
326 326
@@ -336,11 +336,11 @@ process_result_message (void *cls,
336static void 336static void
337receive_cb (void *cls, const struct GNUNET_MessageHeader *msg) 337receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
338{ 338{
339 struct GNUNET_VECTORPRODUCT_Handle *h = cls; 339 struct GNUNET_SCALARPRODUCT_Handle *h = cls;
340 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 340 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
341 int16_t was_transmitted; 341 int16_t was_transmitted;
342 struct GNUNET_VECTORPRODUCT_client_response *message = 342 struct GNUNET_SCALARPRODUCT_client_response *message =
343 (struct GNUNET_VECTORPRODUCT_client_response *) msg; 343 (struct GNUNET_SCALARPRODUCT_client_response *) msg;
344 344
345 h->in_receive = GNUNET_NO; 345 h->in_receive = GNUNET_NO;
346 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received reply from VectorProduct\n"); 346 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received reply from VectorProduct\n");
@@ -376,12 +376,12 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
376 if (msg == NULL) 376 if (msg == NULL)
377 { 377 {
378 LOG (GNUNET_ERROR_TYPE_WARNING, "Service responded with NULL!\n"); 378 LOG (GNUNET_ERROR_TYPE_WARNING, "Service responded with NULL!\n");
379 qe->response_proc (qe, NULL, GNUNET_VECTORPRODUCT_Status_Failure); 379 qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure);
380 } 380 }
381 else if ((ntohs (msg->type) != GNUNET_MESSAGE_TYPE_VECTORPRODUCT_SERVICE_TO_CLIENT)) 381 else if ((ntohs (msg->type) != GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT))
382 { 382 {
383 LOG (GNUNET_ERROR_TYPE_WARNING, "Invalid Message Received\n"); 383 LOG (GNUNET_ERROR_TYPE_WARNING, "Invalid Message Received\n");
384 qe->response_proc (qe, msg, GNUNET_VECTORPRODUCT_Status_InvalidResponse); 384 qe->response_proc (qe, msg, GNUNET_SCALARPRODUCT_Status_InvalidResponse);
385 } 385 }
386 else if (ntohl (message->product_length) == 0) 386 else if (ntohl (message->product_length) == 0)
387 { 387 {
@@ -391,7 +391,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
391 GNUNET_NO); 391 GNUNET_NO);
392 392
393 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received message from service without product attached.\n"); 393 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received message from service without product attached.\n");
394 qe->response_proc (qe, msg, GNUNET_VECTORPRODUCT_Status_Success); 394 qe->response_proc (qe, msg, GNUNET_SCALARPRODUCT_Status_Success);
395 } 395 }
396 else if (ntohl (message->product_length) > 0) 396 else if (ntohl (message->product_length) > 0)
397 { 397 {
@@ -401,7 +401,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg)
401 GNUNET_NO); 401 GNUNET_NO);
402 402
403 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received message from requester service for requester client.\n"); 403 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received message from requester service for requester client.\n");
404 qe->response_proc (qe, msg, GNUNET_VECTORPRODUCT_Status_Success); 404 qe->response_proc (qe, msg, GNUNET_SCALARPRODUCT_Status_Success);
405 } 405 }
406 406
407 GNUNET_free (qe); 407 GNUNET_free (qe);
@@ -422,8 +422,8 @@ static size_t
422transmit_request (void *cls, size_t size, 422transmit_request (void *cls, size_t size,
423 void *buf) 423 void *buf)
424{ 424{
425 struct GNUNET_VECTORPRODUCT_Handle *h = cls; 425 struct GNUNET_SCALARPRODUCT_Handle *h = cls;
426 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 426 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
427 size_t msize; 427 size_t msize;
428 428
429 if (NULL == (qe = h->queue_head)) 429 if (NULL == (qe = h->queue_head))
@@ -440,11 +440,11 @@ transmit_request (void *cls, size_t size,
440 return 0; /* no entry in queue */ 440 return 0; /* no entry in queue */
441 if (buf == NULL) 441 if (buf == NULL)
442 { 442 {
443 LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to transmit request to VECTORPRODUCT.\n"); 443 LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to transmit request to SCALARPRODUCT.\n");
444 GNUNET_STATISTICS_update (h->stats, 444 GNUNET_STATISTICS_update (h->stats,
445 gettext_noop ("# transmission request failures"), 445 gettext_noop ("# transmission request failures"),
446 1, GNUNET_NO); 446 1, GNUNET_NO);
447 GNUNET_VECTORPRODUCT_disconnect (h); 447 GNUNET_SCALARPRODUCT_disconnect (h);
448 return 0; 448 return 0;
449 } 449 }
450 if (size < (msize = qe->message_size)) 450 if (size < (msize = qe->message_size))
@@ -452,7 +452,7 @@ transmit_request (void *cls, size_t size,
452 process_queue (h); 452 process_queue (h);
453 return 0; 453 return 0;
454 } 454 }
455 LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting %u byte request to VECTORPRODUCT\n", 455 LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting %u byte request to SCALARPRODUCT\n",
456 msize); 456 msize);
457 457
458 memcpy (buf, qe->msg, size); 458 memcpy (buf, qe->msg, size);
@@ -467,7 +467,7 @@ transmit_request (void *cls, size_t size,
467 467
468#if INSANE_STATISTICS 468#if INSANE_STATISTICS
469 GNUNET_STATISTICS_update (h->stats, 469 GNUNET_STATISTICS_update (h->stats,
470 gettext_noop ("# bytes sent to vectorproduct"), 1, 470 gettext_noop ("# bytes sent to scalarproduct"), 1,
471 GNUNET_NO); 471 GNUNET_NO);
472#endif 472#endif
473 return size; 473 return size;
@@ -480,9 +480,9 @@ transmit_request (void *cls, size_t size,
480 * @param h handle to the master context 480 * @param h handle to the master context
481 */ 481 */
482static void 482static void
483process_queue (struct GNUNET_VECTORPRODUCT_Handle *h) 483process_queue (struct GNUNET_SCALARPRODUCT_Handle *h)
484{ 484{
485 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 485 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
486 486
487 if (NULL == (qe = h->queue_head)) 487 if (NULL == (qe = h->queue_head))
488 { 488 {
@@ -519,7 +519,7 @@ process_queue (struct GNUNET_VECTORPRODUCT_Handle *h)
519 if (h->th == NULL) 519 if (h->th == NULL)
520 { 520 {
521 LOG (GNUNET_ERROR_TYPE_ERROR, 521 LOG (GNUNET_ERROR_TYPE_ERROR,
522 _ ("Failed to send a message to the vectorproduct service\n")); 522 _ ("Failed to send a message to the scalarproduct service\n"));
523 return; 523 return;
524 } 524 }
525 525
@@ -547,28 +547,28 @@ process_queue (struct GNUNET_VECTORPRODUCT_Handle *h)
547 * @param cont Callback function 547 * @param cont Callback function
548 * @param cont_cls Closure for the callback function 548 * @param cont_cls Closure for the callback function
549 */ 549 */
550struct GNUNET_VECTORPRODUCT_QueueEntry * 550struct GNUNET_SCALARPRODUCT_QueueEntry *
551GNUNET_VECTORPRODUCT_prepare_response (struct GNUNET_VECTORPRODUCT_Handle *h, 551GNUNET_SCALARPRODUCT_prepare_response (struct GNUNET_SCALARPRODUCT_Handle *h,
552 const struct GNUNET_HashCode * key, 552 const struct GNUNET_HashCode * key,
553 uint16_t element_count, 553 uint16_t element_count,
554 int32_t * elements, 554 int32_t * elements,
555 struct GNUNET_TIME_Relative timeout, 555 struct GNUNET_TIME_Relative timeout,
556 GNUNET_VECTORPRODUCT_ContinuationWithStatus cont, 556 GNUNET_SCALARPRODUCT_ContinuationWithStatus cont,
557 void *cont_cls) 557 void *cont_cls)
558{ 558{
559 struct GNUNET_VECTORPRODUCT_QueueEntry *qe = make_queue_entry (h); 559 struct GNUNET_SCALARPRODUCT_QueueEntry *qe = make_queue_entry (h);
560 int32_t * vector; 560 int32_t * vector;
561 uint16_t size; 561 uint16_t size;
562 unsigned int i; 562 unsigned int i;
563 563
564 GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_VECTORPRODUCT_client_request) 564 GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_SCALARPRODUCT_client_request)
565 +element_count * sizeof (int32_t)); 565 +element_count * sizeof (int32_t));
566 size = sizeof (struct GNUNET_VECTORPRODUCT_client_request) +element_count * sizeof (int32_t); 566 size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) +element_count * sizeof (int32_t);
567 567
568 qe->message_size = size; 568 qe->message_size = size;
569 qe->msg = GNUNET_malloc (size); 569 qe->msg = GNUNET_malloc (size);
570 qe->msg->header.size = htons (size); 570 qe->msg->header.size = htons (size);
571 qe->msg->header.type = htons (GNUNET_MESSAGE_TYPE_VECTORPRODUCT_CLIENT_TO_BOB); 571 qe->msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_BOB);
572 qe->msg->element_count = htons (element_count); 572 qe->msg->element_count = htons (element_count);
573 qe->msg->mask_length = htons (0); 573 qe->msg->mask_length = htons (0);
574 memcpy (&qe->msg->key, key, sizeof (struct GNUNET_HashCode)); 574 memcpy (&qe->msg->key, key, sizeof (struct GNUNET_HashCode));
@@ -603,8 +603,8 @@ GNUNET_VECTORPRODUCT_prepare_response (struct GNUNET_VECTORPRODUCT_Handle *h,
603 * @param cont Callback function 603 * @param cont Callback function
604 * @param cont_cls Closure for the callback function 604 * @param cont_cls Closure for the callback function
605 */ 605 */
606struct GNUNET_VECTORPRODUCT_QueueEntry * 606struct GNUNET_SCALARPRODUCT_QueueEntry *
607GNUNET_VECTORPRODUCT_request (struct GNUNET_VECTORPRODUCT_Handle *h, 607GNUNET_SCALARPRODUCT_request (struct GNUNET_SCALARPRODUCT_Handle *h,
608 const struct GNUNET_HashCode * key, 608 const struct GNUNET_HashCode * key,
609 const struct GNUNET_PeerIdentity * peer, 609 const struct GNUNET_PeerIdentity * peer,
610 uint16_t element_count, 610 uint16_t element_count,
@@ -612,23 +612,23 @@ GNUNET_VECTORPRODUCT_request (struct GNUNET_VECTORPRODUCT_Handle *h,
612 int32_t * elements, 612 int32_t * elements,
613 const unsigned char * mask, 613 const unsigned char * mask,
614 struct GNUNET_TIME_Relative timeout, 614 struct GNUNET_TIME_Relative timeout,
615 GNUNET_VECTORPRODUCT_DatumProcessor cont, 615 GNUNET_SCALARPRODUCT_DatumProcessor cont,
616 void *cont_cls) 616 void *cont_cls)
617{ 617{
618 struct GNUNET_VECTORPRODUCT_QueueEntry *qe = make_queue_entry (h); 618 struct GNUNET_SCALARPRODUCT_QueueEntry *qe = make_queue_entry (h);
619 int32_t * vector; 619 int32_t * vector;
620 uint16_t size; 620 uint16_t size;
621 unsigned int i; 621 unsigned int i;
622 622
623 GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_VECTORPRODUCT_client_request) 623 GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_SCALARPRODUCT_client_request)
624 +element_count * sizeof (int32_t) 624 +element_count * sizeof (int32_t)
625 + mask_length); 625 + mask_length);
626 size = sizeof (struct GNUNET_VECTORPRODUCT_client_request) +element_count * sizeof (int32_t) + mask_length; 626 size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) +element_count * sizeof (int32_t) + mask_length;
627 627
628 qe->message_size = size; 628 qe->message_size = size;
629 qe->msg = GNUNET_malloc (size); 629 qe->msg = GNUNET_malloc (size);
630 qe->msg->header.size = htons (size); 630 qe->msg->header.size = htons (size);
631 qe->msg->header.type = htons (GNUNET_MESSAGE_TYPE_VECTORPRODUCT_CLIENT_TO_ALICE); 631 qe->msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE);
632 memcpy (&qe->msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); 632 memcpy (&qe->msg->peer, peer, sizeof (struct GNUNET_PeerIdentity));
633 qe->msg->element_count = htons (element_count); 633 qe->msg->element_count = htons (element_count);
634 qe->msg->mask_length = htons (mask_length); 634 qe->msg->mask_length = htons (mask_length);
@@ -654,44 +654,44 @@ GNUNET_VECTORPRODUCT_request (struct GNUNET_VECTORPRODUCT_Handle *h,
654 654
655 655
656/** 656/**
657 * Connect to the vectorproduct service. 657 * Connect to the scalarproduct service.
658 * 658 *
659 * @param cfg configuration to use 659 * @param cfg configuration to use
660 * @return handle to use to access the service 660 * @return handle to use to access the service
661 */ 661 */
662struct GNUNET_VECTORPRODUCT_Handle * 662struct GNUNET_SCALARPRODUCT_Handle *
663GNUNET_VECTORPRODUCT_connect (const struct GNUNET_CONFIGURATION_Handle * cfg) 663GNUNET_SCALARPRODUCT_connect (const struct GNUNET_CONFIGURATION_Handle * cfg)
664{ 664{
665 struct GNUNET_CLIENT_Connection *client; 665 struct GNUNET_CLIENT_Connection *client;
666 struct GNUNET_VECTORPRODUCT_Handle *h; 666 struct GNUNET_SCALARPRODUCT_Handle *h;
667 667
668 client = GNUNET_CLIENT_connect ("vectorproduct", cfg); 668 client = GNUNET_CLIENT_connect ("scalarproduct", cfg);
669 669
670 if (NULL == client) 670 if (NULL == client)
671 { 671 {
672 LOG (GNUNET_ERROR_TYPE_ERROR, 672 LOG (GNUNET_ERROR_TYPE_ERROR,
673 _ ("Failed to connect to the vectorproduct service\n")); 673 _ ("Failed to connect to the scalarproduct service\n"));
674 return NULL; 674 return NULL;
675 } 675 }
676 676
677 h = GNUNET_malloc (sizeof (struct GNUNET_VECTORPRODUCT_Handle) + 677 h = GNUNET_malloc (sizeof (struct GNUNET_SCALARPRODUCT_Handle) +
678 GNUNET_SERVER_MAX_MESSAGE_SIZE - 1); 678 GNUNET_SERVER_MAX_MESSAGE_SIZE - 1);
679 h->client = client; 679 h->client = client;
680 h->cfg = cfg; 680 h->cfg = cfg;
681 h->stats = GNUNET_STATISTICS_create ("vectorproduct-api", cfg); 681 h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg);
682 return h; 682 return h;
683} 683}
684 684
685 685
686/** 686/**
687 * Disconnect from the vectorproduct service. 687 * Disconnect from the scalarproduct service.
688 * 688 *
689 * @param h handle to the vectorproduct 689 * @param h handle to the scalarproduct
690 */ 690 */
691void 691void
692GNUNET_VECTORPRODUCT_disconnect (struct GNUNET_VECTORPRODUCT_Handle * h) 692GNUNET_SCALARPRODUCT_disconnect (struct GNUNET_SCALARPRODUCT_Handle * h)
693{ 693{
694 struct GNUNET_VECTORPRODUCT_QueueEntry * qe; 694 struct GNUNET_SCALARPRODUCT_QueueEntry * qe;
695 695
696 LOG (GNUNET_ERROR_TYPE_INFO, 696 LOG (GNUNET_ERROR_TYPE_INFO,
697 "Disconnecting from VectorProduct\n"); 697 "Disconnecting from VectorProduct\n");
@@ -699,7 +699,7 @@ GNUNET_VECTORPRODUCT_disconnect (struct GNUNET_VECTORPRODUCT_Handle * h)
699 while (NULL != h->queue_head) 699 while (NULL != h->queue_head)
700 { 700 {
701 GNUNET_assert (NULL != (qe = free_queue_head_entry (h))); 701 GNUNET_assert (NULL != (qe = free_queue_head_entry (h)));
702 qe->response_proc (qe, NULL, GNUNET_VECTORPRODUCT_Status_ServiceDisconnected); 702 qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_ServiceDisconnected);
703 } 703 }
704 704
705 if (h->client != NULL) 705 if (h->client != NULL)