aboutsummaryrefslogtreecommitdiff
path: root/src
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
parent33b89b07e0ea833955f64d07b7e54e64aab500e9 (diff)
downloadgnunet-5a0e57891c7f33f03bb25a3ab6b83d0f0b26a05e.tar.gz
gnunet-5a0e57891c7f33f03bb25a3ab6b83d0f0b26a05e.zip
-more vector -> scalar renaming
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_applications.h4
-rw-r--r--src/include/gnunet_protocols.h12
-rw-r--r--src/include/gnunet_scalarproduct_service.h76
-rw-r--r--src/scalarproduct/gnunet-scalarproduct.c64
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct.c78
-rw-r--r--src/scalarproduct/gnunet_scalarproduct.h16
-rw-r--r--src/scalarproduct/scalarproduct_api.c154
-rw-r--r--src/scalarproduct/test_scalarproduct_api.c110
-rw-r--r--src/scalarproduct/test_scalarproduct_api_4peers.c136
-rw-r--r--src/scalarproduct/test_scalarproduct_api_regression.c92
-rw-r--r--src/scalarproduct/test_scalarproduct_api_regression2.c110
-rw-r--r--src/scalarproduct/vectorproduct_testing.h32
12 files changed, 442 insertions, 442 deletions
diff --git a/src/include/gnunet_applications.h b/src/include/gnunet_applications.h
index 866ea0140..608a4a2e7 100644
--- a/src/include/gnunet_applications.h
+++ b/src/include/gnunet_applications.h
@@ -82,9 +82,9 @@ extern "C"
82#define GNUNET_APPLICATION_TYPE_SET 19 82#define GNUNET_APPLICATION_TYPE_SET 19
83 83
84/** 84/**
85 * Vectorproduct. Used for two-peer vectorproduct operations 85 * Vectorproduct. Used for two-peer scalarproduct operations
86 */ 86 */
87#define GNUNET_APPLICATION_TYPE_VECTORPRODUCT 20 87#define GNUNET_APPLICATION_TYPE_SCALARPRODUCT 20
88 88
89#if 0 /* keep Emacsens' auto-indent happy */ 89#if 0 /* keep Emacsens' auto-indent happy */
90{ 90{
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index dfd7c5506..3332bebd3 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1906,33 +1906,33 @@ extern "C"
1906 1906
1907 1907
1908/******************************************************************************* 1908/*******************************************************************************
1909 * VECTORPRODUCT message types 1909 * SCALARPRODUCT message types
1910 ******************************************************************************/ 1910 ******************************************************************************/
1911 1911
1912/** 1912/**
1913 * Client -> Vector-Product Service request message 1913 * Client -> Vector-Product Service request message
1914 */ 1914 */
1915#define GNUNET_MESSAGE_TYPE_VECTORPRODUCT_CLIENT_TO_ALICE 640 1915#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE 640
1916 1916
1917/** 1917/**
1918 * Client -> Vector-Product Service request message 1918 * Client -> Vector-Product Service request message
1919 */ 1919 */
1920#define GNUNET_MESSAGE_TYPE_VECTORPRODUCT_CLIENT_TO_BOB 641 1920#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_BOB 641
1921 1921
1922/** 1922/**
1923 * Vector-Product Service request -> remote VP Service 1923 * Vector-Product Service request -> remote VP Service
1924 */ 1924 */
1925#define GNUNET_MESSAGE_TYPE_VECTORPRODUCT_ALICE_TO_BOB 642 1925#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_TO_BOB 642
1926 1926
1927/** 1927/**
1928 * remote Vector-Product Service response -> requesting VP Service 1928 * remote Vector-Product Service response -> requesting VP Service
1929 */ 1929 */
1930#define GNUNET_MESSAGE_TYPE_VECTORPRODUCT_BOB_TO_ALICE 643 1930#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_TO_ALICE 643
1931 1931
1932/** 1932/**
1933 * Vector-Product Service response -> Client 1933 * Vector-Product Service response -> Client
1934 */ 1934 */
1935#define GNUNET_MESSAGE_TYPE_VECTORPRODUCT_SERVICE_TO_CLIENT 644 1935#define GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT 644
1936 1936
1937 1937
1938 1938
diff --git a/src/include/gnunet_scalarproduct_service.h b/src/include/gnunet_scalarproduct_service.h
index 743a7365d..9fc8dbd2a 100644
--- a/src/include/gnunet_scalarproduct_service.h
+++ b/src/include/gnunet_scalarproduct_service.h
@@ -19,13 +19,13 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file include/gnunet_vectorproduct_service.h 22 * @file include/gnunet_scalarproduct_service.h
23 * @brief API to the vectorproduct service 23 * @brief API to the scalarproduct service
24 * @author Christian M. Fuchs 24 * @author Christian M. Fuchs
25 * @author Gaurav Kukreja 25 * @author Gaurav Kukreja
26 */ 26 */
27#ifndef GNUNET_VECTORPRODUCT_SERVICE_H 27#ifndef GNUNET_SCALARPRODUCT_SERVICE_H
28#define GNUNET_VECTORPRODUCT_SERVICE_H 28#define GNUNET_SCALARPRODUCT_SERVICE_H
29#define GCRYPT_NO_DEPRECATED 29#define GCRYPT_NO_DEPRECATED
30// including gcrypt crashes netbeans after the next restart... 30// including gcrypt crashes netbeans after the next restart...
31#include <gcrypt.h> 31#include <gcrypt.h>
@@ -38,15 +38,15 @@ extern "C" {
38#endif 38#endif
39 39
40/** 40/**
41 * Version of the vectorproduct API. 41 * Version of the scalarproduct API.
42 */ 42 */
43#define GNUNET_VECTORPRODUCT_VERSION 0x00000042 43#define GNUNET_SCALARPRODUCT_VERSION 0x00000042
44 44
45/** 45/**
46 * Message type passed from client to service 46 * Message type passed from client to service
47 * to initiate a request or responder role 47 * to initiate a request or responder role
48 */ 48 */
49struct GNUNET_VECTORPRODUCT_client_request { 49struct GNUNET_SCALARPRODUCT_client_request {
50 /** 50 /**
51 * GNUNET message header 51 * GNUNET message header
52 */ 52 */
@@ -81,7 +81,7 @@ struct GNUNET_VECTORPRODUCT_client_request {
81 * Message type passed from service client 81 * Message type passed from service client
82 * to finalize a session as requester or responder 82 * to finalize a session as requester or responder
83 */ 83 */
84struct GNUNET_VECTORPRODUCT_client_response { 84struct GNUNET_SCALARPRODUCT_client_response {
85 /** 85 /**
86 * GNUNET message header 86 * GNUNET message header
87 */ 87 */
@@ -107,22 +107,22 @@ struct GNUNET_VECTORPRODUCT_client_response {
107 */ 107 */
108}; 108};
109 109
110enum GNUNET_VECTORPRODUCT_ResponseStatus { 110enum GNUNET_SCALARPRODUCT_ResponseStatus {
111 GNUNET_VECTORPRODUCT_Status_Success = 0, 111 GNUNET_SCALARPRODUCT_Status_Success = 0,
112 GNUNET_VECTORPRODUCT_Status_Failure, 112 GNUNET_SCALARPRODUCT_Status_Failure,
113 GNUNET_VECTORPRODUCT_Status_Timeout, 113 GNUNET_SCALARPRODUCT_Status_Timeout,
114 GNUNET_VECTORPRODUCT_Status_InvalidResponse, 114 GNUNET_SCALARPRODUCT_Status_InvalidResponse,
115 GNUNET_VECTORPRODUCT_Status_ServiceDisconnected 115 GNUNET_SCALARPRODUCT_Status_ServiceDisconnected
116}; 116};
117 117
118struct GNUNET_VECTORPRODUCT_Handle { 118struct GNUNET_SCALARPRODUCT_Handle {
119 /** 119 /**
120 * Our configuration. 120 * Our configuration.
121 */ 121 */
122 const struct GNUNET_CONFIGURATION_Handle *cfg; 122 const struct GNUNET_CONFIGURATION_Handle *cfg;
123 123
124 /** 124 /**
125 * Current connection to the vectorproduct service. 125 * Current connection to the scalarproduct service.
126 */ 126 */
127 struct GNUNET_CLIENT_Connection *client; 127 struct GNUNET_CLIENT_Connection *client;
128 128
@@ -134,12 +134,12 @@ struct GNUNET_VECTORPRODUCT_Handle {
134 /** 134 /**
135 * Current head of priority queue. 135 * Current head of priority queue.
136 */ 136 */
137 struct GNUNET_VECTORPRODUCT_QueueEntry *queue_head; 137 struct GNUNET_SCALARPRODUCT_QueueEntry *queue_head;
138 138
139 /** 139 /**
140 * Current tail of priority queue. 140 * Current tail of priority queue.
141 */ 141 */
142 struct GNUNET_VECTORPRODUCT_QueueEntry *queue_tail; 142 struct GNUNET_SCALARPRODUCT_QueueEntry *queue_tail;
143 143
144 /** 144 /**
145 * Are we currently trying to receive from the service? 145 * Are we currently trying to receive from the service?
@@ -156,9 +156,9 @@ struct GNUNET_VECTORPRODUCT_Handle {
156 */ 156 */
157}; 157};
158 158
159typedef void (*GNUNET_VECTORPRODUCT_ResponseMessageHandler) (void *cls, 159typedef void (*GNUNET_SCALARPRODUCT_ResponseMessageHandler) (void *cls,
160 const struct GNUNET_MessageHeader *msg, 160 const struct GNUNET_MessageHeader *msg,
161 enum GNUNET_VECTORPRODUCT_ResponseStatus status); 161 enum GNUNET_SCALARPRODUCT_ResponseStatus status);
162 162
163/** 163/**
164 * Continuation called to notify client about result of the 164 * Continuation called to notify client about result of the
@@ -170,11 +170,11 @@ typedef void (*GNUNET_VECTORPRODUCT_ResponseMessageHandler) (void *cls,
170 * GNUNET_YES (or other positive value) on success 170 * GNUNET_YES (or other positive value) on success
171 * @param msg NULL on success, otherwise an error message 171 * @param msg NULL on success, otherwise an error message
172 */ 172 */
173typedef void (*GNUNET_VECTORPRODUCT_ContinuationWithStatus) (void *cls, 173typedef void (*GNUNET_SCALARPRODUCT_ContinuationWithStatus) (void *cls,
174 const struct GNUNET_HashCode * key, 174 const struct GNUNET_HashCode * key,
175 enum GNUNET_VECTORPRODUCT_ResponseStatus status); 175 enum GNUNET_SCALARPRODUCT_ResponseStatus status);
176/** 176/**
177 * Process a datum that was stored in the vectorproduct. 177 * Process a datum that was stored in the scalarproduct.
178 * 178 *
179 * @param cls closure 179 * @param cls closure
180 * @param key Sessioon key 180 * @param key Sessioon key
@@ -184,11 +184,11 @@ typedef void (*GNUNET_VECTORPRODUCT_ContinuationWithStatus) (void *cls,
184 * @param data Pointer to the data 184 * @param data Pointer to the data
185 * @param type Type of data 185 * @param type Type of data
186 */ 186 */
187typedef void (*GNUNET_VECTORPRODUCT_DatumProcessor) (void *cls, 187typedef void (*GNUNET_SCALARPRODUCT_DatumProcessor) (void *cls,
188 const struct GNUNET_HashCode * key, 188 const struct GNUNET_HashCode * key,
189 const struct GNUNET_PeerIdentity * peer, 189 const struct GNUNET_PeerIdentity * peer,
190 enum GNUNET_VECTORPRODUCT_ResponseStatus status, 190 enum GNUNET_SCALARPRODUCT_ResponseStatus status,
191 const struct GNUNET_VECTORPRODUCT_client_response *msg); 191 const struct GNUNET_SCALARPRODUCT_client_response *msg);
192 192
193/** 193/**
194 * Request the Scalar Product Evaluation 194 * Request the Scalar Product Evaluation
@@ -204,15 +204,15 @@ typedef void (*GNUNET_VECTORPRODUCT_DatumProcessor) (void *cls,
204 * @param cont Callback function 204 * @param cont Callback function
205 * @param cont_cls Closure for the callback function 205 * @param cont_cls Closure for the callback function
206 */ 206 */
207struct GNUNET_VECTORPRODUCT_QueueEntry * 207struct GNUNET_SCALARPRODUCT_QueueEntry *
208GNUNET_VECTORPRODUCT_request(struct GNUNET_VECTORPRODUCT_Handle *h, 208GNUNET_SCALARPRODUCT_request(struct GNUNET_SCALARPRODUCT_Handle *h,
209 const struct GNUNET_HashCode * key, 209 const struct GNUNET_HashCode * key,
210 const struct GNUNET_PeerIdentity *peer, 210 const struct GNUNET_PeerIdentity *peer,
211 uint16_t element_count, 211 uint16_t element_count,
212 uint16_t mask_bytes, 212 uint16_t mask_bytes,
213 int32_t * elements, const unsigned char * mask, 213 int32_t * elements, const unsigned char * mask,
214 struct GNUNET_TIME_Relative timeout, 214 struct GNUNET_TIME_Relative timeout,
215 GNUNET_VECTORPRODUCT_DatumProcessor cont, 215 GNUNET_SCALARPRODUCT_DatumProcessor cont,
216 void *cont_cls); 216 void *cont_cls);
217 217
218/** 218/**
@@ -228,31 +228,31 @@ GNUNET_VECTORPRODUCT_request(struct GNUNET_VECTORPRODUCT_Handle *h,
228 * @param cont Callback function 228 * @param cont Callback function
229 * @param cont_cls Closure for the callback function 229 * @param cont_cls Closure for the callback function
230 */ 230 */
231struct GNUNET_VECTORPRODUCT_QueueEntry * 231struct GNUNET_SCALARPRODUCT_QueueEntry *
232GNUNET_VECTORPRODUCT_prepare_response(struct GNUNET_VECTORPRODUCT_Handle *h, 232GNUNET_SCALARPRODUCT_prepare_response(struct GNUNET_SCALARPRODUCT_Handle *h,
233 const struct GNUNET_HashCode * key, 233 const struct GNUNET_HashCode * key,
234 uint16_t element_count, 234 uint16_t element_count,
235 int32_t* elements, 235 int32_t* elements,
236 struct GNUNET_TIME_Relative timeout, 236 struct GNUNET_TIME_Relative timeout,
237 GNUNET_VECTORPRODUCT_ContinuationWithStatus cont, 237 GNUNET_SCALARPRODUCT_ContinuationWithStatus cont,
238 void *cont_cls); 238 void *cont_cls);
239 239
240/** 240/**
241 * Connect to the vectorproduct service. 241 * Connect to the scalarproduct service.
242 * 242 *
243 * @param cfg configuration to use 243 * @param cfg configuration to use
244 * @return handle to use to access the service 244 * @return handle to use to access the service
245 */ 245 */
246struct GNUNET_VECTORPRODUCT_Handle * 246struct GNUNET_SCALARPRODUCT_Handle *
247GNUNET_VECTORPRODUCT_connect(const struct GNUNET_CONFIGURATION_Handle * cfg); 247GNUNET_SCALARPRODUCT_connect(const struct GNUNET_CONFIGURATION_Handle * cfg);
248 248
249/** 249/**
250 * Disconnect from the vectorproduct service. 250 * Disconnect from the scalarproduct service.
251 * 251 *
252 * @param h handle to the vectorproduct 252 * @param h handle to the scalarproduct
253 */ 253 */
254void 254void
255GNUNET_VECTORPRODUCT_disconnect(struct GNUNET_VECTORPRODUCT_Handle * h); 255GNUNET_SCALARPRODUCT_disconnect(struct GNUNET_SCALARPRODUCT_Handle * h);
256 256
257 257
258#if 0 /* keep Emacsens' auto-indent happy */ 258#if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c
index 449085593..16c0e173a 100644
--- a/src/scalarproduct/gnunet-scalarproduct.c
+++ b/src/scalarproduct/gnunet-scalarproduct.c
@@ -19,8 +19,8 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file vectorproduct/gnunet-vectorproduct.c 22 * @file scalarproduct/gnunet-scalarproduct.c
23 * @brief vectorproduct client 23 * @brief scalarproduct client
24 * @author Christian M. Fuchs 24 * @author Christian M. Fuchs
25 */ 25 */
26#define GCRYPT_NO_DEPRECATED 26#define GCRYPT_NO_DEPRECATED
@@ -29,10 +29,10 @@
29 29
30#include "platform.h" 30#include "platform.h"
31#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
32#include "gnunet_vectorproduct_service.h" 32#include "gnunet_scalarproduct_service.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
34 34
35#define LOG(kind,...) GNUNET_log_from (kind, "gnunet-vectorproduct",__VA_ARGS__) 35#define LOG(kind,...) GNUNET_log_from (kind, "gnunet-scalarproduct",__VA_ARGS__)
36/** 36/**
37 * Option -p: destination peer identity for checking message-ids with 37 * Option -p: destination peer identity for checking message-ids with
38 */ 38 */
@@ -44,12 +44,12 @@ static char *input_peer_id = NULL;
44static char *input_key = NULL; 44static char *input_key = NULL;
45 45
46/** 46/**
47 * Option -e: vector to calculate a vectorproduct with 47 * Option -e: vector to calculate a scalarproduct with
48 */ 48 */
49static char *input_elements = NULL; 49static char *input_elements = NULL;
50 50
51/** 51/**
52 * Option -m: message-ids to calculate a vectorproduct with 52 * Option -m: message-ids to calculate a scalarproduct with
53 */ 53 */
54static char *input_mask = NULL; 54static char *input_mask = NULL;
55 55
@@ -89,21 +89,21 @@ struct GNUNET_PeerIdentity peer;
89struct GNUNET_HashCode key; 89struct GNUNET_HashCode key;
90 90
91/** 91/**
92 * Pointer to the GNUNET_VECTORPRODUCT_Handle 92 * Pointer to the GNUNET_SCALARPRODUCT_Handle
93 */ 93 */
94struct GNUNET_VECTORPRODUCT_Handle *handle; 94struct GNUNET_SCALARPRODUCT_Handle *handle;
95 95
96/** 96/**
97 * Global return value 97 * Global return value
98 */ 98 */
99static int ret; 99static int ret;
100 100
101struct GNUNET_VECTORPRODUCT_TestCls 101struct GNUNET_SCALARPRODUCT_TestCls
102{ 102{
103 struct GNUNET_VECTORPRODUCT_Handle * h; 103 struct GNUNET_SCALARPRODUCT_Handle * h;
104}; 104};
105 105
106struct GNUNET_VECTORPRODUCT_TestCls test_cls; 106struct GNUNET_SCALARPRODUCT_TestCls test_cls;
107 107
108 108
109/** 109/**
@@ -115,32 +115,32 @@ struct GNUNET_VECTORPRODUCT_TestCls test_cls;
115static void 115static void
116responder_callback (void *cls, 116responder_callback (void *cls,
117 const struct GNUNET_HashCode * key, 117 const struct GNUNET_HashCode * key,
118 enum GNUNET_VECTORPRODUCT_ResponseStatus status) 118 enum GNUNET_SCALARPRODUCT_ResponseStatus status)
119{ 119{
120 ret = -1; 120 ret = -1;
121 121
122 switch (status) 122 switch (status)
123 { 123 {
124 case GNUNET_VECTORPRODUCT_Status_Success: 124 case GNUNET_SCALARPRODUCT_Status_Success:
125 ret = 0; 125 ret = 0;
126 LOG (GNUNET_ERROR_TYPE_INFO, "Session %s concluded.\n", GNUNET_h2s (key)); 126 LOG (GNUNET_ERROR_TYPE_INFO, "Session %s concluded.\n", GNUNET_h2s (key));
127 break; 127 break;
128 case GNUNET_VECTORPRODUCT_Status_InvalidResponse: 128 case GNUNET_SCALARPRODUCT_Status_InvalidResponse:
129 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: invalid response\n", GNUNET_h2s (key)); 129 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: invalid response\n", GNUNET_h2s (key));
130 break; 130 break;
131 case GNUNET_VECTORPRODUCT_Status_Timeout: 131 case GNUNET_SCALARPRODUCT_Status_Timeout:
132 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: timeout\n", GNUNET_h2s (key)); 132 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: timeout\n", GNUNET_h2s (key));
133 break; 133 break;
134 case GNUNET_VECTORPRODUCT_Status_Failure: 134 case GNUNET_SCALARPRODUCT_Status_Failure:
135 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: service failure\n", GNUNET_h2s (key)); 135 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: service failure\n", GNUNET_h2s (key));
136 case GNUNET_VECTORPRODUCT_Status_ServiceDisconnected: 136 case GNUNET_SCALARPRODUCT_Status_ServiceDisconnected:
137 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: service disconnect!!\n", GNUNET_h2s (key)); 137 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: service disconnect!!\n", GNUNET_h2s (key));
138 break; 138 break;
139 default: 139 default:
140 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status); 140 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status);
141 } 141 }
142 142
143 GNUNET_VECTORPRODUCT_disconnect (handle); 143 GNUNET_SCALARPRODUCT_disconnect (handle);
144 GNUNET_SCHEDULER_shutdown (); 144 GNUNET_SCHEDULER_shutdown ();
145} 145}
146 146
@@ -160,15 +160,15 @@ static void
160requester_callback (void *cls, 160requester_callback (void *cls,
161 const struct GNUNET_HashCode * key, 161 const struct GNUNET_HashCode * key,
162 const struct GNUNET_PeerIdentity * peer, 162 const struct GNUNET_PeerIdentity * peer,
163 enum GNUNET_VECTORPRODUCT_ResponseStatus status, 163 enum GNUNET_SCALARPRODUCT_ResponseStatus status,
164 const struct GNUNET_VECTORPRODUCT_client_response *msg) 164 const struct GNUNET_SCALARPRODUCT_client_response *msg)
165{ 165{
166 uint32_t product_len; 166 uint32_t product_len;
167 ret = -1; 167 ret = -1;
168 168
169 switch (status) 169 switch (status)
170 { 170 {
171 case GNUNET_VECTORPRODUCT_Status_Success: 171 case GNUNET_SCALARPRODUCT_Status_Success:
172 product_len = ntohl (msg->product_length); 172 product_len = ntohl (msg->product_length);
173 173
174 LOG (GNUNET_ERROR_TYPE_INFO, "Session %s concluded.\n", GNUNET_h2s (key)); 174 LOG (GNUNET_ERROR_TYPE_INFO, "Session %s concluded.\n", GNUNET_h2s (key));
@@ -194,21 +194,21 @@ requester_callback (void *cls,
194 LOG (GNUNET_ERROR_TYPE_ERROR, "Service-side error in session %s, return code: %d\n", GNUNET_h2s (key), product_len); 194 LOG (GNUNET_ERROR_TYPE_ERROR, "Service-side error in session %s, return code: %d\n", GNUNET_h2s (key), product_len);
195 } 195 }
196 break; 196 break;
197 case GNUNET_VECTORPRODUCT_Status_InvalidResponse: 197 case GNUNET_SCALARPRODUCT_Status_InvalidResponse:
198 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: invalid response\n", GNUNET_h2s (key)); 198 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: invalid response\n", GNUNET_h2s (key));
199 break; 199 break;
200 case GNUNET_VECTORPRODUCT_Status_Timeout: 200 case GNUNET_SCALARPRODUCT_Status_Timeout:
201 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: timeout\n", GNUNET_h2s (key)); 201 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: timeout\n", GNUNET_h2s (key));
202 break; 202 break;
203 case GNUNET_VECTORPRODUCT_Status_Failure: 203 case GNUNET_SCALARPRODUCT_Status_Failure:
204 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: service failure\n", GNUNET_h2s (key)); 204 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: service failure\n", GNUNET_h2s (key));
205 case GNUNET_VECTORPRODUCT_Status_ServiceDisconnected: 205 case GNUNET_SCALARPRODUCT_Status_ServiceDisconnected:
206 LOG (GNUNET_ERROR_TYPE_ERROR, "Disconnected from service.\n", GNUNET_h2s (key)); 206 LOG (GNUNET_ERROR_TYPE_ERROR, "Disconnected from service.\n", GNUNET_h2s (key));
207 break; 207 break;
208 default: 208 default:
209 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status); 209 LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status);
210 } 210 }
211 GNUNET_VECTORPRODUCT_disconnect (handle); 211 GNUNET_SCALARPRODUCT_disconnect (handle);
212 GNUNET_SCHEDULER_shutdown (); 212 GNUNET_SCHEDULER_shutdown ();
213} 213}
214 214
@@ -342,7 +342,7 @@ run (void *cls,
342 mask[i] = UCHAR_MAX; // all 1's 342 mask[i] = UCHAR_MAX; // all 1's
343 } 343 }
344 344
345 handle = GNUNET_VECTORPRODUCT_connect (cfg); 345 handle = GNUNET_SCALARPRODUCT_connect (cfg);
346 if (handle == NULL) 346 if (handle == NULL)
347 { 347 {
348 FPRINTF (stderr, _ ("Could not connect to the GNUNET Vector Product Service\n")); 348 FPRINTF (stderr, _ ("Could not connect to the GNUNET Vector Product Service\n"));
@@ -351,7 +351,7 @@ run (void *cls,
351 351
352 test_cls.h = handle; 352 test_cls.h = handle;
353 353
354 if (input_peer_id && !GNUNET_VECTORPRODUCT_request (handle, 354 if (input_peer_id && !GNUNET_SCALARPRODUCT_request (handle,
355 &key, 355 &key,
356 &peer, 356 &peer,
357 element_count, 357 element_count,
@@ -361,7 +361,7 @@ run (void *cls,
361 &requester_callback, 361 &requester_callback,
362 (void *) &test_cls)) 362 (void *) &test_cls))
363 return; 363 return;
364 if ( !input_peer_id && !GNUNET_VECTORPRODUCT_prepare_response (handle, 364 if ( !input_peer_id && !GNUNET_SCALARPRODUCT_prepare_response (handle,
365 &key, 365 &key,
366 element_count, 366 element_count,
367 elements, 367 elements,
@@ -375,7 +375,7 @@ run (void *cls,
375 375
376 376
377/** 377/**
378 * The main function to the vectorproduct client. 378 * The main function to the scalarproduct client.
379 * 379 *
380 * @param argc number of arguments from the command line 380 * @param argc number of arguments from the command line
381 * @param argv command line arguments 381 * @param argv command line arguments
@@ -392,7 +392,7 @@ main (int argc, char *const *argv)
392 gettext_noop ("A comma separated mask to select which elements should actually be compared."), 392 gettext_noop ("A comma separated mask to select which elements should actually be compared."),
393 1, &GNUNET_GETOPT_set_string, &input_mask}, 393 1, &GNUNET_GETOPT_set_string, &input_mask},
394 {'p', "peer", "PEERID", 394 {'p', "peer", "PEERID",
395 gettext_noop ("[Optional] peer to calculate our vectorproduct with. If this parameter is not given, the service will wait for a remote peer to compute the request."), 395 gettext_noop ("[Optional] peer to calculate our scalarproduct with. If this parameter is not given, the service will wait for a remote peer to compute the request."),
396 1, &GNUNET_GETOPT_set_string, &input_peer_id}, 396 1, &GNUNET_GETOPT_set_string, &input_peer_id},
397 {'k', "key", "TRANSACTION_ID", 397 {'k', "key", "TRANSACTION_ID",
398 gettext_noop ("Transaction ID shared with peer."), 398 gettext_noop ("Transaction ID shared with peer."),
@@ -403,7 +403,7 @@ main (int argc, char *const *argv)
403 return (GNUNET_OK == 403 return (GNUNET_OK ==
404 GNUNET_PROGRAM_run (argc, 404 GNUNET_PROGRAM_run (argc,
405 argv, 405 argv,
406 "gnunet-vectorproduct", 406 "gnunet-scalarproduct",
407 gettext_noop ("Calculate the Vectorproduct with a GNUnet peer."), 407 gettext_noop ("Calculate the Vectorproduct with a GNUnet peer."),
408 options, &run, NULL)) ? ret : 1; 408 options, &run, NULL)) ? ret : 1;
409} 409}
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c
index 8724af60d..37b3dedf9 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct.c
@@ -19,8 +19,8 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file vectorproduct/gnunet-service-vectorproduct.c 22 * @file scalarproduct/gnunet-service-scalarproduct.c
23 * @brief vectorproduct service implementation 23 * @brief scalarproduct service implementation
24 * @author Christian M. Fuchs 24 * @author Christian M. Fuchs
25 */ 25 */
26#include <limits.h> 26#include <limits.h>
@@ -30,8 +30,8 @@
30#include "gnunet_mesh_service.h" 30#include "gnunet_mesh_service.h"
31#include "gnunet_applications.h" 31#include "gnunet_applications.h"
32#include "gnunet_protocols.h" 32#include "gnunet_protocols.h"
33#include "gnunet_vectorproduct_service.h" 33#include "gnunet_scalarproduct_service.h"
34#include "gnunet_vectorproduct.h" 34#include "gnunet_scalarproduct.h"
35 35
36/////////////////////////////////////////////////////////////////////////////// 36///////////////////////////////////////////////////////////////////////////////
37// Global Variables 37// Global Variables
@@ -610,16 +610,16 @@ prepare_client_end_notification (void * cls,
610 const struct GNUNET_SCHEDULER_TaskContext * tc) 610 const struct GNUNET_SCHEDULER_TaskContext * tc)
611{ 611{
612 struct ServiceSession * session = cls; 612 struct ServiceSession * session = cls;
613 struct GNUNET_VECTORPRODUCT_client_response * msg; 613 struct GNUNET_SCALARPRODUCT_client_response * msg;
614 struct MessageObject * msg_obj; 614 struct MessageObject * msg_obj;
615 615
616 GNUNET_assert (NULL != session); 616 GNUNET_assert (NULL != session);
617 617
618 msg = GNUNET_new (struct GNUNET_VECTORPRODUCT_client_response); 618 msg = GNUNET_new (struct GNUNET_SCALARPRODUCT_client_response);
619 msg->header.type = htons (GNUNET_MESSAGE_TYPE_VECTORPRODUCT_SERVICE_TO_CLIENT); 619 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT);
620 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode)); 620 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode));
621 memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity)); 621 memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity));
622 msg->header.size = htons (sizeof (struct GNUNET_VECTORPRODUCT_client_response)); 622 msg->header.size = htons (sizeof (struct GNUNET_SCALARPRODUCT_client_response));
623 // 0 size and the first char in the product is 0, which should never be zero if encoding is used. 623 // 0 size and the first char in the product is 0, which should never be zero if encoding is used.
624 msg->product_length = htonl (0); 624 msg->product_length = htonl (0);
625 625
@@ -630,7 +630,7 @@ prepare_client_end_notification (void * cls,
630 //transmit this message to our client 630 //transmit this message to our client
631 session->client_transmit_handle = 631 session->client_transmit_handle =
632 GNUNET_SERVER_notify_transmit_ready (session->client, 632 GNUNET_SERVER_notify_transmit_ready (session->client,
633 sizeof (struct GNUNET_VECTORPRODUCT_client_response), 633 sizeof (struct GNUNET_SCALARPRODUCT_client_response),
634 GNUNET_TIME_UNIT_FOREVER_REL, 634 GNUNET_TIME_UNIT_FOREVER_REL,
635 &do_send_message, 635 &do_send_message,
636 msg_obj); 636 msg_obj);
@@ -679,7 +679,7 @@ prepare_service_response (gcry_mpi_t * kp,
679 struct ServiceSession * request, 679 struct ServiceSession * request,
680 struct ServiceSession * response) 680 struct ServiceSession * response)
681{ 681{
682 struct GNUNET_VECTORPRODUCT_service_response * msg; 682 struct GNUNET_SCALARPRODUCT_service_response * msg;
683 uint16_t msg_length = 0; 683 uint16_t msg_length = 0;
684 unsigned char * current = NULL; 684 unsigned char * current = NULL;
685 unsigned char * element_exported = NULL; 685 unsigned char * element_exported = NULL;
@@ -688,14 +688,14 @@ prepare_service_response (gcry_mpi_t * kp,
688 688
689 GNUNET_assert (request); 689 GNUNET_assert (request);
690 690
691 msg_length = sizeof (struct GNUNET_VECTORPRODUCT_service_response) 691 msg_length = sizeof (struct GNUNET_SCALARPRODUCT_service_response)
692 + 2 * request->used_element_count * PAILLIER_ELEMENT_LENGTH // kp, kq 692 + 2 * request->used_element_count * PAILLIER_ELEMENT_LENGTH // kp, kq
693 + 2 * PAILLIER_ELEMENT_LENGTH; // s, stick 693 + 2 * PAILLIER_ELEMENT_LENGTH; // s, stick
694 694
695 msg = GNUNET_malloc (msg_length); 695 msg = GNUNET_malloc (msg_length);
696 GNUNET_assert (msg); 696 GNUNET_assert (msg);
697 697
698 msg->header.type = htons (GNUNET_MESSAGE_TYPE_VECTORPRODUCT_BOB_TO_ALICE); 698 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_TO_ALICE);
699 msg->header.size = htons (msg_length); 699 msg->header.size = htons (msg_length);
700 msg->element_count = htons (request->element_count); 700 msg->element_count = htons (request->element_count);
701 msg->used_element_count = htons (request->used_element_count); 701 msg->used_element_count = htons (request->used_element_count);
@@ -1033,7 +1033,7 @@ prepare_service_request (void *cls,
1033{ 1033{
1034 struct ServiceSession * session = cls; 1034 struct ServiceSession * session = cls;
1035 unsigned char * current; 1035 unsigned char * current;
1036 struct GNUNET_VECTORPRODUCT_service_request * msg; 1036 struct GNUNET_SCALARPRODUCT_service_request * msg;
1037 struct MessageObject * msg_obj; 1037 struct MessageObject * msg_obj;
1038 unsigned int i; 1038 unsigned int i;
1039 unsigned int j; 1039 unsigned int j;
@@ -1047,12 +1047,12 @@ prepare_service_request (void *cls,
1047 GNUNET_assert (NULL != peer); 1047 GNUNET_assert (NULL != peer);
1048 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Successfully created new tunnel to peer (%s)!\n"), GNUNET_i2s (peer)); 1048 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Successfully created new tunnel to peer (%s)!\n"), GNUNET_i2s (peer));
1049 1049
1050 msg_length = sizeof (struct GNUNET_VECTORPRODUCT_service_request) 1050 msg_length = sizeof (struct GNUNET_SCALARPRODUCT_service_request)
1051 + session->used_element_count * PAILLIER_ELEMENT_LENGTH 1051 + session->used_element_count * PAILLIER_ELEMENT_LENGTH
1052 + session->mask_length 1052 + session->mask_length
1053 + my_pubkey_external_length; 1053 + my_pubkey_external_length;
1054 1054
1055 if (GNUNET_SERVER_MAX_MESSAGE_SIZE < sizeof (struct GNUNET_VECTORPRODUCT_service_request) 1055 if (GNUNET_SERVER_MAX_MESSAGE_SIZE < sizeof (struct GNUNET_SCALARPRODUCT_service_request)
1056 + session->used_element_count * PAILLIER_ELEMENT_LENGTH 1056 + session->used_element_count * PAILLIER_ELEMENT_LENGTH
1057 + session->mask_length 1057 + session->mask_length
1058 + my_pubkey_external_length) 1058 + my_pubkey_external_length)
@@ -1067,7 +1067,7 @@ prepare_service_request (void *cls,
1067 } 1067 }
1068 msg = GNUNET_malloc (msg_length); 1068 msg = GNUNET_malloc (msg_length);
1069 1069
1070 msg->header.type = htons (GNUNET_MESSAGE_TYPE_VECTORPRODUCT_ALICE_TO_BOB); 1070 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_TO_BOB);
1071 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode)); 1071 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode));
1072 msg->mask_length = htons (session->mask_length); 1072 msg->mask_length = htons (session->mask_length);
1073 msg->pk_length = htons (my_pubkey_external_length); 1073 msg->pk_length = htons (my_pubkey_external_length);
@@ -1207,7 +1207,7 @@ handle_client_request (void *cls,
1207 struct GNUNET_SERVER_Client *client, 1207 struct GNUNET_SERVER_Client *client,
1208 const struct GNUNET_MessageHeader *message) 1208 const struct GNUNET_MessageHeader *message)
1209{ 1209{
1210 struct GNUNET_VECTORPRODUCT_client_request * msg = (struct GNUNET_VECTORPRODUCT_client_request *) message; 1210 struct GNUNET_SCALARPRODUCT_client_request * msg = (struct GNUNET_SCALARPRODUCT_client_request *) message;
1211 struct ServiceSession * session; 1211 struct ServiceSession * session;
1212 uint16_t element_count; 1212 uint16_t element_count;
1213 uint16_t mask_length; 1213 uint16_t mask_length;
@@ -1218,7 +1218,7 @@ handle_client_request (void *cls,
1218 GNUNET_assert (message); 1218 GNUNET_assert (message);
1219 1219
1220 //we need at least a peer and one message id to compare 1220 //we need at least a peer and one message id to compare
1221 if (sizeof (struct GNUNET_VECTORPRODUCT_client_request) > ntohs (msg->header.size)) 1221 if (sizeof (struct GNUNET_SCALARPRODUCT_client_request) > ntohs (msg->header.size))
1222 { 1222 {
1223 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Too short message received from client!\n")); 1223 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Too short message received from client!\n"));
1224 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1224 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -1230,7 +1230,7 @@ handle_client_request (void *cls,
1230 mask_length = ntohs (msg->mask_length); 1230 mask_length = ntohs (msg->mask_length);
1231 1231
1232 //sanity check: is the message as long as the message_count fields suggests? 1232 //sanity check: is the message as long as the message_count fields suggests?
1233 if (( ntohs (msg->header.size) != (sizeof (struct GNUNET_VECTORPRODUCT_client_request) + element_count * sizeof (int32_t) + mask_length)) 1233 if (( ntohs (msg->header.size) != (sizeof (struct GNUNET_SCALARPRODUCT_client_request) + element_count * sizeof (int32_t) + mask_length))
1234 || (0 == element_count)) 1234 || (0 == element_count))
1235 { 1235 {
1236 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Invalid message received from client, session information incorrect!\n")); 1236 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Invalid message received from client, session information incorrect!\n"));
@@ -1259,7 +1259,7 @@ handle_client_request (void *cls,
1259 session->vector = GNUNET_malloc (sizeof (int32_t) * element_count); 1259 session->vector = GNUNET_malloc (sizeof (int32_t) * element_count);
1260 vector = (int32_t *) & msg[1]; 1260 vector = (int32_t *) & msg[1];
1261 1261
1262 if (GNUNET_MESSAGE_TYPE_VECTORPRODUCT_CLIENT_TO_ALICE == msg_type) 1262 if (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE == msg_type)
1263 { 1263 {
1264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Got client-request-session with key %s, preparing tunnel to remote service.\n"), GNUNET_h2s (&session->key)); 1264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("Got client-request-session with key %s, preparing tunnel to remote service.\n"), GNUNET_h2s (&session->key));
1265 1265
@@ -1537,7 +1537,7 @@ prepare_client_response (void *cls,
1537 const struct GNUNET_SCHEDULER_TaskContext *tc) 1537 const struct GNUNET_SCHEDULER_TaskContext *tc)
1538{ 1538{
1539 struct ServiceSession * session = cls; 1539 struct ServiceSession * session = cls;
1540 struct GNUNET_VECTORPRODUCT_client_response * msg; 1540 struct GNUNET_SCALARPRODUCT_client_response * msg;
1541 unsigned char * product_exported = NULL; 1541 unsigned char * product_exported = NULL;
1542 size_t product_length = 0; 1542 size_t product_length = 0;
1543 uint16_t msg_length = 0; 1543 uint16_t msg_length = 0;
@@ -1556,11 +1556,11 @@ prepare_client_response (void *cls,
1556 session->product = NULL; 1556 session->product = NULL;
1557 } 1557 }
1558 1558
1559 msg_length = sizeof (struct GNUNET_VECTORPRODUCT_client_response) +product_length; 1559 msg_length = sizeof (struct GNUNET_SCALARPRODUCT_client_response) +product_length;
1560 msg = GNUNET_malloc (msg_length); 1560 msg = GNUNET_malloc (msg_length);
1561 memcpy (&msg[1], product_exported, product_length); 1561 memcpy (&msg[1], product_exported, product_length);
1562 GNUNET_free_non_null (product_exported); 1562 GNUNET_free_non_null (product_exported);
1563 msg->header.type = htons (GNUNET_MESSAGE_TYPE_VECTORPRODUCT_SERVICE_TO_CLIENT); 1563 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT);
1564 msg->header.size = htons (msg_length); 1564 msg->header.size = htons (msg_length);
1565 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode)); 1565 memcpy (&msg->key, &session->key, sizeof (struct GNUNET_HashCode));
1566 memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity)); 1566 memcpy (&msg->peer, &session->peer, sizeof ( struct GNUNET_PeerIdentity));
@@ -1593,7 +1593,7 @@ prepare_client_response (void *cls,
1593 1593
1594 1594
1595/** 1595/**
1596 * Handle a request from another service to calculate a vectorproduct with us. 1596 * Handle a request from another service to calculate a scalarproduct with us.
1597 * 1597 *
1598 * @param cls closure (set from GNUNET_MESH_connect) 1598 * @param cls closure (set from GNUNET_MESH_connect)
1599 * @param tunnel connection to the other end 1599 * @param tunnel connection to the other end
@@ -1613,7 +1613,7 @@ handle_service_request (void *cls,
1613 const struct GNUNET_ATS_Information * atsi) 1613 const struct GNUNET_ATS_Information * atsi)
1614{ 1614{
1615 struct ServiceSession * session; 1615 struct ServiceSession * session;
1616 struct GNUNET_VECTORPRODUCT_service_request * msg = (struct GNUNET_VECTORPRODUCT_service_request *) message; 1616 struct GNUNET_SCALARPRODUCT_service_request * msg = (struct GNUNET_SCALARPRODUCT_service_request *) message;
1617 uint16_t mask_length; 1617 uint16_t mask_length;
1618 uint16_t pk_length; 1618 uint16_t pk_length;
1619 uint16_t used_elements; 1619 uint16_t used_elements;
@@ -1651,7 +1651,7 @@ handle_service_request (void *cls,
1651 } 1651 }
1652 1652
1653 //we need at least a peer and one message id to compare 1653 //we need at least a peer and one message id to compare
1654 if (ntohs (msg->header.size) < sizeof (struct GNUNET_VECTORPRODUCT_service_request)) 1654 if (ntohs (msg->header.size) < sizeof (struct GNUNET_SCALARPRODUCT_service_request))
1655 { 1655 {
1656 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Too short message received from peer!\n")); 1656 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Too short message received from peer!\n"));
1657 GNUNET_free (session); 1657 GNUNET_free (session);
@@ -1661,7 +1661,7 @@ handle_service_request (void *cls,
1661 pk_length = ntohs (msg->pk_length); 1661 pk_length = ntohs (msg->pk_length);
1662 used_elements = ntohs (msg->used_element_count); 1662 used_elements = ntohs (msg->used_element_count);
1663 element_count = ntohs (msg->element_count); 1663 element_count = ntohs (msg->element_count);
1664 msg_length = sizeof (struct GNUNET_VECTORPRODUCT_service_request) 1664 msg_length = sizeof (struct GNUNET_SCALARPRODUCT_service_request)
1665 + mask_length + pk_length + used_elements * PAILLIER_ELEMENT_LENGTH; 1665 + mask_length + pk_length + used_elements * PAILLIER_ELEMENT_LENGTH;
1666 1666
1667 //sanity check: is the message as long as the message_count fields suggests? 1667 //sanity check: is the message as long as the message_count fields suggests?
@@ -1720,7 +1720,7 @@ handle_service_request (void *cls,
1720 1720
1721 session->a = GNUNET_malloc (sizeof (gcry_mpi_t) * used_elements); 1721 session->a = GNUNET_malloc (sizeof (gcry_mpi_t) * used_elements);
1722 1722
1723 if (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_VECTORPRODUCT_service_request) 1723 if (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_SCALARPRODUCT_service_request)
1724 +pk_length 1724 +pk_length
1725 + mask_length 1725 + mask_length
1726 + used_elements * PAILLIER_ELEMENT_LENGTH) 1726 + used_elements * PAILLIER_ELEMENT_LENGTH)
@@ -1788,7 +1788,7 @@ except:
1788 1788
1789 1789
1790/** 1790/**
1791 * Handle a response we got from another service we wanted to calculate a vectorproduct with. 1791 * Handle a response we got from another service we wanted to calculate a scalarproduct with.
1792 * 1792 *
1793 * @param cls closure (set from GNUNET_MESH_connect) 1793 * @param cls closure (set from GNUNET_MESH_connect)
1794 * @param tunnel connection to the other end 1794 * @param tunnel connection to the other end
@@ -1809,7 +1809,7 @@ handle_service_response (void *cls,
1809{ 1809{
1810 1810
1811 struct ServiceSession * session; 1811 struct ServiceSession * session;
1812 struct GNUNET_VECTORPRODUCT_service_response * msg = (struct GNUNET_VECTORPRODUCT_service_response *) message; 1812 struct GNUNET_SCALARPRODUCT_service_response * msg = (struct GNUNET_SCALARPRODUCT_service_response *) message;
1813 unsigned char * current; 1813 unsigned char * current;
1814 uint16_t count; 1814 uint16_t count;
1815 gcry_mpi_t s = NULL; 1815 gcry_mpi_t s = NULL;
@@ -1835,13 +1835,13 @@ handle_service_response (void *cls,
1835 goto invalid_msg; 1835 goto invalid_msg;
1836 } 1836 }
1837 //we need at least a peer and one message id to compare 1837 //we need at least a peer and one message id to compare
1838 if (sizeof (struct GNUNET_VECTORPRODUCT_service_response) > ntohs (msg->header.size)) 1838 if (sizeof (struct GNUNET_SCALARPRODUCT_service_response) > ntohs (msg->header.size))
1839 { 1839 {
1840 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Too short message received from peer!\n")); 1840 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ ("Too short message received from peer!\n"));
1841 goto invalid_msg; 1841 goto invalid_msg;
1842 } 1842 }
1843 used_element_count = ntohs (msg->used_element_count); 1843 used_element_count = ntohs (msg->used_element_count);
1844 msg_size = sizeof (struct GNUNET_VECTORPRODUCT_service_response) 1844 msg_size = sizeof (struct GNUNET_SCALARPRODUCT_service_response)
1845 + 2 * used_element_count * PAILLIER_ELEMENT_LENGTH 1845 + 2 * used_element_count * PAILLIER_ELEMENT_LENGTH
1846 + 2 * PAILLIER_ELEMENT_LENGTH; 1846 + 2 * PAILLIER_ELEMENT_LENGTH;
1847 //sanity check: is the message as long as the message_count fields suggests? 1847 //sanity check: is the message as long as the message_count fields suggests?
@@ -1997,20 +1997,20 @@ run (void *cls,
1997 const struct GNUNET_CONFIGURATION_Handle *c) 1997 const struct GNUNET_CONFIGURATION_Handle *c)
1998{ 1998{
1999 static const struct GNUNET_SERVER_MessageHandler server_handlers[] = { 1999 static const struct GNUNET_SERVER_MessageHandler server_handlers[] = {
2000 {&handle_client_request, NULL, GNUNET_MESSAGE_TYPE_VECTORPRODUCT_CLIENT_TO_ALICE, 0}, 2000 {&handle_client_request, NULL, GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE, 0},
2001 {&handle_client_request, NULL, GNUNET_MESSAGE_TYPE_VECTORPRODUCT_CLIENT_TO_BOB, 0}, 2001 {&handle_client_request, NULL, GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_BOB, 0},
2002 {NULL, NULL, 0, 0} 2002 {NULL, NULL, 0, 0}
2003 }; 2003 };
2004 static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = { 2004 static const struct GNUNET_MESH_MessageHandler mesh_handlers[] = {
2005 { &handle_service_request, GNUNET_MESSAGE_TYPE_VECTORPRODUCT_ALICE_TO_BOB, 0}, 2005 { &handle_service_request, GNUNET_MESSAGE_TYPE_SCALARPRODUCT_ALICE_TO_BOB, 0},
2006 { &handle_service_response, GNUNET_MESSAGE_TYPE_VECTORPRODUCT_BOB_TO_ALICE, 0}, 2006 { &handle_service_response, GNUNET_MESSAGE_TYPE_SCALARPRODUCT_BOB_TO_ALICE, 0},
2007 {NULL, 0, 0} 2007 {NULL, 0, 0}
2008 }; 2008 };
2009 static const struct GNUNET_CORE_MessageHandler core_handlers[] = { 2009 static const struct GNUNET_CORE_MessageHandler core_handlers[] = {
2010 {NULL, 0, 0} 2010 {NULL, 0, 0}
2011 }; 2011 };
2012 static GNUNET_MESH_ApplicationType mesh_types[] = { 2012 static GNUNET_MESH_ApplicationType mesh_types[] = {
2013 GNUNET_APPLICATION_TYPE_VECTORPRODUCT, 2013 GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
2014 GNUNET_APPLICATION_TYPE_END 2014 GNUNET_APPLICATION_TYPE_END
2015 }; 2015 };
2016 2016
@@ -2048,7 +2048,7 @@ run (void *cls,
2048 2048
2049 2049
2050/** 2050/**
2051 * The main function for the vectorproduct service. 2051 * The main function for the scalarproduct service.
2052 * 2052 *
2053 * @param argc number of arguments from the command line 2053 * @param argc number of arguments from the command line
2054 * @param argv command line arguments 2054 * @param argv command line arguments
@@ -2059,7 +2059,7 @@ main (int argc, char *const *argv)
2059{ 2059{
2060 return (GNUNET_OK == 2060 return (GNUNET_OK ==
2061 GNUNET_SERVICE_run (argc, argv, 2061 GNUNET_SERVICE_run (argc, argv,
2062 "vectorproduct", 2062 "scalarproduct",
2063 GNUNET_SERVICE_OPTION_NONE, 2063 GNUNET_SERVICE_OPTION_NONE,
2064 &run, NULL)) ? 0 : 1; 2064 &run, NULL)) ? 0 : 1;
2065} 2065}
diff --git a/src/scalarproduct/gnunet_scalarproduct.h b/src/scalarproduct/gnunet_scalarproduct.h
index 4b116646b..7d3e320af 100644
--- a/src/scalarproduct/gnunet_scalarproduct.h
+++ b/src/scalarproduct/gnunet_scalarproduct.h
@@ -19,13 +19,13 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file include/gnunet_vectorproduct.h 22 * @file include/gnunet_scalarproduct.h
23 * @brief API to the vectorproduct service 23 * @brief API to the scalarproduct service
24 * @author Christian M. Fuchs 24 * @author Christian M. Fuchs
25 */ 25 */
26 26
27#ifndef GNUNET_VECTORPRODUCT_H 27#ifndef GNUNET_SCALARPRODUCT_H
28#define GNUNET_VECTORPRODUCT_H 28#define GNUNET_SCALARPRODUCT_H
29 29
30/////////////////////////////////////////////////////////////////////////////// 30///////////////////////////////////////////////////////////////////////////////
31// Defines 31// Defines
@@ -57,7 +57,7 @@ extern "C"
57 * Message type passed from requesting service Alice to responding service Bob 57 * Message type passed from requesting service Alice to responding service Bob
58 * to initiate a request and make bob participate in our protocol 58 * to initiate a request and make bob participate in our protocol
59 */ 59 */
60struct GNUNET_VECTORPRODUCT_service_request { 60struct GNUNET_SCALARPRODUCT_service_request {
61 /** 61 /**
62 * GNUNET message header 62 * GNUNET message header
63 */ 63 */
@@ -97,7 +97,7 @@ struct GNUNET_VECTORPRODUCT_service_request {
97 * Message type passed from responding service Bob to responding service Alice 97 * Message type passed from responding service Bob to responding service Alice
98 * to complete a request and allow Alice to compute the result 98 * to complete a request and allow Alice to compute the result
99 */ 99 */
100struct GNUNET_VECTORPRODUCT_service_response { 100struct GNUNET_SCALARPRODUCT_service_response {
101 /** 101 /**
102 * GNUNET message header 102 * GNUNET message header
103 */ 103 */
@@ -148,7 +148,7 @@ enum PeerRole
148 BOB 148 BOB
149}; 149};
150/** 150/**
151 * A vectorproduct session which tracks: 151 * A scalarproduct session which tracks:
152 * 152 *
153 * a request form the client to our final response. 153 * a request form the client to our final response.
154 * or 154 * or
@@ -270,5 +270,5 @@ struct MessageObject
270} 270}
271#endif 271#endif
272 272
273#endif /* GNUNET_VECTORPRODUCT_H */ 273#endif /* GNUNET_SCALARPRODUCT_H */
274 274
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)
diff --git a/src/scalarproduct/test_scalarproduct_api.c b/src/scalarproduct/test_scalarproduct_api.c
index 802015694..9ef9535e7 100644
--- a/src/scalarproduct/test_scalarproduct_api.c
+++ b/src/scalarproduct/test_scalarproduct_api.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21/** 21/**
22 * Aim of test_vectorproduct_api : This test creates two peers. Peer1 is the 22 * Aim of test_scalarproduct_api : This test creates two peers. Peer1 is the
23 * responder peer, Bob and Peer2 is the initiator peer, Alice. Both peers 23 * responder peer, Bob and Peer2 is the initiator peer, Alice. Both peers
24 * connect to VectorProduct Service, and use the API to issue requests to 24 * connect to VectorProduct Service, and use the API to issue requests to
25 * service. Test passes, when the expected scalar product is received from the 25 * service. Test passes, when the expected scalar product is received from the
@@ -27,7 +27,7 @@
27 */ 27 */
28 28
29/** 29/**
30 * @file vectorproduct/testbed_vectorproduct_api.c 30 * @file scalarproduct/testbed_scalarproduct_api.c
31 * @brief VectorProduct API testing between 4 peers using testing API 31 * @brief VectorProduct API testing between 4 peers using testing API
32 * @author Gaurav Kukreja 32 * @author Gaurav Kukreja
33 * @author Christian Fuchs 33 * @author Christian Fuchs
@@ -40,12 +40,12 @@
40#include "gnunet_util_lib.h" 40#include "gnunet_util_lib.h"
41#include "gnunet_testbed_service.h" 41#include "gnunet_testbed_service.h"
42#include "gnunet_common.h" 42#include "gnunet_common.h"
43#include "gnunet_vectorproduct_service.h" 43#include "gnunet_scalarproduct_service.h"
44#include "gnunet_protocols.h" 44#include "gnunet_protocols.h"
45 45
46#define NUM_PEERS 2 46#define NUM_PEERS 2
47 47
48#define LOG(kind,...) GNUNET_log_from (kind, "test-vectorproduct-api",__VA_ARGS__) 48#define LOG(kind,...) GNUNET_log_from (kind, "test-scalarproduct-api",__VA_ARGS__)
49 49
50/** 50/**
51 * Structure for holding peer's sockets and IO Handles 51 * Structure for holding peer's sockets and IO Handles
@@ -70,7 +70,7 @@ struct PeerData
70 /** 70 /**
71 * Pointer to Vector Product Handle 71 * Pointer to Vector Product Handle
72 */ 72 */
73 struct GNUNET_VECTORPRODUCT_Handle *vh; 73 struct GNUNET_SCALARPRODUCT_Handle *vh;
74}; 74};
75 75
76/** 76/**
@@ -91,12 +91,12 @@ enum SetupState
91 /** 91 /**
92 * Connect to stream service of peer 1 92 * Connect to stream service of peer 1
93 */ 93 */
94 PEER1_VECTORPRODUCT_CONNECT, 94 PEER1_SCALARPRODUCT_CONNECT,
95 95
96 /** 96 /**
97 * Connect to stream service of peer 2 97 * Connect to stream service of peer 2
98 */ 98 */
99 PEER2_VECTORPRODUCT_CONNECT 99 PEER2_SCALARPRODUCT_CONNECT
100 100
101}; 101};
102 102
@@ -236,7 +236,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
236 LOG (GNUNET_ERROR_TYPE_INFO, "Disconnecting Peer2\n\n"); 236 LOG (GNUNET_ERROR_TYPE_INFO, "Disconnecting Peer2\n\n");
237 237
238 // peer->op contains handle to the TESTBED_connect_service operation 238 // peer->op contains handle to the TESTBED_connect_service operation
239 // calling operation done, leads to call to vectorproduct_da 239 // calling operation done, leads to call to scalarproduct_da
240 if (peer->op != NULL) 240 if (peer->op != NULL)
241 { 241 {
242 GNUNET_TESTBED_operation_done (peer->op); 242 GNUNET_TESTBED_operation_done (peer->op);
@@ -275,8 +275,8 @@ controller_event_cb (void *cls,
275 275
276 switch (setup_state) 276 switch (setup_state)
277 { 277 {
278 case PEER1_VECTORPRODUCT_CONNECT: 278 case PEER1_SCALARPRODUCT_CONNECT:
279 case PEER2_VECTORPRODUCT_CONNECT: 279 case PEER2_SCALARPRODUCT_CONNECT:
280 GNUNET_assert (NULL == event->details.operation_finished.emsg); 280 GNUNET_assert (NULL == event->details.operation_finished.emsg);
281 break; 281 break;
282 default: 282 default:
@@ -288,30 +288,30 @@ controller_event_cb (void *cls,
288static void 288static void
289responder_callback (void *cls, 289responder_callback (void *cls,
290 const struct GNUNET_HashCode * key, 290 const struct GNUNET_HashCode * key,
291 enum GNUNET_VECTORPRODUCT_ResponseStatus status) 291 enum GNUNET_SCALARPRODUCT_ResponseStatus status)
292{ 292{
293 293
294 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 294 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
295 { 295 {
296 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status failure\n"); 296 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status failure\n");
297 responder_ok = -1; 297 responder_ok = -1;
298 } 298 }
299 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 299 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
300 { 300 {
301 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status invalid response\n"); 301 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status invalid response\n");
302 responder_ok = -1; 302 responder_ok = -1;
303 } 303 }
304 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 304 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
305 { 305 {
306 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received timeout occured\n"); 306 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received timeout occured\n");
307 responder_ok = -1; 307 responder_ok = -1;
308 } 308 }
309 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 309 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
310 { 310 {
311 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received service disconnected!!\n"); 311 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received service disconnected!!\n");
312 responder_ok = -1; 312 responder_ok = -1;
313 } 313 }
314 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 314 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
315 { 315 {
316 LOG (GNUNET_ERROR_TYPE_INFO, "Responder Client expected response received!\n"); 316 LOG (GNUNET_ERROR_TYPE_INFO, "Responder Client expected response received!\n");
317 responder_ok = 1; 317 responder_ok = 1;
@@ -332,37 +332,37 @@ static void
332requester_callback (void *cls, 332requester_callback (void *cls,
333 const struct GNUNET_HashCode * key, 333 const struct GNUNET_HashCode * key,
334 const struct GNUNET_PeerIdentity * peer, 334 const struct GNUNET_PeerIdentity * peer,
335 enum GNUNET_VECTORPRODUCT_ResponseStatus status, 335 enum GNUNET_SCALARPRODUCT_ResponseStatus status,
336 const struct GNUNET_VECTORPRODUCT_client_response *msg) 336 const struct GNUNET_SCALARPRODUCT_client_response *msg)
337{ 337{
338 uint32_t product_len; 338 uint32_t product_len;
339 339
340 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 340 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
341 { 341 {
342 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status failure\n"); 342 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status failure\n");
343 requester_ok = -1; 343 requester_ok = -1;
344 } 344 }
345 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 345 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
346 { 346 {
347 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status invalid response\n"); 347 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status invalid response\n");
348 requester_ok = -1; 348 requester_ok = -1;
349 } 349 }
350 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 350 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
351 { 351 {
352 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client timeout occured\n"); 352 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client timeout occured\n");
353 requester_ok = -1; 353 requester_ok = -1;
354 } 354 }
355 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 355 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
356 { 356 {
357 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client service disconnected!!\n"); 357 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client service disconnected!!\n");
358 requester_ok = -1; 358 requester_ok = -1;
359 } 359 }
360 else if (GNUNET_VECTORPRODUCT_Status_Success != status) 360 else if (GNUNET_SCALARPRODUCT_Status_Success != status)
361 { 361 {
362 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client Status = %d\n", (int) status); 362 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client Status = %d\n", (int) status);
363 requester_ok = -1; 363 requester_ok = -1;
364 } 364 }
365 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 365 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
366 { 366 {
367 LOG (GNUNET_ERROR_TYPE_INFO, "Requester Client expected response received!\n"); 367 LOG (GNUNET_ERROR_TYPE_INFO, "Requester Client expected response received!\n");
368 product_len = ntohl(msg->product_length); 368 product_len = ntohl(msg->product_length);
@@ -453,10 +453,10 @@ requester_callback (void *cls,
453} 453}
454 454
455/** 455/**
456 * Prepare the message to be sent by peer2 to its vectorproduct service, to 456 * Prepare the message to be sent by peer2 to its scalarproduct service, to
457 * initiate a request to peer1. 457 * initiate a request to peer1.
458 */ 458 */
459static struct GNUNET_VECTORPRODUCT_QueueEntry * 459static struct GNUNET_SCALARPRODUCT_QueueEntry *
460requester_request () 460requester_request ()
461{ 461{
462 unsigned int i; 462 unsigned int i;
@@ -465,7 +465,7 @@ requester_request ()
465 char * begin = input_elements_peer2; 465 char * begin = input_elements_peer2;
466 char * end; 466 char * end;
467 int32_t element; 467 int32_t element;
468 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 468 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
469 struct GNUNET_HashCode key; 469 struct GNUNET_HashCode key;
470 470
471 GNUNET_assert (peer2.vh != NULL); 471 GNUNET_assert (peer2.vh != NULL);
@@ -549,7 +549,7 @@ requester_request ()
549 mask_peer2[i] = UCHAR_MAX; // all 1's 549 mask_peer2[i] = UCHAR_MAX; // all 1's
550 } 550 }
551 551
552 qe = GNUNET_VECTORPRODUCT_request (peer2.vh, 552 qe = GNUNET_SCALARPRODUCT_request (peer2.vh,
553 &key, 553 &key,
554 &peer1.our_id, 554 &peer1.our_id,
555 element_count_peer2, 555 element_count_peer2,
@@ -561,7 +561,7 @@ requester_request ()
561 561
562 if (qe == NULL) 562 if (qe == NULL)
563 { 563 {
564 LOG(GNUNET_ERROR_TYPE_ERROR, "Could not send request to vectorproduct service! Exitting!"); 564 LOG(GNUNET_ERROR_TYPE_ERROR, "Could not send request to scalarproduct service! Exitting!");
565 ok = -1; 565 ok = -1;
566 return NULL; 566 return NULL;
567 } 567 }
@@ -571,10 +571,10 @@ requester_request ()
571 571
572 572
573/** 573/**
574 * Function prepares the message to be sent by peer1 to its vectorproduct service 574 * Function prepares the message to be sent by peer1 to its scalarproduct service
575 * to prepare response, and wait for a request session to be initiated by peer1 575 * to prepare response, and wait for a request session to be initiated by peer1
576 */ 576 */
577static struct GNUNET_VECTORPRODUCT_QueueEntry * 577static struct GNUNET_SCALARPRODUCT_QueueEntry *
578responder_prepare_response () 578responder_prepare_response ()
579{ 579{
580 GNUNET_assert (peer1.vh != NULL); 580 GNUNET_assert (peer1.vh != NULL);
@@ -582,7 +582,7 @@ responder_prepare_response ()
582 char * begin = input_elements_peer1; 582 char * begin = input_elements_peer1;
583 char * end; 583 char * end;
584 int32_t element; 584 int32_t element;
585 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 585 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
586 struct GNUNET_HashCode key; 586 struct GNUNET_HashCode key;
587 587
588 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); 588 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
@@ -617,7 +617,7 @@ responder_prepare_response ()
617 GNUNET_assert (elements_peer1 != NULL); 617 GNUNET_assert (elements_peer1 != NULL);
618 GNUNET_assert (element_count_peer1 >= 1); 618 GNUNET_assert (element_count_peer1 >= 1);
619 619
620 qe = GNUNET_VECTORPRODUCT_prepare_response (peer1.vh, 620 qe = GNUNET_SCALARPRODUCT_prepare_response (peer1.vh,
621 &key, 621 &key,
622 element_count_peer1, 622 element_count_peer1,
623 elements_peer1, 623 elements_peer1,
@@ -627,7 +627,7 @@ responder_prepare_response ()
627 627
628 if (qe == NULL) 628 if (qe == NULL)
629 { 629 {
630 LOG(GNUNET_ERROR_TYPE_ERROR, "Could not send request to vectorproduct service! Exitting!"); 630 LOG(GNUNET_ERROR_TYPE_ERROR, "Could not send request to scalarproduct service! Exitting!");
631 ok = -1; 631 ok = -1;
632 return NULL; 632 return NULL;
633 } 633 }
@@ -677,11 +677,11 @@ prepare_response_task(void *cls,
677 * @param op_result service handle returned from the connect adapter 677 * @param op_result service handle returned from the connect adapter
678 */ 678 */
679static void 679static void
680vectorproduct_da (void *cls, void *op_result) 680scalarproduct_da (void *cls, void *op_result)
681{ 681{
682 struct PeerData* peer = (struct PeerData*) cls; 682 struct PeerData* peer = (struct PeerData*) cls;
683 683
684 GNUNET_VECTORPRODUCT_disconnect (peer->vh); 684 GNUNET_SCALARPRODUCT_disconnect (peer->vh);
685 return; 685 return;
686} 686}
687 687
@@ -697,7 +697,7 @@ vectorproduct_da (void *cls, void *op_result)
697 * @return service handle to return in 'op_result', NULL on error 697 * @return service handle to return in 'op_result', NULL on error
698 */ 698 */
699static void * 699static void *
700vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) 700scalarproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
701{ 701{
702 struct PeerData *p = cls; 702 struct PeerData *p = cls;
703 703
@@ -706,22 +706,22 @@ vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
706 706
707 switch (setup_state) 707 switch (setup_state)
708 { 708 {
709 case PEER1_VECTORPRODUCT_CONNECT: 709 case PEER1_SCALARPRODUCT_CONNECT:
710 /* Connect peer 2 to vectorproduct service */ 710 /* Connect peer 2 to scalarproduct service */
711 { 711 {
712 peer2.op = GNUNET_TESTBED_service_connect (&peer2, peer2.peer, "vectorproduct", 712 peer2.op = GNUNET_TESTBED_service_connect (&peer2, peer2.peer, "scalarproduct",
713 NULL, NULL, vectorproduct_ca, 713 NULL, NULL, scalarproduct_ca,
714 vectorproduct_da, &peer2); 714 scalarproduct_da, &peer2);
715 setup_state = PEER2_VECTORPRODUCT_CONNECT; 715 setup_state = PEER2_SCALARPRODUCT_CONNECT;
716 } 716 }
717 717
718 /* Actually connect peer 1 to vectorproduct service */ 718 /* Actually connect peer 1 to scalarproduct service */
719 peer1.vh = GNUNET_VECTORPRODUCT_connect (cfg); 719 peer1.vh = GNUNET_SCALARPRODUCT_connect (cfg);
720 return peer1.vh; 720 return peer1.vh;
721 721
722 case PEER2_VECTORPRODUCT_CONNECT: 722 case PEER2_SCALARPRODUCT_CONNECT:
723 /* Actually connect peer 2 to vectorproduct service */ 723 /* Actually connect peer 2 to scalarproduct service */
724 peer2.vh = GNUNET_VECTORPRODUCT_connect (cfg); 724 peer2.vh = GNUNET_SCALARPRODUCT_connect (cfg);
725 725
726 /* Schedule tasks to initiate request from peer2 and prepare_response from peer1 */ 726 /* Schedule tasks to initiate request from peer2 and prepare_response from peer1 */
727 if(peer1.vh != NULL && peer2.vh != NULL) 727 if(peer1.vh != NULL && peer2.vh != NULL)
@@ -780,11 +780,11 @@ peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op_,
780 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full 780 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full
781 (&peer2.our_id)); 781 (&peer2.our_id));
782 782
783 /* Connect peer 1 to vectorproduct service */ 783 /* Connect peer 1 to scalarproduct service */
784 peer1.op = GNUNET_TESTBED_service_connect (&peer1, peer1.peer, "vectorproduct", 784 peer1.op = GNUNET_TESTBED_service_connect (&peer1, peer1.peer, "scalarproduct",
785 NULL, NULL, vectorproduct_ca, 785 NULL, NULL, scalarproduct_ca,
786 vectorproduct_da, &peer1); 786 scalarproduct_da, &peer1);
787 setup_state = PEER1_VECTORPRODUCT_CONNECT; 787 setup_state = PEER1_SCALARPRODUCT_CONNECT;
788 } 788 }
789 break; 789 break;
790 default: 790 default:
@@ -837,8 +837,8 @@ main (int argc, char **argv)
837 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader)) 837 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader))
838 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1; 838 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1;
839 839
840 (void) GNUNET_TESTBED_test_run ("test_vectorproduct_api", 840 (void) GNUNET_TESTBED_test_run ("test_scalarproduct_api",
841 "test_vectorproduct_api_data.conf", 841 "test_scalarproduct_api_data.conf",
842 NUM_PEERS, event_mask, &controller_event_cb, 842 NUM_PEERS, event_mask, &controller_event_cb,
843 NULL, 843 NULL,
844 &test_master, NULL); 844 &test_master, NULL);
diff --git a/src/scalarproduct/test_scalarproduct_api_4peers.c b/src/scalarproduct/test_scalarproduct_api_4peers.c
index 73ab634f9..70c763ca6 100644
--- a/src/scalarproduct/test_scalarproduct_api_4peers.c
+++ b/src/scalarproduct/test_scalarproduct_api_4peers.c
@@ -28,7 +28,7 @@
28 * 28 *
29 * To test this, we create 4 peers. peer1 and peer2 are designated responders, 29 * To test this, we create 4 peers. peer1 and peer2 are designated responders,
30 * and peer3 and peer4 are designated as requesters. Each peer calls API for the 30 * and peer3 and peer4 are designated as requesters. Each peer calls API for the
31 * vectorproduct service accordingly. 31 * scalarproduct service accordingly.
32 * 32 *
33 * * peer1 tells the service to prepare response for requests with keys 33 * * peer1 tells the service to prepare response for requests with keys
34 * input_key_p1_p3(shared key b/w peer1 and peer3) and input_key_p1_p4. 34 * input_key_p1_p3(shared key b/w peer1 and peer3) and input_key_p1_p4.
@@ -45,7 +45,7 @@
45 45
46 46
47/** 47/**
48 * @file vectorproduct/test_vectorproduct_api_4peers.c 48 * @file scalarproduct/test_scalarproduct_api_4peers.c
49 * @brief Vectorproduct API testing between 4 peers using testing API 49 * @brief Vectorproduct API testing between 4 peers using testing API
50 * @author Gaurav Kukreja 50 * @author Gaurav Kukreja
51 * @author Christian Fuchs 51 * @author Christian Fuchs
@@ -58,10 +58,10 @@
58#include "gnunet_util_lib.h" 58#include "gnunet_util_lib.h"
59#include "gnunet_testbed_service.h" 59#include "gnunet_testbed_service.h"
60#include "gnunet_common.h" 60#include "gnunet_common.h"
61#include "gnunet_vectorproduct_service.h" 61#include "gnunet_scalarproduct_service.h"
62#include "gnunet_protocols.h" 62#include "gnunet_protocols.h"
63 63
64#define LOG(kind,...) GNUNET_log_from (kind, "test-vectorproduct-api-4peers",__VA_ARGS__) 64#define LOG(kind,...) GNUNET_log_from (kind, "test-scalarproduct-api-4peers",__VA_ARGS__)
65 65
66#define NUM_PEERS 4 66#define NUM_PEERS 4
67 67
@@ -88,7 +88,7 @@ struct PeerData
88 /** 88 /**
89 * Pointer to Vector Product Handle 89 * Pointer to Vector Product Handle
90 */ 90 */
91 struct GNUNET_VECTORPRODUCT_Handle *vh; 91 struct GNUNET_SCALARPRODUCT_Handle *vh;
92 92
93 /** 93 /**
94 * Input elements for peer 94 * Input elements for peer
@@ -151,22 +151,22 @@ enum SetupState
151 /** 151 /**
152 * Connect to stream service of peer 1 152 * Connect to stream service of peer 1
153 */ 153 */
154 PEER1_VECTORPRODUCT_CONNECT, 154 PEER1_SCALARPRODUCT_CONNECT,
155 155
156 /** 156 /**
157 * Connect to stream service of peer 2 157 * Connect to stream service of peer 2
158 */ 158 */
159 PEER2_VECTORPRODUCT_CONNECT, 159 PEER2_SCALARPRODUCT_CONNECT,
160 160
161 /** 161 /**
162 * Connect to stream service of peer 3 162 * Connect to stream service of peer 3
163 */ 163 */
164 PEER3_VECTORPRODUCT_CONNECT, 164 PEER3_SCALARPRODUCT_CONNECT,
165 165
166 /** 166 /**
167 * Connect to stream service of peer 4 167 * Connect to stream service of peer 4
168 */ 168 */
169 PEER4_VECTORPRODUCT_CONNECT 169 PEER4_SCALARPRODUCT_CONNECT
170 170
171}; 171};
172 172
@@ -335,7 +335,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
335 LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down Peer 4!!! \n"); 335 LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down Peer 4!!! \n");
336 336
337 // peer->op contains handle to the TESTBED_connect_service operation 337 // peer->op contains handle to the TESTBED_connect_service operation
338 // calling operation done, leads to call to vectorproduct_da 338 // calling operation done, leads to call to scalarproduct_da
339 GNUNET_TESTBED_operation_done (peer->op); 339 GNUNET_TESTBED_operation_done (peer->op);
340 peer->op = NULL; 340 peer->op = NULL;
341 341
@@ -372,8 +372,8 @@ controller_event_cb (void *cls,
372 case GNUNET_TESTBED_ET_OPERATION_FINISHED: 372 case GNUNET_TESTBED_ET_OPERATION_FINISHED:
373 switch (setup_state) 373 switch (setup_state)
374 { 374 {
375 case PEER1_VECTORPRODUCT_CONNECT: 375 case PEER1_SCALARPRODUCT_CONNECT:
376 case PEER2_VECTORPRODUCT_CONNECT: 376 case PEER2_SCALARPRODUCT_CONNECT:
377 GNUNET_assert (NULL == event->details.operation_finished.emsg); 377 GNUNET_assert (NULL == event->details.operation_finished.emsg);
378 break; 378 break;
379 default: 379 default:
@@ -389,7 +389,7 @@ controller_event_cb (void *cls,
389static void 389static void
390responder_callback (void *cls, 390responder_callback (void *cls,
391 const struct GNUNET_HashCode * key, 391 const struct GNUNET_HashCode * key,
392 enum GNUNET_VECTORPRODUCT_ResponseStatus status) 392 enum GNUNET_SCALARPRODUCT_ResponseStatus status)
393{ 393{
394 struct PeerData * peer = cls; 394 struct PeerData * peer = cls;
395 395
@@ -407,27 +407,27 @@ responder_callback (void *cls,
407 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester callback received, but peer is neither peer1 nor peer2!!!\n"); 407 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester callback received, but peer is neither peer1 nor peer2!!!\n");
408 408
409 409
410 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 410 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
411 { 411 {
412 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received status failure\n"); 412 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received status failure\n");
413 ok = -1; 413 ok = -1;
414 } 414 }
415 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 415 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
416 { 416 {
417 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received status invalid response\n"); 417 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received status invalid response\n");
418 ok = -1; 418 ok = -1;
419 } 419 }
420 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 420 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
421 { 421 {
422 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received timeout occured\n"); 422 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received timeout occured\n");
423 ok = -1; 423 ok = -1;
424 } 424 }
425 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 425 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
426 { 426 {
427 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received service disconnected!!\n"); 427 LOG (GNUNET_ERROR_TYPE_ERROR, "Responder Client received service disconnected!!\n");
428 ok = -1; 428 ok = -1;
429 } 429 }
430 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 430 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
431 { 431 {
432 LOG (GNUNET_ERROR_TYPE_DEBUG, "Responder Client expected response received!\n"); 432 LOG (GNUNET_ERROR_TYPE_DEBUG, "Responder Client expected response received!\n");
433 ok = 1; 433 ok = 1;
@@ -448,8 +448,8 @@ static void
448requester_callback (void *cls, 448requester_callback (void *cls,
449 const struct GNUNET_HashCode * key, 449 const struct GNUNET_HashCode * key,
450 const struct GNUNET_PeerIdentity * peer, 450 const struct GNUNET_PeerIdentity * peer,
451 enum GNUNET_VECTORPRODUCT_ResponseStatus status, 451 enum GNUNET_SCALARPRODUCT_ResponseStatus status,
452 const struct GNUNET_VECTORPRODUCT_client_response *msg) 452 const struct GNUNET_SCALARPRODUCT_client_response *msg)
453{ 453{
454 struct PeerData * peer_ = cls; 454 struct PeerData * peer_ = cls;
455 uint32_t product_len; 455 uint32_t product_len;
@@ -468,32 +468,32 @@ requester_callback (void *cls,
468 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester callback received, but peer is neither peer3 nor peer4!!!\n"); 468 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester callback received, but peer is neither peer3 nor peer4!!!\n");
469 469
470 470
471 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 471 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
472 { 472 {
473 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client received status failure\n"); 473 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client received status failure\n");
474 ok = -1; 474 ok = -1;
475 } 475 }
476 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 476 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
477 { 477 {
478 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client received status invalid response\n"); 478 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client received status invalid response\n");
479 ok = -1; 479 ok = -1;
480 } 480 }
481 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 481 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
482 { 482 {
483 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client timeout occured\n"); 483 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client timeout occured\n");
484 ok = -1; 484 ok = -1;
485 } 485 }
486 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 486 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
487 { 487 {
488 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client service disconnected!!\n"); 488 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client service disconnected!!\n");
489 ok = -1; 489 ok = -1;
490 } 490 }
491 else if (GNUNET_VECTORPRODUCT_Status_Success != status) 491 else if (GNUNET_SCALARPRODUCT_Status_Success != status)
492 { 492 {
493 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client Status = %d\n", (int) status); 493 LOG (GNUNET_ERROR_TYPE_ERROR, "Requester Client Status = %d\n", (int) status);
494 ok = -1; 494 ok = -1;
495 } 495 }
496 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 496 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
497 { 497 {
498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requester client received status successful!\n"); 498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requester client received status successful!\n");
499 product_len = ntohl (msg->product_length); 499 product_len = ntohl (msg->product_length);
@@ -529,7 +529,7 @@ requester_callback (void *cls,
529} 529}
530 530
531 531
532static struct GNUNET_VECTORPRODUCT_QueueEntry * 532static struct GNUNET_SCALARPRODUCT_QueueEntry *
533requester_request (char * input_elements, 533requester_request (char * input_elements,
534 char * input_mask, 534 char * input_mask,
535 char * input_key, 535 char * input_key,
@@ -544,7 +544,7 @@ requester_request (char * input_elements,
544 uint16_t mask_length = 0; 544 uint16_t mask_length = 0;
545 unsigned char * mask = NULL; 545 unsigned char * mask = NULL;
546 int32_t element; 546 int32_t element;
547 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 547 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
548 struct GNUNET_HashCode key; 548 struct GNUNET_HashCode key;
549 int exit_loop; 549 int exit_loop;
550 char * begin = input_elements; 550 char * begin = input_elements;
@@ -633,7 +633,7 @@ requester_request (char * input_elements,
633 mask[i] = UCHAR_MAX; // all 1's 633 mask[i] = UCHAR_MAX; // all 1's
634 } 634 }
635 635
636 qe = GNUNET_VECTORPRODUCT_request (peer->vh, 636 qe = GNUNET_SCALARPRODUCT_request (peer->vh,
637 &key, 637 &key,
638 &to_peer->our_id, 638 &to_peer->our_id,
639 element_count, 639 element_count,
@@ -645,7 +645,7 @@ requester_request (char * input_elements,
645 645
646 if (qe == NULL) 646 if (qe == NULL)
647 { 647 {
648 LOG(GNUNET_ERROR_TYPE_WARNING, "Could not send request to vectorproduct service! Exitting!"); 648 LOG(GNUNET_ERROR_TYPE_WARNING, "Could not send request to scalarproduct service! Exitting!");
649 ok = -1; 649 ok = -1;
650 return NULL; 650 return NULL;
651 } 651 }
@@ -655,10 +655,10 @@ requester_request (char * input_elements,
655 655
656 656
657/** 657/**
658 * Function prepares the message to be sent by peer1 to its vectorproduct service 658 * Function prepares the message to be sent by peer1 to its scalarproduct service
659 * to prepare response, and wait for a request session to be initiated by peer1 659 * to prepare response, and wait for a request session to be initiated by peer1
660 */ 660 */
661static struct GNUNET_VECTORPRODUCT_QueueEntry * 661static struct GNUNET_SCALARPRODUCT_QueueEntry *
662responder_prepare_response (char * input_elements, 662responder_prepare_response (char * input_elements,
663 char * input_mask, 663 char * input_mask,
664 char * input_key, 664 char * input_key,
@@ -672,7 +672,7 @@ responder_prepare_response (char * input_elements,
672 unsigned short mask_length = 0; 672 unsigned short mask_length = 0;
673 unsigned char * mask = NULL; 673 unsigned char * mask = NULL;
674 int32_t element; 674 int32_t element;
675 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 675 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
676 struct GNUNET_HashCode key; 676 struct GNUNET_HashCode key;
677 int exit_loop; 677 int exit_loop;
678 char * begin; 678 char * begin;
@@ -758,7 +758,7 @@ responder_prepare_response (char * input_elements,
758 mask[i] = UCHAR_MAX; // all 1's 758 mask[i] = UCHAR_MAX; // all 1's
759 } 759 }
760 760
761 qe = GNUNET_VECTORPRODUCT_prepare_response (peer->vh, 761 qe = GNUNET_SCALARPRODUCT_prepare_response (peer->vh,
762 &key, 762 &key,
763 element_count, 763 element_count,
764 elements, 764 elements,
@@ -768,7 +768,7 @@ responder_prepare_response (char * input_elements,
768 768
769 if (qe == NULL) 769 if (qe == NULL)
770 { 770 {
771 LOG(GNUNET_ERROR_TYPE_ERROR, "Could not send request to vectorproduct service! Exitting!"); 771 LOG(GNUNET_ERROR_TYPE_ERROR, "Could not send request to scalarproduct service! Exitting!");
772 ok = -1; 772 ok = -1;
773 return NULL; 773 return NULL;
774 } 774 }
@@ -813,11 +813,11 @@ prepare_response_task (void *cls,
813 * @param op_result service handle returned from the connect adapter 813 * @param op_result service handle returned from the connect adapter
814 */ 814 */
815static void 815static void
816vectorproduct_da (void *cls, void *op_result) 816scalarproduct_da (void *cls, void *op_result)
817{ 817{
818 struct PeerData* peer = (struct PeerData*) cls; 818 struct PeerData* peer = (struct PeerData*) cls;
819 819
820 GNUNET_VECTORPRODUCT_disconnect (peer->vh); 820 GNUNET_SCALARPRODUCT_disconnect (peer->vh);
821 return; 821 return;
822 822
823 GNUNET_assert (0); 823 GNUNET_assert (0);
@@ -835,7 +835,7 @@ vectorproduct_da (void *cls, void *op_result)
835 * @return service handle to return in 'op_result', NULL on error 835 * @return service handle to return in 'op_result', NULL on error
836 */ 836 */
837static void * 837static void *
838vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) 838scalarproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
839{ 839{
840 struct PeerData *p = cls; 840 struct PeerData *p = cls;
841 841
@@ -844,44 +844,44 @@ vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
844 844
845 switch (setup_state) 845 switch (setup_state)
846 { 846 {
847 case PEER1_VECTORPRODUCT_CONNECT: 847 case PEER1_SCALARPRODUCT_CONNECT:
848 /* Connect peer 2 to vectorproduct service */ 848 /* Connect peer 2 to scalarproduct service */
849 { 849 {
850 peer2.op = GNUNET_TESTBED_service_connect (&peer2, peer2.peer, "vectorproduct", 850 peer2.op = GNUNET_TESTBED_service_connect (&peer2, peer2.peer, "scalarproduct",
851 NULL, NULL, vectorproduct_ca, 851 NULL, NULL, scalarproduct_ca,
852 vectorproduct_da, &peer2); 852 scalarproduct_da, &peer2);
853 setup_state = PEER2_VECTORPRODUCT_CONNECT; 853 setup_state = PEER2_SCALARPRODUCT_CONNECT;
854 } 854 }
855 855
856 peer1.vh = GNUNET_VECTORPRODUCT_connect (cfg); 856 peer1.vh = GNUNET_SCALARPRODUCT_connect (cfg);
857 return peer1.vh; 857 return peer1.vh;
858 858
859 case PEER2_VECTORPRODUCT_CONNECT: 859 case PEER2_SCALARPRODUCT_CONNECT:
860 /* Connect peer 3 to vectorproduct service */ 860 /* Connect peer 3 to scalarproduct service */
861 { 861 {
862 peer3.op = GNUNET_TESTBED_service_connect (&peer3, peer3.peer, "vectorproduct", 862 peer3.op = GNUNET_TESTBED_service_connect (&peer3, peer3.peer, "scalarproduct",
863 NULL, NULL, vectorproduct_ca, 863 NULL, NULL, scalarproduct_ca,
864 vectorproduct_da, &peer3); 864 scalarproduct_da, &peer3);
865 setup_state = PEER3_VECTORPRODUCT_CONNECT; 865 setup_state = PEER3_SCALARPRODUCT_CONNECT;
866 } 866 }
867 867
868 peer2.vh = GNUNET_VECTORPRODUCT_connect (cfg); 868 peer2.vh = GNUNET_SCALARPRODUCT_connect (cfg);
869 return peer2.vh; 869 return peer2.vh;
870 870
871 case PEER3_VECTORPRODUCT_CONNECT: 871 case PEER3_SCALARPRODUCT_CONNECT:
872 /* Connect peer 4 to vectorproduct service */ 872 /* Connect peer 4 to scalarproduct service */
873 { 873 {
874 peer4.op = GNUNET_TESTBED_service_connect (&peer4, peer4.peer, "vectorproduct", 874 peer4.op = GNUNET_TESTBED_service_connect (&peer4, peer4.peer, "scalarproduct",
875 NULL, NULL, vectorproduct_ca, 875 NULL, NULL, scalarproduct_ca,
876 vectorproduct_da, &peer4); 876 scalarproduct_da, &peer4);
877 setup_state = PEER4_VECTORPRODUCT_CONNECT; 877 setup_state = PEER4_SCALARPRODUCT_CONNECT;
878 } 878 }
879 879
880 peer3.vh = GNUNET_VECTORPRODUCT_connect (cfg); 880 peer3.vh = GNUNET_SCALARPRODUCT_connect (cfg);
881 return peer3.vh; 881 return peer3.vh;
882 882
883 case PEER4_VECTORPRODUCT_CONNECT: 883 case PEER4_SCALARPRODUCT_CONNECT:
884 peer4.vh = GNUNET_VECTORPRODUCT_connect (cfg); 884 peer4.vh = GNUNET_SCALARPRODUCT_connect (cfg);
885 885
886 /* Schedule the tasks to issue prepare_response calls from peer1 and peer2 886 /* Schedule the tasks to issue prepare_response calls from peer1 and peer2
887 * for peer3 and peer4. 887 * for peer3 and peer4.
@@ -982,11 +982,11 @@ peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op_,
982 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full 982 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full
983 (&peer2.our_id)); 983 (&peer2.our_id));
984 984
985 /* Connect peer 1 to vectorproduct service */ 985 /* Connect peer 1 to scalarproduct service */
986 peer1.op = GNUNET_TESTBED_service_connect (&peer1, peer1.peer, "vectorproduct", 986 peer1.op = GNUNET_TESTBED_service_connect (&peer1, peer1.peer, "scalarproduct",
987 NULL, NULL, vectorproduct_ca, 987 NULL, NULL, scalarproduct_ca,
988 vectorproduct_da, &peer1); 988 scalarproduct_da, &peer1);
989 setup_state = PEER1_VECTORPRODUCT_CONNECT; 989 setup_state = PEER1_SCALARPRODUCT_CONNECT;
990 } 990 }
991 break; 991 break;
992 default: 992 default:
@@ -1073,8 +1073,8 @@ main (int argc, char **argv)
1073 event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); 1073 event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
1074 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader)) 1074 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader))
1075 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1; 1075 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1;
1076 (void) GNUNET_TESTBED_test_run ("test_vectorproduct_api_4peers", 1076 (void) GNUNET_TESTBED_test_run ("test_scalarproduct_api_4peers",
1077 "test_vectorproduct_api_data.conf", 1077 "test_scalarproduct_api_data.conf",
1078 NUM_PEERS, event_mask, &controller_event_cb, 1078 NUM_PEERS, event_mask, &controller_event_cb,
1079 NULL, 1079 NULL,
1080 &test_master, NULL); 1080 &test_master, NULL);
diff --git a/src/scalarproduct/test_scalarproduct_api_regression.c b/src/scalarproduct/test_scalarproduct_api_regression.c
index 2bc0adec6..1042b10da 100644
--- a/src/scalarproduct/test_scalarproduct_api_regression.c
+++ b/src/scalarproduct/test_scalarproduct_api_regression.c
@@ -20,7 +20,7 @@
20 */ 20 */
21 21
22/** 22/**
23 * @file vectorproduct/test_vectorproduct_api_regression.c 23 * @file scalarproduct/test_scalarproduct_api_regression.c
24 * @brief VectorProduct API regression test 24 * @brief VectorProduct API regression test
25 * @author Gaurav Kukreja 25 * @author Gaurav Kukreja
26 * @author Christian Fuchs 26 * @author Christian Fuchs
@@ -47,10 +47,10 @@
47#include "gnunet_util_lib.h" 47#include "gnunet_util_lib.h"
48#include "gnunet_testbed_service.h" 48#include "gnunet_testbed_service.h"
49#include "gnunet_common.h" 49#include "gnunet_common.h"
50#include "gnunet_vectorproduct_service.h" 50#include "gnunet_scalarproduct_service.h"
51#include "gnunet_protocols.h" 51#include "gnunet_protocols.h"
52 52
53#define LOG(kind,...) GNUNET_log_from (kind, "test-vectorproduct-api-regression",__VA_ARGS__) 53#define LOG(kind,...) GNUNET_log_from (kind, "test-scalarproduct-api-regression",__VA_ARGS__)
54#define NUM_PEERS 2 54#define NUM_PEERS 2
55 55
56/** 56/**
@@ -76,7 +76,7 @@ struct PeerData
76 /** 76 /**
77 * Pointer to Vector Product Handle 77 * Pointer to Vector Product Handle
78 */ 78 */
79 struct GNUNET_VECTORPRODUCT_Handle *vh; 79 struct GNUNET_SCALARPRODUCT_Handle *vh;
80}; 80};
81 81
82/** 82/**
@@ -97,12 +97,12 @@ enum SetupState
97 /** 97 /**
98 * Connect to stream service of peer 1 98 * Connect to stream service of peer 1
99 */ 99 */
100 PEER1_VECTORPRODUCT_CONNECT, 100 PEER1_SCALARPRODUCT_CONNECT,
101 101
102 /** 102 /**
103 * Connect to stream service of peer 2 103 * Connect to stream service of peer 2
104 */ 104 */
105 PEER2_VECTORPRODUCT_CONNECT 105 PEER2_SCALARPRODUCT_CONNECT
106 106
107}; 107};
108 108
@@ -250,7 +250,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
250 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting Peer2\n\n"); 250 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting Peer2\n\n");
251 251
252 // peer->op contains handle to the TESTBED_connect_service operation 252 // peer->op contains handle to the TESTBED_connect_service operation
253 // calling operation done, leads to call to vectorproduct_da 253 // calling operation done, leads to call to scalarproduct_da
254 if (peer->op != NULL) 254 if (peer->op != NULL)
255 { 255 {
256 GNUNET_TESTBED_operation_done (peer->op); 256 GNUNET_TESTBED_operation_done (peer->op);
@@ -290,8 +290,8 @@ controller_event_cb (void *cls,
290 case GNUNET_TESTBED_ET_OPERATION_FINISHED: 290 case GNUNET_TESTBED_ET_OPERATION_FINISHED:
291 switch (setup_state) 291 switch (setup_state)
292 { 292 {
293 case PEER1_VECTORPRODUCT_CONNECT: 293 case PEER1_SCALARPRODUCT_CONNECT:
294 case PEER2_VECTORPRODUCT_CONNECT: 294 case PEER2_SCALARPRODUCT_CONNECT:
295 GNUNET_assert (NULL == event->details.operation_finished.emsg); 295 GNUNET_assert (NULL == event->details.operation_finished.emsg);
296 break; 296 break;
297 default: 297 default:
@@ -314,29 +314,29 @@ controller_event_cb (void *cls,
314static void 314static void
315responder_callback (void *cls, 315responder_callback (void *cls,
316 const struct GNUNET_HashCode * key, 316 const struct GNUNET_HashCode * key,
317 enum GNUNET_VECTORPRODUCT_ResponseStatus status) 317 enum GNUNET_SCALARPRODUCT_ResponseStatus status)
318{ 318{
319 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 319 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
320 { 320 {
321 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status failure\n"); 321 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status failure\n");
322 ok = -1; 322 ok = -1;
323 } 323 }
324 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 324 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
325 { 325 {
326 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status invalid response\n"); 326 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status invalid response\n");
327 ok = -1; 327 ok = -1;
328 } 328 }
329 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 329 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
330 { 330 {
331 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received timeout occured\n"); 331 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received timeout occured\n");
332 ok = -1; 332 ok = -1;
333 } 333 }
334 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 334 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
335 { 335 {
336 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received service disconnected!!\n"); 336 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received service disconnected!!\n");
337 ok = 1; 337 ok = 1;
338 } 338 }
339 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 339 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
340 { 340 {
341 LOG (GNUNET_ERROR_TYPE_DEBUG, "Responder Client expected response received!\n"); 341 LOG (GNUNET_ERROR_TYPE_DEBUG, "Responder Client expected response received!\n");
342 ok = -1; 342 ok = -1;
@@ -369,37 +369,37 @@ static void
369requester_callback (void *cls, 369requester_callback (void *cls,
370 const struct GNUNET_HashCode * key, 370 const struct GNUNET_HashCode * key,
371 const struct GNUNET_PeerIdentity * peer, 371 const struct GNUNET_PeerIdentity * peer,
372 enum GNUNET_VECTORPRODUCT_ResponseStatus status, 372 enum GNUNET_SCALARPRODUCT_ResponseStatus status,
373 const struct GNUNET_VECTORPRODUCT_client_response *msg) 373 const struct GNUNET_SCALARPRODUCT_client_response *msg)
374{ 374{
375 uint32_t product_len; 375 uint32_t product_len;
376 376
377 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 377 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
378 { 378 {
379 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status failure\n"); 379 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status failure\n");
380 ok = -1; 380 ok = -1;
381 } 381 }
382 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 382 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
383 { 383 {
384 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status invalid response\n"); 384 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status invalid response\n");
385 ok = -1; 385 ok = -1;
386 } 386 }
387 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 387 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
388 { 388 {
389 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client timeout occured\n"); 389 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client timeout occured\n");
390 ok = -1; 390 ok = -1;
391 } 391 }
392 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 392 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
393 { 393 {
394 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client service disconnected!!\n"); 394 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client service disconnected!!\n");
395 ok = 1; 395 ok = 1;
396 } 396 }
397 else if (GNUNET_VECTORPRODUCT_Status_Success != status) 397 else if (GNUNET_SCALARPRODUCT_Status_Success != status)
398 { 398 {
399 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requester Client Status = %d\n", (int) status); 399 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requester Client Status = %d\n", (int) status);
400 ok = -1; 400 ok = -1;
401 } 401 }
402 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 402 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
403 { 403 {
404 product_len = ntohl (msg->product_length); 404 product_len = ntohl (msg->product_length);
405 405
@@ -452,7 +452,7 @@ requester_request (void *cls,
452 char * begin = input_elements_peer2; 452 char * begin = input_elements_peer2;
453 char * end; 453 char * end;
454 int32_t element; 454 int32_t element;
455 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 455 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
456 struct GNUNET_HashCode key; 456 struct GNUNET_HashCode key;
457 int exit_loop = 0; 457 int exit_loop = 0;
458 458
@@ -537,7 +537,7 @@ requester_request (void *cls,
537 537
538 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Responder peer key %s\n", &peer1.our_id); 538 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Responder peer key %s\n", &peer1.our_id);
539 539
540 qe = GNUNET_VECTORPRODUCT_request (peer2.vh, 540 qe = GNUNET_SCALARPRODUCT_request (peer2.vh,
541 &key, 541 &key,
542 &peer1.our_id, 542 &peer1.our_id,
543 element_count, 543 element_count,
@@ -549,7 +549,7 @@ requester_request (void *cls,
549 549
550 if (qe == NULL) 550 if (qe == NULL)
551 { 551 {
552 FPRINTF (stderr, "%s", _ ("Could not send request to vectorproduct service! Exitting!")); 552 FPRINTF (stderr, "%s", _ ("Could not send request to scalarproduct service! Exitting!"));
553 ok = -1; 553 ok = -1;
554 return; 554 return;
555 } 555 }
@@ -566,7 +566,7 @@ requester_request (void *cls,
566 566
567 567
568/** 568/**
569 * Function prepares the message to be sent by peer1 to its vectorproduct service 569 * Function prepares the message to be sent by peer1 to its scalarproduct service
570 * to prepare response, and wait for a request session to be initiated by peer1 570 * to prepare response, and wait for a request session to be initiated by peer1
571 */ 571 */
572static void 572static void
@@ -580,7 +580,7 @@ responder_prepare_response (void *cls,
580 char * end; 580 char * end;
581 int32_t element; 581 int32_t element;
582 582
583 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 583 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
584 584
585 struct GNUNET_HashCode key; 585 struct GNUNET_HashCode key;
586 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); 586 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
@@ -616,7 +616,7 @@ responder_prepare_response (void *cls,
616 GNUNET_assert (elements_peer1 != NULL); 616 GNUNET_assert (elements_peer1 != NULL);
617 GNUNET_assert (element_count >= 1); 617 GNUNET_assert (element_count >= 1);
618 618
619 qe = GNUNET_VECTORPRODUCT_prepare_response (peer1.vh, 619 qe = GNUNET_SCALARPRODUCT_prepare_response (peer1.vh,
620 &key, 620 &key,
621 element_count, 621 element_count,
622 elements_peer1, 622 elements_peer1,
@@ -626,13 +626,13 @@ responder_prepare_response (void *cls,
626 626
627 if (qe == NULL) 627 if (qe == NULL)
628 { 628 {
629 FPRINTF (stderr, "%s", _ ("Could not send request to vectorproduct service! Exitting!")); 629 FPRINTF (stderr, "%s", _ ("Could not send request to scalarproduct service! Exitting!"));
630 ok = -1; 630 ok = -1;
631 return; 631 return;
632 } 632 }
633 633
634 // connect the second peer 634 // connect the second peer
635 setup_state = PEER2_VECTORPRODUCT_CONNECT; 635 setup_state = PEER2_SCALARPRODUCT_CONNECT;
636 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), &connect_peer, &peer2); 636 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), &connect_peer, &peer2);
637 637
638 // while the service is waiting for a matching request, disconnect the test client 638 // while the service is waiting for a matching request, disconnect the test client
@@ -652,11 +652,11 @@ responder_prepare_response (void *cls,
652 * @param op_result service handle returned from the connect adapter 652 * @param op_result service handle returned from the connect adapter
653 */ 653 */
654static void 654static void
655vectorproduct_da (void *cls, void *op_result) 655scalarproduct_da (void *cls, void *op_result)
656{ 656{
657 struct PeerData* peer = (struct PeerData*) cls; 657 struct PeerData* peer = (struct PeerData*) cls;
658 658
659 GNUNET_VECTORPRODUCT_disconnect (peer->vh); 659 GNUNET_SCALARPRODUCT_disconnect (peer->vh);
660 peer->vh = NULL; 660 peer->vh = NULL;
661 return; 661 return;
662} 662}
@@ -673,7 +673,7 @@ vectorproduct_da (void *cls, void *op_result)
673 * @return service handle to return in 'op_result', NULL on error 673 * @return service handle to return in 'op_result', NULL on error
674 */ 674 */
675static void * 675static void *
676vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) 676scalarproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
677{ 677{
678 struct PeerData *p = cls; 678 struct PeerData *p = cls;
679 679
@@ -682,8 +682,8 @@ vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
682 682
683 switch (setup_state) 683 switch (setup_state)
684 { 684 {
685 case PEER1_VECTORPRODUCT_CONNECT: 685 case PEER1_SCALARPRODUCT_CONNECT:
686 peer1.vh = GNUNET_VECTORPRODUCT_connect (cfg); 686 peer1.vh = GNUNET_SCALARPRODUCT_connect (cfg);
687 687
688 if (peer1.vh != NULL) 688 if (peer1.vh != NULL)
689 { 689 {
@@ -698,9 +698,9 @@ vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
698 698
699 return peer1.vh; 699 return peer1.vh;
700 700
701 case PEER2_VECTORPRODUCT_CONNECT: 701 case PEER2_SCALARPRODUCT_CONNECT:
702 /* Actually connect peer 2 to vectorproduct service */ 702 /* Actually connect peer 2 to scalarproduct service */
703 peer2.vh = GNUNET_VECTORPRODUCT_connect (cfg); 703 peer2.vh = GNUNET_SCALARPRODUCT_connect (cfg);
704 704
705 if (peer2.vh != NULL) 705 if (peer2.vh != NULL)
706 { 706 {
@@ -732,9 +732,9 @@ connect_peer (void *cls,
732{ 732{
733 struct PeerData *peer = cls; 733 struct PeerData *peer = cls;
734 734
735 peer->op = GNUNET_TESTBED_service_connect (peer, peer->peer, "vectorproduct", 735 peer->op = GNUNET_TESTBED_service_connect (peer, peer->peer, "scalarproduct",
736 NULL, NULL, vectorproduct_ca, 736 NULL, NULL, scalarproduct_ca,
737 vectorproduct_da, peer); 737 scalarproduct_da, peer);
738 738
739} 739}
740 740
@@ -783,8 +783,8 @@ peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op_,
783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full 783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full
784 (&peer2.our_id)); 784 (&peer2.our_id));
785 785
786 /* Connect peer 1 to vectorproduct service */ 786 /* Connect peer 1 to scalarproduct service */
787 setup_state = PEER1_VECTORPRODUCT_CONNECT; 787 setup_state = PEER1_SCALARPRODUCT_CONNECT;
788 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &connect_peer, &peer1); 788 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, &connect_peer, &peer1);
789 } 789 }
790 break; 790 break;
@@ -838,8 +838,8 @@ main (int argc, char **argv)
838 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader)) 838 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader))
839 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1; 839 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1;
840 840
841 (void) GNUNET_TESTBED_test_run ("test_vectorproduct_api_regression", 841 (void) GNUNET_TESTBED_test_run ("test_scalarproduct_api_regression",
842 "test_vectorproduct_api_data.conf", 842 "test_scalarproduct_api_data.conf",
843 NUM_PEERS, event_mask, &controller_event_cb, 843 NUM_PEERS, event_mask, &controller_event_cb,
844 NULL, 844 NULL,
845 &test_master, NULL); 845 &test_master, NULL);
diff --git a/src/scalarproduct/test_scalarproduct_api_regression2.c b/src/scalarproduct/test_scalarproduct_api_regression2.c
index 8a0162b40..7fb4e0c01 100644
--- a/src/scalarproduct/test_scalarproduct_api_regression2.c
+++ b/src/scalarproduct/test_scalarproduct_api_regression2.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file vectorproduct/test_vectorproduct_api_regression2.c 22 * @file scalarproduct/test_scalarproduct_api_regression2.c
23 * @brief Regression test, destroys requester service before receiving response 23 * @brief Regression test, destroys requester service before receiving response
24 * responder service 24 * responder service
25 * @author Gaurav Kukreja 25 * @author Gaurav Kukreja
@@ -33,10 +33,10 @@
33#include "gnunet_util_lib.h" 33#include "gnunet_util_lib.h"
34#include "gnunet_testbed_service.h" 34#include "gnunet_testbed_service.h"
35#include "gnunet_common.h" 35#include "gnunet_common.h"
36#include "gnunet_vectorproduct_service.h" 36#include "gnunet_scalarproduct_service.h"
37#include "gnunet_protocols.h" 37#include "gnunet_protocols.h"
38 38
39#define LOG(kind,...) GNUNET_log_from (kind, "test-vectorproduct-api-regression2",__VA_ARGS__) 39#define LOG(kind,...) GNUNET_log_from (kind, "test-scalarproduct-api-regression2",__VA_ARGS__)
40#define NUM_PEERS 2 40#define NUM_PEERS 2
41 41
42/** 42/**
@@ -62,7 +62,7 @@ struct PeerData
62 /** 62 /**
63 * Pointer to Vector Product Handle 63 * Pointer to Vector Product Handle
64 */ 64 */
65 struct GNUNET_VECTORPRODUCT_Handle *vh; 65 struct GNUNET_SCALARPRODUCT_Handle *vh;
66}; 66};
67 67
68/** 68/**
@@ -83,12 +83,12 @@ enum SetupState
83 /** 83 /**
84 * Connect to stream service of peer 1 84 * Connect to stream service of peer 1
85 */ 85 */
86 PEER1_VECTORPRODUCT_CONNECT, 86 PEER1_SCALARPRODUCT_CONNECT,
87 87
88 /** 88 /**
89 * Connect to stream service of peer 2 89 * Connect to stream service of peer 2
90 */ 90 */
91 PEER2_VECTORPRODUCT_CONNECT 91 PEER2_SCALARPRODUCT_CONNECT
92 92
93}; 93};
94 94
@@ -241,7 +241,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
241 struct PeerData* peer = (struct PeerData*) cls; 241 struct PeerData* peer = (struct PeerData*) cls;
242 242
243 // peer->op contains handle to the TESTBED_connect_service operation 243 // peer->op contains handle to the TESTBED_connect_service operation
244 // calling operation done, leads to call to vectorproduct_da 244 // calling operation done, leads to call to scalarproduct_da
245 if (peer->op != NULL) 245 if (peer->op != NULL)
246 { 246 {
247 if (peer == &peer1) 247 if (peer == &peer1)
@@ -287,8 +287,8 @@ controller_event_cb (void *cls,
287 case GNUNET_TESTBED_ET_OPERATION_FINISHED: 287 case GNUNET_TESTBED_ET_OPERATION_FINISHED:
288 switch (setup_state) 288 switch (setup_state)
289 { 289 {
290 case PEER1_VECTORPRODUCT_CONNECT: 290 case PEER1_SCALARPRODUCT_CONNECT:
291 case PEER2_VECTORPRODUCT_CONNECT: 291 case PEER2_SCALARPRODUCT_CONNECT:
292 GNUNET_assert (NULL == event->details.operation_finished.emsg); 292 GNUNET_assert (NULL == event->details.operation_finished.emsg);
293 break; 293 break;
294 default: 294 default:
@@ -304,31 +304,31 @@ controller_event_cb (void *cls,
304static void 304static void
305responder_callback (void *cls, 305responder_callback (void *cls,
306 const struct GNUNET_HashCode * key, 306 const struct GNUNET_HashCode * key,
307 enum GNUNET_VECTORPRODUCT_ResponseStatus status) 307 enum GNUNET_SCALARPRODUCT_ResponseStatus status)
308{ 308{
309 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 309 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
310 { 310 {
311 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status failure\n"); 311 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status failure\n");
312 responder_ok = -1; 312 responder_ok = -1;
313 } 313 }
314 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 314 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
315 { 315 {
316 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status invalid response\n"); 316 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received status invalid response\n");
317 responder_ok = -1; 317 responder_ok = -1;
318 } 318 }
319 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 319 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
320 { 320 {
321 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received timeout occured\n"); 321 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received timeout occured\n");
322 // In this regression test, requester is supposed to fail due to timeout 322 // In this regression test, requester is supposed to fail due to timeout
323 // therefore responder_ok is set to 1, to make regression test pass 323 // therefore responder_ok is set to 1, to make regression test pass
324 responder_ok = 1; 324 responder_ok = 1;
325 } 325 }
326 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 326 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
327 { 327 {
328 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received service disconnected!!\n"); 328 LOG (GNUNET_ERROR_TYPE_WARNING, "Responder Client received service disconnected!!\n");
329 responder_ok = -1; 329 responder_ok = -1;
330 } 330 }
331 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 331 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
332 { 332 {
333 LOG (GNUNET_ERROR_TYPE_DEBUG, "Responder Client expected response received!\n"); 333 LOG (GNUNET_ERROR_TYPE_DEBUG, "Responder Client expected response received!\n");
334 responder_ok = 1; 334 responder_ok = 1;
@@ -349,40 +349,40 @@ static void
349requester_callback (void *cls, 349requester_callback (void *cls,
350 const struct GNUNET_HashCode * key, 350 const struct GNUNET_HashCode * key,
351 const struct GNUNET_PeerIdentity * peer, 351 const struct GNUNET_PeerIdentity * peer,
352 enum GNUNET_VECTORPRODUCT_ResponseStatus status, 352 enum GNUNET_SCALARPRODUCT_ResponseStatus status,
353 uint16_t size, struct GNUNET_VECTORPRODUCT_client_response *msg, 353 uint16_t size, struct GNUNET_SCALARPRODUCT_client_response *msg,
354 uint16_t type) 354 uint16_t type)
355{ 355{
356 uint32_t product_len; 356 uint32_t product_len;
357 357
358 if (status == GNUNET_VECTORPRODUCT_Status_Failure) 358 if (status == GNUNET_SCALARPRODUCT_Status_Failure)
359 { 359 {
360 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status failure\n"); 360 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status failure\n");
361 // In this regression test, requester is supposed to receive status failure 361 // In this regression test, requester is supposed to receive status failure
362 // therefore requester_ok is set to 1, to make regression test pass 362 // therefore requester_ok is set to 1, to make regression test pass
363 requester_ok = 1; 363 requester_ok = 1;
364 } 364 }
365 else if (status == GNUNET_VECTORPRODUCT_Status_InvalidResponse) 365 else if (status == GNUNET_SCALARPRODUCT_Status_InvalidResponse)
366 { 366 {
367 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status invalid response\n"); 367 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client received status invalid response\n");
368 requester_ok = -1; 368 requester_ok = -1;
369 } 369 }
370 else if (GNUNET_VECTORPRODUCT_Status_Timeout == status) 370 else if (GNUNET_SCALARPRODUCT_Status_Timeout == status)
371 { 371 {
372 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client timeout occured\n"); 372 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client timeout occured\n");
373 requester_ok = -1; 373 requester_ok = -1;
374 } 374 }
375 else if (GNUNET_VECTORPRODUCT_Status_ServiceDisconnected == status) 375 else if (GNUNET_SCALARPRODUCT_Status_ServiceDisconnected == status)
376 { 376 {
377 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client service disconnected!!\n"); 377 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client service disconnected!!\n");
378 requester_ok = -1; 378 requester_ok = -1;
379 } 379 }
380 else if (GNUNET_VECTORPRODUCT_Status_Success != status) 380 else if (GNUNET_SCALARPRODUCT_Status_Success != status)
381 { 381 {
382 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client Status = %d\n", (int) status); 382 LOG (GNUNET_ERROR_TYPE_WARNING, "Requester Client Status = %d\n", (int) status);
383 requester_ok = -1; 383 requester_ok = -1;
384 } 384 }
385 else if (GNUNET_VECTORPRODUCT_Status_Success == status) 385 else if (GNUNET_SCALARPRODUCT_Status_Success == status)
386 { 386 {
387 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requester Client expected response received!\n"); 387 LOG (GNUNET_ERROR_TYPE_DEBUG, "Requester Client expected response received!\n");
388 388
@@ -475,7 +475,7 @@ requester_callback (void *cls,
475} 475}
476 476
477 477
478static struct GNUNET_VECTORPRODUCT_QueueEntry * 478static struct GNUNET_SCALARPRODUCT_QueueEntry *
479requester_request () 479requester_request ()
480{ 480{
481 GNUNET_assert (peer2.vh != NULL); 481 GNUNET_assert (peer2.vh != NULL);
@@ -487,7 +487,7 @@ requester_request ()
487 char * end; 487 char * end;
488 int32_t element; 488 int32_t element;
489 489
490 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 490 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
491 491
492 struct GNUNET_HashCode key; 492 struct GNUNET_HashCode key;
493 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); 493 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
@@ -573,7 +573,7 @@ requester_request ()
573 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Responder peer key %s\n", &peer1.our_id); 573 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Responder peer key %s\n", &peer1.our_id);
574 574
575 // TODO : Create the mask array 575 // TODO : Create the mask array
576 qe = GNUNET_VECTORPRODUCT_request (peer2.vh, 576 qe = GNUNET_SCALARPRODUCT_request (peer2.vh,
577 &key, 577 &key,
578 &peer1.our_id, 578 &peer1.our_id,
579 element_count_peer2, 579 element_count_peer2,
@@ -585,7 +585,7 @@ requester_request ()
585 585
586 if (qe == NULL) 586 if (qe == NULL)
587 { 587 {
588 FPRINTF (stderr, "%s", _ ("Could not send request to vectorproduct service! Exitting!")); 588 FPRINTF (stderr, "%s", _ ("Could not send request to scalarproduct service! Exitting!"));
589 ok = -1; 589 ok = -1;
590 return NULL; 590 return NULL;
591 } 591 }
@@ -595,10 +595,10 @@ requester_request ()
595 595
596 596
597/** 597/**
598 * Function prepares the message to be sent by peer1 to its vectorproduct service 598 * Function prepares the message to be sent by peer1 to its scalarproduct service
599 * to prepare response, and wait for a request session to be initiated by peer1 599 * to prepare response, and wait for a request session to be initiated by peer1
600 */ 600 */
601static struct GNUNET_VECTORPRODUCT_QueueEntry * 601static struct GNUNET_SCALARPRODUCT_QueueEntry *
602responder_prepare_response () 602responder_prepare_response ()
603{ 603{
604 GNUNET_assert (peer1.vh != NULL); 604 GNUNET_assert (peer1.vh != NULL);
@@ -609,7 +609,7 @@ responder_prepare_response ()
609 char * end; 609 char * end;
610 int32_t element; 610 int32_t element;
611 611
612 struct GNUNET_VECTORPRODUCT_QueueEntry *qe; 612 struct GNUNET_SCALARPRODUCT_QueueEntry *qe;
613 613
614 struct GNUNET_HashCode key; 614 struct GNUNET_HashCode key;
615 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key); 615 GNUNET_CRYPTO_hash (input_key, strlen (input_key), &key);
@@ -648,7 +648,7 @@ responder_prepare_response ()
648 GNUNET_assert (elements_peer1 != NULL); 648 GNUNET_assert (elements_peer1 != NULL);
649 GNUNET_assert (element_count_peer1 >= 1); 649 GNUNET_assert (element_count_peer1 >= 1);
650 650
651 qe = GNUNET_VECTORPRODUCT_prepare_response (peer1.vh, 651 qe = GNUNET_SCALARPRODUCT_prepare_response (peer1.vh,
652 &key, 652 &key,
653 element_count_peer1, 653 element_count_peer1,
654 elements_peer1, 654 elements_peer1,
@@ -658,7 +658,7 @@ responder_prepare_response ()
658 658
659 if (qe == NULL) 659 if (qe == NULL)
660 { 660 {
661 FPRINTF (stderr, "%s", _ ("Could not send request to vectorproduct service! Exitting!")); 661 FPRINTF (stderr, "%s", _ ("Could not send request to scalarproduct service! Exitting!"));
662 ok = -1; 662 ok = -1;
663 return NULL; 663 return NULL;
664 } 664 }
@@ -737,11 +737,11 @@ destroy_server (void *cls,
737 * @param op_result service handle returned from the connect adapter 737 * @param op_result service handle returned from the connect adapter
738 */ 738 */
739static void 739static void
740vectorproduct_da (void *cls, void *op_result) 740scalarproduct_da (void *cls, void *op_result)
741{ 741{
742 struct PeerData* peer = (struct PeerData*) cls; 742 struct PeerData* peer = (struct PeerData*) cls;
743 743
744 GNUNET_VECTORPRODUCT_disconnect (peer->vh); 744 GNUNET_SCALARPRODUCT_disconnect (peer->vh);
745 return; 745 return;
746} 746}
747 747
@@ -757,7 +757,7 @@ vectorproduct_da (void *cls, void *op_result)
757 * @return service handle to return in 'op_result', NULL on error 757 * @return service handle to return in 'op_result', NULL on error
758 */ 758 */
759static void * 759static void *
760vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) 760scalarproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
761{ 761{
762 struct PeerData *p = cls; 762 struct PeerData *p = cls;
763 763
@@ -766,23 +766,23 @@ vectorproduct_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
766 766
767 switch (setup_state) 767 switch (setup_state)
768 { 768 {
769 case PEER1_VECTORPRODUCT_CONNECT: 769 case PEER1_SCALARPRODUCT_CONNECT:
770 /* Connect peer 2 to vectorproduct service */ 770 /* Connect peer 2 to scalarproduct service */
771 /* The connect adapter vectorproduct_ca will be called to perform the actual connection */ 771 /* The connect adapter scalarproduct_ca will be called to perform the actual connection */
772 { 772 {
773 peer2.op = GNUNET_TESTBED_service_connect (&peer2, peer2.peer, "vectorproduct", 773 peer2.op = GNUNET_TESTBED_service_connect (&peer2, peer2.peer, "scalarproduct",
774 NULL, NULL, vectorproduct_ca, 774 NULL, NULL, scalarproduct_ca,
775 vectorproduct_da, &peer2); 775 scalarproduct_da, &peer2);
776 setup_state = PEER2_VECTORPRODUCT_CONNECT; 776 setup_state = PEER2_SCALARPRODUCT_CONNECT;
777 } 777 }
778 778
779 /* Actually connect peer 1 to vectorproduct service */ 779 /* Actually connect peer 1 to scalarproduct service */
780 peer1.vh = GNUNET_VECTORPRODUCT_connect (cfg); 780 peer1.vh = GNUNET_SCALARPRODUCT_connect (cfg);
781 return peer1.vh; 781 return peer1.vh;
782 782
783 case PEER2_VECTORPRODUCT_CONNECT: 783 case PEER2_SCALARPRODUCT_CONNECT:
784 /* Actually connect peer 2 to vectorproduct service */ 784 /* Actually connect peer 2 to scalarproduct service */
785 peer2.vh = GNUNET_VECTORPRODUCT_connect (cfg); 785 peer2.vh = GNUNET_SCALARPRODUCT_connect (cfg);
786 786
787 787
788 if (peer1.vh != NULL && peer2.vh != NULL) 788 if (peer1.vh != NULL && peer2.vh != NULL)
@@ -848,12 +848,12 @@ peerinfo_cb (void *cb_cls, struct GNUNET_TESTBED_Operation *op_,
848 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full 848 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 2 id: %s\n", GNUNET_i2s_full
849 (&peer2.our_id)); 849 (&peer2.our_id));
850 850
851 /* Connect peer 1 to vectorproduct service */ 851 /* Connect peer 1 to scalarproduct service */
852 /* The connect adapter vectorproduct_ca will be called to perform the actual connection */ 852 /* The connect adapter scalarproduct_ca will be called to perform the actual connection */
853 peer1.op = GNUNET_TESTBED_service_connect (&peer1, peer1.peer, "vectorproduct", 853 peer1.op = GNUNET_TESTBED_service_connect (&peer1, peer1.peer, "scalarproduct",
854 NULL, NULL, vectorproduct_ca, 854 NULL, NULL, scalarproduct_ca,
855 vectorproduct_da, &peer1); 855 scalarproduct_da, &peer1);
856 setup_state = PEER1_VECTORPRODUCT_CONNECT; 856 setup_state = PEER1_SCALARPRODUCT_CONNECT;
857 } 857 }
858 break; 858 break;
859 default: 859 default:
@@ -904,8 +904,8 @@ main (int argc, char **argv)
904 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader)) 904 max_mids = (GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_MessageHeader))
905 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1; 905 / sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1;
906 906
907 (void) GNUNET_TESTBED_test_run ("test_vectorproduct_api_regression2", 907 (void) GNUNET_TESTBED_test_run ("test_scalarproduct_api_regression2",
908 "test_vectorproduct_api_data.conf", 908 "test_scalarproduct_api_data.conf",
909 NUM_PEERS, event_mask, &controller_event_cb, 909 NUM_PEERS, event_mask, &controller_event_cb,
910 NULL, 910 NULL,
911 &test_master, NULL); 911 &test_master, NULL);
diff --git a/src/scalarproduct/vectorproduct_testing.h b/src/scalarproduct/vectorproduct_testing.h
index 19e4f6163..c2c692129 100644
--- a/src/scalarproduct/vectorproduct_testing.h
+++ b/src/scalarproduct/vectorproduct_testing.h
@@ -1,18 +1,18 @@
1/* 1/*
2 * File: vectorproduct_testing.h 2 * File: scalarproduct_testing.h
3 * Author: gnunet 3 * Author: gnunet
4 * 4 *
5 * Created on June 29, 2013, 7:39 PM 5 * Created on June 29, 2013, 7:39 PM
6 */ 6 */
7 7
8#ifndef VECTORPRODUCT_TESTING_H 8#ifndef SCALARPRODUCT_TESTING_H
9#define VECTORPRODUCT_TESTING_H 9#define SCALARPRODUCT_TESTING_H
10 10
11#ifdef __cplusplus 11#ifdef __cplusplus
12extern "C" { 12extern "C" {
13#endif 13#endif
14 14
15struct GNUNET_VECTORPRODUCT_TESTING_handle 15struct GNUNET_SCALARPRODUCT_TESTING_handle
16{ 16{
17 /** 17 /**
18 * Testing library system handle 18 * Testing library system handle
@@ -60,7 +60,7 @@ struct PeerContext
60 /** 60 /**
61 * Pointer to Vector Product Handle 61 * Pointer to Vector Product Handle
62 */ 62 */
63 struct GNUNET_VECTORPRODUCT_Handle *vh; 63 struct GNUNET_SCALARPRODUCT_Handle *vh;
64 64
65 /** 65 /**
66 * Closure for the callbacks 66 * Closure for the callbacks
@@ -80,7 +80,7 @@ struct PeerContext
80 /** 80 /**
81 * Pointer to the master testing handle 81 * Pointer to the master testing handle
82 */ 82 */
83 struct GNUNET_VECTORPRODUCT_TESTING_handle * vth; 83 struct GNUNET_SCALARPRODUCT_TESTING_handle * vth;
84 84
85 /** 85 /**
86 * Callback when two peers are connected and both have called the connect callback 86 * Callback when two peers are connected and both have called the connect callback
@@ -91,31 +91,31 @@ struct PeerContext
91// /** 91// /**
92// * Pointer to function where the test occurs 92// * Pointer to function where the test occurs
93// */ 93// */
94// GNUNET_VECTORPRODUCT_TESTING_start_cb start_cb; 94// GNUNET_SCALARPRODUCT_TESTING_start_cb start_cb;
95}; 95};
96 96
97/** 97/**
98 * Callback when two peers are connected and both have called the connect callback 98 * Callback when two peers are connected and both have called the connect callback
99 * to notify clients about a new peer 99 * to notify clients about a new peer
100 */ 100 */
101typedef void (*GNUNET_VECTORPRODUCT_TESTING_start_cb) (struct PeerContext * p, 101typedef void (*GNUNET_SCALARPRODUCT_TESTING_start_cb) (struct PeerContext * p,
102 void *cls); 102 void *cls);
103 103
104struct GNUNET_VECTORPRODUCT_TESTING_handle * 104struct GNUNET_SCALARPRODUCT_TESTING_handle *
105GNUNET_VECTORPRODUCT_TESTING_init(); 105GNUNET_SCALARPRODUCT_TESTING_init();
106 106
107static void 107static void
108GNUNET_VECTORPRODUCT_TESTING_done(struct GNUNET_VECTORPRODUCT_TESTING_handle * vth); 108GNUNET_SCALARPRODUCT_TESTING_done(struct GNUNET_SCALARPRODUCT_TESTING_handle * vth);
109 109
110struct PeerContext * 110struct PeerContext *
111GNUNET_VECTORPRODUCT_TESTING_start_peer (struct GNUNET_VECTORPRODUCT_TESTING_handle * vth, 111GNUNET_SCALARPRODUCT_TESTING_start_peer (struct GNUNET_SCALARPRODUCT_TESTING_handle * vth,
112 const char *cfgname, int peer_id, 112 const char *cfgname, int peer_id,
113 GNUNET_VECTORPRODUCT_TESTING_start_cb start_cb, 113 GNUNET_SCALARPRODUCT_TESTING_start_cb start_cb,
114 void *cb_cls); 114 void *cb_cls);
115 115
116static void 116static void
117GNUNET_VECTORPRODUCT_TESTING_stop_peer 117GNUNET_SCALARPRODUCT_TESTING_stop_peer
118 (struct GNUNET_VECTORPRODUCT_TESTING_handle * vth, 118 (struct GNUNET_SCALARPRODUCT_TESTING_handle * vth,
119 struct PeerContext *p); 119 struct PeerContext *p);
120 120
121 121
@@ -125,5 +125,5 @@ GNUNET_VECTORPRODUCT_TESTING_stop_peer
125} 125}
126#endif 126#endif
127 127
128#endif /* VECTORPRODUCT_TESTING_H */ 128#endif /* SCALARPRODUCT_TESTING_H */
129 129