gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8662 - gnunet/src/include


From: gnunet
Subject: [GNUnet-SVN] r8662 - gnunet/src/include
Date: Fri, 10 Jul 2009 14:41:54 -0600

Author: grothoff
Date: 2009-07-10 14:41:54 -0600 (Fri, 10 Jul 2009)
New Revision: 8662

Modified:
   gnunet/src/include/gnunet_fs_service.h
Log:
API refinement

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2009-07-10 19:18:28 UTC (rev 
8661)
+++ gnunet/src/include/gnunet_fs_service.h      2009-07-10 20:41:54 UTC (rev 
8662)
@@ -84,9 +84,10 @@
  * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
  */
 typedef int (*GNUNET_FS_KeywordIterator) (void *cls,
-                                   const char *keyword,
-                                            int is_mandatory);
+                                         const char *keyword,
+                                         int is_mandatory);
 
+
 /**
  * Does the meta-data claim that this is a directory?
  * Checks if the mime-type is that of a GNUnet directory.
@@ -94,7 +95,8 @@
  * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if
  *  we have no mime-type information (treat as 'GNUNET_NO')
  */
-int GNUNET_FS_meta_data_test_for_directory (const struct 
GNUNET_CONTAINER_MetaData *md);
+int 
+GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData 
*md);
 
 
 /**
@@ -102,96 +104,128 @@
  */
 struct GNUNET_FS_Uri;
 
+
 /**
  * Get a unique key from a URI.  This is for putting URIs
  * into HashMaps.  The key may change between FS implementations.
+ *
+ * @param uri uri to convert to a unique key
+ * @param key wherer to store the unique key
  */
-void GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
-                             GNUNET_HashCode * key);
+void 
+GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
+                     GNUNET_HashCode * key);
 
 /**
  * Convert a URI to a UTF-8 String.
+ *
+ * @param uri uri to convert to a string
+ * @return the UTF-8 string
  */
-char *GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri);
+char *
+GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri);
 
 /**
  * Convert keyword URI to a human readable format
  * (i.e. the search query that was used in the first place)
+ *
+ * @param uri ksk uri to convert to a string 
+ * @return string with the keywords
  */
-char *GNUNET_FS_ksk_uri_ksk_to_string_fancy (const struct
-                                                    GNUNET_FS_Uri *uri);
+char *
+GNUNET_FS_ksk_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri);
 
 /**
  * Convert a UTF-8 String to a URI.
-*
-* @param uri string to parse
-* @param emsg where to store the parser error message (if any)
-* @return NULL on error
+ *
+ * @param uri string to parse
+ * @param emsg where to store the parser error message (if any)
+ * @return NULL on error
  */
-struct GNUNET_FS_Uri *GNUNET_FS_uri_parse (
-                                               const char *uri, char **emsg);
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_parse (const char *uri,
+                    char **emsg);
 
 /**
  * Free URI.
+ *
+ * @param uri uri to free
  */
-void GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri);
+void 
+GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri);
 
+
 /**
  * How many keywords are ANDed in this keyword URI?
+ *
+ * @param uri ksk uri to get the number of keywords from
  * @return 0 if this is not a keyword URI
  */
-unsigned int GNUNET_FS_uri_ksk_get_keyword_count (const struct
-                                                         GNUNET_FS_Uri
-                                                         *uri);
+unsigned int 
+GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri);
 
+
 /**
  * Iterate over all keywords in this keyword URI.
  *
+ * @param uri ksk uri to get the keywords from
+ * @param iterator function to call on each keyword
+ * @param iterator_cls closure for iterator
  * @return -1 if this is not a keyword URI, otherwise number of
  *   keywords iterated over until iterator aborted
  */
-int GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri,
-                                           GNUNET_FS_KeywordIterator
-                                           iterator, void *iterator_cls);
+int 
+GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri,
+                               GNUNET_FS_KeywordIterator iterator, 
+                               void *iterator_cls);
 
+
 /**
  * Obtain the identity of the peer offering the data
+ *
+ * @param uri the location URI to inspect
+ * @param peer where to store the identify of the peer (presumably) offering 
the content
  * @return GNUNET_SYSERR if this is not a location URI, otherwise GNUNET_OK
  */
