diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-11 18:15:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-11 18:15:38 +0100 |
commit | abdec5e11ff11bb10d32c013e11344a54786f80f (patch) | |
tree | c2b8eb6705efa8ac8278a6024d8ab19222471f0e /src/set/gnunet-service-set.h | |
parent | 4e981fb2bd74f21c33adf05d7999b05704d6909b (diff) | |
download | gnunet-abdec5e11ff11bb10d32c013e11344a54786f80f.tar.gz gnunet-abdec5e11ff11bb10d32c013e11344a54786f80f.zip |
cleaning up set handlers, eliminating 2nd level demultiplexing and improving use of types
Diffstat (limited to 'src/set/gnunet-service-set.h')
-rw-r--r-- | src/set/gnunet-service-set.h | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h index 68d8fe81f..c981430ef 100644 --- a/src/set/gnunet-service-set.h +++ b/src/set/gnunet-service-set.h | |||
@@ -213,20 +213,6 @@ typedef void | |||
213 | 213 | ||
214 | 214 | ||
215 | /** | 215 | /** |
216 | * Signature of functions that implement the message handling for | ||
217 | * the different set operations. | ||
218 | * | ||
219 | * @param op operation state | ||
220 | * @param msg received message | ||
221 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to | ||
222 | * destroy the operation and the tunnel | ||
223 | */ | ||
224 | typedef int | ||
225 | (*MsgHandlerImpl) (struct Operation *op, | ||
226 | const struct GNUNET_MessageHeader *msg); | ||
227 | |||
228 | |||
229 | /** | ||
230 | * Signature of functions that implement operation cancellation | 216 | * Signature of functions that implement operation cancellation |
231 | * | 217 | * |
232 | * @param op operation state | 218 | * @param op operation state |
@@ -276,11 +262,6 @@ struct SetVT | |||
276 | DestroySetImpl destroy_set; | 262 | DestroySetImpl destroy_set; |
277 | 263 | ||
278 | /** | 264 | /** |
279 | * Callback for handling operation-specific messages. | ||
280 | */ | ||
281 | MsgHandlerImpl msg_handler; | ||
282 | |||
283 | /** | ||
284 | * Callback for handling the remote peer's disconnect. | 265 | * Callback for handling the remote peer's disconnect. |
285 | */ | 266 | */ |
286 | PeerDisconnectImpl peer_disconnect; | 267 | PeerDisconnectImpl peer_disconnect; |
@@ -364,6 +345,27 @@ struct Listener; | |||
364 | 345 | ||
365 | 346 | ||
366 | /** | 347 | /** |
348 | * Possible set operations. | ||
349 | */ | ||
350 | enum OperationType { | ||
351 | /** | ||
352 | * Operation type unknown. | ||
353 | */ | ||
354 | OT_UNKNOWN = 0, | ||
355 | |||
356 | /** | ||
357 | * We are performing a union. | ||
358 | */ | ||
359 | OT_UNION, | ||
360 | |||
361 | /** | ||
362 | * We are performing an intersection. | ||
363 | */ | ||
364 | OT_INTERSECTION | ||
365 | }; | ||
366 | |||
367 | |||
368 | /** | ||
367 | * Operation context used to execute a set operation. | 369 | * Operation context used to execute a set operation. |
368 | */ | 370 | */ |
369 | struct Operation | 371 | struct Operation |
@@ -427,6 +429,11 @@ struct Operation | |||
427 | struct GNUNET_SCHEDULER_Task *timeout_task; | 429 | struct GNUNET_SCHEDULER_Task *timeout_task; |
428 | 430 | ||
429 | /** | 431 | /** |
432 | * What type of operation is this? | ||
433 | */ | ||
434 | enum OperationType type; | ||
435 | |||
436 | /** | ||
430 | * Unique request id for the request from a remote peer, sent to the | 437 | * Unique request id for the request from a remote peer, sent to the |
431 | * client, which will accept or reject the request. Set to '0' iff | 438 | * client, which will accept or reject the request. Set to '0' iff |
432 | * the request has not been suggested yet. | 439 | * the request has not been suggested yet. |
@@ -582,6 +589,11 @@ struct Set | |||
582 | struct Operation *ops_tail; | 589 | struct Operation *ops_tail; |
583 | 590 | ||
584 | /** | 591 | /** |
592 | * What type of operation is this set for? | ||
593 | */ | ||
594 | enum OperationType type; | ||
595 | |||
596 | /** | ||
585 | * Current generation, that is, number of previously executed | 597 | * Current generation, that is, number of previously executed |
586 | * operations and lazy copies on the underlying set content. | 598 | * operations and lazy copies on the underlying set content. |
587 | */ | 599 | */ |