messages for inter-controller overlay connect
[oweals/gnunet.git] / src / include / gnunet_fs_service.h
index 3eb58921a71fef5d87fabedd994a3071e7031df2..b35134313750e944f812209eeef0e3f966d9e9df 100644 (file)
@@ -55,7 +55,7 @@ extern "C"
  * 9.0.0: CPS-style integrated API
  * 9.1.1: asynchronous directory scanning
  */
-#define GNUNET_FS_VERSION 0x00090102
+#define GNUNET_FS_VERSION 0x00090103
 
 
 /* ******************** URI API *********************** */
@@ -91,7 +91,7 @@ typedef int (*GNUNET_FS_KeywordIterator) (void *cls, const char *keyword,
  * @param key wherer to store the unique key
  */
 void
-GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, GNUNET_HashCode * key);
+GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCode * key);
 
 /**
  * Convert a URI to a UTF-8 String.
@@ -341,7 +341,7 @@ GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, const char *id,
  * @return an FS URI for the given namespace and identifier
  */
 struct GNUNET_FS_Uri *
-GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * nsid, const char *id);
+GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_HashCode * nsid, const char *id);
 
 
 /**
@@ -354,7 +354,7 @@ GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * nsid, const char *id);
  */
 int
 GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
-                                 GNUNET_HashCode * nsid);
+                                 struct GNUNET_HashCode * nsid);
 
 
 /**
@@ -1017,6 +1017,12 @@ struct GNUNET_FS_ProgressInfo
           */
           uint64_t data_len;
 
+          /**
+          * How much time passed between us asking for this block and
+           * actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown.
+          */
+          struct GNUNET_TIME_Relative block_download_duration;
+
           /**
           * Depth of the given block in the tree;
           * 0 would be the lowest level (DBLOCKS).
@@ -1024,15 +1030,20 @@ struct GNUNET_FS_ProgressInfo
           unsigned int depth;
 
           /**
-          * How much trust did we offer for downloading this block?
+          * How much respect did we offer for downloading this block? (estimate,
+          * because we might have the same request pending for multiple clients,
+          * and of course because a transmission may have failed at a lower
+          * layer).
           */
-          unsigned int trust_offered;
+          uint32_t respect_offered;
 
           /**
-          * How much time passed between us asking for this block and
-           * actually getting it? GNUNET_TIME_UNIT_FOREVER_REL if unknown.
+          * How often did we transmit the request? (estimate,
+          * because we might have the same request pending for multiple clients,
+          * and of course because a transmission may have failed at a lower
+          * layer).
           */
-          struct GNUNET_TIME_Relative block_download_duration;
+          uint32_t num_transmissions;
 
         } progress;
 
@@ -1383,9 +1394,9 @@ struct GNUNET_FS_ProgressInfo
           /**
           * Hash-identifier for the namespace.
           */
-          GNUNET_HashCode id;
+          struct GNUNET_HashCode id;
 
-        } namespace;
+        } ns;
 
       } specifics;
 
@@ -1531,8 +1542,7 @@ struct GNUNET_FS_ProgressInfo
  *         field in the GNUNET_FS_ProgressInfo struct.
  */
 typedef void *(*GNUNET_FS_ProgressCallback) (void *cls,
-                                             const struct GNUNET_FS_ProgressInfo
-                                             * info);
+                                             const struct GNUNET_FS_ProgressInfo *info);
 
 
 /**
@@ -1559,30 +1569,31 @@ enum GNUNET_FS_Flags
   GNUNET_FS_FLAGS_DO_PROBES = 2
 };
 
+
 /**
  * Options specified in the VARARGs portion of GNUNET_FS_start.
  */
 enum GNUNET_FS_OPTIONS
 {
 
-    /**
-     * Last option in the VARARG list.
-     */
+  /**
+   * Last option in the VARARG list.
+   */
   GNUNET_FS_OPTIONS_END = 0,
 
-    /**
-     * Select the desired amount of parallelism (this option should be
-     * followed by an "unsigned int" giving the desired maximum number
-     * of parallel downloads).
-     */
+  /**
+   * Select the desired amount of parallelism (this option should be
+   * followed by an "unsigned int" giving the desired maximum number
+   * of parallel downloads).
+   */
   GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1,
 
-    /**
-     * Maximum number of requests that should be pending at a given
-     * point in time (invidivual downloads may go above this, but
-     * if we are above this threshold, we should not activate any
-     * additional downloads.
-     */
+  /**
+   * Maximum number of requests that should be pending at a given
+   * point in time (invidivual downloads may go above this, but
+   * if we are above this threshold, we should not activate any
+   * additional downloads.
+   */
   GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2
 };
 
@@ -1820,7 +1831,11 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h,
  * @param cls closure
  * @param offset offset to read from; it is possible
  *            that the caller might need to go backwards