-int GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri
-                                                *uri,
-                                                struct GNUNET_PeerIdentity * 
peer);
+int
+GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri,
+                                    struct GNUNET_PeerIdentity * peer);
 
+
 /**
  * Obtain the URI of the content itself.
  *
+ * @param uri location URI to get the content URI from
  * @return NULL if argument is not a location URI
  */
-struct GNUNET_FS_Uri *GNUNET_FS_uri_loc_get_uri (const struct
-                                                                  GNUNET_FS_Uri
-                                                                  *uri);
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_loc_get_uri (const struct GNUNET_FS_Uri *uri);
 
+
 /**
- * Construct a location URI.
+ * Construct a location URI (this peer will be used for the location).
  *
  * @param baseURI content offered by the sender
+ * @param cfg configuration information (used to find our hostkey)
  * @param expiration_time how long will the content be offered?
  * @return the location URI, NULL on error
  */
-struct GNUNET_FS_Uri *GNUNET_FS_uri_loc_create (const struct
-                                                     GNUNET_FS_Uri *baseUri,
-       struct GNUNET_CONFIGURATION_Handle *cfg,
-                                                 struct GNUNET_TIME_Absolute
-                                                     expirationTime
-                                                     );
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri,
+                         struct GNUNET_CONFIGURATION_Handle *cfg,
+                         struct GNUNET_TIME_Absolute expiration_time);
 
 
 /**
  * Duplicate URI.
+ *
+ * @param uri the URI to duplicate
+ * @return copy of the URI
  */
-struct GNUNET_FS_Uri *GNUNET_FS_uri_dup (const struct
-                                                   GNUNET_FS_Uri *uri);
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri);
 
+
 /**
  * Create an FS URI from a single user-supplied string of keywords.
  * The string is broken up at spaces into individual keywords.
@@ -204,13 +238,14 @@
  * example, the string '""foo bar""' will be turned into two
  * "OR"ed keywords 'foo' and 'bar', not into '"foo bar"'.
  *
+ * @param keywords the keyword string
  * @return an FS URI for the given keywords, NULL
  *  if keywords is not legal (i.e. empty).
  */
-struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create (
-                                                           const char
-                                                           *keywords);
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_ksk_create (const char *keywords);
 
+
 /**
  * Create an FS URI from a user-supplied command line of keywords.
  * Arguments should start with "+" to indicate mandatory
@@ -228,88 +263,156 @@
  * @return an FS URI for the given keywords, NULL
  *  if keywords is not legal (i.e. empty).
  */
-struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create_from_args (
-                                                                 unsigned int
-                                                                 argc,
-                                                                 const char
-                                                                 **argv);
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_ksk_create_from_args (unsigned int argc,
+                                   const char **argv);
 
+
 /**
  * Test if two URIs are equal.
+ *
+ * @param u1 one of the URIs
+ * @param u2 the other URI
+ * @return GNUNET_YES if the URIs are equal
  */
-int GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1,
-                                const struct GNUNET_FS_Uri *u2);
+int 
+GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1,
+                         const struct GNUNET_FS_Uri *u2);
 
+
 /**
  * Is this a namespace URI?
+ *
+ * @param uri the uri to check
+ * @return GNUNET_YES if this is an SKS uri
  */
-int GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri);
+int
+GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri);
 
+
 /**
  * Get the ID of a namespace from the given
  * namespace URI.
+ *
+ * @param uri the uri to get the namespace ID from
+ * @param nsid where to store the ID of the namespace
+ * @return GNUNET_OK on success
  */
-int GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
-                                            GNUNET_HashCode * nsid);
+int 
+GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
+                                GNUNET_HashCode * nsid);
 
+
 /**
  * Get the content identifier of an SKS URI.
  *
- * @return NULL on error
+ * @param uri the sks uri
+ * @return NULL on error (not a valid SKS URI)
  */
