GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
* @file include/gnunet_fs_service.h
* @brief API for file-sharing via GNUnet
* @author Christian Grothoff
- *
- * TODO:
- * - extend API with support for publish simulation (-s)
- * and URI-argument binding to keyword/namespace (-u)
*/
#ifndef GNUNET_FS_LIB_H
#define GNUNET_FS_LIB_H
*/
struct GNUNET_FS_Uri *
GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TIME_Absolute expiration_time);
*/
GNUNET_FS_STATUS_SEARCH_SUSPEND,
- /**
- * Event generated for each search result
- * when the respective search is suspended.
- */
- GNUNET_FS_STATUS_SEARCH_SUSPEND_RESULT,
-
/**
* This search has yielded a result.
*/
/**
* Context for controlling the upload.
*/
- struct GNUNET_FS_PublishContext *sc;
+ struct GNUNET_FS_PublishContext *pc;
/**
* Information about the file that is being publishd.
*/
uint32_t anonymity;
+ /**
+ * Is the download currently active.
+ */
+ int is_active;
+
/**
* Additional values for specific events.
*/
/**
* Client parent-context pointer; NULL for top-level searches,
- * non-NULL for automatically triggered searches for updates in
- * namespaces.
+ * refers to the client context of the associated search result
+ * for automatically triggered searches for updates in
+ * namespaces. In this case, 'presult' refers to that search
+ * result.
*/
void *pctx;
*/
struct GNUNET_FS_SearchResult *result;
+ /**
+ * Applicability rank (the larger, the better the result
+ * fits the search criteria).
+ */
+ uint32_t applicability_rank;
+
} result;
/**
GNUNET_FS_stop (struct GNUNET_FS_Handle *h);
+/**
+ * Extract meta-data from a file.
+ *
+ * @param md metadata to set
+ * @param filename name of file to inspect
+ * @param extractors plugins to use
+ * @return GNUNET_SYSERR on error, otherwise the number
+ * of meta-data items obtained
+ */
+int
+GNUNET_FS_meta_data_extract_from_file (struct
+ GNUNET_CONTAINER_MetaData
+ *md, const char *filename,
+ struct EXTRACTOR_PluginList *
+ extractors);
+
+
/**
* Function called on entries in a GNUNET_FS_FileInformation publish-structure.
*
* @param uri pointer to the keywords that will be used for this entry (can be modified)
* @param anonymity pointer to selected anonymity level (can be modified)
* @param priority pointer to selected priority (can be modified)
+ * @param do_index should we index (can be modified)
* @param expirationTime pointer to selected expiration time (can be modified)
* @param client_info pointer to client context set upon creation (can be modified)
* @return GNUNET_OK to continue, GNUNET_NO to remove
struct GNUNET_FS_Uri **uri,
uint32_t *anonymity,
uint32_t *priority,
+ int *do_index,
struct GNUNET_TIME_Absolute *expirationTime,
void **client_info);
struct GNUNET_TIME_Absolute expirationTime);
+/**
+ * Test if a given entry represents a directory.
+ *
+ * @param ent check if this FI represents a directory
+ * @return GNUNET_YES if so, GNUNET_NO if not
+ */
+int
+GNUNET_FS_file_information_is_directory (struct GNUNET_FS_FileInformation *ent);
+
+
/**
* Add an entry to a directory in a publish-structure. Clients
* should never modify publish structures that were passed to
int do_delete);
-/**
- * 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
- */
-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_FS_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);
-
-
-/**
- * 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);
-
-
-
-
/* ******************** Directory API *********************** */
* @param offset offset of data in the directory
* @param dep function to call on each entry
* @param dep_cls closure for dep
+ * @return GNUNET_OK if this could be a block in a directory,
+ * GNUNET_NO if this could be part of a directory (but not 100% OK)
+ * GNUNET_SYSERR if 'data' does not represent a directory
*/
-void
+int
GNUNET_FS_directory_list_contents (size_t size,
const void *data,
uint64_t offset,