aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-12 15:44:04 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-12 15:44:04 +0000
commita9670db6f78bdc4be16dc856a02fe42f4e039f93 (patch)
tree36d15444e0a8f06d63c27d7e9c7b684698a51bda /src/scalarproduct
parentfbfdc8a66888a992517ee61bfb9c39784b2cee83 (diff)
downloadgnunet-a9670db6f78bdc4be16dc856a02fe42f4e039f93.tar.gz
gnunet-a9670db6f78bdc4be16dc856a02fe42f4e039f93.zip
- removed some optional parts from the SP test config
- fixed two bugs in the API, where the API would only append number-of-elements bytes instead of the size of those elements - SP-service now retains the configuration handle received during initialization
Diffstat (limited to 'src/scalarproduct')
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct.c6
-rw-r--r--src/scalarproduct/scalarproduct_api.c6
-rw-r--r--src/scalarproduct/test_scalarproduct.conf97
3 files changed, 24 insertions, 85 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c
index 14711bf0c..abf6daa03 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct.c
@@ -2423,6 +2423,8 @@ run (void *cls,
2423 GNUNET_APPLICATION_TYPE_SCALARPRODUCT, 2423 GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
2424 0 2424 0
2425 }; 2425 };
2426 cfg = c;
2427
2426 //generate private/public key set 2428 //generate private/public key set
2427 GNUNET_CRYPTO_paillier_create (&my_pubkey, &my_privkey); 2429 GNUNET_CRYPTO_paillier_create (&my_pubkey, &my_privkey);
2428 2430
@@ -2438,9 +2440,9 @@ run (void *cls,
2438 &cb_client_disconnect, 2440 &cb_client_disconnect,
2439 NULL); 2441 NULL);
2440 GNUNET_break (GNUNET_OK == 2442 GNUNET_break (GNUNET_OK ==
2441 GNUNET_CRYPTO_get_peer_identity (c, 2443 GNUNET_CRYPTO_get_peer_identity (cfg,
2442 &me)); 2444 &me));
2443 my_cadet = GNUNET_CADET_connect (c, NULL, 2445 my_cadet = GNUNET_CADET_connect (cfg, NULL,
2444 &cb_channel_incoming, 2446 &cb_channel_incoming,
2445 &cb_channel_destruction, 2447 &cb_channel_destruction,
2446 cadet_handlers, ports); 2448 cadet_handlers, ports);
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c
index 9c497129a..3b92af579 100644
--- a/src/scalarproduct/scalarproduct_api.c
+++ b/src/scalarproduct/scalarproduct_api.c
@@ -273,7 +273,7 @@ send_multipart (void * cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
273 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART); 273 msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART);
274 msg->element_count_contained = htonl (todo); 274 msg->element_count_contained = htonl (todo);
275 275
276 memcpy (&msg[1], &h->elements[h->element_count_transfered], todo); 276 memcpy (&msg[1], &h->elements[h->element_count_transfered], todo * sizeof (struct GNUNET_SCALARPRODUCT_Element));
277 h->element_count_transfered += todo; 277 h->element_count_transfered += todo;
278 278
279 h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, 279 h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size,
@@ -515,7 +515,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
515 size = sizeof (struct GNUNET_SCALARPRODUCT_computation_message) + possible*sizeof (struct GNUNET_SCALARPRODUCT_Element); 515 size = sizeof (struct GNUNET_SCALARPRODUCT_computation_message) + possible*sizeof (struct GNUNET_SCALARPRODUCT_Element);
516 h->elements = (struct GNUNET_SCALARPRODUCT_Element*) 516 h->elements = (struct GNUNET_SCALARPRODUCT_Element*)
517 GNUNET_malloc (sizeof(struct GNUNET_SCALARPRODUCT_Element) * element_count); 517 GNUNET_malloc (sizeof(struct GNUNET_SCALARPRODUCT_Element) * element_count);
518 memcpy (h->elements, elements, sizeof (struct GNUNET_SCALARPRODUCT_Element)*element_count); 518 memcpy (h->elements, elements, sizeof (struct GNUNET_SCALARPRODUCT_Element) * element_count);
519 } 519 }
520 520
521 h->cont_datum = cont; 521 h->cont_datum = cont;
@@ -533,7 +533,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
533 533
534 memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); 534 memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity));
535 memcpy (&msg->session_key, session_key, sizeof (struct GNUNET_HashCode)); 535 memcpy (&msg->session_key, session_key, sizeof (struct GNUNET_HashCode));
536 memcpy (&msg[1], elements, possible); 536 memcpy (&msg[1], elements, sizeof (struct GNUNET_SCALARPRODUCT_Element) * possible);
537 537
538 h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, 538 h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size,
539 GNUNET_TIME_UNIT_FOREVER_REL, 539 GNUNET_TIME_UNIT_FOREVER_REL,
diff --git a/src/scalarproduct/test_scalarproduct.conf b/src/scalarproduct/test_scalarproduct.conf
index e80b9dc0e..fb9a34da6 100644
--- a/src/scalarproduct/test_scalarproduct.conf
+++ b/src/scalarproduct/test_scalarproduct.conf
@@ -1,94 +1,31 @@
1[arm] 1[arm]
2DEFAULTSERVICES = core cadet statistics scalarproduct 2DEFAULTSERVICES = core cadet statistics scalarproduct set
3PORT = 12366 3PORT = 12366
4 4
5[ats]
6WAN_QUOTA_OUT = 3932160
7WAN_QUOTA_IN = 3932160
8
9[block]
10plugins = dht test
11
12[consensus]
13AUTOSTART = NO
14
15[core]
16PORT = 12092
17AUTOSTART = YES
18
19[dht]
20AUTOSTART = YES
21DISABLE_TRY_CONNECT = NO
22
23[dhtcache]
24QUOTA = 1 MB
25DATABASE = heap
26
27[dns]
28AUTOSTART = NO
29
30[fs]
31AUTOSTART = NO
32
33[gnunetd]
34HOSTKEY = $SERVICEHOME/.hostkey
35
36[cadet]
37#AUTOSTART = YES
38ACCEPT_FROM = 127.0.0.1;
39PORT = 10700
40
41[nat]
42RETURN_LOCAL_ADDRESSES = YES
43
44[namestore]
45AUTOSTART = NO
46
47[nse]
48AUTOSTART = NO
49
50[PATHS] 5[PATHS]
51GNUNET_TEST_HOME = /tmp/test-scalarproduct/ 6GNUNET_TEST_HOME = /tmp/test-scalarproduct/
52 7
53[psycstore]
54AUTOSTART = NO
55
56[regex]
57AUTOSTART = NO
58
59[resolver]
60AUTOSTART = NO
61HOSTNAME = localhost
62
63[statistics]
64AUTOSTART = NO
65
66[scalarproduct] 8[scalarproduct]
67AUTOSTART = YES 9AUTOSTART = YES
68BINARY = gnunet-service-scalarproduct 10BINARY = gnunet-service-scalarproduct
69UNIXPATH = $SERVICEHOME/scalarproduct.sock 11#UNIXPATH = $SERVICEHOME/scalarproduct.sock
70#HOME = $SERVICEHOME 12UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct.sock
71HOSTNAME = localhost 13HOSTNAME = localhost
72PORT = 13087 14PORT = 13087
15#OPTIONS = -L DEBUG
73 16
74[transport] 17[set]
75PLUGINS = tcp 18AUTOSTART = YES
76ACCEPT_FROM6 = ::1; 19PORT = 12106
77ACCEPT_FROM = 127.0.0.1; 20HOSTNAME = localhost
78NEIGHBOUR_LIMIT = 50 21BINARY = gnunet-service-set
79PORT = 12365 22#ACCEPT_FROM = 127.0.0.1;
80 23#ACCEPT_FROM6 = ::1;
81[transport-tcp] 24#UNIXPATH = $SERVICEHOME/set.sock
82TIMEOUT = 300 s 25UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-set.sock
83PORT = 12368 26#UNIX_MATCH_UID = YES
27#UNIX_MATCH_GID = YES
28#OPTIONS = -L DEBUG
84 29
85[testbed] 30[testbed]
86OVERLAY_TOPOLOGY = LINE 31OVERLAY_TOPOLOGY = CLIQUE \ No newline at end of file
87
88[TESTING]
89WEAKRANDOM = YES
90
91[vpn]
92AUTOSTART = NO
93
94