-char *GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri
-                                               *uri);
+char *
+GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri);
 
 
 /**
+ * Convert namespace URI to a human readable format
+ * (using the namespace description, if available).
+ *
+ * @param cfg configuration to use
+ * @param uri SKS uri to convert
+ * @return NULL on error (not an SKS URI)
+ */
+char *
+GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg,
+                                  const struct GNUNET_FS_Uri *uri);
+
+
+/**
  * Is this a keyword URI?
+ *
+ * @param uri the uri
+ * @return GNUNET_YES if this is a KSK uri
  */
-int GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri);
+int 
+GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri);
 
+
 /**
  * Is this a file (or directory) URI?
+ *
+ * @param uri the uri to check
+ * @return GNUNET_YES if this is a CHK uri
  */
-int GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri);
+int 
+GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri);
 
+
 /**
  * What is the size of the file that this URI
  * refers to?
+ *
+ * @param uri the CHK URI to inspect
+ * @return size of the file as specified in the CHK URI
  */
-uint64_t GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri
-                                                  *uri);
+uint64_t 
+GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri);
 
+
 /**
  * Is this a location URI?
+ *
+ * @param uri the uri to check
+ * @return GNUNET_YES if this is a LOC uri
  */
-int GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri);
+int 
+GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri);
 
 
-
 /**
  * Construct a keyword-URI from meta-data (take all entries
  * in the meta-data and construct one large keyword URI
  * that lists all keywords that can be found in the meta-data).
+ * @deprecated
  */
-struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create_from_meta_data (const struct
-                                                 GNUNET_MetaData *md);
+struct GNUNET_FS_Uri *
+GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_MetaData *md);
 
+
 /**
+ * Command-line option parser function that allows the user
+ * to specify one or more '-k' options with keywords.  Each
+ * specified keyword will be added to the URI.  A pointer to
+ * the URI must be passed as the "scls" argument.
+ *
+ * @param ctx command line processor context
  * @param scls must be of type "struct GNUNET_FS_Uri **"
+ * @param option name of the option (typically 'k')
+ * @param value command line argument given
+ * @return GNUNET_OK on success
  */
 int
-GNUNET_FS_getopt_configure_set_keywords 
(GNUNET_GETOPT_CommandLineProcessorContext
-                                           * ctx, void *scls,
-                                           const char *option,
-                                           const char *value);
+GNUNET_FS_getopt_configure_set_keywords 
(GNUNET_GETOPT_CommandLineProcessorContext* ctx, 
+                                        void *scls,
+                                        const char *option,
+                                        const char *value);
 
+
 /**
+ * Command-line option parser function that allows the user to specify
+ * one or more '-m' options with metadata.  Each specified entry of
+ * the form "type=value" will be added to the metadata.  A pointer to
+ * the metadata must be passed as the "scls" argument.
+ *
+ * @param ctx command line processor context
  * @param scls must be of type "struct GNUNET_MetaData **"
+ * @param option name of the option (typically 'k')
+ * @param value command line argument given
+ * @return GNUNET_OK on success
  */
 int
-GNUNET_FS_getopt_configure_set_metadata 
(GNUNET_GETOPT_CommandLineProcessorContext
-                                           * ctx, void *scls,
-                                           const char *option,
-                                           const char *value);
+GNUNET_FS_getopt_configure_set_metadata 
(GNUNET_GETOPT_CommandLineProcessorContext* ctx, 
+                                        void *scls,
+                                        const char *option,
+                                        const char *value);
 
 
 
