new timeout tests for WLAN and bluetooth
[oweals/gnunet.git] / src / set / set.h
index ad2200de939b662ad401b475e89294e888085e20..09d1120f07a03b95780df5bda10410cd0d3a37ae 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
 #include "platform.h"
 #include "gnunet_common.h"
 
-
-/**
- * The service sends up to GNUNET_SET_ACK_WINDOW messages per client handle,
- * the client should send an ack every GNUNET_SET_ACK_WINDOW/2 messages.
- */
-#define GNUNET_SET_ACK_WINDOW 8
+#define GNUNET_SET_ACK_WINDOW 10
 
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
-struct SetCreateMessage
+struct GNUNET_SET_CreateMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_CREATE
@@ -54,7 +49,7 @@ struct SetCreateMessage
 };
 
 
-struct ListenMessage
+struct GNUNET_SET_ListenMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
@@ -64,7 +59,7 @@ struct ListenMessage
   /**
    * Operation type, values of enum GNUNET_SET_OperationType
    */
-  uint16_t operation GNUNET_PACKED;
+  uint32_t operation GNUNET_PACKED;
 
   /**
    * application id
@@ -74,32 +69,37 @@ struct ListenMessage
 };
 
 
-struct AcceptMessage
+struct GNUNET_SET_AcceptRejectMessage
 {
   /**
-   * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT
+   * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT or
+   *       GNUNET_MESSAGE_TYPE_SET_REJECT
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * Request id that will be sent along with
-   * results for the accepted operation.
-   * Chosen by the client.
-   * Must be 0 if the request has been rejected.
+   * ID of the incoming request we want to accept / reject.
+   */
+  uint32_t accept_reject_id GNUNET_PACKED;
+
+  /**
+   * Request ID to identify responses,
+   * must be 0 if we don't accept the request.
    */
   uint32_t request_id GNUNET_PACKED;
 
   /**
-   * ID of the incoming request we want to accept / reject.
+   * How should results be sent to us?
+   * See enum GNUNET_SET_ResultMode.
    */
-  uint32_t accept_id GNUNET_PACKED;
+  uint16_t result_mode GNUNET_PACKED;
 };
 
 
 /**
  * A request for an operation with another client.
  */
-struct RequestMessage
+struct GNUNET_SET_RequestMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_Request.
@@ -107,21 +107,21 @@ struct RequestMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * ID of the request we want to accept,
-   * chosen by the service.
+   * Identity of the requesting peer.
    */
-  uint32_t accept_id GNUNET_PACKED;
+  struct GNUNET_PeerIdentity peer_id;
 
   /**
-   * Identity of the requesting peer.
+   * ID of the to identify the request when accepting or
+   * rejecting it.
    */
-  struct GNUNET_PeerIdentity peer_id;
+  uint32_t accept_id GNUNET_PACKED;
 
   /* rest: nested context message */
 };
 
 
-struct EvaluateMessage
+struct GNUNET_SET_EvaluateMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
@@ -136,7 +136,7 @@ struct EvaluateMessage
   /**
    * Peer to evaluate the operation with
    */
-  struct GNUNET_PeerIdentity peer;
+  struct GNUNET_PeerIdentity target_peer;
 
   /**
    * Application id
@@ -149,15 +149,16 @@ struct EvaluateMessage
   uint16_t salt GNUNET_PACKED;
 
   /**
-   * Padding
+   * How should results be sent to us?
+   * See enum GNUNET_SET_ResultMode.
    */
-  uint16_t reserved GNUNET_PACKED;
+  uint16_t result_mode GNUNET_PACKED;
 
   /* rest: inner message */
 };
 
 
-struct ResultMessage
+struct GNUNET_SET_ResultMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_RESULT
@@ -184,7 +185,7 @@ struct ResultMessage
 };
 
 
-struct ElementMessage
+struct GNUNET_SET_ElementMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
@@ -200,7 +201,11 @@ struct ElementMessage
 };
 
 
-struct CancelMessage
+/**
+ * Sent to the service by the client
+ * in order to cancel a set operation.
+ */
+struct GNUNET_SET_CancelMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
@@ -208,11 +213,39 @@ struct CancelMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * id we want to cancel result belongs to
+   * ID of the request we want to cancel.
    */
   uint32_t request_id GNUNET_PACKED;
 };
 
+struct GNUNET_SET_IterResponseMessage
+{
+  /**
+   * Type: GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Type of the element attachted to the message,
+   * if any.
+   */
+  uint16_t element_type GNUNET_PACKED;
+
+  /* rest: element */
+};
+
+struct GNUNET_SET_IterAckMessage
+{
+  /**
+   * Type: GNUNET_MESSAGE_TYPE_SET_ITER_ACK
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Non-zero if the service should continue sending elements.
+   */
+  uint32_t send_more;
+};
 
 GNUNET_NETWORK_STRUCT_END