diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-05-07 08:21:49 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-05-07 08:21:49 +0000 |
commit | 8a2d1e6aedbf1bc95052e63ac67093b89385b0a1 (patch) | |
tree | 993d5f09035ce90f8f9a2d50cdcc417631d88227 /src/include/gnunet_scalarproduct_service.h | |
parent | 3a658d6f0923662f193a49af8aae52a83aafae1c (diff) | |
download | gnunet-8a2d1e6aedbf1bc95052e63ac67093b89385b0a1.tar.gz gnunet-8a2d1e6aedbf1bc95052e63ac67093b89385b0a1.zip |
WIP commit of scalar product 2.0. It is unfinished and does not yet pass tests. This commit happens because of the move from mesh->cadet.
- reverted SP API back to the original design from 2012 (using key-value pairs)
- SP now uses set intersection to determine common elements from the set provided by the user
- values are sorted based on their keys after intersection
- removed state tracking, as simple tracking is now insufficient. Just checking for conditions directly is easier readable and less buggy
- modified/renamed SP message types to reflect the changed behavior of SP
Diffstat (limited to 'src/include/gnunet_scalarproduct_service.h')
-rw-r--r-- | src/include/gnunet_scalarproduct_service.h | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/src/include/gnunet_scalarproduct_service.h b/src/include/gnunet_scalarproduct_service.h index 7a1eec91a..63bc29f0e 100644 --- a/src/include/gnunet_scalarproduct_service.h +++ b/src/include/gnunet_scalarproduct_service.h | |||
@@ -39,7 +39,7 @@ extern "C" { | |||
39 | /** | 39 | /** |
40 | * Version of the scalarproduct API. | 40 | * Version of the scalarproduct API. |
41 | */ | 41 | */ |
42 | #define GNUNET_SCALARPRODUCT_VERSION 0x00000042 | 42 | #define GNUNET_SCALARPRODUCT_VERSION 0x00000043 |
43 | 43 | ||
44 | enum GNUNET_SCALARPRODUCT_ResponseStatus | 44 | enum GNUNET_SCALARPRODUCT_ResponseStatus |
45 | { | 45 | { |
@@ -55,6 +55,14 @@ enum GNUNET_SCALARPRODUCT_ResponseStatus | |||
55 | */ | 55 | */ |
56 | struct GNUNET_SCALARPRODUCT_Handle; | 56 | struct GNUNET_SCALARPRODUCT_Handle; |
57 | 57 | ||
58 | /** | ||
59 | * An element key-value pair for scalarproduct | ||
60 | */ | ||
61 | struct GNUNET_SCALARPRODUCT_Element { | ||
62 | int32_t value; | ||
63 | struct GNUNET_HashCode key; | ||
64 | }; | ||
65 | |||
58 | 66 | ||
59 | /** | 67 | /** |
60 | * Continuation called to notify client about result of the | 68 | * Continuation called to notify client about result of the |
@@ -87,24 +95,21 @@ struct GNUNET_SCALARPRODUCT_ComputationHandle; | |||
87 | * Request by Alice's client for computing a scalar product | 95 | * Request by Alice's client for computing a scalar product |
88 | * | 96 | * |
89 | * @param cfg the gnunet configuration handle | 97 | * @param cfg the gnunet configuration handle |
90 | * @param key Session key should be unique to the requesting client | 98 | * @param session_key Session key should be unique to the requesting client |
91 | * @param peer PeerID of the other peer | 99 | * @param peer PeerID of the other peer |
92 | * @param elements Array of elements of the vector | 100 | * @param elements Array of elements of the vector |
93 | * @param element_count Number of elements in the vector | 101 | * @param element_count Number of elements in the vector |
94 | * @param mask Array of the mask | ||
95 | * @param mask_bytes number of bytes in the mask | ||
96 | * @param cont Callback function | 102 | * @param cont Callback function |
97 | * @param cont_cls Closure for @a cont | 103 | * @param cont_cls Closure for the callback function |
104 | * | ||
98 | * @return a new handle for this computation | 105 | * @return a new handle for this computation |
99 | */ | 106 | */ |
100 | struct GNUNET_SCALARPRODUCT_ComputationHandle * | 107 | struct GNUNET_SCALARPRODUCT_ComputationHandle * |
101 | GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, | 108 | GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle * cfg, |
102 | const struct GNUNET_HashCode *key, | 109 | const struct GNUNET_HashCode * session_key, |
103 | const struct GNUNET_PeerIdentity *peer, | 110 | const struct GNUNET_PeerIdentity *peer, |
104 | const int32_t *elements, | 111 | const struct GNUNET_SCALARPRODUCT_Element * elements, |
105 | uint32_t element_count, | 112 | uint32_t element_count, |
106 | const unsigned char *mask, | ||
107 | uint32_t mask_bytes, | ||
108 | GNUNET_SCALARPRODUCT_DatumProcessor cont, | 113 | GNUNET_SCALARPRODUCT_DatumProcessor cont, |
109 | void * cont_cls); | 114 | void * cont_cls); |
110 | 115 | ||
@@ -112,20 +117,21 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
112 | * Used by Bob's client to cooperate with Alice, | 117 | * Used by Bob's client to cooperate with Alice, |
113 | * | 118 | * |
114 | * @param cfg the gnunet configuration handle | 119 | * @param cfg the gnunet configuration handle |
115 | * @param key Session key unique to the requesting client | 120 | * @param session_key Session key unique to the requesting client |
116 | * @param elements Array of elements of the vector | 121 | * @param elements Array of elements of the vector |
117 | * @param element_count Number of elements in the vector | 122 | * @param element_count Number of elements in the vector |
118 | * @param cont Callback function | 123 | * @param cont Callback function |
119 | * @param cont_cls Closure for @a cont | 124 | * @param cont_cls Closure for the callback function |
125 | * | ||
120 | * @return a new handle for this computation | 126 | * @return a new handle for this computation |
121 | */ | 127 | */ |
122 | struct GNUNET_SCALARPRODUCT_ComputationHandle * | 128 | struct GNUNET_SCALARPRODUCT_ComputationHandle * |
123 | GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, | 129 | GNUNET_SCALARPRODUCT_accept_computation (const struct GNUNET_CONFIGURATION_Handle * cfg, |
124 | const struct GNUNET_HashCode *key, | 130 | const struct GNUNET_HashCode * key, |
125 | const int32_t *elements, | 131 | const struct GNUNET_SCALARPRODUCT_Element * elements, |
126 | uint32_t element_count, | 132 | uint32_t element_count, |
127 | GNUNET_SCALARPRODUCT_ContinuationWithStatus cont, | 133 | GNUNET_SCALARPRODUCT_ContinuationWithStatus cont, |
128 | void *cont_cls); | 134 | void * cont_cls); |
129 | 135 | ||
130 | 136 | ||
131 | /** | 137 | /** |
@@ -137,20 +143,6 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
137 | void | 143 | void |
138 | GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle *h); | 144 | GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle *h); |
139 | 145 | ||
140 | |||
141 | /** | ||
142 | * Cancel ALL ongoing computation or revoke our collaboration offer. | ||
143 | * Closes ALL connections to the service | ||
144 | * | ||
145 | * FIXME: this should take an argument, and we should | ||
146 | * have an explicit 'connect' API which returns an opaque | ||
147 | * connection handle. Avoid (globals) in the library! | ||
148 | * @deprecated in this form | ||
149 | */ | ||
150 | void | ||
151 | GNUNET_SCALARPRODUCT_disconnect (); | ||
152 | |||
153 | |||
154 | #if 0 /* keep Emacsens' auto-indent happy */ | 146 | #if 0 /* keep Emacsens' auto-indent happy */ |
155 | { | 147 | { |
156 | #endif | 148 | #endif |