@@ -317,16 +420,16 @@
 
 
 /**
-* Possible status codes used in the callback for the 
-* various file-sharing operations.  On each file (or search),
-* the callback is guaranteed to be called once with "START"
-* and once with STOPPED; calls with PROGRESS, ERROR or COMPLETED
-* are optional and depend on the circumstances; parent operations
-* will be STARTED before child-operations and STOPPED after
-* their respective child-operations.  START and STOP signals 
-* are typically generated either due to explicit client requests
-* or because of suspend/resume operations.
-*/
+ * Possible status codes used in the callback for the 
+ * various file-sharing operations.  On each file (or search),
+ * the callback is guaranteed to be called once with "START"
+ * and once with STOPPED; calls with PROGRESS, ERROR or COMPLETED
+ * are optional and depend on the circumstances; parent operations
+ * will be STARTED before child-operations and STOPPED after
+ * their respective child-operations.  START and STOP signals 
+ * are typically generated either due to explicit client requests
+ * or because of suspend/resume operations.
+ */
 enum GNUNET_FS_Status
 {
   GNUNET_FS_STATUS_UPLOAD_START,
@@ -334,16 +437,19 @@
   GNUENT_FS_STATUS_UPLOAD_ERROR,
   GNUNET_FS_STATUS_UPLOAD_COMPLETED,
   GNUNET_FS_STATUS_UPLOAD_STOPPED,
-  GNUNET_FS_DOWNLOAD_START,
-  GNUNET_FS_DOWNLOAD_PROGRESS,
-  GNUNET_FS_DOWNLOAD_ERROR,
-  GNUNET_FS_DOWNLOAD_COMPLETED,
-  GNUNET_FS_DOWNLOAD_STOPPED,
-  GNUNET_FS_SEARCH_START,
-  GNUNET_FS_SEARCH_PROGRESS,
-  GNUNET_FS_SEARCH_ERROR,
-  GNUNET_FS_SEARCH_STOPPED
-/* fixme: unindex status codes... */
+  GNUNET_FS_STATUS_DOWNLOAD_START,
+  GNUNET_FS_STATUS_DOWNLOAD_PROGRESS,
+  GNUNET_FS_STATUS_DOWNLOAD_ERROR,
+  GNUNET_FS_STATUS_DOWNLOAD_COMPLETED,
+  GNUNET_FS_STATUS_DOWNLOAD_STOPPED,
+  GNUNET_FS_STATUS_SEARCH_START,
+  GNUNET_FS_STATUS_SEARCH_PROGRESS,
+  GNUNET_FS_STATUS_SEARCH_ERROR,
+  GNUNET_FS_STATUS_SEARCH_STOPPED,
+  GNUNET_FS_STATUS_UNINDEX_START,
+  GNUNET_FS_STATUS_UNINDEX_PROGRESS,
+  GNUNET_FS_STATUS_UNINDEX_ERROR,
+  GNUNET_FS_STATUS_UNINDEX_STOPPED
 };
 
 
@@ -392,6 +498,7 @@
  *        stop this specific operation (do not share this file or skip
  *        this download; GNUNET_NO has no meaning for search results);
  *        GNUNET_YES to continue processing as usual
+ * @deprecated (use 2-arg function getting union argument instead)
  */
 typedef int (*GNUNET_FS_ProgressCallback)
   (void *cls,
@@ -416,248 +523,342 @@
 
 
 /**
-* Setup a connection to the file-sharing service.
-*
-* @param client_name unique identifier for this client 
+ * Setup a connection to the file-sharing service.
+ *
+ * @param sched scheduler to use
+ * @param cfg configuration to use
+ * @param client_name unique identifier for this client 
+ * @param upcb function to call to notify about FS actions
+ * @param upcb_cls closure for upcb
  */
 struct GNUNET_FS_Handle *
 GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
-                     struct GNUNET_CONFIGURATION_Handle *cfg,
+                struct GNUNET_CONFIGURATION_Handle *cfg,
                 const char *client_name,
-        GNUNET_FS_ProgressCallback upcb,
-                     void *upcb_closure);
+                GNUNET_FS_ProgressCallback upcb,
+                void *upcb_cls);
 
+
 /**
-* Close our connection with the file-sharing service.
-* The callback given to GNUNET_FS_start will no longer be
-* called after this function returns.
-*/                    
-void GNUNET_FS_stop (struct GNUNET_FS_Handle *h); 
+ * Close our connection with the file-sharing service.
+ * The callback given to GNUNET_FS_start will no longer be
+ * called after this function returns.
+ *
+ * @param h handle that was returned from GNUNET_FS_start
+ */                    
+void 
+GNUNET_FS_stop (struct GNUNET_FS_Handle *h); 
 
 
 /**
-* Handle to one of our namespaces.
-*/
+ * Handle to one of our namespaces.
+ */
 struct GNUNET_FS_Namespace;
 
+
+/**
+ * Handle for controlling an upload.
+ */
 struct GNUNET_FS_ShareContext;
 
