session time out for http client/server
[oweals/gnunet.git] / src / set / set.h
index 33e0aafddf95ec627a0cc4fdafb5c4d0de00f08c..09d1120f07a03b95780df5bda10410cd0d3a37ae 100644 (file)
@@ -1,10 +1,10 @@
 /*
      This file is part of GNUnet.
-     (C) 2012 Christian Grothoff (and other contributing authors)
+     (C) 2012, 2013 Christian Grothoff (and other contributing authors)
 
      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
@@ -49,11 +44,12 @@ struct SetCreateMessage
   /**
    * Operation type, values of enum GNUNET_SET_OperationType
    */
+  // FIXME: use 32_t for 'enum'.
   uint16_t operation GNUNET_PACKED;
 };
 
 
-struct ListenMessage
+struct GNUNET_SET_ListenMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
@@ -61,43 +57,49 @@ struct ListenMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * application id
+   * Operation type, values of enum GNUNET_SET_OperationType
    */
-  struct GNUNET_HashCode app_id;
+  uint32_t operation GNUNET_PACKED;
 
   /**
-   * Operation type, values of enum GNUNET_SET_OperationType
+   * application id
    */
-  uint16_t operation GNUNET_PACKED;
+  struct GNUNET_HashCode app_id;
+
 };
 
 
-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.
@@ -110,8 +112,8 @@ struct RequestMessage
   struct GNUNET_PeerIdentity peer_id;
 
   /**
-   * ID of the request we want to accept,
-   * chosen by the service.
+   * ID of the to identify the request when accepting or
+   * rejecting it.
    */
   uint32_t accept_id GNUNET_PACKED;
 
@@ -119,7 +121,7 @@ struct RequestMessage
 };
 
 
-struct EvaluateMessage
+struct GNUNET_SET_EvaluateMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
@@ -127,19 +129,19 @@ struct EvaluateMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Peer to evaluate the operation with
+   * id of our evaluate, chosen by the client
    */
-  struct GNUNET_PeerIdentity peer;
+  uint32_t request_id GNUNET_PACKED;
 
   /**
-   * Application id
+   * Peer to evaluate the operation with
    */
-  struct GNUNET_HashCode app_id;
+  struct GNUNET_PeerIdentity target_peer;
 
   /**
-   * id of our evaluate, chosen by the client
+   * Application id
    */
-  uint32_t request_id GNUNET_PACKED;
+  struct GNUNET_HashCode app_id;
 
   /**
    * Salt to use for the operation
@@ -147,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
@@ -182,7 +185,7 @@ struct ResultMessage
 };
 
 
-struct ElementMessage
+struct GNUNET_SET_ElementMessage
 {
   /**
    * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
@@ -198,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
@@ -206,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