sblocks
authorChristian Grothoff <christian@grothoff.org>
Sun, 30 Aug 2009 19:05:29 +0000 (19:05 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 30 Aug 2009 19:05:29 +0000 (19:05 +0000)
src/fs/fs_publish.c
src/include/gnunet_fs_service.h
src/include/gnunet_signatures.h

index 55541fc33f97ea35324d6a45078555d220649420..1445c98d52f54b1291cfe42c3f7c440c147540d4 100644 (file)
@@ -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"
index 2b0880f0df6af2bbe80114de1f32a01b5e09a3aa..d0032f72d87cf5e05b824025c5efedb4d545b323 100644 (file)
@@ -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);
 
 
 /**
index 6e4b0dc4205ad3221e84b5f466c96d54299d8239..29aa36811e565cd131005c34d40d31e26af748c2 100644 (file)
@@ -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 */