+
 /**
  * Share a file or directory.
  *
+ * @param h handle to the file sharing subsystem
  * @param ctx initial value to use for the '*ctx' in the callback
+ * @param filename name of the file or directory to share
+ * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
+ *                GNUNET_SYSERR for simulation
+ * @param anonymity what is the desired anonymity level for sharing?
  * @param priority what is the priority for OUR node to
  *   keep this file available?  Use 0 for maximum anonymity and
  *   minimum reliability...
- * @param do_index GNUNET_YES for index, GNUNET_NO for insertion,
- *                GNUNET_SYSERR for simulation
+ * @param expirationTime when should this content expire?
  * @param namespace namespace to share the file in, NULL for no namespace
  * @param nid identifier to use for the shared 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 
  *        (can be NULL, must be NULL if namespace or nid is NULL)
+ * @deprecated API not powerful enough to share complex directory structures
+ *         with metadata in general (need to pre-build tree)
  */
 struct GNUNET_FS_ShareContext *
- GNUNET_FS_share_start (struct GNUNET_FS_Handle *h,
-                    void *ctx,
-                     const char *filename,
-                     int do_index,
-                     unsigned int anonymity,
-                     unsigned int priority,
-                     struct GNUNET_TIME_Absolute expirationTime,
-                    struct GNUNET_FS_Namespace *namespace
-                     const char *nid, const char *nuid);
+GNUNET_FS_share_start (struct GNUNET_FS_Handle *h,
+                      void *ctx,
+                      const char *filename,
+                      int do_index,
+                      unsigned int anonymity,
+                      unsigned int priority,
+                      struct GNUNET_TIME_Absolute expirationTime,
+                      struct GNUNET_FS_Namespace *namespace
+                      const char *nid,
+                      const char *nuid);
 
-void GNUNET_FS_share_stop (struct GNUNET_FS_ShareContext *sc);
 
 /**
+ * Stop an upload.  Will abort incomplete uploads (but 
+ * not remove blocks that have already been shared) or
+ * simply clean up the state for completed uploads.
+ *
+ * @param sc context for the upload to stop
+ */
+void 
+GNUNET_FS_share_stop (struct GNUNET_FS_ShareContext *sc);
+
+
+/**
+ * Type of a function called by "GNUNET_FS_get_indexed_files".
+ *
+ * @param cls closure
+ * @param filename the name of the file
  * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
  */
-typedef int (*GNUNET_FS_FileProcessor) (void *cls, const char *filename);
+typedef int (*GNUNET_FS_FileProcessor) (void *cls,
+                                       const char *filename);
 
 
 /**
  * Iterate over all indexed files.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param iterator function to call on each indexed file
+ * @param iterator_cls closure for iterator
  */
-void GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *sched,
-                                   GNUNET_FS_FileProcessor iterator,
-                                   void *iterator_closure);
+void 
+GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h,
+                            GNUNET_FS_FileProcessor iterator,
+                            void *iterator_cls);
 
+
 /**
  * Unindex a file.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param filename file to unindex
  */
-void GNUNET_FS_unindex (struct GNUNET_FS_Handle *h,
-                              const char *filename,
-                              );
+void
+GNUNET_FS_unindex (struct GNUNET_FS_Handle *h,
+                  const char *filename);
 
 
 /**
- * Create a new namespace (and publish an advertismement).
- * This publishes both an GNUNET_EC_NBlock in the namespace itself
- * as well as KNBlocks under all keywords specified in
- * the advertisementURI.
+ * Publish an advertismement for a namespace.  
  *
+ * @param h handle to the file sharing subsystem
+ * @param namespace handle for the namespace that should be advertised
+ * @param meta meta-data for the namespace advertisement
  * @param anonymity for the namespace advertismement
  * @param priority for the namespace advertisement
  * @param expiration for the namespace advertisement
  * @param advertisementURI the keyword (!) URI to advertise the
- *        namespace under (GNUNET_EC_KNBlock)
- * @param meta meta-data for the namespace advertisement
- *        (will be used to derive a name)
+ *        namespace under (we will create a GNUNET_EC_KNBlock)
  * @param rootEntry name of the root entry in the namespace (for
  *        the namespace advertisement)
  *
  * @return uri of the advertisement
  */
 struct GNUNET_FS_Uri *
