diff options
author | Florian Dold <florian.dold@gmail.com> | 2013-11-05 00:08:13 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2013-11-05 00:08:13 +0000 |
commit | ca2c7bdfa64a30c0013598f0718dcfe7e6d98b2a (patch) | |
tree | 3bedd0e18f88371c2e75bd1953e0bc321629c828 /src/set/gnunet-service-set.h | |
parent | 6c3bf6b3486fd31402ab991f5ddef76bf9cd93c4 (diff) | |
download | gnunet-ca2c7bdfa64a30c0013598f0718dcfe7e6d98b2a.tar.gz gnunet-ca2c7bdfa64a30c0013598f0718dcfe7e6d98b2a.zip |
- implemented missing set functionality
- secretsharing api changes
Diffstat (limited to 'src/set/gnunet-service-set.h')
-rw-r--r-- | src/set/gnunet-service-set.h | 99 |
1 files changed, 75 insertions, 24 deletions
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h index 7c2363e9f..7a2c5ba8d 100644 --- a/src/set/gnunet-service-set.h +++ b/src/set/gnunet-service-set.h | |||
@@ -55,8 +55,8 @@ struct OperationState; | |||
55 | 55 | ||
56 | /* forward declarations */ | 56 | /* forward declarations */ |
57 | struct Set; | 57 | struct Set; |
58 | struct TunnelContext; | ||
59 | struct ElementEntry; | 58 | struct ElementEntry; |
59 | struct Operation; | ||
60 | 60 | ||
61 | 61 | ||
62 | /** | 62 | /** |
@@ -135,7 +135,7 @@ typedef void (*AddRemoveImpl) (struct SetState *state, struct ElementEntry *ee); | |||
135 | * | 135 | * |
136 | * @param op the set operation, contains implementation-specific data | 136 | * @param op the set operation, contains implementation-specific data |
137 | */ | 137 | */ |
138 | typedef void (*PeerDisconnectImpl) (struct OperationState *op); | 138 | typedef void (*PeerDisconnectImpl) (struct Operation *op); |
139 | 139 | ||
140 | 140 | ||
141 | /** | 141 | /** |
@@ -151,13 +151,9 @@ typedef void (*DestroySetImpl) (struct SetState *state); | |||
151 | * Signature of functions that implement the creation of set operations | 151 | * Signature of functions that implement the creation of set operations |
152 | * (currently evaluate and accept). | 152 | * (currently evaluate and accept). |
153 | * | 153 | * |
154 | * @param spec specification of the set operation to be created | 154 | * @param op operation that is created, should be initialized by the implementation |
155 | * @param tunnel the tunnel with the other peer | ||
156 | * @param tc tunnel context | ||
157 | */ | 155 | */ |
158 | typedef void (*OpCreateImpl) (struct OperationSpecification *spec, | 156 | typedef void (*OpCreateImpl) (struct Operation *op); |
159 | struct GNUNET_MESH_Tunnel *tunnel, | ||
160 | struct TunnelContext *tc); | ||
161 | 157 | ||
162 | 158 | ||
163 | /** | 159 | /** |
@@ -169,11 +165,10 @@ typedef void (*OpCreateImpl) (struct OperationSpecification *spec, | |||
169 | * @return GNUNET_OK on success, GNUNET_SYSERR to | 165 | * @return GNUNET_OK on success, GNUNET_SYSERR to |
170 | * destroy the operation and the tunnel | 166 | * destroy the operation and the tunnel |
171 | */ | 167 | */ |
172 | typedef int (*MsgHandlerImpl) (struct OperationState *op, | 168 | typedef int (*MsgHandlerImpl) (struct Operation *op, |
173 | const struct GNUNET_MessageHeader *msg); | 169 | const struct GNUNET_MessageHeader *msg); |
174 | 170 | ||
175 | typedef void (*CancelImpl) (struct SetState *set, | 171 | typedef void (*CancelImpl) (struct Operation *op); |
176 | uint32_t request_id); | ||
177 | 172 | ||
178 | 173 | ||
179 | /** | 174 | /** |
@@ -263,6 +258,7 @@ struct ElementEntry | |||
263 | 258 | ||
264 | /** | 259 | /** |
265 | * Hash of the element. | 260 | * Hash of the element. |
261 | * For set union: | ||
266 | * Will be used to derive the different IBF keys | 262 | * Will be used to derive the different IBF keys |
267 | * for different salts. | 263 | * for different salts. |
268 | */ | 264 | */ |
@@ -294,6 +290,63 @@ struct ElementEntry | |||
294 | }; | 290 | }; |
295 | 291 | ||
296 | 292 | ||
293 | struct Operation | ||
294 | { | ||
295 | /** | ||
296 | * V-Table for the operation belonging | ||
297 | * to the tunnel contest. | ||
298 | */ | ||
299 | const struct SetVT *vt; | ||
300 | |||
301 | /** | ||
302 | * Tunnel to the peer. | ||
303 | */ | ||
304 | struct GNUNET_MESH_Tunnel *tunnel; | ||
305 | |||
306 | /** | ||
307 | * Message queue for the tunnel. | ||
308 | */ | ||
309 | struct GNUNET_MQ_Handle *mq; | ||
310 | |||
311 | /** | ||
312 | * GNUNET_YES if this is not a "real" set operation yet, and we still | ||
313 | * need to wait for the other peer to give us more details. | ||
314 | */ | ||
315 | int is_incoming; | ||
316 | |||
317 | /** | ||
318 | * Generation in which the operation handle | ||
319 | * was created. | ||
320 | */ | ||
321 | unsigned int generation_created; | ||
322 | |||
323 | /** | ||
324 | * Detail information about the set operation, | ||
325 | * including the set to use. | ||
326 | * When 'spec' is NULL, the operation is not yet entirely | ||
327 | * initialized. | ||
328 | */ | ||
329 | struct OperationSpecification *spec; | ||
330 | |||
331 | /** | ||
332 | * Operation-specific operation state. | ||
333 | */ | ||
334 | struct OperationState *state; | ||
335 | |||
336 | /** | ||
337 | * Evaluate operations are held in | ||
338 | * a linked list. | ||
339 | */ | ||
340 | struct Operation *next; | ||
341 | |||
342 | /** | ||
343 | * Evaluate operations are held in | ||
344 | * a linked list. | ||
345 | */ | ||
346 | struct Operation *prev; | ||
347 | }; | ||
348 | |||
349 | |||
297 | /** | 350 | /** |
298 | * A set that supports a specific operation | 351 | * A set that supports a specific operation |
299 | * with other peers. | 352 | * with other peers. |
@@ -353,28 +406,25 @@ struct Set | |||
353 | * previously executed operations on this set | 406 | * previously executed operations on this set |
354 | */ | 407 | */ |
355 | unsigned int current_generation; | 408 | unsigned int current_generation; |
356 | }; | ||
357 | 409 | ||
358 | |||
359 | /** | ||
360 | * Information about a tunnel we are connected to. | ||
361 | * Used as tunnel context with mesh. | ||
362 | */ | ||
363 | struct TunnelContext | ||
364 | { | ||
365 | /** | 410 | /** |
366 | * V-Table for the operation belonging | 411 | * Evaluate operations are held in |
367 | * to the tunnel contest. | 412 | * a linked list. |
368 | */ | 413 | */ |
369 | const struct SetVT *vt; | 414 | struct Operation *ops_head; |
370 | 415 | ||
371 | /** | 416 | /** |
372 | * Implementation-specific operation state. | 417 | * Evaluate operations are held in |
418 | * a linked list. | ||
373 | */ | 419 | */ |
374 | struct OperationState *op; | 420 | struct Operation *ops_tail; |
375 | }; | 421 | }; |
376 | 422 | ||
377 | 423 | ||
424 | void | ||
425 | _GSS_operation_destroy (struct Operation *op); | ||
426 | |||
427 | |||
378 | /** | 428 | /** |
379 | * Get the table with implementing functions for | 429 | * Get the table with implementing functions for |
380 | * set union. | 430 | * set union. |
@@ -382,6 +432,7 @@ struct TunnelContext | |||
382 | const struct SetVT * | 432 | const struct SetVT * |
383 | _GSS_union_vt (void); | 433 | _GSS_union_vt (void); |
384 | 434 | ||
435 | |||
385 | /** | 436 | /** |
386 | * Get the table with implementing functions for | 437 | * Get the table with implementing functions for |
387 | * set intersection. | 438 | * set intersection. |