* 9.0.0: CPS-style integrated API
* 9.1.1: asynchronous directory scanning
*/
-#define GNUNET_FS_VERSION 0x00090101
+#define GNUNET_FS_VERSION 0x00090102
/* ******************** URI API *********************** */
*/
struct GNUNET_FS_Uri;
-struct GNUNET_FS_DirScanner;
-
/**
* Iterator over keywords
*
* @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.
* @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);
/**
*/
int
GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
- GNUNET_HashCode * nsid);
+ struct GNUNET_HashCode * nsid);
/**
*/
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).
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;
/**
* Hash-identifier for the namespace.
*/
- GNUNET_HashCode id;
+ struct GNUNET_HashCode id;
} namespace;
* @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;
const char *emsg);
+/**
+ * Handle to cancel publish KSK operation.
+ */
+struct GNUNET_FS_PublishKskContext;
+
+
/**
* Publish a KBlock on GNUnet.
*
* @param options publication options
* @param cont continuation
* @param cont_cls closure for cont
+ * @return NULL on error ('cont' will still be called)
*/
-void
+struct GNUNET_FS_PublishKskContext *
GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
const struct GNUNET_FS_Uri *ksk_uri,
const struct GNUNET_CONTAINER_MetaData *meta,
GNUNET_FS_PublishContinuation cont, void *cont_cls);
+/**
+ * Abort the KSK publishing operation.
+ *
+ * @param pkc context of the operation to abort.
+ */
+void
+GNUNET_FS_publish_ksk_cancel (struct GNUNET_FS_PublishKskContext *pkc);
+
+
+/**
+ * Handle to cancel publish SKS operation.
+ */
+struct GNUNET_FS_PublishSksContext;
+
+
/**
* Publish an SBlock on GNUnet.
*
* @param options publication options
* @param cont continuation
* @param cont_cls closure for cont
+ * @return NULL on error ('cont' will still be called)
*/
-void
+struct GNUNET_FS_PublishSksContext *
GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
struct GNUNET_FS_Namespace *namespace,
const char *identifier, const char *update,
GNUNET_FS_PublishContinuation cont, void *cont_cls);
+/**
+ * Abort the SKS publishing operation.
+ *
+ * @param psc context of the operation to abort.
+ */
+void
+GNUNET_FS_publish_sks_cancel (struct GNUNET_FS_PublishSksContext *psc);
+
+
/**
* Type of a function called by "GNUNET_FS_get_indexed_files".
*
* @param cls closure
- * @param filename the name of the file
+ * @param filename the name of the file, NULL for end of list
* @param file_id hash of the contents of the indexed file
* @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);
+
+
+/**
+ * Handle to cancel 'GNUNET_FS_get_indexed_files'.
+ */
+struct GNUNET_FS_GetIndexedContext;
/**
* @param h handle to the file sharing subsystem
* @param iterator function to call on each indexed file
* @param iterator_cls closure for iterator
- * @param cont continuation to call when done;
- * reason should be "TIMEOUT" (on
- * error) or "PREREQ_DONE" (on success)
- * @param cont_cls closure for cont
+ * @return NULL on error ('iter' is not called)
*/
-void
+struct GNUNET_FS_GetIndexedContext *
GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h,
GNUNET_FS_IndexedFileProcessor iterator,
- void *iterator_cls, GNUNET_SCHEDULER_Task cont,
- void *cont_cls);
+ void *iterator_cls);
+
+
+/**
+ * Cancel iteration over all indexed files.
+ *
+ * @param gic operation to cancel
+ */
+void
+GNUNET_FS_get_indexed_files_cancel (struct GNUNET_FS_GetIndexedContext *gic);
/**
GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc);
+/**
+ * Context for advertising a namespace.
+ */
+struct GNUNET_FS_AdvertisementContext;
+
+
/**
* Publish an advertismement for a namespace.
*
* @param rootEntry name of the root of the namespace
* @param cont continuation
* @param cont_cls closure for cont
+ * @return NULL on error ('cont' will still be called)
*/
-void
+struct GNUNET_FS_AdvertisementContext *
GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
struct GNUNET_FS_Uri *ksk_uri,
struct GNUNET_FS_Namespace *namespace,
void *cont_cls);
+/**
+ * Abort the namespace advertisement operation.
+ *
+ * @param ac context of the operation to abort.
+ */
+void
+GNUNET_FS_namespace_advertise_cancel (struct GNUNET_FS_AdvertisementContext *ac);
+
+
/**
* Create a namespace with the given name; if one already
* exists, return a handle to the existing namespace.
*
* @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);
+/**
+ * Duplicate a namespace handle.
+ *
+ * @param ns namespace handle
+ * @return duplicated handle to the namespace
+ */
+struct GNUNET_FS_Namespace *
+GNUNET_FS_namespace_dup (struct GNUNET_FS_Namespace *ns);
+
+
/**
* Delete a namespace handle. Can be used for a clean shutdown (free
* memory) or also to freeze the namespace to prevent further
* @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);
/**
* Start a directory scanner.
*
* @param filename name of the directory to scan
- * @param GNUNET_YES to not to run libextractor on files (only build a tree)
+ * @param disable_extractor GNUNET_YES to not to run libextractor on files (only build a tree)
* @param ex if not NULL, must be a list of extra plugins for extractor
* @param cb the callback to call when there are scanning progress messages
* @param cb_cls closure for 'cb'
/**
- * Abort the scan.
+ * Abort the scan. Must not be called from within the progress_callback
+ * function.
*
* @param ds directory scanner structure
*/