-GNUNET_FS_namespace_advertise (struct GNUNET_FS_Namespace *namespace,
-                                                      const struct
-                                                      GNUNET_MetaData
-                                                      *meta,
-                                                      unsigned int
-                                                      anonymity,
-                                                      unsigned int priority,
-                                                      struct 
GNUNET_TIME_Absolute
-                                                      expiration,
-                                                      const struct
-                                                      GNUNET_FS_Uri
-                                                      *advertisementURI,
-                                                      const char *rootEntry);
+GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
+                              struct GNUNET_FS_Namespace *namespace,
+                              const struct GNUNET_MetaData *meta,
+                              unsigned int anonymity,
+                              unsigned int priority,
+                              struct GNUNET_TIME_Absolute expiration,
+                              const struct GNUNET_FS_Uri *advertisementURI,
+                              const char *rootEntry);
 
+
 /**
  * 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
  */
 struct GNUNET_FS_Namespace *
 GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h,
-                           const char *name,
-       const char *root);
+                           const char *name);
 
+
 /**
- * Delete a namespace handle.
+ * Delete a namespace handle.  Can be used for a clean shutdown (free
+ * 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 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);
+int 
+GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace,
+                           int freeze);
 
 
 /**
  * Callback with information about local (!) namespaces.
  * Contains the names of the local namespace and the global
  * ID.
+ *
+ * @param cls closure
+ * @param name human-readable identifier of the namespace
+ * @param id hash identifier for the namespace
  */
 typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls,
-                                                 const char *name,
-const char *root,
-               const GNUNET_HashCode *id);
+                                                 const char *name,
+                                                 const GNUNET_HashCode *id);
 
+
 /**
- * Build a list of all available local (!) namespaces
- * The returned names are only the nicknames since
- * we only iterate over the local namespaces.
+ * Build a list of all available local (!) namespaces The returned
+ * names are only the nicknames since we only iterate over the local
+ * namespaces.
  *
- * @param list where to store the names (is allocated, caller frees)
+ * @param h handle to the file sharing subsystem
+ * @param cb function to call on each known namespace
+ * @param cb_cls closure for cb
  * @return GNUNET_SYSERR on error, otherwise the number of pseudonyms in list
  */
-int GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h,
-                                GNUNET_FS_NamespaceProcessor cb,
-                                void *cls);
+int 
+GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h,
+                         GNUNET_FS_NamespaceProcessor cb,
+                         void *cb_cls);
 
-typedef void (*GNUNET_FS_IdentifierProcessor)(void *cls,
-       const char *last_id, const struct GNUNET_FS_Uri *last_uri,
-        const struct GNUNET_CONTAINER_MetaData *last_meta,
-const char *next_id);
 
 /**
+ * Function called on updateable identifiers.
+ *
+ * @param cls closure
+ * @param last_id last identifier 
+ * @param last_uri uri used for the content published under the last_id
+ * @param last_meta metadata associated with last_uri
+ * @param next_id identifier that should be used for updates
+ */
+typedef void 
+(*GNUNET_FS_IdentifierProcessor)(void *cls,
+                                const char *last_id, 
+                                const struct GNUNET_FS_Uri *last_uri,
+                                const struct GNUNET_CONTAINER_MetaData 
*last_meta,
+                                const char *next_id);
+
+
+/**
  * List all of the identifiers in the namespace for 
  * which we could produce an update.
  *
+ * @param namespace namespace to inspect for updateable content
+ * @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_IdentifierProcessor ip, 
-                           void *ip_cls);
+GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace,
+                                    GNUNET_FS_IdentifierProcessor ip, 
+                                    void *ip_cls);
 
 
+/**
+ * Handle for controlling a search.
+ */
 struct GNUNET_FS_SearchContext;
 
+
 /**
  * Start search for content.
  *
- * @param uri specifies the search parameters;
- *        this must be a simple URI (with a single
- *        keyword)
+ * @param h handle to the file sharing subsystem
+ * @param uri specifies the search parameters; can be
+ *        a KSK URI or an SKS URI.
+ * @param anonymity desired level of anonymity
+ * @return context that can be used to control the search
  */
 struct GNUNET_FS_SearchContext *
