-fixes
[oweals/gnunet.git] / src / fs / fs.h
index 89a375022979f2381e8fe831af959cd78604e1a4..059b8920d248d01d16eb93a82b0f3c9622c2b2ea 100644 (file)
@@ -64,6 +64,8 @@ struct ContentHashKey
 };
 
 
+GNUNET_NETWORK_STRUCT_BEGIN
+
 /**
  * Message sent from a GNUnet (fs) publishing activity to the
  * gnunet-fs-service to initiate indexing of a file.  The service is
@@ -177,6 +179,25 @@ struct UnindexMessage
 };
 
 
+/**
+ * No options.
+ */
+#define SEARCH_MESSAGE_OPTION_NONE 0
+
+/**
+ * Only search the local datastore (no network)
+ */
+#define SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY 1
+
+/**
+ * Request is too large to fit in 64k format.  The list of
+ * already-known search results will be continued in another message
+ * for the same type/query/target and additional already-known results
+ * following this one).
+ */
+#define SEARCH_MESSAGE_OPTION_CONTINUED 2
+
+
 /**
  * Message sent from a GNUnet (fs) search activity to the
  * gnunet-service-fs to start a search.
@@ -191,10 +212,15 @@ struct SearchMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Bitmask with options.  Zero for no options, one for loopback-only.
+   * Bitmask with options.  Zero for no options, one for
+   * loopback-only, two for 'to be continued' (with a second search
+   * message for the same type/query/target and additional
+   * already-known results following this one).  See
+   * SEARCH_MESSAGE_OPTION_ defines.
+   *
    * Other bits are currently not defined.
    */
-  int32_t options GNUNET_PACKED;
+  uint32_t options GNUNET_PACKED;
 
   /**
    * Type of the content that we're looking for.
@@ -238,100 +264,40 @@ struct SearchMessage
 
 
 /**
- * Only the (mandatory) query is included.
- */
-#define GET_MESSAGE_BIT_QUERY_ONLY 0
-
-/**
- * The peer identity of a peer waiting for the
- * reply is included (used if the response
- * should be transmitted to someone other than
- * the sender of the GET).
- */
-#define GET_MESSAGE_BIT_RETURN_TO 1
-
-/**
- * The hash of the public key of the target
- * namespace is included (for SKS queries).
- */
-#define GET_MESSAGE_BIT_SKS_NAMESPACE 2
-
-/**
- * The peer identity of a peer that had claimed to have the content
- * previously is included (can be used if responder-anonymity is not
- * desired; note that the precursor presumably lacked a direct
- * connection to the specified peer; still, the receiver is in no way
- * required to limit forwarding only to the specified peer, it should
- * only prefer it somewhat if possible).
- */
-#define GET_MESSAGE_BIT_TRANSMIT_TO 4
-
-
-/**
- * Message sent between peers asking for FS-content.
+ * Response from FS service with a result for a previous FS search.
+ * Note that queries for DBLOCKS and IBLOCKS that have received a
+ * single response are considered done.  This message is transmitted
+ * between peers.
  */
-struct GetMessage
+struct PutMessage
 {
 
   /**
-   * Message type will be GNUNET_MESSAGE_TYPE_FS_GET.
+   * Message type will be GNUNET_MESSAGE_TYPE_FS_PUT.
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * Type of the query (block type).
+   * Type of the block (in big endian).  Should never be zero.
    */
   uint32_t type GNUNET_PACKED;
 
   /**
-   * How important is this request (network byte order)
-   */
-  uint32_t priority GNUNET_PACKED;
-
-  /**
-   * Relative time to live in MILLISECONDS (network byte order)
-   */
-  int32_t ttl GNUNET_PACKED;
-
-  /**
-   * The content hash should be mutated using this value
-   * before checking against the bloomfilter (used to
-   * get many different filters for the same hash codes).
-   * The number should be in big-endian format when used
-   * for mingling.
-   */
-  uint32_t filter_mutator GNUNET_PACKED;
-
-  /**
-   * Which of the optional hash codes are present at the end of the
-   * message?  See GET_MESSAGE_BIT_xx constants.  For each bit that is
-   * set, an additional GNUNET_HashCode with the respective content
-   * (in order of the bits) will be appended to the end of the GET
-   * message.
+   * When does this result expire?
    */
-  uint32_t hash_bitmap GNUNET_PACKED;
+  struct GNUNET_TIME_AbsoluteNBO expiration;
 
-  /**
-   * Hashcodes of the file(s) we're looking for.
-   * Details depend on the query type.
-   */
-  GNUNET_HashCode query GNUNET_PACKED;
+  /* this is followed by the actual encrypted content */
 
-  /* this is followed by hash codes
-   * as specified in the  "hash_bitmap";
-   * after that, an optional bloomfilter
-   * (with bits set for replies that should
-   * be suppressed) can be present */
 };
 
-
 /**
  * Response from FS service with a result for a previous FS search.
  * Note that queries for DBLOCKS and IBLOCKS that have received a
  * single response are considered done.  This message is transmitted
- * between peers as well as between the service and a client.
+ * between the service and a client.
  */
-struct PutMessage
+struct ClientPutMessage
 {
 
   /**
@@ -349,35 +315,16 @@ struct PutMessage
    */
   struct GNUNET_TIME_AbsoluteNBO expiration;
 
-  /* this is followed by the actual encrypted content */
-
-};
-
-
-/**
- * Message send by a peer that wants to be excluded
- * from migration for a while.
- */
-struct MigrationStopMessage
-{
-  /**
-   * Message type will be
-   * GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP.
-   */
-  struct GNUNET_MessageHeader header;
-
   /**
-   * Always zero.
+   * When was the last time we've tried to download this block?
+   * (FOREVER if unknown/not relevant)
    */
-  uint32_t reserved GNUNET_PACKED;
+  struct GNUNET_TIME_AbsoluteNBO last_transmission;
 
-  /**
-   * How long should the block last?
-   */
-  struct GNUNET_TIME_RelativeNBO duration;
+  /* this is followed by the actual encrypted content */
 
 };
-
+GNUNET_NETWORK_STRUCT_END
 
 
 #endif