From 365afdb913c3446f358d3a13fcdaad4ae76334b3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 30 Aug 2009 19:05:29 +0000 Subject: [PATCH] sblocks --- src/fs/fs_publish.c | 1 + src/include/gnunet_fs_service.h | 55 ++++++++++++++++++++++++++++----- src/include/gnunet_signatures.h | 15 +++++++-- 3 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 55541fc33..1445c98d5 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -30,6 +30,7 @@ * - code-sharing with unindex (can wait) * - persistence support (can wait) * - datastore reservation support (optimization) + * - location URIs (publish with anonymity-level zero) */ #include "platform.h" diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 2b0880f0d..d0032f72d 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h @@ -1769,6 +1769,24 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, void *cleaner_cls); +/** + * Options for publishing. Compatible options + * can be OR'ed together. + */ +enum GNUNET_FS_PublishOptions + { + /** + * No options (use defaults for everything). + */ + GNUNET_FS_PUBLISH_OPTION_NONE = 0, + + /** + * Simulate publishing. With this option, no data will be stored + * in the datastore. Useful for computing URIs from files. + */ + GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 + }; + /** * Publish a file or directory. * @@ -1781,6 +1799,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, * (can be NULL, must be NULL if namespace is NULL) * @param nuid update-identifier that will be used for future updates * (can be NULL, must be NULL if namespace or nid is NULL) + * @param options options for the publication * @return context that can be used to control the publish operation */ struct GNUNET_FS_PublishContext * @@ -1789,7 +1808,8 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, struct GNUNET_FS_FileInformation *fi, struct GNUNET_FS_Namespace *namespace, const char *nid, - const char *nuid); + const char *nuid, + enum GNUNET_FS_PublishOptions options); /** @@ -1803,26 +1823,43 @@ void GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *sc); +/** + * Signature of a function called as the continuation of a KBlock or + * SBlock publication. + * + * @param cls closure + * @param uri URI under which the block is now available, NULL on error + * @param emsg error message, NULL on success + */ +typedef void (*GNUNET_FS_PublishContinuation)(void *cls, + const struct GNUNET_FS_Uri *uri, + const char *emsg); + + /** * Publish a KBlock on GNUnet. * * @param h handle to the file sharing subsystem - * @param keyword keyword to use + * @param keywords keywords to use * @param meta metadata to use * @param uri URI to refer to in the KBlock * @param expirationTime when the KBlock expires * @param anonymity anonymity level for the KBlock * @param priority priority for the KBlock + * @param cont continuation + * @param cont_cls closure for cont */ -// FIXME: CPS this one.. void GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, - const char *keyword, + struct GNUNET_FS_Uri *keywords, struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri *uri, struct GNUNET_TIME_Absolute expirationTime, unsigned int anonymity, - unsigned int priority); + unsigned int priority, + enum GNUNET_FS_PublishOptions options, + GNUNET_FS_PublishContinuation cont, + void *cont_cls); /** @@ -1837,8 +1874,9 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, * @param expirationTime when the SBlock expires * @param anonymity anonymity level for the SBlock * @param priority priority for the SBlock + * @param cont continuation + * @param cont_cls closure for cont */ -// FIXME: CPS this one.. void GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, struct GNUNET_FS_Namespace *namespace, @@ -1848,7 +1886,10 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, struct GNUNET_FS_Uri *uri, struct GNUNET_TIME_Absolute expirationTime, unsigned int anonymity, - unsigned int priority); + unsigned int priority, + enum GNUNET_FS_PublishOptions options, + GNUNET_FS_PublishContinuation cont, + void *cont_cls); /** diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h index 6e4b0dc42..29aa36811 100644 --- a/src/include/gnunet_signatures.h +++ b/src/include/gnunet_signatures.h @@ -59,16 +59,27 @@ extern "C" */ #define GNUNET_SIGNATURE_PURPOSE_NAMESPACE_ADVERTISEMENT 3 +/** + * Signature by which a peer affirms that it is + * providing a certain bit of content (used + * in LOCation URIs). + */ +#define GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT 4 + +/** + * Signature in a KBlock of the FS module. + */ +#define GNUNET_SIGNATURE_PURPOSE_FS_KBLOCK 5 /** * Signature of content URI placed into a namespace. */ -#define GNUNET_SIGNATURE_PURPOSE_NAMESPACE_PLACEMENT 4 +#define GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK 6 /** * */ -#define GNUNET_SIGNATURE_PURPOSE_RESOLVER_RESPONSE 5 +#define GNUNET_SIGNATURE_PURPOSE_RESOLVER_RESPONSE 7 #if 0 /* keep Emacsens' auto-indent happy */ -- 2.25.1