-GNUNET_FS_search_start (struct
-                        GNUNET_FS_Handle *h,
-                                                            const struct
-                                                            GNUNET_FS_Uri
-                                                            *uri,
-                                                            unsigned int
-                                                            anonymity
-                                                            );
+GNUNET_FS_search_start (struct GNUNET_FS_Handle *h,
+                       const struct GNUNET_FS_Uri *uri,
+                       unsigned int anonymity);
 
 
-void GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc);
+/**
+ * Pause search.  
+ *
+ * @param sc context for the search that should be paused
+ */
+void 
+GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc);
 
-void GNUNET_FS_search_resume (struct GNUNET_FS_SearchContext *sc);
 
 /**
+ * Resume paused search.
+ *
+ * @param sc context for the search that should be resumed
+ */
+void 
+GNUNET_FS_search_resume (struct GNUNET_FS_SearchContext *sc);
+
+
+/**
  * Stop search for content.
  *
- * @param uri specifies the search parameters
- * @param uri set to the URI of the uploaded file
+ * @param sc context for the search that should be stopped
  */
-void GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sctx);
+void 
+GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc);
 
 
+/**
+ * Context for controlling a download.
+ */
 struct GNUNET_FS_DownloadContext;
 
+
 /**
  * Download parts of a file.  Note that this will store
  * the blocks at the respective offset in the given file.  Also, the
  * download is still using the blocking of the underlying FS
  * encoding.  As a result, the download may *write* outside of the
  * given boundaries (if offset and length do not match the 32k FS
- * block boundaries).  <p>
+ * block boundaries). <p>
  *
  * This function should be used to focus a download towards a
  * particular portion of the file (optimization), not to strictly
  * limit the download to exactly those bytes.
  *
- * @param uri the URI of the file (determines what to download)
+ * @param h handle to the file sharing subsystem
+ * @param uri the URI of the file (determines what to download); CHK or LOC URI
  * @param filename where to store the file, maybe NULL (then no file is
- *        created on disk)
+ *        created on disk and data must be grabbed from the callbacks)
+ * @param offset at what offset should we start the download (typically 0)
+ * @param length how many bytes should be downloaded starting at offset
+ * @param anonymity anonymity level to use for the download
  * @param no_temporaries set to GNUNET_YES to disallow generation of temporary 
files
- * @param start starting offset
- * @param length length of the download (starting at offset)
+ * @param recursive should this be a recursive download (useful for directories
+ *        to automatically trigger download of files in the directories)
+ * @param parent parent download to associate this download with (use NULL
+ *        for top-level downloads; useful for manually-triggered recursive 
downloads)
+ * @return context that can be used to control this download
  */
-struct GNUNET_FS_DownloadContext
-  *GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
-                                            const struct GNUNET_FS_Uri *uri,
-                                            const char *filename,
-                                            unsigned long long offset,
-                                            unsigned long long length,
-                                            unsigned int anonymity,
-                                            int no_temporaries,        
-                                           int recursive,
-                                           struct GNUNET_FS_DownloadContext 
*parent);
+struct GNUNET_FS_DownloadContext *
+GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
+                              const struct GNUNET_FS_Uri *uri,
+                              const char *filename,
+                              unsigned long long offset,
+                              unsigned long long length,
+                              unsigned int anonymity,
+                              int no_temporaries,      
+                              int recursive,
+                              struct GNUNET_FS_DownloadContext *parent);
 
+
 /**
  * Stop a download (aborts if download is incomplete).
+ *
+ * @param rm handle for the download
  * @param do_delete delete files of incomplete downloads
  */
