-fixing misc issues and bugs, including better termination logic for intersection...
[oweals/gnunet.git] / src / set / gnunet-service-set.h
index c226611ffaac37b9e04badc305f3abcc73ac38d9..ab81558834e8a83e3997c106f20e4b386de23c2d 100644 (file)
@@ -165,13 +165,27 @@ typedef void
 
 
 /**
- * Signature of functions that implement the creation of set operations
- * (currently "evaluate" and "accept").
+ * Signature of functions that implement accepting a set operation.
  *
- * @param op operation that is created, should be initialized by the implementation
+ * @param op operation that is created by accepting the operation,
+ *        should be initialized by the implementation
  */
 typedef void
-(*OpCreateImpl) (struct Operation *op);
+(*OpAcceptImpl) (struct Operation *op);
+
+
+/**
+ * Signature of functions that implement starting the evaluation of
+ * set operations.
+ *
+ * @param op operation that is created, should be initialized to
+ *        begin the evaluation
+ * @param opaque_context message to be transmitted to the listener
+ *        to convince him to accept, may be NULL
+ */
+typedef void
+(*OpEvaluateImpl) (struct Operation *op,
+                   const struct GNUNET_MessageHeader *opaque_context);
 
 
 /**
@@ -221,12 +235,12 @@ struct SetVT
   /**
    * Callback for accepting a set operation request
    */
-  OpCreateImpl accept;
+  OpAcceptImpl accept;
 
   /**
    * Callback for starting evaluation with a remote peer.
    */
-  OpCreateImpl evaluate;
+  OpEvaluateImpl evaluate;
 
   /**
    * Callback for destruction of the set state.
@@ -326,7 +340,9 @@ struct Operation
   struct OperationSpecification *spec;
 
   /**
-   * Operation-specific operation state.
+   * Operation-specific operation state.  Note that the exact
+   * type depends on this being a union or intersection operation
+   * (and thus on @e vt).
    */
   struct OperationState *state;
 
@@ -340,6 +356,25 @@ struct Operation
    */
   struct Operation *prev;
 
+  /**
+   * The identity of the requesting peer.  Needs to
+   * be stored here as the op spec might not have been created yet.
+   */
+  struct GNUNET_PeerIdentity peer;
+
+  /**
+   * Timeout task, if the incoming peer has not been accepted
+   * after the timeout, it will be disconnected.
+   */
+  GNUNET_SCHEDULER_TaskIdentifier timeout_task;
+
+  /**
+   * Unique request id for the request from a remote peer, sent to the
+   * client, which will accept or reject the request.  Set to '0' iff
+   * the request has not been suggested yet.
+   */
+  uint32_t suggest_id;
+
   /**
    * #GNUNET_YES if this is not a "real" set operation yet, and we still
    * need to wait for the other peer to give us more details.
@@ -433,6 +468,12 @@ struct Set
    */
   enum GNUNET_SET_OperationType operation;
 
+  /**
+   * Each @e iter is assigned a unique number, so that the client
+   * can distinguish iterations.
+   */
+  uint16_t iteration_id;
+
 };