aboutsummaryrefslogtreecommitdiff
path: root/src/set/gnunet-service-set.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-11 18:15:38 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-11 18:15:38 +0100
commitabdec5e11ff11bb10d32c013e11344a54786f80f (patch)
treec2b8eb6705efa8ac8278a6024d8ab19222471f0e /src/set/gnunet-service-set.h
parent4e981fb2bd74f21c33adf05d7999b05704d6909b (diff)
downloadgnunet-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.h50
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 */
224typedef 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 */
350enum 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 */
369struct Operation 371struct 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 */