-int
-GNUNET_FS_file_download_stop (struct GNUNET_FS_DownloadContext
-                                        *rm,
+void
+GNUNET_FS_file_download_stop (struct GNUNET_FS_DownloadContext *rm,
                              int do_delete);
 
 
@@ -668,91 +869,103 @@
  * a client can call this function on the buffer in the
  * GNUNET_FS_ProgressCallback.
  *
+ * @param size number of bytes in data
  * @param data pointer to the beginning of the directory
- * @param size number of bytes in data
- * @param offset offset of data in the file
+ * @param offset offset of data in the directory
+ * @param spcb function to call on each entry
+ * @param spcb_cls closure for spcb
  */
-void GNUNET_FS_directory_list_contents (size_t size,
-                                       const void *data,
-                                       uint64_t offset,
-                                         GNUNET_FS_SearchResultProcessor
-                                         spcb, void *spcbClosure);
+void 
+GNUNET_FS_directory_list_contents (size_t size,
+                                  const void *data,
+                                  uint64_t offset,
+                                  GNUNET_FS_SearchResultProcessor spcb, 
+                                  void *spcb_cls);
 
+
 /**
  * Create a directory.
  *
  * @param data pointer set to the beginning of the directory
  * @param len set to number of bytes in data
  * @param count number of entries in uris and metaDatas
+
  * @param uris URIs of the files in the directory
  * @param metaDatas meta-data for the files (must match
  *        respective values at same offset in in uris)
  * @param meta meta-data for the directory.  The meta entry
  *        is extended with the mime-type for a GNUnet directory.
+
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @deprecated (not powerful enough?)
  */
-int GNUNET_FS_directory_create (
-                                  char **data,
-                                  unsigned long long *len,
-                                  unsigned int count,
-                                  const GNUNET_FS_FileInfo * fis,
-                                  struct GNUNET_MetaData *meta);
+int 
+GNUNET_FS_directory_create (char **data,
+                           uint64_t *len,
+                           unsigned int count,
+                           const GNUNET_FS_FileInfo * fis,
+                           struct GNUNET_MetaData *meta);
 
 
-
-
 /**
  * Initialize collection.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param namespace namespace to use for the collection
+ * @return GNUNET_OK on success, GNUNET_SYSERR if another
+ *         namespace is already set for our collection
  */
-void GNUNET_FS_collection_start (struct GNUNET_FS_Handle *h,
-                    struct GNUNET_FS_Namespace *namespace);
+int 
+GNUNET_FS_collection_start (struct GNUNET_FS_Handle *h,
+                           struct GNUNET_FS_Namespace *namespace);
 
+
 /**
  * Stop collection.
  *
+ * @param h handle to the file sharing subsystem
  * @return GNUNET_OK on success, GNUNET_SYSERR if no collection is active
  */
-int GNUNET_CO_collection_stop (struct GNUNET_FS_Handle *h);
+int 
+GNUNET_CO_collection_stop (struct GNUNET_FS_Handle *h);
 
 
 /**
  * Are we using a collection?
  *
+ * @param h handle to the file sharing subsystem
  * @return NULL if there is no collection,
  */
-struct GNUNET_FS_Namespace *GNUNET_FS_collection_get(struct GNUNET_FS_Handle 
*h);
+struct GNUNET_FS_Namespace *
+GNUNET_FS_collection_get(struct GNUNET_FS_Handle *h);
 
+
 /**
  * Publish an update of the current collection information to the
  * network now.  The function has no effect if the collection has not
  * changed since the last publication.  If we are currently not
  * collecting, this function does nothing.
+ *
+ * @param h handle to the file sharing subsystem
  */
 void GNUNET_FS_collection_publish (struct GNUNET_FS_Handle *h);
 
+
 /**
  * If we are currently building a collection, publish the given file
  * information in that collection.  If we are currently not
  * collecting, this function does nothing.
+ *
+ * @param h handle to the file sharing subsystem
+ * @param uri uri to add to the collection
+ * @param meta metadata for the uri
  */
 void GNUNET_FS_collection_add (const struct GNUNET_FS_Handle *h,
-               const struct GNUNET_FS_Uri *uri,
-        const struct GNUNET_CONTAINER_MetaData *meta);
+                              const struct GNUNET_FS_Uri *uri,
+                              const struct GNUNET_CONTAINER_MetaData *meta);
 
 
 
-/**
- * Convert namespace URI to a human readable format
- * (using the namespace description, if available).
- */
-char *GNUNET_FS_uri_sks_to_string_fancy (
-                                                  struct
-                                                  GNUNET_CONFIGURATION_Handle 
*cfg,
-                                                  const struct GNUNET_FS_Uri
-                                                  *uri);
-
-
-
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]