fix
[oweals/gnunet.git] / src / fs / fs.h
index 41831e8a82e576f4ba22a86ed592629cfa659984..d48af35b410cd65d5585e98ad911bb47c6ee83f5 100644 (file)
 
 #include "gnunet_constants.h"
 #include "gnunet_datastore_service.h"
+#include "gnunet_dht_service.h"
 #include "gnunet_fs_service.h"
 #include "gnunet_block_lib.h"
+#include "block_fs.h"
 
 /**
  * Maximum size of the datastore queue for P2P operations.
  * Number of bits we set per entry in the bloomfilter.
  * Do not change!
  */
-#define BLOOMFILTER_K 16
+#define BLOOMFILTER_K GNUNET_DHT_GET_BLOOMFILTER_K
 
 /**
  * Number of availability trials we perform per search result.
  */
 #define AVAILABILITY_TRIALS_MAX 8
 
-/**
- * By how much (in ms) do we decrement the TTL
- * at each hop?
- */
-#define TTL_DECREMENT 5000
-
 /**
  * Length of the P2P success tracker.  Note that
  * having a very long list can also hurt performance.
@@ -1839,14 +1835,71 @@ struct GNUNET_FS_DownloadContext
   int tried_full_data;
 };
 
+
+/**
+ * Information about an (updateable) node in the
+ * namespace.
+ */
+struct NamespaceUpdateNode
+{
+  /**
+   * Identifier for this node.
+   */
+  char *id;
+
+  /**
+   * Identifier of children of this node.
+   */
+  char *update;
+
+  /**
+   * Metadata for this entry.
+   */
+  struct GNUNET_CONTAINER_MetaData *md;
+
+  /**
+   * URI of this entry in the namespace.
+   */
+  struct GNUNET_FS_Uri *uri;
+
+  /**
+   * Namespace update generation ID.  Used to ensure
+   * freshness of the scc_id.
+   */
+  unsigned int nug;
+  
+  /**
+   * SCC this entry belongs to (if nug is current).
+   */
+  unsigned int scc_id;
+
+};
+
+
 struct GNUNET_FS_Namespace
 {
 
+  /**
+   * Handle to the FS service context.
+   */
+  struct GNUNET_FS_Handle *h;
+  
+  /**
+   * Array with information about nodes in the namespace.
+   */
+  struct NamespaceUpdateNode **update_nodes;
+
   /**
    * Private key for the namespace.
    */
   struct GNUNET_CRYPTO_RsaPrivateKey *key;
 
+  /**
+   * Hash map mapping identifiers of update nodes
+   * to the update nodes (initialized on-demand).
+   */
+  struct GNUNET_CONTAINER_MultiHashMap *update_map;
+
   /**
    * Name of the file with the private key.
    */
@@ -1857,10 +1910,20 @@ struct GNUNET_FS_Namespace
    */ 
   char *name;
 
+  /**
+   * Size of the update nodes array.
+   */
+  unsigned int update_node_count;
+
   /**
    * Reference counter.
    */
   unsigned int rc;
+
+  /**
+   * Generator for unique nug numbers.
+   */
+  unsigned int nug_gen;
 };
 
 
@@ -2154,6 +2217,32 @@ struct PutMessage
 };
 
 
+/**
+ * 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.
+   */
+  uint32_t reserved GNUNET_PACKED;
+
+  /**
+   * How long should the block last?
+   */
+  struct GNUNET_TIME_RelativeNBO duration;
+
+};
+
+
+
 #endif
 
 /* end of fs.h */