From 046e90172489ca6091346685bf444a037b1187ee Mon Sep 17 00:00:00 2001 From: LRN Date: Tue, 19 Feb 2013 04:04:35 +0000 Subject: Asynchronous namespace creation. With a test. --- src/include/gnunet_fs_service.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/include/gnunet_fs_service.h') diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index a80662867..d6b26d927 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h @@ -2239,6 +2239,45 @@ struct GNUNET_FS_Namespace * GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name); +/** + * Context for creating a namespace asynchronously. + */ +struct GNUNET_FS_NamespaceCreationContext; + +/** + * Function called upon completion of 'GNUNET_FS_namespace_create_start'. + * + * @param cls closure + * @param ns NULL on error, otherwise the namespace (which must be free'd by the callee) + * @param emsg NULL on success, otherwise an error message + */ +typedef void (*GNUNET_FS_NamespaceCreationCallback)(void *cls, + struct GNUNET_FS_Namespace *ns, const char *emsg); + + +/** + * Create a namespace with the given name; if one already + * exists, return a handle to the existing namespace immediately. + * Otherwise create a namespace asynchronously. + * + * @param h handle to the file sharing subsystem + * @param name name to use for the namespace + * @return namespace creation context, NULL on error (i.e. invalid filename) + */ +struct GNUNET_FS_NamespaceCreationContext * +GNUNET_FS_namespace_create_start (struct GNUNET_FS_Handle *h, const char *name, + GNUNET_FS_NamespaceCreationCallback cont, void *cont_cls); + + +/** + * Abort namespace creation. + * + * @param ncc namespace creation context to abort + */ +void +GNUNET_FS_namespace_create_stop (struct GNUNET_FS_NamespaceCreationContext *ncc); + + /** * Duplicate a namespace handle. * -- cgit v1.2.3