- *            a bit at times
+ *            a bit at times; set to UINT64_MAX to tell
+ *            the reader that we won't be reading for a while
+ *            (used to close the file descriptor but NOT fully
+ *             clean up the reader's state); in this case,
+ *            a value of '0' for max should be ignored
  * @param max maximum number of bytes that should be
  *            copied to buf; readers are not allowed
  *            to provide less data unless there is an error;
@@ -1979,7 +1994,7 @@ enum GNUNET_FS_PublishOptions
  *
  * @param h handle to the file sharing subsystem
  * @param fi information about the file or directory structure to publish
- * @param namespace namespace to publish the file in, NULL for no namespace
+ * @param ns namespace to publish the file in, NULL for no namespace
  * @param nid identifier to use for the publishd content in the namespace
  *        (can be NULL, must be NULL if namespace is NULL)
  * @param nuid update-identifier that will be used for future updates
@@ -1990,7 +2005,7 @@ enum GNUNET_FS_PublishOptions
 struct GNUNET_FS_PublishContext *
 GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h,
                          struct GNUNET_FS_FileInformation *fi,
-                         struct GNUNET_FS_Namespace *namespace, const char *nid,
+                         struct GNUNET_FS_Namespace *ns, const char *nid,
                          const char *nuid,
                          enum GNUNET_FS_PublishOptions options);
 
@@ -2068,7 +2083,7 @@ struct GNUNET_FS_PublishSksContext;
  * Publish an SBlock on GNUnet.
  *
  * @param h handle to the file sharing subsystem
- * @param namespace namespace to publish in
+ * @param ns namespace to publish in
  * @param identifier identifier to use
  * @param update update identifier to use
  * @param meta metadata to use
@@ -2081,7 +2096,7 @@ struct GNUNET_FS_PublishSksContext;
  */
 struct GNUNET_FS_PublishSksContext *
 GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
-                       struct GNUNET_FS_Namespace *namespace,
+                       struct GNUNET_FS_Namespace *ns,
                        const char *identifier, const char *update,
                        const struct GNUNET_CONTAINER_MetaData *meta,
                        const struct GNUNET_FS_Uri *uri,
@@ -2108,7 +2123,7 @@ GNUNET_FS_publish_sks_cancel (struct GNUNET_FS_PublishSksContext *psc);
  * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
  */
 typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filename,
-                                               const GNUNET_HashCode * file_id);
+                                               const struct GNUNET_HashCode * file_id);
 
 
 /**
@@ -2173,7 +2188,7 @@ struct GNUNET_FS_AdvertisementContext;
  *
  * @param h handle to the file sharing subsystem
  * @param ksk_uri keywords to use for advertisment
- * @param namespace handle for the namespace that should be advertised
+ * @param ns handle for the namespace that should be advertised
  * @param meta meta-data for the namespace advertisement
  * @param bo block options
  * @param rootEntry name of the root of the namespace
@@ -2184,7 +2199,7 @@ struct GNUNET_FS_AdvertisementContext;
 struct GNUNET_FS_AdvertisementContext *
 GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
                                struct GNUNET_FS_Uri *ksk_uri,
-                               struct GNUNET_FS_Namespace *namespace,
+                               struct GNUNET_FS_Namespace *ns,
                                const struct GNUNET_CONTAINER_MetaData *meta,
                                const struct GNUNET_FS_BlockOptions *bo,
                                const char *rootEntry,
@@ -2207,7 +2222,7 @@ GNUNET_FS_namespace_advertise_cancel (struct GNUNET_FS_AdvertisementContext *ac)
  *
  * @param h handle to the file sharing subsystem
  * @param name name to use for the namespace
- * @return handle to the namespace, NULL on error
+ * @return handle to the namespace, NULL on error (i.e. invalid filename)
  */
 struct GNUNET_FS_Namespace *
 GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name);
@@ -2228,14 +2243,14 @@ GNUNET_FS_namespace_dup (struct GNUNET_FS_Namespace *ns);
  * memory) or also to freeze the namespace to prevent further
  * insertions by anyone.
  *
- * @param namespace handle to the namespace that should be deleted / freed
+ * @param ns handle to the namespace that should be deleted / freed
  * @param freeze prevents future insertions; creating a namespace
  *        with the same name again will create a fresh namespace instead
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int
-GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int freeze);
+GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *ns, int freeze);
 
 
 /**
@@ -2248,7 +2263,7 @@ GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int freeze);
  * @param id hash identifier for the namespace
  */
 typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, const char *name,
-                                                  const GNUNET_HashCode * id);
+                                                  const struct GNUNET_HashCode * id);
 
 
 /**
@@ -2297,13 +2312,13 @@ typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, const char *last_id,
  * cause the library to call "ip" with all children of the node.  Note
  * that cycles within an SCC are possible (including self-loops).
  *
- * @param namespace namespace to inspect for updateable content
+ * @param ns namespace to inspect for updateable content
  * @param next_id ID to look for; use NULL to look for SCC roots
  * @param ip function to call on each updateable identifier
  * @param ip_cls closure for ip
  */
 void
-GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace,
+GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *ns,
                                      const char *next_id,
                                      GNUNET_FS_IdentifierProcessor ip,
                                      void *ip_cls);