aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-19 11:05:13 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-19 11:05:13 +0200
commit6dabecce0f319d5e6c1a26dc09abf689c7249971 (patch)
tree5f7888ea5f2e0ce57c80b9881d8fd6ce1944cce4
parent2d010ea152050af11acdb3d233f80c443dfd55c8 (diff)
downloadgnunet-6dabecce0f319d5e6c1a26dc09abf689c7249971.tar.gz
gnunet-6dabecce0f319d5e6c1a26dc09abf689c7249971.zip
change scalarproduct to use seti service in lieu of deprecated set service
-rw-r--r--src/scalarproduct/Makefile.am8
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c75
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c70
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_alice.c77
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_bob.c71
5 files changed, 133 insertions, 168 deletions
diff --git a/src/scalarproduct/Makefile.am b/src/scalarproduct/Makefile.am
index 311cfd1af..f3448725a 100644
--- a/src/scalarproduct/Makefile.am
+++ b/src/scalarproduct/Makefile.am
@@ -39,7 +39,7 @@ gnunet_service_scalarproduct_alice_SOURCES = \
39gnunet_service_scalarproduct_alice_LDADD = \ 39gnunet_service_scalarproduct_alice_LDADD = \
40 $(top_builddir)/src/util/libgnunetutil.la \ 40 $(top_builddir)/src/util/libgnunetutil.la \
41 $(top_builddir)/src/cadet/libgnunetcadet.la \ 41 $(top_builddir)/src/cadet/libgnunetcadet.la \
42 $(top_builddir)/src/set/libgnunetset.la \ 42 $(top_builddir)/src/seti/libgnunetseti.la \
43 $(LIBGCRYPT_LIBS) \ 43 $(LIBGCRYPT_LIBS) \
44 -lgcrypt \ 44 -lgcrypt \
45 $(GN_LIBINTL) 45 $(GN_LIBINTL)
@@ -50,7 +50,7 @@ gnunet_service_scalarproduct_bob_SOURCES = \
50gnunet_service_scalarproduct_bob_LDADD = \ 50gnunet_service_scalarproduct_bob_LDADD = \
51 $(top_builddir)/src/util/libgnunetutil.la \ 51 $(top_builddir)/src/util/libgnunetutil.la \
52 $(top_builddir)/src/cadet/libgnunetcadet.la \ 52 $(top_builddir)/src/cadet/libgnunetcadet.la \
53 $(top_builddir)/src/set/libgnunetset.la \ 53 $(top_builddir)/src/seti/libgnunetseti.la \
54 $(LIBGCRYPT_LIBS) \ 54 $(LIBGCRYPT_LIBS) \
55 -lgcrypt \ 55 -lgcrypt \
56 $(GN_LIBINTL) 56 $(GN_LIBINTL)
@@ -61,7 +61,7 @@ gnunet_service_scalarproduct_ecc_alice_SOURCES = \
61gnunet_service_scalarproduct_ecc_alice_LDADD = \ 61gnunet_service_scalarproduct_ecc_alice_LDADD = \
62 $(top_builddir)/src/util/libgnunetutil.la \ 62 $(top_builddir)/src/util/libgnunetutil.la \
63 $(top_builddir)/src/cadet/libgnunetcadet.la \ 63 $(top_builddir)/src/cadet/libgnunetcadet.la \
64 $(top_builddir)/src/set/libgnunetset.la \ 64 $(top_builddir)/src/seti/libgnunetseti.la \
65 $(LIBGCRYPT_LIBS) \ 65 $(LIBGCRYPT_LIBS) \
66 -lgcrypt \ 66 -lgcrypt \
67 $(GN_LIBINTL) 67 $(GN_LIBINTL)
@@ -72,7 +72,7 @@ gnunet_service_scalarproduct_ecc_bob_SOURCES = \
72gnunet_service_scalarproduct_ecc_bob_LDADD = \ 72gnunet_service_scalarproduct_ecc_bob_LDADD = \
73 $(top_builddir)/src/util/libgnunetutil.la \ 73 $(top_builddir)/src/util/libgnunetutil.la \
74 $(top_builddir)/src/cadet/libgnunetcadet.la \ 74 $(top_builddir)/src/cadet/libgnunetcadet.la \
75 $(top_builddir)/src/set/libgnunetset.la \ 75 $(top_builddir)/src/seti/libgnunetseti.la \
76 $(LIBGCRYPT_LIBS) \ 76 $(LIBGCRYPT_LIBS) \
77 -lgcrypt \ 77 -lgcrypt \
78 $(GN_LIBINTL) 78 $(GN_LIBINTL)
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
index 20ab292cf..447451aef 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
@@ -32,7 +32,7 @@
32#include "gnunet_applications.h" 32#include "gnunet_applications.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
34#include "gnunet_scalarproduct_service.h" 34#include "gnunet_scalarproduct_service.h"
35#include "gnunet_set_service.h" 35#include "gnunet_seti_service.h"
36#include "scalarproduct.h" 36#include "scalarproduct.h"
37#include "gnunet-service-scalarproduct-ecc.h" 37#include "gnunet-service-scalarproduct-ecc.h"
38 38
@@ -114,18 +114,18 @@ struct AliceServiceSession
114 * Set of elements for which will conduction an intersection. 114 * Set of elements for which will conduction an intersection.
115 * the resulting elements are then used for computing the scalar product. 115 * the resulting elements are then used for computing the scalar product.
116 */ 116 */
117 struct GNUNET_SET_Handle *intersection_set; 117 struct GNUNET_SETI_Handle *intersection_set;
118 118
119 /** 119 /**
120 * Set of elements for which will conduction an intersection. 120 * Set of elements for which will conduction an intersection.
121 * the resulting elements are then used for computing the scalar product. 121 * the resulting elements are then used for computing the scalar product.
122 */ 122 */
123 struct GNUNET_SET_OperationHandle *intersection_op; 123 struct GNUNET_SETI_OperationHandle *intersection_op;
124 124
125 /** 125 /**
126 * Handle to Alice's Intersection operation listening for Bob 126 * Handle to Alice's Intersection operation listening for Bob
127 */ 127 */
128 struct GNUNET_SET_ListenHandle *intersection_listen; 128 struct GNUNET_SETI_ListenHandle *intersection_listen;
129 129
130 /** 130 /**
131 * channel-handle associated with our cadet handle 131 * channel-handle associated with our cadet handle
@@ -256,18 +256,18 @@ destroy_service_session (struct AliceServiceSession *s)
256 } 256 }
257 if (NULL != s->intersection_listen) 257 if (NULL != s->intersection_listen)
258 { 258 {
259 GNUNET_SET_listen_cancel (s->intersection_listen); 259 GNUNET_SETI_listen_cancel (s->intersection_listen);
260 s->intersection_listen = NULL; 260 s->intersection_listen = NULL;
261 } 261 }
262 if (NULL != s->intersection_op) 262 if (NULL != s->intersection_op)
263 { 263 {
264 LOG (GNUNET_ERROR_TYPE_DEBUG, "Set intersection, op still ongoing!\n"); 264 LOG (GNUNET_ERROR_TYPE_DEBUG, "Set intersection, op still ongoing!\n");
265 GNUNET_SET_operation_cancel (s->intersection_op); 265 GNUNET_SETI_operation_cancel (s->intersection_op);
266 s->intersection_op = NULL; 266 s->intersection_op = NULL;
267 } 267 }
268 if (NULL != s->intersection_set) 268 if (NULL != s->intersection_set)
269 { 269 {
270 GNUNET_SET_destroy (s->intersection_set); 270 GNUNET_SETI_destroy (s->intersection_set);
271 s->intersection_set = NULL; 271 s->intersection_set = NULL;
272 } 272 }
273 if (NULL != s->sorted_elements) 273 if (NULL != s->sorted_elements)
@@ -649,22 +649,22 @@ send_alices_cryptodata_message (struct AliceServiceSession *s)
649 * to indicate that the set intersection operation is done. 649 * to indicate that the set intersection operation is done.
650 * 650 *
651 * @param cls closure with the `struct AliceServiceSession` 651 * @param cls closure with the `struct AliceServiceSession`
652 * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK 652 * @param element a result element, only valid if status is #GNUNET_SETI_STATUS_OK
653 * @param current_size current set size 653 * @param current_size current set size
654 * @param status what has happened with the set intersection? 654 * @param status what has happened with the set intersection?
655 */ 655 */
656static void 656static void
657cb_intersection_element_removed (void *cls, 657cb_intersection_element_removed (void *cls,
658 const struct GNUNET_SET_Element *element, 658 const struct GNUNET_SETI_Element *element,
659 uint64_t current_size, 659 uint64_t current_size,
660 enum GNUNET_SET_Status status) 660 enum GNUNET_SETI_Status status)
661{ 661{
662 struct AliceServiceSession *s = cls; 662 struct AliceServiceSession *s = cls;
663 struct GNUNET_SCALARPRODUCT_Element *se; 663 struct GNUNET_SCALARPRODUCT_Element *se;
664 664
665 switch (status) 665 switch (status)
666 { 666 {
667 case GNUNET_SET_STATUS_OK: 667 case GNUNET_SETI_STATUS_DEL_LOCAL:
668 /* this element has been removed from the set */ 668 /* this element has been removed from the set */
669 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements, 669 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements,
670 element->data); 670 element->data);
@@ -680,34 +680,27 @@ cb_intersection_element_removed (void *cls,
680 se)); 680 se));
681 GNUNET_free (se); 681 GNUNET_free (se);
682 return; 682 return;
683 683 case GNUNET_SETI_STATUS_DONE:
684 case GNUNET_SET_STATUS_DONE:
685 s->intersection_op = NULL; 684 s->intersection_op = NULL;
686 if (NULL != s->intersection_set) 685 if (NULL != s->intersection_set)
687 { 686 {
688 GNUNET_SET_destroy (s->intersection_set); 687 GNUNET_SETI_destroy (s->intersection_set);
689 s->intersection_set = NULL; 688 s->intersection_set = NULL;
690 } 689 }
691 send_alices_cryptodata_message (s); 690 send_alices_cryptodata_message (s);
692 return; 691 return;
693 692 case GNUNET_SETI_STATUS_FAILURE:
694 case GNUNET_SET_STATUS_HALF_DONE:
695 /* unexpected for intersection */
696 GNUNET_break (0);
697 return;
698
699 case GNUNET_SET_STATUS_FAILURE:
700 /* unhandled status code */ 693 /* unhandled status code */
701 LOG (GNUNET_ERROR_TYPE_DEBUG, "Set intersection failed!\n"); 694 LOG (GNUNET_ERROR_TYPE_DEBUG, "Set intersection failed!\n");
702 if (NULL != s->intersection_listen) 695 if (NULL != s->intersection_listen)
703 { 696 {
704 GNUNET_SET_listen_cancel (s->intersection_listen); 697 GNUNET_SETI_listen_cancel (s->intersection_listen);
705 s->intersection_listen = NULL; 698 s->intersection_listen = NULL;
706 } 699 }
707 s->intersection_op = NULL; 700 s->intersection_op = NULL;
708 if (NULL != s->intersection_set) 701 if (NULL != s->intersection_set)
709 { 702 {
710 GNUNET_SET_destroy (s->intersection_set); 703 GNUNET_SETI_destroy (s->intersection_set);
711 s->intersection_set = NULL; 704 s->intersection_set = NULL;
712 } 705 }
713 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 706 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
@@ -729,7 +722,7 @@ cb_intersection_element_removed (void *cls,
729 * @param other_peer the other peer 722 * @param other_peer the other peer
730 * @param context_msg message with application specific information from 723 * @param context_msg message with application specific information from
731 * the other peer 724 * the other peer
732 * @param request request from the other peer (never NULL), use GNUNET_SET_accept() 725 * @param request request from the other peer (never NULL), use GNUNET_SETI_accept()
733 * to accept it, otherwise the request will be refused 726 * to accept it, otherwise the request will be refused
734 * Note that we can't just return value from the listen callback, 727 * Note that we can't just return value from the listen callback,
735 * as it is also necessary to specify the set we want to do the 728 * as it is also necessary to specify the set we want to do the
@@ -740,7 +733,7 @@ static void
740cb_intersection_request_alice (void *cls, 733cb_intersection_request_alice (void *cls,
741 const struct GNUNET_PeerIdentity *other_peer, 734 const struct GNUNET_PeerIdentity *other_peer,
742 const struct GNUNET_MessageHeader *context_msg, 735 const struct GNUNET_MessageHeader *context_msg,
743 struct GNUNET_SET_Request *request) 736 struct GNUNET_SETI_Request *request)
744{ 737{
745 struct AliceServiceSession *s = cls; 738 struct AliceServiceSession *s = cls;
746 739
@@ -752,11 +745,11 @@ cb_intersection_request_alice (void *cls,
752 GNUNET_break_op (0); 745 GNUNET_break_op (0);
753 return; 746 return;
754 } 747 }
755 s->intersection_op = GNUNET_SET_accept (request, 748 s->intersection_op = GNUNET_SETI_accept (request,
756 GNUNET_SET_RESULT_REMOVED, 749 (struct
757 (struct GNUNET_SET_Option[]){ { 0 } }, 750 GNUNET_SETI_Option[]){ { 0 } },
758 &cb_intersection_element_removed, 751 &cb_intersection_element_removed,
759 s); 752 s);
760 if (NULL == s->intersection_op) 753 if (NULL == s->intersection_op)
761 { 754 {
762 GNUNET_break (0); 755 GNUNET_break (0);
@@ -764,7 +757,7 @@ cb_intersection_request_alice (void *cls,
764 prepare_client_end_notification (s); 757 prepare_client_end_notification (s);
765 return; 758 return;
766 } 759 }
767 if (GNUNET_OK != GNUNET_SET_commit (s->intersection_op, s->intersection_set)) 760 if (GNUNET_OK != GNUNET_SETI_commit (s->intersection_op, s->intersection_set))
768 { 761 {
769 GNUNET_break (0); 762 GNUNET_break (0);
770 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 763 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
@@ -812,11 +805,10 @@ client_request_complete_alice (struct AliceServiceSession *s)
812 return; 805 return;
813 } 806 }
814 s->cadet_mq = GNUNET_CADET_get_mq (s->channel); 807 s->cadet_mq = GNUNET_CADET_get_mq (s->channel);
815 s->intersection_listen = GNUNET_SET_listen (cfg, 808 s->intersection_listen = GNUNET_SETI_listen (cfg,
816 GNUNET_SET_OPERATION_INTERSECTION, 809 &set_sid,
817 &set_sid, 810 &cb_intersection_request_alice,
818 &cb_intersection_request_alice, 811 s);
819 s);
820 if (NULL == s->intersection_listen) 812 if (NULL == s->intersection_listen)
821 { 813 {
822 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 814 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
@@ -883,7 +875,7 @@ handle_alice_client_message_multipart (
883 struct AliceServiceSession *s = cls; 875 struct AliceServiceSession *s = cls;
884 uint32_t contained_count; 876 uint32_t contained_count;
885 const struct GNUNET_SCALARPRODUCT_Element *elements; 877 const struct GNUNET_SCALARPRODUCT_Element *elements;
886 struct GNUNET_SET_Element set_elem; 878 struct GNUNET_SETI_Element set_elem;
887 struct GNUNET_SCALARPRODUCT_Element *elem; 879 struct GNUNET_SCALARPRODUCT_Element *elem;
888 880
889 contained_count = ntohl (msg->element_count_contained); 881 contained_count = ntohl (msg->element_count_contained);
@@ -908,7 +900,7 @@ handle_alice_client_message_multipart (
908 set_elem.data = &elem->key; 900 set_elem.data = &elem->key;
909 set_elem.size = sizeof(elem->key); 901 set_elem.size = sizeof(elem->key);
910 set_elem.element_type = 0; 902 set_elem.element_type = 0;
911 GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL); 903 GNUNET_SETI_add_element (s->intersection_set, &set_elem, NULL, NULL);
912 s->used_element_count++; 904 s->used_element_count++;
913 } 905 }
914 GNUNET_SERVICE_client_continue (s->client); 906 GNUNET_SERVICE_client_continue (s->client);
@@ -978,7 +970,7 @@ handle_alice_client_message (void *cls,
978 uint32_t contained_count; 970 uint32_t contained_count;
979 uint32_t total_count; 971 uint32_t total_count;
980 const struct GNUNET_SCALARPRODUCT_Element *elements; 972 const struct GNUNET_SCALARPRODUCT_Element *elements;
981 struct GNUNET_SET_Element set_elem; 973 struct GNUNET_SETI_Element set_elem;
982 struct GNUNET_SCALARPRODUCT_Element *elem; 974 struct GNUNET_SCALARPRODUCT_Element *elem;
983 975
984 total_count = ntohl (msg->element_count_total); 976 total_count = ntohl (msg->element_count_total);
@@ -991,8 +983,7 @@ handle_alice_client_message (void *cls,
991 elements = (const struct GNUNET_SCALARPRODUCT_Element *) &msg[1]; 983 elements = (const struct GNUNET_SCALARPRODUCT_Element *) &msg[1];
992 s->intersected_elements = 984 s->intersected_elements =
993 GNUNET_CONTAINER_multihashmap_create (s->total, GNUNET_YES); 985 GNUNET_CONTAINER_multihashmap_create (s->total, GNUNET_YES);
994 s->intersection_set = 986 s->intersection_set = GNUNET_SETI_create (cfg);
995 GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_INTERSECTION);
996 for (uint32_t i = 0; i < contained_count; i++) 987 for (uint32_t i = 0; i < contained_count; i++)
997 { 988 {
998 if (0 == GNUNET_ntohll (elements[i].value)) 989 if (0 == GNUNET_ntohll (elements[i].value))
@@ -1015,7 +1006,7 @@ handle_alice_client_message (void *cls,
1015 set_elem.data = &elem->key; 1006 set_elem.data = &elem->key;
1016 set_elem.size = sizeof(elem->key); 1007 set_elem.size = sizeof(elem->key);
1017 set_elem.element_type = 0; 1008 set_elem.element_type = 0;
1018 GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL); 1009 GNUNET_SETI_add_element (s->intersection_set, &set_elem, NULL, NULL);
1019 s->used_element_count++; 1010 s->used_element_count++;
1020 } 1011 }
1021 GNUNET_SERVICE_client_continue (s->client); 1012 GNUNET_SERVICE_client_continue (s->client);
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
index 2da79f845..4c835d52a 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
@@ -32,7 +32,7 @@
32#include "gnunet_applications.h" 32#include "gnunet_applications.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
34#include "gnunet_scalarproduct_service.h" 34#include "gnunet_scalarproduct_service.h"
35#include "gnunet_set_service.h" 35#include "gnunet_seti_service.h"
36#include "scalarproduct.h" 36#include "scalarproduct.h"
37#include "gnunet-service-scalarproduct-ecc.h" 37#include "gnunet-service-scalarproduct-ecc.h"
38 38
@@ -83,13 +83,13 @@ struct BobServiceSession
83 * Set of elements for which we will be conducting an intersection. 83 * Set of elements for which we will be conducting an intersection.
84 * The resulting elements are then used for computing the scalar product. 84 * The resulting elements are then used for computing the scalar product.
85 */ 85 */
86 struct GNUNET_SET_Handle *intersection_set; 86 struct GNUNET_SETI_Handle *intersection_set;
87 87
88 /** 88 /**
89 * Set of elements for which will conduction an intersection. 89 * Set of elements for which will conduction an intersection.
90 * the resulting elements are then used for computing the scalar product. 90 * the resulting elements are then used for computing the scalar product.
91 */ 91 */
92 struct GNUNET_SET_OperationHandle *intersection_op; 92 struct GNUNET_SETI_OperationHandle *intersection_op;
93 93
94 /** 94 /**
95 * Our open port. 95 * Our open port.
@@ -235,12 +235,12 @@ destroy_service_session (struct BobServiceSession *s)
235 } 235 }
236 if (NULL != s->intersection_op) 236 if (NULL != s->intersection_op)
237 { 237 {
238 GNUNET_SET_operation_cancel (s->intersection_op); 238 GNUNET_SETI_operation_cancel (s->intersection_op);
239 s->intersection_op = NULL; 239 s->intersection_op = NULL;
240 } 240 }
241 if (NULL != s->intersection_set) 241 if (NULL != s->intersection_set)
242 { 242 {
243 GNUNET_SET_destroy (s->intersection_set); 243 GNUNET_SETI_destroy (s->intersection_set);
244 s->intersection_set = NULL; 244 s->intersection_set = NULL;
245 } 245 }
246 if (NULL != s->sorted_elements) 246 if (NULL != s->sorted_elements)
@@ -578,22 +578,22 @@ handle_alices_cryptodata_message (void *cls,
578 * that needs to be removed from the result set. 578 * that needs to be removed from the result set.
579 * 579 *
580 * @param cls closure with the `struct BobServiceSession` 580 * @param cls closure with the `struct BobServiceSession`
581 * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK 581 * @param element a result element, only valid if status is #GNUNET_SETI_STATUS_OK
582 * @param current_size current set size 582 * @param current_size current set size
583 * @param status what has happened with the set intersection? 583 * @param status what has happened with the set intersection?
584 */ 584 */
585static void 585static void
586cb_intersection_element_removed (void *cls, 586cb_intersection_element_removed (void *cls,
587 const struct GNUNET_SET_Element *element, 587 const struct GNUNET_SETI_Element *element,
588 uint64_t current_size, 588 uint64_t current_size,
589 enum GNUNET_SET_Status status) 589 enum GNUNET_SETI_Status status)
590{ 590{
591 struct BobServiceSession *s = cls; 591 struct BobServiceSession *s = cls;
592 struct GNUNET_SCALARPRODUCT_Element *se; 592 struct GNUNET_SCALARPRODUCT_Element *se;
593 593
594 switch (status) 594 switch (status)
595 { 595 {
596 case GNUNET_SET_STATUS_OK: 596 case GNUNET_SETI_STATUS_DEL_LOCAL:
597 /* this element has been removed from the set */ 597 /* this element has been removed from the set */
598 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements, 598 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements,
599 element->data); 599 element->data);
@@ -609,8 +609,7 @@ cb_intersection_element_removed (void *cls,
609 se)); 609 se));
610 GNUNET_free (se); 610 GNUNET_free (se);
611 return; 611 return;
612 612 case GNUNET_SETI_STATUS_DONE:
613 case GNUNET_SET_STATUS_DONE:
614 s->intersection_op = NULL; 613 s->intersection_op = NULL;
615 GNUNET_break (NULL == s->intersection_set); 614 GNUNET_break (NULL == s->intersection_set);
616 GNUNET_CADET_receive_done (s->channel); 615 GNUNET_CADET_receive_done (s->channel);
@@ -625,20 +624,14 @@ cb_intersection_element_removed (void *cls,
625 transmit_bobs_cryptodata_message (s); 624 transmit_bobs_cryptodata_message (s);
626 } 625 }
627 return; 626 return;
628 627 case GNUNET_SETI_STATUS_FAILURE:
629 case GNUNET_SET_STATUS_HALF_DONE:
630 /* unexpected for intersection */
631 GNUNET_break (0);
632 return;
633
634 case GNUNET_SET_STATUS_FAILURE:
635 /* unhandled status code */ 628 /* unhandled status code */
636 LOG (GNUNET_ERROR_TYPE_DEBUG, 629 LOG (GNUNET_ERROR_TYPE_DEBUG,
637 "Set intersection failed!\n"); 630 "Set intersection failed!\n");
638 s->intersection_op = NULL; 631 s->intersection_op = NULL;
639 if (NULL != s->intersection_set) 632 if (NULL != s->intersection_set)
640 { 633 {
641 GNUNET_SET_destroy (s->intersection_set); 634 GNUNET_SETI_destroy (s->intersection_set);
642 s->intersection_set = NULL; 635 s->intersection_set = NULL;
643 } 636 }
644 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 637 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
@@ -672,23 +665,22 @@ start_intersection (struct BobServiceSession *s)
672 (unsigned int) s->total); 665 (unsigned int) s->total);
673 666
674 s->intersection_op 667 s->intersection_op
675 = GNUNET_SET_prepare (&s->peer, 668 = GNUNET_SETI_prepare (&s->peer,
676 &set_sid, 669 &set_sid,
677 NULL, 670 NULL,
678 GNUNET_SET_RESULT_REMOVED, 671 (struct GNUNET_SETI_Option[]) { { 0 } },
679 (struct GNUNET_SET_Option[]) { { 0 } }, 672 &cb_intersection_element_removed,
680 &cb_intersection_element_removed, 673 s);
681 s);
682 if (GNUNET_OK != 674 if (GNUNET_OK !=
683 GNUNET_SET_commit (s->intersection_op, 675 GNUNET_SETI_commit (s->intersection_op,
684 s->intersection_set)) 676 s->intersection_set))
685 { 677 {
686 GNUNET_break (0); 678 GNUNET_break (0);
687 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 679 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
688 prepare_client_end_notification (s); 680 prepare_client_end_notification (s);
689 return; 681 return;
690 } 682 }
691 GNUNET_SET_destroy (s->intersection_set); 683 GNUNET_SETI_destroy (s->intersection_set);
692 s->intersection_set = NULL; 684 s->intersection_set = NULL;
693} 685}
694 686
@@ -797,7 +789,7 @@ handle_bob_client_message_multipart (void *cls,
797 struct BobServiceSession *s = cls; 789 struct BobServiceSession *s = cls;
798 uint32_t contained_count; 790 uint32_t contained_count;
799 const struct GNUNET_SCALARPRODUCT_Element *elements; 791 const struct GNUNET_SCALARPRODUCT_Element *elements;
800 struct GNUNET_SET_Element set_elem; 792 struct GNUNET_SETI_Element set_elem;
801 struct GNUNET_SCALARPRODUCT_Element *elem; 793 struct GNUNET_SCALARPRODUCT_Element *elem;
802 794
803 contained_count = ntohl (msg->element_count_contained); 795 contained_count = ntohl (msg->element_count_contained);
@@ -821,9 +813,9 @@ handle_bob_client_message_multipart (void *cls,
821 set_elem.data = &elem->key; 813 set_elem.data = &elem->key;
822 set_elem.size = sizeof(elem->key); 814 set_elem.size = sizeof(elem->key);
823 set_elem.element_type = 0; 815 set_elem.element_type = 0;
824 GNUNET_SET_add_element (s->intersection_set, 816 GNUNET_SETI_add_element (s->intersection_set,
825 &set_elem, 817 &set_elem,
826 NULL, NULL); 818 NULL, NULL);
827 } 819 }
828 s->client_received_element_count += contained_count; 820 s->client_received_element_count += contained_count;
829 GNUNET_SERVICE_client_continue (s->client); 821 GNUNET_SERVICE_client_continue (s->client);
@@ -913,7 +905,7 @@ handle_bob_client_message (void *cls,
913 uint32_t contained_count; 905 uint32_t contained_count;
914 uint32_t total_count; 906 uint32_t total_count;
915 const struct GNUNET_SCALARPRODUCT_Element *elements; 907 const struct GNUNET_SCALARPRODUCT_Element *elements;
916 struct GNUNET_SET_Element set_elem; 908 struct GNUNET_SETI_Element set_elem;
917 struct GNUNET_SCALARPRODUCT_Element *elem; 909 struct GNUNET_SCALARPRODUCT_Element *elem;
918 910
919 total_count = ntohl (msg->element_count_total); 911 total_count = ntohl (msg->element_count_total);
@@ -927,9 +919,7 @@ handle_bob_client_message (void *cls,
927 s->intersected_elements 919 s->intersected_elements
928 = GNUNET_CONTAINER_multihashmap_create (s->total, 920 = GNUNET_CONTAINER_multihashmap_create (s->total,
929 GNUNET_YES); 921 GNUNET_YES);
930 s->intersection_set 922 s->intersection_set = GNUNET_SETI_create (cfg);
931 = GNUNET_SET_create (cfg,
932 GNUNET_SET_OPERATION_INTERSECTION);
933 for (uint32_t i = 0; i < contained_count; i++) 923 for (uint32_t i = 0; i < contained_count; i++)
934 { 924 {
935 if (0 == GNUNET_ntohll (elements[i].value)) 925 if (0 == GNUNET_ntohll (elements[i].value))
@@ -951,9 +941,9 @@ handle_bob_client_message (void *cls,
951 set_elem.data = &elem->key; 941 set_elem.data = &elem->key;
952 set_elem.size = sizeof(elem->key); 942 set_elem.size = sizeof(elem->key);
953 set_elem.element_type = 0; 943 set_elem.element_type = 0;
954 GNUNET_SET_add_element (s->intersection_set, 944 GNUNET_SETI_add_element (s->intersection_set,
955 &set_elem, 945 &set_elem,
956 NULL, NULL); 946 NULL, NULL);
957 s->used_element_count++; 947 s->used_element_count++;
958 } 948 }
959 GNUNET_SERVICE_client_continue (s->client); 949 GNUNET_SERVICE_client_continue (s->client);
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
index 44534c850..1ca7f61da 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
@@ -32,7 +32,7 @@
32#include "gnunet_applications.h" 32#include "gnunet_applications.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
34#include "gnunet_scalarproduct_service.h" 34#include "gnunet_scalarproduct_service.h"
35#include "gnunet_set_service.h" 35#include "gnunet_seti_service.h"
36#include "scalarproduct.h" 36#include "scalarproduct.h"
37#include "gnunet-service-scalarproduct.h" 37#include "gnunet-service-scalarproduct.h"
38 38
@@ -99,18 +99,18 @@ struct AliceServiceSession
99 * Set of elements for which will conduction an intersection. 99 * Set of elements for which will conduction an intersection.
100 * the resulting elements are then used for computing the scalar product. 100 * the resulting elements are then used for computing the scalar product.
101 */ 101 */
102 struct GNUNET_SET_Handle *intersection_set; 102 struct GNUNET_SETI_Handle *intersection_set;
103 103
104 /** 104 /**
105 * Set of elements for which will conduction an intersection. 105 * Set of elements for which will conduction an intersection.
106 * the resulting elements are then used for computing the scalar product. 106 * the resulting elements are then used for computing the scalar product.
107 */ 107 */
108 struct GNUNET_SET_OperationHandle *intersection_op; 108 struct GNUNET_SETI_OperationHandle *intersection_op;
109 109
110 /** 110 /**
111 * Handle to Alice's Intersection operation listening for Bob 111 * Handle to Alice's Intersection operation listening for Bob
112 */ 112 */
113 struct GNUNET_SET_ListenHandle *intersection_listen; 113 struct GNUNET_SETI_ListenHandle *intersection_listen;
114 114
115 /** 115 /**
116 * channel-handle associated with our cadet handle 116 * channel-handle associated with our cadet handle
@@ -265,17 +265,17 @@ destroy_service_session (struct AliceServiceSession *s)
265 } 265 }
266 if (NULL != s->intersection_listen) 266 if (NULL != s->intersection_listen)
267 { 267 {
268 GNUNET_SET_listen_cancel (s->intersection_listen); 268 GNUNET_SETI_listen_cancel (s->intersection_listen);
269 s->intersection_listen = NULL; 269 s->intersection_listen = NULL;
270 } 270 }
271 if (NULL != s->intersection_op) 271 if (NULL != s->intersection_op)
272 { 272 {
273 GNUNET_SET_operation_cancel (s->intersection_op); 273 GNUNET_SETI_operation_cancel (s->intersection_op);
274 s->intersection_op = NULL; 274 s->intersection_op = NULL;
275 } 275 }
276 if (NULL != s->intersection_set) 276 if (NULL != s->intersection_set)
277 { 277 {
278 GNUNET_SET_destroy (s->intersection_set); 278 GNUNET_SETI_destroy (s->intersection_set);
279 s->intersection_set = NULL; 279 s->intersection_set = NULL;
280 } 280 }
281 if (NULL != s->sorted_elements) 281 if (NULL != s->sorted_elements)
@@ -894,22 +894,22 @@ send_alices_cryptodata_message (struct AliceServiceSession *s)
894 * to indicate that the set intersection operation is done. 894 * to indicate that the set intersection operation is done.
895 * 895 *
896 * @param cls closure with the `struct AliceServiceSession` 896 * @param cls closure with the `struct AliceServiceSession`
897 * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK 897 * @param element a result element, only valid if status is #GNUNET_SETI_STATUS_OK
898 * @param current_size current set size 898 * @param current_size current set size
899 * @param status what has happened with the set intersection? 899 * @param status what has happened with the set intersection?
900 */ 900 */
901static void 901static void
902cb_intersection_element_removed (void *cls, 902cb_intersection_element_removed (void *cls,
903 const struct GNUNET_SET_Element *element, 903 const struct GNUNET_SETI_Element *element,
904 uint64_t current_size, 904 uint64_t current_size,
905 enum GNUNET_SET_Status status) 905 enum GNUNET_SETI_Status status)
906{ 906{
907 struct AliceServiceSession *s = cls; 907 struct AliceServiceSession *s = cls;
908 struct GNUNET_SCALARPRODUCT_Element *se; 908 struct GNUNET_SCALARPRODUCT_Element *se;
909 909
910 switch (status) 910 switch (status)
911 { 911 {
912 case GNUNET_SET_STATUS_OK: 912 case GNUNET_SETI_STATUS_DEL_LOCAL:
913 /* this element has been removed from the set */ 913 /* this element has been removed from the set */
914 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements, 914 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements,
915 element->data); 915 element->data);
@@ -926,33 +926,27 @@ cb_intersection_element_removed (void *cls,
926 GNUNET_free (se); 926 GNUNET_free (se);
927 return; 927 return;
928 928
929 case GNUNET_SET_STATUS_DONE: 929 case GNUNET_SETI_STATUS_DONE:
930 s->intersection_op = NULL; 930 s->intersection_op = NULL;
931 if (NULL != s->intersection_set) 931 if (NULL != s->intersection_set)
932 { 932 {
933 GNUNET_SET_destroy (s->intersection_set); 933 GNUNET_SETI_destroy (s->intersection_set);
934 s->intersection_set = NULL; 934 s->intersection_set = NULL;
935 } 935 }
936 send_alices_cryptodata_message (s); 936 send_alices_cryptodata_message (s);
937 return; 937 return;
938 938 case GNUNET_SETI_STATUS_FAILURE:
939 case GNUNET_SET_STATUS_HALF_DONE:
940 /* unexpected for intersection */
941 GNUNET_break (0);
942 return;
943
944 case GNUNET_SET_STATUS_FAILURE:
945 /* unhandled status code */ 939 /* unhandled status code */
946 LOG (GNUNET_ERROR_TYPE_DEBUG, "Set intersection failed!\n"); 940 LOG (GNUNET_ERROR_TYPE_DEBUG, "Set intersection failed!\n");
947 if (NULL != s->intersection_listen) 941 if (NULL != s->intersection_listen)
948 { 942 {
949 GNUNET_SET_listen_cancel (s->intersection_listen); 943 GNUNET_SETI_listen_cancel (s->intersection_listen);
950 s->intersection_listen = NULL; 944 s->intersection_listen = NULL;
951 } 945 }
952 s->intersection_op = NULL; 946 s->intersection_op = NULL;
953 if (NULL != s->intersection_set) 947 if (NULL != s->intersection_set)
954 { 948 {
955 GNUNET_SET_destroy (s->intersection_set); 949 GNUNET_SETI_destroy (s->intersection_set);
956 s->intersection_set = NULL; 950 s->intersection_set = NULL;
957 } 951 }
958 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 952 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
@@ -974,7 +968,7 @@ cb_intersection_element_removed (void *cls,
974 * @param other_peer the other peer 968 * @param other_peer the other peer
975 * @param context_msg message with application specific information from 969 * @param context_msg message with application specific information from
976 * the other peer 970 * the other peer
977 * @param request request from the other peer (never NULL), use GNUNET_SET_accept() 971 * @param request request from the other peer (never NULL), use GNUNET_SETI_accept()
978 * to accept it, otherwise the request will be refused 972 * to accept it, otherwise the request will be refused
979 * Note that we can't just return value from the listen callback, 973 * Note that we can't just return value from the listen callback,
980 * as it is also necessary to specify the set we want to do the 974 * as it is also necessary to specify the set we want to do the
@@ -985,7 +979,7 @@ static void
985cb_intersection_request_alice (void *cls, 979cb_intersection_request_alice (void *cls,
986 const struct GNUNET_PeerIdentity *other_peer, 980 const struct GNUNET_PeerIdentity *other_peer,
987 const struct GNUNET_MessageHeader *context_msg, 981 const struct GNUNET_MessageHeader *context_msg,
988 struct GNUNET_SET_Request *request) 982 struct GNUNET_SETI_Request *request)
989{ 983{
990 struct AliceServiceSession *s = cls; 984 struct AliceServiceSession *s = cls;
991 985
@@ -994,11 +988,11 @@ cb_intersection_request_alice (void *cls,
994 GNUNET_break_op (0); 988 GNUNET_break_op (0);
995 return; 989 return;
996 } 990 }
997 s->intersection_op = GNUNET_SET_accept (request, 991 s->intersection_op = GNUNET_SETI_accept (request,
998 GNUNET_SET_RESULT_REMOVED, 992 (struct
999 (struct GNUNET_SET_Option[]){ { 0 } }, 993 GNUNET_SETI_Option[]){ { 0 } },
1000 &cb_intersection_element_removed, 994 &cb_intersection_element_removed,
1001 s); 995 s);
1002 if (NULL == s->intersection_op) 996 if (NULL == s->intersection_op)
1003 { 997 {
1004 GNUNET_break (0); 998 GNUNET_break (0);
@@ -1006,7 +1000,7 @@ cb_intersection_request_alice (void *cls,
1006 prepare_client_end_notification (s); 1000 prepare_client_end_notification (s);
1007 return; 1001 return;
1008 } 1002 }
1009 if (GNUNET_OK != GNUNET_SET_commit (s->intersection_op, s->intersection_set)) 1003 if (GNUNET_OK != GNUNET_SETI_commit (s->intersection_op, s->intersection_set))
1010 { 1004 {
1011 GNUNET_break (0); 1005 GNUNET_break (0);
1012 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 1006 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
@@ -1055,11 +1049,10 @@ client_request_complete_alice (struct AliceServiceSession *s)
1055 return; 1049 return;
1056 } 1050 }
1057 s->cadet_mq = GNUNET_CADET_get_mq (s->channel); 1051 s->cadet_mq = GNUNET_CADET_get_mq (s->channel);
1058 s->intersection_listen = GNUNET_SET_listen (cfg, 1052 s->intersection_listen = GNUNET_SETI_listen (cfg,
1059 GNUNET_SET_OPERATION_INTERSECTION, 1053 &s->session_id,
1060 &s->session_id, 1054 &cb_intersection_request_alice,
1061 &cb_intersection_request_alice, 1055 s);
1062 s);
1063 if (NULL == s->intersection_listen) 1056 if (NULL == s->intersection_listen)
1064 { 1057 {
1065 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 1058 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
@@ -1125,7 +1118,7 @@ handle_alice_client_message_multipart (
1125 struct AliceServiceSession *s = cls; 1118 struct AliceServiceSession *s = cls;
1126 uint32_t contained_count; 1119 uint32_t contained_count;
1127 const struct GNUNET_SCALARPRODUCT_Element *elements; 1120 const struct GNUNET_SCALARPRODUCT_Element *elements;
1128 struct GNUNET_SET_Element set_elem; 1121 struct GNUNET_SETI_Element set_elem;
1129 struct GNUNET_SCALARPRODUCT_Element *elem; 1122 struct GNUNET_SCALARPRODUCT_Element *elem;
1130 1123
1131 contained_count = ntohl (msg->element_count_contained); 1124 contained_count = ntohl (msg->element_count_contained);
@@ -1150,7 +1143,7 @@ handle_alice_client_message_multipart (
1150 set_elem.data = &elem->key; 1143 set_elem.data = &elem->key;
1151 set_elem.size = sizeof(elem->key); 1144 set_elem.size = sizeof(elem->key);
1152 set_elem.element_type = 0; 1145 set_elem.element_type = 0;
1153 GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL); 1146 GNUNET_SETI_add_element (s->intersection_set, &set_elem, NULL, NULL);
1154 s->used_element_count++; 1147 s->used_element_count++;
1155 } 1148 }
1156 GNUNET_SERVICE_client_continue (s->client); 1149 GNUNET_SERVICE_client_continue (s->client);
@@ -1217,7 +1210,7 @@ handle_alice_client_message (void *cls,
1217 uint32_t contained_count; 1210 uint32_t contained_count;
1218 uint32_t total_count; 1211 uint32_t total_count;
1219 const struct GNUNET_SCALARPRODUCT_Element *elements; 1212 const struct GNUNET_SCALARPRODUCT_Element *elements;
1220 struct GNUNET_SET_Element set_elem; 1213 struct GNUNET_SETI_Element set_elem;
1221 struct GNUNET_SCALARPRODUCT_Element *elem; 1214 struct GNUNET_SCALARPRODUCT_Element *elem;
1222 1215
1223 total_count = ntohl (msg->element_count_total); 1216 total_count = ntohl (msg->element_count_total);
@@ -1230,8 +1223,7 @@ handle_alice_client_message (void *cls,
1230 elements = (const struct GNUNET_SCALARPRODUCT_Element *) &msg[1]; 1223 elements = (const struct GNUNET_SCALARPRODUCT_Element *) &msg[1];
1231 s->intersected_elements = 1224 s->intersected_elements =
1232 GNUNET_CONTAINER_multihashmap_create (s->total, GNUNET_YES); 1225 GNUNET_CONTAINER_multihashmap_create (s->total, GNUNET_YES);
1233 s->intersection_set = 1226 s->intersection_set = GNUNET_SETI_create (cfg);
1234 GNUNET_SET_create (cfg, GNUNET_SET_OPERATION_INTERSECTION);
1235 1227
1236 for (uint32_t i = 0; i < contained_count; i++) 1228 for (uint32_t i = 0; i < contained_count; i++)
1237 { 1229 {
@@ -1255,7 +1247,10 @@ handle_alice_client_message (void *cls,
1255 set_elem.data = &elem->key; 1247 set_elem.data = &elem->key;
1256 set_elem.size = sizeof(elem->key); 1248 set_elem.size = sizeof(elem->key);
1257 set_elem.element_type = 0; 1249 set_elem.element_type = 0;
1258 GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL); 1250 GNUNET_SETI_add_element (s->intersection_set,
1251 &set_elem,
1252 NULL,
1253 NULL);
1259 s->used_element_count++; 1254 s->used_element_count++;
1260 } 1255 }
1261 GNUNET_SERVICE_client_continue (s->client); 1256 GNUNET_SERVICE_client_continue (s->client);
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
index c000749af..b0299779d 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
@@ -32,7 +32,7 @@
32#include "gnunet_applications.h" 32#include "gnunet_applications.h"
33#include "gnunet_protocols.h" 33#include "gnunet_protocols.h"
34#include "gnunet_scalarproduct_service.h" 34#include "gnunet_scalarproduct_service.h"
35#include "gnunet_set_service.h" 35#include "gnunet_seti_service.h"
36#include "scalarproduct.h" 36#include "scalarproduct.h"
37#include "gnunet-service-scalarproduct.h" 37#include "gnunet-service-scalarproduct.h"
38 38
@@ -88,13 +88,13 @@ struct BobServiceSession
88 * Set of elements for which we will be conducting an intersection. 88 * Set of elements for which we will be conducting an intersection.
89 * The resulting elements are then used for computing the scalar product. 89 * The resulting elements are then used for computing the scalar product.
90 */ 90 */
91 struct GNUNET_SET_Handle *intersection_set; 91 struct GNUNET_SETI_Handle *intersection_set;
92 92
93 /** 93 /**
94 * Set of elements for which will conduction an intersection. 94 * Set of elements for which will conduction an intersection.
95 * the resulting elements are then used for computing the scalar product. 95 * the resulting elements are then used for computing the scalar product.
96 */ 96 */
97 struct GNUNET_SET_OperationHandle *intersection_op; 97 struct GNUNET_SETI_OperationHandle *intersection_op;
98 98
99 /** 99 /**
100 * CADET port we are listening on. 100 * CADET port we are listening on.
@@ -277,12 +277,12 @@ destroy_service_session (struct BobServiceSession *s)
277 } 277 }
278 if (NULL != s->intersection_op) 278 if (NULL != s->intersection_op)
279 { 279 {
280 GNUNET_SET_operation_cancel (s->intersection_op); 280 GNUNET_SETI_operation_cancel (s->intersection_op);
281 s->intersection_op = NULL; 281 s->intersection_op = NULL;
282 } 282 }
283 if (NULL != s->intersection_set) 283 if (NULL != s->intersection_set)
284 { 284 {
285 GNUNET_SET_destroy (s->intersection_set); 285 GNUNET_SETI_destroy (s->intersection_set);
286 s->intersection_set = NULL; 286 s->intersection_set = NULL;
287 } 287 }
288 if (NULL != s->e_a) 288 if (NULL != s->e_a)
@@ -888,22 +888,22 @@ handle_alices_cryptodata_message (void *cls,
888 * that needs to be removed from the result set. 888 * that needs to be removed from the result set.
889 * 889 *
890 * @param cls closure with the `struct BobServiceSession` 890 * @param cls closure with the `struct BobServiceSession`
891 * @param element a result element, only valid if status is #GNUNET_SET_STATUS_OK 891 * @param element a result element, only valid if status is #GNUNET_SETI_STATUS_OK
892 * @param current_size current set size 892 * @param current_size current set size
893 * @param status what has happened with the set intersection? 893 * @param status what has happened with the set intersection?
894 */ 894 */
895static void 895static void
896cb_intersection_element_removed (void *cls, 896cb_intersection_element_removed (void *cls,
897 const struct GNUNET_SET_Element *element, 897 const struct GNUNET_SETI_Element *element,
898 uint64_t current_size, 898 uint64_t current_size,
899 enum GNUNET_SET_Status status) 899 enum GNUNET_SETI_Status status)
900{ 900{
901 struct BobServiceSession *s = cls; 901 struct BobServiceSession *s = cls;
902 struct GNUNET_SCALARPRODUCT_Element *se; 902 struct GNUNET_SCALARPRODUCT_Element *se;
903 903
904 switch (status) 904 switch (status)
905 { 905 {
906 case GNUNET_SET_STATUS_OK: 906 case GNUNET_SETI_STATUS_DEL_LOCAL:
907 /* this element has been removed from the set */ 907 /* this element has been removed from the set */
908 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements, 908 se = GNUNET_CONTAINER_multihashmap_get (s->intersected_elements,
909 element->data); 909 element->data);
@@ -919,8 +919,7 @@ cb_intersection_element_removed (void *cls,
919 se)); 919 se));
920 GNUNET_free (se); 920 GNUNET_free (se);
921 return; 921 return;
922 922 case GNUNET_SETI_STATUS_DONE:
923 case GNUNET_SET_STATUS_DONE:
924 s->intersection_op = NULL; 923 s->intersection_op = NULL;
925 GNUNET_break (NULL == s->intersection_set); 924 GNUNET_break (NULL == s->intersection_set);
926 GNUNET_CADET_receive_done (s->channel); 925 GNUNET_CADET_receive_done (s->channel);
@@ -935,26 +934,19 @@ cb_intersection_element_removed (void *cls,
935 transmit_cryptographic_reply (s); 934 transmit_cryptographic_reply (s);
936 } 935 }
937 return; 936 return;
938 937 case GNUNET_SETI_STATUS_FAILURE:
939 case GNUNET_SET_STATUS_HALF_DONE:
940 /* unexpected for intersection */
941 GNUNET_break (0);
942 return;
943
944 case GNUNET_SET_STATUS_FAILURE:
945 /* unhandled status code */ 938 /* unhandled status code */
946 LOG (GNUNET_ERROR_TYPE_DEBUG, 939 LOG (GNUNET_ERROR_TYPE_DEBUG,
947 "Set intersection failed!\n"); 940 "Set intersection failed!\n");
948 s->intersection_op = NULL; 941 s->intersection_op = NULL;
949 if (NULL != s->intersection_set) 942 if (NULL != s->intersection_set)
950 { 943 {
951 GNUNET_SET_destroy (s->intersection_set); 944 GNUNET_SETI_destroy (s->intersection_set);
952 s->intersection_set = NULL; 945 s->intersection_set = NULL;
953 } 946 }
954 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 947 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
955 prepare_client_end_notification (s); 948 prepare_client_end_notification (s);
956 return; 949 return;
957
958 default: 950 default:
959 GNUNET_break (0); 951 GNUNET_break (0);
960 return; 952 return;
@@ -977,23 +969,22 @@ start_intersection (struct BobServiceSession *s)
977 (unsigned int) s->total); 969 (unsigned int) s->total);
978 970
979 s->intersection_op 971 s->intersection_op
980 = GNUNET_SET_prepare (&s->peer, 972 = GNUNET_SETI_prepare (&s->peer,
981 &s->session_id, 973 &s->session_id,
982 NULL, 974 NULL,
983 GNUNET_SET_RESULT_REMOVED, 975 (struct GNUNET_SETI_Option[]) { { 0 } },
984 (struct GNUNET_SET_Option[]) { { 0 } }, 976 &cb_intersection_element_removed,
985 &cb_intersection_element_removed, 977 s);
986 s);
987 if (GNUNET_OK != 978 if (GNUNET_OK !=
988 GNUNET_SET_commit (s->intersection_op, 979 GNUNET_SETI_commit (s->intersection_op,
989 s->intersection_set)) 980 s->intersection_set))
990 { 981 {
991 GNUNET_break (0); 982 GNUNET_break (0);
992 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE; 983 s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
993 prepare_client_end_notification (s); 984 prepare_client_end_notification (s);
994 return; 985 return;
995 } 986 }
996 GNUNET_SET_destroy (s->intersection_set); 987 GNUNET_SETI_destroy (s->intersection_set);
997 s->intersection_set = NULL; 988 s->intersection_set = NULL;
998} 989}
999 990
@@ -1096,7 +1087,7 @@ handle_bob_client_message_multipart (void *cls,
1096 struct BobServiceSession *s = cls; 1087 struct BobServiceSession *s = cls;
1097 uint32_t contained_count; 1088 uint32_t contained_count;
1098 const struct GNUNET_SCALARPRODUCT_Element *elements; 1089 const struct GNUNET_SCALARPRODUCT_Element *elements;
1099 struct GNUNET_SET_Element set_elem; 1090 struct GNUNET_SETI_Element set_elem;
1100 struct GNUNET_SCALARPRODUCT_Element *elem; 1091 struct GNUNET_SCALARPRODUCT_Element *elem;
1101 1092
1102 contained_count = ntohl (msg->element_count_contained); 1093 contained_count = ntohl (msg->element_count_contained);
@@ -1120,9 +1111,9 @@ handle_bob_client_message_multipart (void *cls,
1120 set_elem.data = &elem->key; 1111 set_elem.data = &elem->key;
1121 set_elem.size = sizeof(elem->key); 1112 set_elem.size = sizeof(elem->key);
1122 set_elem.element_type = 0; 1113 set_elem.element_type = 0;
1123 GNUNET_SET_add_element (s->intersection_set, 1114 GNUNET_SETI_add_element (s->intersection_set,
1124 &set_elem, 1115 &set_elem,
1125 NULL, NULL); 1116 NULL, NULL);
1126 } 1117 }
1127 s->client_received_element_count += contained_count; 1118 s->client_received_element_count += contained_count;
1128 GNUNET_SERVICE_client_continue (s->client); 1119 GNUNET_SERVICE_client_continue (s->client);
@@ -1206,7 +1197,7 @@ handle_bob_client_message (void *cls,
1206 uint32_t contained_count; 1197 uint32_t contained_count;
1207 uint32_t total_count; 1198 uint32_t total_count;
1208 const struct GNUNET_SCALARPRODUCT_Element *elements; 1199 const struct GNUNET_SCALARPRODUCT_Element *elements;
1209 struct GNUNET_SET_Element set_elem; 1200 struct GNUNET_SETI_Element set_elem;
1210 struct GNUNET_SCALARPRODUCT_Element *elem; 1201 struct GNUNET_SCALARPRODUCT_Element *elem;
1211 1202
1212 total_count = ntohl (msg->element_count_total); 1203 total_count = ntohl (msg->element_count_total);
@@ -1220,9 +1211,7 @@ handle_bob_client_message (void *cls,
1220 s->intersected_elements 1211 s->intersected_elements
1221 = GNUNET_CONTAINER_multihashmap_create (s->total, 1212 = GNUNET_CONTAINER_multihashmap_create (s->total,
1222 GNUNET_YES); 1213 GNUNET_YES);
1223 s->intersection_set 1214 s->intersection_set = GNUNET_SETI_create (cfg);
1224 = GNUNET_SET_create (cfg,
1225 GNUNET_SET_OPERATION_INTERSECTION);
1226 for (uint32_t i = 0; i < contained_count; i++) 1215 for (uint32_t i = 0; i < contained_count; i++)
1227 { 1216 {
1228 if (0 == GNUNET_ntohll (elements[i].value)) 1217 if (0 == GNUNET_ntohll (elements[i].value))
@@ -1244,9 +1233,9 @@ handle_bob_client_message (void *cls,
1244 set_elem.data = &elem->key; 1233 set_elem.data = &elem->key;
1245 set_elem.size = sizeof(elem->key); 1234 set_elem.size = sizeof(elem->key);
1246 set_elem.element_type = 0; 1235 set_elem.element_type = 0;
1247 GNUNET_SET_add_element (s->intersection_set, 1236 GNUNET_SETI_add_element (s->intersection_set,
1248 &set_elem, 1237 &set_elem,
1249 NULL, NULL); 1238 NULL, NULL);
1250 s->used_element_count++; 1239 s->used_element_count++;
1251 } 1240 }
1252 GNUNET_SERVICE_client_continue (s->client); 1241 GNUNET_SERVICE_client_continue (s->client);