File sharing. More...
Modules | |
Metadata | |
Meta data processingGNU libextractor key-value pairs. | |
Data Structures | |
struct | GNUNET_FS_ProgressInfo |
Argument given to the progress callback with information about what is going on. More... | |
struct | GNUNET_FS_BlockOptions |
Settings for publishing a block (which may of course also apply to an entire directory or file). More... | |
struct | GNUNET_FS_ShareTreeItem |
A node of a directory tree (produced by dirscanner) More... | |
Macros | |
#define | GNUNET_FS_VERSION 0x00090300 |
Version number of the implementation. More... | |
#define | EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 180 |
#define | GNUNET_FS_URI_PREFIX "gnunet://fs/" |
#define | GNUNET_FS_URI_KSK_INFIX "ksk/" |
#define | GNUNET_FS_URI_SKS_INFIX "sks/" |
#define | GNUNET_FS_URI_CHK_INFIX "chk/" |
#define | GNUNET_FS_URI_LOC_INFIX "loc/" |
#define | GNUNET_FS_PROBE_UPDATE_FREQUENCY |
How often do we signal applications that a probe for a particular search result is running? (used to visualize probes). More... | |
#define | GNUNET_FS_DIRECTORY_MIME "application/gnunet-directory" |
#define | GNUNET_FS_DIRECTORY_MAGIC "\211GND\r\n\032\n" |
#define | GNUNET_FS_DIRECTORY_EXT ".gnd" |
Typedefs | |
typedef int(* | GNUNET_FS_KeywordIterator) (void *cls, const char *keyword, int is_mandatory) |
Iterator over keywords. More... | |
typedef void *(* | GNUNET_FS_ProgressCallback) (void *cls, const struct GNUNET_FS_ProgressInfo *info) |
Notification of FS to a client about the progress of an operation. More... | |
typedef int(* | GNUNET_FS_FileInformationProcessor) (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_FS_MetaData *meta, struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) |
Function called on entries in a struct GNUNET_FS_FileInformation iteration. More... | |
typedef size_t(* | GNUNET_FS_DataReader) (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) |
Function that provides data. More... | |
typedef void(* | GNUNET_FS_PublishContinuation) (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) |
Signature of a function called as the continuation of a KBlock or SBlock publication. More... | |
typedef int(* | GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filename, const struct GNUNET_HashCode *file_id) |
Type of a function called by GNUNET_FS_get_indexed_files. More... | |
typedef void(* | GNUNET_FS_IdentifierProcessor) (void *cls, const char *last_id, const struct GNUNET_FS_Uri *last_uri, const struct GNUNET_FS_MetaData *last_meta, const char *next_id) |
Function called on updateable identifiers. More... | |
typedef void(* | GNUNET_FS_DirectoryEntryProcessor) (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, size_t length, const void *data) |
Function used to process entries in a directory. More... | |
typedef void(* | GNUNET_FS_DirScannerProgressCallback) (void *cls, const char *filename, int is_directory, enum GNUNET_FS_DirScannerProgressUpdateReason reason) |
Function called over time as the directory scanner makes progress on the job at hand. More... | |
Functions | |
int | GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, struct GNUNET_HashCode *key) |
Get a unique key from a URI. More... | |
char * | GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri) |
Convert a URI to a UTF-8 String. More... | |
char * | GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri) |
Convert keyword URI to a human readable format (i.e. More... | |
void | GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, const char *keyword, int is_mandatory) |
Add the given keyword to the set of keywords represented by the URI. More... | |
void | GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, const char *keyword) |
Remove the given keyword from the set of keywords represented by the URI. More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_parse (const char *uri, char **emsg) |
Convert a UTF-8 String to a URI. More... | |
void | GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri) |
Free URI. More... | |
unsigned int | GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri) |
How many keywords are ANDed in this keyword URI? More... | |
int | GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, GNUNET_FS_KeywordIterator iterator, void *iterator_cls) |
Iterate over all keywords in this keyword URI. More... | |
int | GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, struct GNUNET_PeerIdentity *peer) |
Obtain the identity of the peer offering the data. More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_loc_get_uri (const struct GNUNET_FS_Uri *uri) |
Obtain the URI of the content itself. More... | |
struct GNUNET_TIME_Absolute | GNUNET_FS_uri_loc_get_expiration (const struct GNUNET_FS_Uri *uri) |
Obtain the expiration of the LOC URI. More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *base_uri, const struct GNUNET_CRYPTO_EddsaPrivateKey *sign_key, struct GNUNET_TIME_Absolute expiration_time) |
Construct a location URI (this peer will be used for the location). More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, const struct GNUNET_FS_Uri *u2) |
Merge the sets of keywords from two KSK URIs. More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri) |
Duplicate URI. More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_ksk_create (const char *keywords, char **emsg) |
Create an FS URI from a single user-supplied string of keywords. More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, const char **argv) |
Create an FS URI from a user-supplied command line of keywords. More... | |
int | GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, const struct GNUNET_FS_Uri *u2) |
Test if two URIs are equal. More... | |
int | GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri) |
Is this a namespace URI? More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *id) |
Create an SKS URI from a namespace ID and an identifier. More... | |
int | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, struct GNUNET_CRYPTO_EcdsaPublicKey *pseudonym) |
Get the public key of a namespace from the given namespace URI. More... | |
char * | GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri) |
Get the content identifier of an SKS URI. More... | |
int | GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri) |
Is this a keyword URI? More... | |
int | GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri) |
Is this a file (or directory) URI? More... | |
uint64_t | GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri) |
What is the size of the file that this URI refers to? More... | |
const struct GNUNET_HashCode * | GNUNET_FS_uri_chk_get_file_hash (const struct GNUNET_FS_Uri *uri) |
What is the hash of the original file's content that this URI refers to? More... | |
int | GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri) |
Is this a location URI? More... | |
struct GNUNET_FS_Uri * | GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_FS_MetaData *md) |
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). More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_FS_GETOPT_KEYWORDS (char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_FS_Uri **topKeywords) |
Allow user to specify keywords. More... | |
struct GNUNET_GETOPT_CommandLineOption | GNUNET_FS_GETOPT_METADATA (char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_FS_MetaData **meta) |
Allow user to specify metadata. More... | |
int | GNUNET_FS_getopt_set_metadata (struct 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. More... | |
struct GNUNET_FS_Handle * | GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *client_name, GNUNET_FS_ProgressCallback upcb, void *upcb_cls, enum GNUNET_FS_Flags flags,...) |
Setup a connection to the file-sharing service. More... | |
void | GNUNET_FS_stop (struct GNUNET_FS_Handle *h) |
Close our connection with the file-sharing service. More... | |
const char * | GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s) |
Obtain the name under which this file information structure is stored on disk. More... | |
const char * | GNUNET_FS_file_information_get_filename (const struct GNUNET_FS_FileInformation *s) |
Obtain the filename from the file information structure. More... | |
void | GNUNET_FS_file_information_set_filename (struct GNUNET_FS_FileInformation *s, const char *filename) |
Set the filename in the file information structure. More... | |
struct GNUNET_FS_FileInformation * | GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, void *client_info, const char *filename, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, int do_index, const struct GNUNET_FS_BlockOptions *bo) |
Create an entry for a file in a publish-structure. More... | |
struct GNUNET_FS_FileInformation * | GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, void *client_info, uint64_t length, void *data, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, int do_index, const struct GNUNET_FS_BlockOptions *bo) |
Create an entry for a file in a publish-structure. More... | |
struct GNUNET_FS_FileInformation * | GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, void *client_info, uint64_t length, GNUNET_FS_DataReader reader, void *reader_cls, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, int do_index, const struct GNUNET_FS_BlockOptions *bo) |
Create an entry for a file in a publish-structure. More... | |
struct GNUNET_FS_FileInformation * | GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, void *client_info, const struct GNUNET_FS_Uri *keywords, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_BlockOptions *bo, const char *filename) |
Create an entry for an empty directory in a publish-structure. More... | |
int | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation *ent) |
Test if a given entry represents a directory. More... | |
int | GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, struct GNUNET_FS_FileInformation *ent) |
Add an entry to a directory in a publish-structure. More... | |
void | GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, GNUNET_FS_FileInformationProcessor proc, void *proc_cls) |
Inspect a file or directory in a publish-structure. More... | |
void | GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, GNUNET_FS_FileInformationProcessor cleaner, void *cleaner_cls) |
Destroy publish-structure. More... | |
struct GNUNET_FS_PublishContext * | GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, struct GNUNET_FS_FileInformation *fi, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *nid, const char *nuid, enum GNUNET_FS_PublishOptions options) |
Publish a file or directory. More... | |
void | GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) |
Stop a publication. More... | |
struct GNUNET_FS_PublishKskContext * | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *ksk_uri, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_PublishContinuation cont, void *cont_cls) |
Publish a KBlock on GNUnet. More... | |
void | GNUNET_FS_publish_ksk_cancel (struct GNUNET_FS_PublishKskContext *pkc) |
Abort the KSK publishing operation. More... | |
struct GNUNET_FS_PublishSksContext * | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *identifier, const char *update, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_PublishContinuation cont, void *cont_cls) |
Publish an SBlock on GNUnet. More... | |
void | GNUNET_FS_publish_sks_cancel (struct GNUNET_FS_PublishSksContext *psc) |
Abort the SKS publishing operation. More... | |
struct GNUNET_FS_GetIndexedContext * | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, GNUNET_FS_IndexedFileProcessor iterator, void *iterator_cls) |
Iterate over all indexed files. More... | |
void | GNUNET_FS_get_indexed_files_cancel (struct GNUNET_FS_GetIndexedContext *gic) |
Cancel iteration over all indexed files. More... | |
struct GNUNET_FS_UnindexContext * | GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, const char *filename, void *cctx) |
Unindex a file. More... | |
void | GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc) |
Clean up after completion of an unindex operation. More... | |
void | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *next_id, GNUNET_FS_IdentifierProcessor ip, void *ip_cls) |
List all of the identifiers in the namespace for which we could produce an update. More... | |
struct GNUNET_FS_SearchContext * | GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, uint32_t anonymity, enum GNUNET_FS_SearchOptions options, void *cctx) |
Start search for content. More... | |
void | GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc) |
Pause search. More... | |
void | GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc) |
Continue paused search. More... | |
void | GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc) |
Stop search for content. More... | |
struct GNUNET_FS_SearchResult * | GNUNET_FS_probe (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, void *client_info, uint32_t anonymity) |
Start download probes for the given search result. More... | |
void * | GNUNET_FS_probe_stop (struct GNUNET_FS_SearchResult *sr) |
Stop probe activity. More... | |
struct GNUNET_FS_DownloadContext * | GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, const char *filename, const char *tempname, uint64_t offset, uint64_t length, uint32_t anonymity, enum GNUNET_FS_DownloadOptions options, void *cctx, struct GNUNET_FS_DownloadContext *parent) |
Download parts of a file. More... | |
struct GNUNET_FS_DownloadContext * | GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, struct GNUNET_FS_SearchResult *sr, const char *filename, const char *tempname, uint64_t offset, uint64_t length, uint32_t anonymity, enum GNUNET_FS_DownloadOptions options, void *cctx) |
Download parts of a file based on a search result. More... | |
void | GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete) |
Stop a download (aborts if download is incomplete). More... | |
void | GNUNET_FS_download_suspend (struct GNUNET_FS_DownloadContext *dc) |
Suspend a download. More... | |
void | GNUNET_FS_download_resume (struct GNUNET_FS_DownloadContext *dc) |
Resume a suspended download. More... | |
int | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_FS_MetaData *md) |
Does the meta-data claim that this is a directory? Checks if the mime-type is that of a GNUnet directory. More... | |
void | GNUNET_FS_meta_data_make_directory (struct GNUNET_FS_MetaData *md) |
Set the MIMETYPE information for the given metadata to "application/gnunet-directory". More... | |
char * | GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_FS_MetaData *md) |
Suggest a filename based on given metadata. More... | |
int | GNUNET_FS_directory_list_contents (size_t size, const void *data, uint64_t offset, GNUNET_FS_DirectoryEntryProcessor dep, void *dep_cls) |
Iterate over all entries in a directory. More... | |
struct GNUNET_FS_DirectoryBuilder * | GNUNET_FS_directory_builder_create (const struct GNUNET_FS_MetaData *mdir) |
Create a directory builder. More... | |
void | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *md, const void *data) |
Add an entry to a directory. More... | |
int | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, size_t *rsize, void **rdata) |
Finish building the directory. More... | |
struct GNUNET_FS_DirScanner * | GNUNET_FS_directory_scan_start (const char *filename, int disable_extractor, const char *ex, GNUNET_FS_DirScannerProgressCallback cb, void *cb_cls) |
Start a directory scanner. More... | |
void | GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds) |
Abort the scan. More... | |
struct GNUNET_FS_ShareTreeItem * | GNUNET_FS_directory_scan_get_result (struct GNUNET_FS_DirScanner *ds) |
Obtain the result of the scan after the scan has signalled completion. More... | |
void | GNUNET_FS_share_tree_trim (struct GNUNET_FS_ShareTreeItem *toplevel) |
Process a share item tree, moving frequent keywords up and copying frequent metadata up. More... | |
void | GNUNET_FS_share_tree_free (struct GNUNET_FS_ShareTreeItem *toplevel) |
Release memory of a share item tree. More... | |
enum GNUNET_GenericReturnValue | GNUNET_FS_write_meta_data (struct GNUNET_BIO_WriteHandle *h, const char *what, const struct GNUNET_FS_MetaData *m) |
Write a metadata container. More... | |
struct GNUNET_BIO_ReadSpec | GNUNET_FS_read_spec_meta_data (const char *what, struct GNUNET_FS_MetaData **result) |
Create the specification to read a metadata container. More... | |
struct GNUNET_BIO_WriteSpec | GNUNET_FS_write_spec_meta_data (const char *what, const struct GNUNET_FS_MetaData *m) |
Create the specification to write a metadata container. More... | |
enum GNUNET_GenericReturnValue | GNUNET_FS_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what, struct GNUNET_FS_MetaData **result) |
Read a metadata container. More... | |
File sharing.
#define GNUNET_FS_VERSION 0x00090300 |
Version number of the implementation.
History:
1.x.x: initial version with triple GNUNET_hash and merkle tree 2.x.x: root node with mime-type, filename and version number 2.1.x: combined GNUNET_EC_ContentHashKey/3HASH encoding with 25:1 super-nodes 2.2.x: with directories 3.0.x: with namespaces 3.1.x: with namespace meta-data 3.2.x: with collections 4.0.x: with expiration, variable meta-data, kblocks 4.1.x: with new error and configuration handling 5.0.x: with location URIs 6.0.0: with support for OR in KSKs 6.1.x: with simplified namespace support 9.0.0: CPS-style integrated API 9.1.1: asynchronous directory scanning 9.2.0: unified K-Block and S-block format (#2564) 9.3.0: base32crockford encoded URLs
Definition at line 72 of file gnunet_fs_service.h.
#define EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME 180 |
Definition at line 171 of file gnunet_fs_service.h.
#define GNUNET_FS_URI_PREFIX "gnunet://fs/" |
Definition at line 177 of file gnunet_fs_service.h.
#define GNUNET_FS_URI_KSK_INFIX "ksk/" |
Definition at line 178 of file gnunet_fs_service.h.
#define GNUNET_FS_URI_SKS_INFIX "sks/" |
Definition at line 179 of file gnunet_fs_service.h.
#define GNUNET_FS_URI_CHK_INFIX "chk/" |
Definition at line 180 of file gnunet_fs_service.h.
#define GNUNET_FS_URI_LOC_INFIX "loc/" |
Definition at line 181 of file gnunet_fs_service.h.
#define GNUNET_FS_PROBE_UPDATE_FREQUENCY |
How often do we signal applications that a probe for a particular search result is running? (used to visualize probes).
Definition at line 188 of file gnunet_fs_service.h.
#define GNUNET_FS_DIRECTORY_MIME "application/gnunet-directory" |
Definition at line 2582 of file gnunet_fs_service.h.
#define GNUNET_FS_DIRECTORY_MAGIC "\211GND\r\n\032\n" |
Definition at line 2583 of file gnunet_fs_service.h.
#define GNUNET_FS_DIRECTORY_EXT ".gnd" |
Definition at line 2584 of file gnunet_fs_service.h.
typedef int(* GNUNET_FS_KeywordIterator) (void *cls, const char *keyword, int is_mandatory) |
Iterator over keywords.
cls | closure |
keyword | the keyword |
is_mandatory | is the keyword mandatory (in a search) |
Definition at line 211 of file gnunet_fs_service.h.
typedef void *(* GNUNET_FS_ProgressCallback) (void *cls, const struct GNUNET_FS_ProgressInfo *info) |
Notification of FS to a client about the progress of an operation.
Callbacks of this type will be used for uploads, downloads and searches. Some of the arguments depend a bit in their meaning on the context in which the callback is used.
cls | closure |
info | details about the event, specifying the event type and various bits about the event |
struct GNUNET_FS_ProgressInfo
. Definition at line 1669 of file gnunet_fs_service.h.
typedef int(* GNUNET_FS_FileInformationProcessor) (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_FS_MetaData *meta, struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) |
Function called on entries in a struct GNUNET_FS_FileInformation
iteration.
cls | closure |
fi | the entry in the publish-structure |
length | length of the file or directory |
meta | metadata for the file or directory (can be modified) |
uri | pointer to the keywords that will be used for this entry (can be modified) |
bo | block options (can be modified) |
do_index | should we index (can be modified) |
client_info | pointer to client context set upon creation (can be modified) |
Definition at line 1823 of file gnunet_fs_service.h.
typedef size_t(* GNUNET_FS_DataReader) (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) |
Function that provides data.
cls | closure |
offset | offset to read from; it is possible that the caller might need to go backwards a bit at times; set to UINT64_MAX to tell the reader that we won't be reading for a while (used to close the file descriptor but NOT fully clean up the reader's state); in this case, a value of '0' for max should be ignored |
max | maximum number of bytes that should be copied to buf; readers are not allowed to provide less data unless there is an error; a value of "0" will be used at the end to allow the reader to clean up its internal state |
buf | where the reader should write the data |
emsg | location for the reader to store an error message |
Definition at line 1948 of file gnunet_fs_service.h.
typedef void(* GNUNET_FS_PublishContinuation) (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) |
Signature of a function called as the continuation of a KBlock or SBlock publication.
cls | closure |
uri | URI under which the block is now available, NULL on error |
emsg | error message, NULL on success |
Definition at line 2136 of file gnunet_fs_service.h.
typedef int(* GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filename, const struct GNUNET_HashCode *file_id) |
Type of a function called by GNUNET_FS_get_indexed_files.
cls | closure |
filename | the name of the file, NULL for end of list |
file_id | hash of the contents of the indexed file |
Definition at line 2230 of file gnunet_fs_service.h.
typedef void(* GNUNET_FS_IdentifierProcessor) (void *cls, const char *last_id, const struct GNUNET_FS_Uri *last_uri, const struct GNUNET_FS_MetaData *last_meta, const char *next_id) |
Function called on updateable identifiers.
cls | closure |
last_id | last identifier |
last_uri | uri used for the content published under the last_id |
last_meta | metadata associated with last_uri |
next_id | identifier that should be used for updates |
Definition at line 2297 of file gnunet_fs_service.h.
typedef void(* GNUNET_FS_DirectoryEntryProcessor) (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_MetaData *meta, size_t length, const void *data) |
Function used to process entries in a directory.
cls | closure |
filename | name of the file in the directory |
uri | URI of the file |
metadata | metadata for the file; metadata for the directory if everything else is NULL/zero |
length | length of the available data for the file (of type size_t since data must certainly fit into memory; if files are larger than size_t permits, then they will certainly not be embedded with the directory itself). |
data | data available for the file (length bytes) |
Definition at line 2634 of file gnunet_fs_service.h.
typedef void(* GNUNET_FS_DirScannerProgressCallback) (void *cls, const char *filename, int is_directory, enum GNUNET_FS_DirScannerProgressUpdateReason reason) |
Function called over time as the directory scanner makes progress on the job at hand.
cls | closure |
filename | which file we are making progress on |
is_directory | GNUNET_YES if this is a directory, GNUNET_NO if this is a file GNUNET_SYSERR if it is neither (or unknown) |
reason | kind of progress we are making |
Definition at line 2770 of file gnunet_fs_service.h.
enum GNUNET_FS_Status |
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.
Enumerator | |
---|---|
GNUNET_FS_STATUS_PUBLISH_START | Notification that we have started to publish a file structure. |
GNUNET_FS_STATUS_PUBLISH_RESUME | Notification that we have resumed sharing a file structure. |
GNUNET_FS_STATUS_PUBLISH_SUSPEND | Notification that we have suspended sharing a file structure. |
GNUNET_FS_STATUS_PUBLISH_PROGRESS | Notification that we are making progress sharing a file structure. |
GNUNET_FS_STATUS_PUBLISH_ERROR | Notification that an error was encountered sharing a file structure. The application will continue to receive resume/suspend events for this structure until "GNUNET_FS_publish_stop" is called. |
GNUNET_FS_STATUS_PUBLISH_COMPLETED | Notification that we completed sharing a file structure. The application will continue to receive resume/suspend events for this structure until "GNUNET_FS_publish_stop" is called. |
GNUNET_FS_STATUS_PUBLISH_STOPPED | Notification that we have stopped the process of uploading a file structure; no further events will be generated for this action. |
GNUNET_FS_STATUS_DOWNLOAD_START | Notification that we have started this download. |
GNUNET_FS_STATUS_DOWNLOAD_RESUME | Notification that this download is being resumed. |
GNUNET_FS_STATUS_DOWNLOAD_SUSPEND | Notification that this download was suspended. |
GNUNET_FS_STATUS_DOWNLOAD_PROGRESS | Notification about progress with this download. |
GNUNET_FS_STATUS_DOWNLOAD_ERROR | Notification that this download encountered an error. |
GNUNET_FS_STATUS_DOWNLOAD_COMPLETED | Notification that this download completed. Note that for directories, completion does not imply completion of all files in the directory. |
GNUNET_FS_STATUS_DOWNLOAD_STOPPED | Notification that this download was stopped (final event with respect to this action). |
GNUNET_FS_STATUS_DOWNLOAD_ACTIVE | Notification that this download is now actively being pursued (as opposed to waiting in the queue). |
GNUNET_FS_STATUS_DOWNLOAD_INACTIVE | Notification that this download is no longer actively being pursued (back in the queue). |
GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT | Notification that this download is no longer part of a recursive download or search but now a 'stand-alone' download (and may thus need to be moved in the GUI into a different category). |
GNUNET_FS_STATUS_SEARCH_START | First event generated when a client requests a search to begin or when a namespace result automatically triggers the search for updates. |
GNUNET_FS_STATUS_SEARCH_RESUME | Last event when a search is being resumed; note that "GNUNET_FS_SEARCH_START" will not be generated in this case. |
GNUNET_FS_STATUS_SEARCH_RESUME_RESULT | Event generated for each search result when the respective search is resumed. |
GNUNET_FS_STATUS_SEARCH_SUSPEND | Last event when a search is being suspended; note that "GNUNET_FS_SEARCH_STOPPED" will not be generated in this case. |
GNUNET_FS_STATUS_SEARCH_RESULT | This search has yielded a result. |
GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE | We have discovered a new namespace. |
GNUNET_FS_STATUS_SEARCH_UPDATE | We have additional data about the quality or availability of a search result. |
GNUNET_FS_STATUS_SEARCH_ERROR | Signals a problem with this search. |
GNUNET_FS_STATUS_SEARCH_PAUSED | Signals that this search was paused. |
GNUNET_FS_STATUS_SEARCH_CONTINUED | Signals that this search was continued (unpaused). |
GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED | Event generated for each search result when the respective search is stopped. |
GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND | Event generated for each search result when the respective search is suspended. |
GNUNET_FS_STATUS_SEARCH_STOPPED | Last message from a search; this signals that there will be no further events associated with this search. |
GNUNET_FS_STATUS_UNINDEX_START | Notification that we started to unindex a file. |
GNUNET_FS_STATUS_UNINDEX_RESUME | Notification that we resumed unindexing of a file. |
GNUNET_FS_STATUS_UNINDEX_SUSPEND | Notification that we suspended unindexing a file. |
GNUNET_FS_STATUS_UNINDEX_PROGRESS | Notification that we made progress unindexing a file. |
GNUNET_FS_STATUS_UNINDEX_ERROR | Notification that we encountered an error unindexing a file. |
GNUNET_FS_STATUS_UNINDEX_COMPLETED | Notification that the unindexing of this file was completed. |
GNUNET_FS_STATUS_UNINDEX_STOPPED | Notification that the unindexing of this file was stopped (final event for this action). |
GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY | Notification that we are making progress sharing a directory. |
Definition at line 629 of file gnunet_fs_service.h.
enum GNUNET_FS_Flags |
General (global) option flags for file-sharing.
Enumerator | |
---|---|
GNUNET_FS_FLAGS_NONE | No special flags set. |
GNUNET_FS_FLAGS_PERSISTENCE | Is persistence of operations desired? (will create SUSPEND/RESUME events). |
GNUNET_FS_FLAGS_DO_PROBES | Should we automatically trigger probes for search results to determine availability? (will create GNUNET_FS_STATUS_SEARCH_UPDATE events). |
Definition at line 1677 of file gnunet_fs_service.h.
enum GNUNET_FS_OPTIONS |
Options specified in the VARARGs portion of GNUNET_FS_start.
Definition at line 1702 of file gnunet_fs_service.h.
Options for publishing.
Compatible options can be OR'ed together.
Definition at line 2079 of file gnunet_fs_service.h.
Options for searching.
Compatible options can be OR'ed together.
Enumerator | |
---|---|
GNUNET_FS_SEARCH_OPTION_NONE | No options (use defaults for everything). |
GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY | Only search the local host, do not search remote systems (no P2P) |
Definition at line 2341 of file gnunet_fs_service.h.
Options for downloading.
Compatible options can be OR'ed together.
Definition at line 2432 of file gnunet_fs_service.h.
Progress reasons of the directory scanner.
Definition at line 2723 of file gnunet_fs_service.h.
int GNUNET_FS_uri_to_key | ( | const struct GNUNET_FS_Uri * | uri, |
struct GNUNET_HashCode * | key | ||
) |
Get a unique key from a URI.
This is for putting URIs into HashMaps. The key may change between FS implementations.
uri | uri to convert to a unique key |
key | where to store the unique key |
Definition at line 96 of file fs_uri.c.
References FileIdentifier::chk, GNUNET_FS_Uri::chk, GNUNET_FS_Uri::data, Location::fi, GNUNET_CRYPTO_hash(), GNUNET_FS_URI_CHK, GNUNET_FS_URI_KSK, GNUNET_FS_URI_LOC, GNUNET_FS_URI_SKS, GNUNET_OK, GNUNET_SYSERR, GNUNET_FS_Uri::identifier, key, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::loc, ContentHashKey::query, GNUNET_FS_Uri::sks, GNUNET_FS_Uri::type, and uri.
Referenced by process_ksk_result(), and process_sks_result().
char * GNUNET_FS_uri_to_string | ( | const struct GNUNET_FS_Uri * | uri | ) |
Convert a URI to a UTF-8 String.
uri | uri to convert to a string |
Definition at line 2034 of file fs_uri.c.
References GNUNET_break, GNUNET_FS_URI_CHK, GNUNET_FS_URI_KSK, GNUNET_FS_URI_LOC, GNUNET_FS_URI_SKS, GNUNET_FS_Uri::type, uri, uri_chk_to_string(), uri_ksk_to_string(), uri_loc_to_string(), and uri_sks_to_string().
Referenced by GNUNET_FS_directory_builder_add(), GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_ublock_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_search_sync_(), GNUNET_FS_unindex_sync_(), print_entry(), print_search_result(), progress_cb(), run(), trigger_recursive_download(), and write_update_information_graph().
char * GNUNET_FS_uri_ksk_to_string_fancy | ( | 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)
uri | ksk uri to convert to a string |
Definition at line 148 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_break, GNUNET_FS_URI_KSK, GNUNET_malloc, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, ret, GNUNET_FS_Uri::type, and uri.
void GNUNET_FS_uri_ksk_add_keyword | ( | struct GNUNET_FS_Uri * | uri, |
const char * | keyword, | ||
int | is_mandatory | ||
) |
Add the given keyword to the set of keywords represented by the URI.
Does nothing if the keyword is already present.
uri | ksk uri to modify |
keyword | keyword to add |
is_mandatory | is this keyword mandatory? |
Definition at line 752 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_array_append, GNUNET_asprintf(), GNUNET_assert, GNUNET_FS_URI_KSK, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::type, and uri.
Referenced by get_file_information(), and migrate_and_drop_keywords().
void GNUNET_FS_uri_ksk_remove_keyword | ( | struct GNUNET_FS_Uri * | uri, |
const char * | keyword | ||
) |
Remove the given keyword from the set of keywords represented by the URI.
Does nothing if the keyword is not present.
uri | ksk uri to modify |
keyword | keyword to add |
Definition at line 780 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_array_grow, GNUNET_assert, GNUNET_free, GNUNET_FS_URI_KSK, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::type, and uri.
Referenced by remove_high_frequency_keywords().
struct GNUNET_FS_Uri * GNUNET_FS_uri_parse | ( | const char * | uri, |
char ** | emsg | ||
) |
Convert a UTF-8 String to a URI.
uri | string to parse |
emsg | where to store the parser error message (if any) |
FIXME: Do we want to log this?
Definition at line 637 of file fs_uri.c.
References _, GNUNET_break, GNUNET_free, GNUNET_strdup, msg, ret, uri, uri_chk_parse(), uri_ksk_parse(), uri_loc_parse(), and uri_sks_parse().
Referenced by deserialize_download(), deserialize_fi_node(), deserialize_search(), deserialize_search_result(), deserialize_unindex_file(), GNUNET_FS_directory_list_contents(), GNUNET_FS_uri_ksk_create_from_args(), identity_continuation(), process_kblock(), process_kblock_for_unindex(), process_sblock(), read_update_information_graph(), and run().
void GNUNET_FS_uri_destroy | ( | struct GNUNET_FS_Uri * | uri | ) |
Free URI.
uri | uri to free |
Definition at line 677 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_array_grow, GNUNET_free, GNUNET_FS_URI_KSK, GNUNET_FS_URI_LOC, GNUNET_FS_URI_SKS, GNUNET_FS_Uri::identifier, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::sks, GNUNET_FS_Uri::type, and uri.
Referenced by deserialize_search_result(), do_stop_task(), free_download_context(), free_result(), free_search_context(), free_update_information_graph(), GNUNET_FS_directory_builder_add(), GNUNET_FS_directory_list_contents(), GNUNET_FS_download_signal_suspend_(), GNUNET_FS_download_stop(), GNUNET_FS_file_information_destroy(), GNUNET_FS_probe_stop(), GNUNET_FS_publish_ksk_cancel(), GNUNET_FS_publish_sks_cancel(), GNUNET_FS_search_signal_suspend_(), GNUNET_FS_search_stop(), GNUNET_FS_share_tree_free(), GNUNET_FS_tree_encoder_finish(), GNUNET_FS_unindex_signal_suspend_(), GNUNET_FS_unindex_stop(), handle_client_loc_sign(), make_file(), process_kblock(), process_kblock_for_unindex(), process_sblock(), publish_inspector(), run(), search_result_free(), search_result_suspend(), search_start(), and share_tree_trim().
unsigned int GNUNET_FS_uri_ksk_get_keyword_count | ( | const struct GNUNET_FS_Uri * | uri | ) |
How many keywords are ANDed in this keyword URI?
uri | ksk uri to get the number of keywords from |
Definition at line 711 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_FS_URI_KSK, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::type, and uri.
Referenced by fip_signal_start().
int GNUNET_FS_uri_ksk_get_keywords | ( | const struct GNUNET_FS_Uri * | uri, |
GNUNET_FS_KeywordIterator | iterator, | ||
void * | iterator_cls | ||
) |
Iterate over all keywords in this keyword URI.
uri | ksk uri to get the keywords from |
iterator | function to call on each keyword |
iterator_cls | closure for iterator |
Definition at line 720 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_FS_URI_KSK, GNUNET_OK, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::type, and uri.
Referenced by publish_inspector(), and share_tree_trim().
int GNUNET_FS_uri_loc_get_peer_identity | ( | const struct GNUNET_FS_Uri * | uri, |
struct GNUNET_PeerIdentity * | peer | ||
) |
Obtain the identity of the peer offering the data.
uri | the location URI to inspect |
peer | where to store the identify of the peer (presumably) offering the content |
Definition at line 812 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_FS_URI_LOC, GNUNET_OK, GNUNET_SYSERR, GNUNET_FS_Uri::loc, Location::peer, GNUNET_FS_Uri::type, and uri.
Referenced by create_download_context(), and deserialize_download().
struct GNUNET_FS_Uri * GNUNET_FS_uri_loc_get_uri | ( | const struct GNUNET_FS_Uri * | uri | ) |
Obtain the URI of the content itself.
uri | location URI to get the content URI from |
Definition at line 843 of file fs_uri.c.
References GNUNET_FS_Uri::data, Location::fi, GNUNET_FS_URI_CHK, GNUNET_FS_URI_LOC, GNUNET_new, GNUNET_FS_Uri::loc, ret, GNUNET_FS_Uri::type, and uri.
Referenced by GNUNET_FS_directory_builder_add().
struct GNUNET_TIME_Absolute GNUNET_FS_uri_loc_get_expiration | ( | const struct GNUNET_FS_Uri * | uri | ) |
Obtain the expiration of the LOC URI.
uri | location URI to get the expiration from |
Definition at line 829 of file fs_uri.c.
References GNUNET_FS_Uri::data, Location::expirationTime, GNUNET_assert, GNUNET_FS_URI_LOC, GNUNET_FS_Uri::loc, GNUNET_FS_Uri::type, and uri.
struct GNUNET_FS_Uri * GNUNET_FS_uri_loc_create | ( | const struct GNUNET_FS_Uri * | base_uri, |
const struct GNUNET_CRYPTO_EddsaPrivateKey * | sign_key, | ||
struct GNUNET_TIME_Absolute | expiration_time | ||
) |
Construct a location URI (this peer will be used for the location).
This function should only be called from within gnunet-service-fs, as it requires the peer's private key which is generally unavailable to processes directly under the user's control. However, for testing and as it logically fits under URIs, it is in this API.
base_uri | content offered by the sender |
sign_key | private key of the peer |
expiration_time | how long will the content be offered? |
Definition at line 869 of file fs_uri.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_FS_Uri::chk, Location::contentSignature, GNUNET_FS_Uri::data, Location::expirationTime, LocUriAssembly::exptime, Location::fi, LocUriAssembly::fi, GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_eddsa_sign, GNUNET_FS_URI_CHK, GNUNET_FS_URI_LOC, GNUNET_new, GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, GNUNET_TIME_absolute_hton(), GNUNET_FS_Uri::loc, Location::peer, LocUriAssembly::peer, GNUNET_PeerIdentity::public_key, GNUNET_CRYPTO_EccSignaturePurpose::purpose, LocUriAssembly::purpose, GNUNET_CRYPTO_EccSignaturePurpose::size, GNUNET_FS_Uri::type, and uri.
Referenced by handle_client_loc_sign().
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_merge | ( | const struct GNUNET_FS_Uri * | u1, |
const struct GNUNET_FS_Uri * | u2 | ||
) |
Merge the sets of keywords from two KSK URIs.
u1 | first uri |
u2 | second uri |
(useful for merging the canonicalized keywords with the original keywords for sharing).
u1 | first uri |
u2 | second uri |
Definition at line 931 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_break, GNUNET_FS_uri_dup(), GNUNET_FS_URI_KSK, GNUNET_new, GNUNET_new_array, GNUNET_strdup, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, ret, and GNUNET_FS_Uri::type.
Referenced by publish_inspector().
struct GNUNET_FS_Uri * GNUNET_FS_uri_dup | ( | const struct GNUNET_FS_Uri * | uri | ) |
Duplicate URI.
uri | the URI to duplicate |
Definition at line 987 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_break, GNUNET_free, GNUNET_FS_URI_KSK, GNUNET_FS_URI_LOC, GNUNET_FS_URI_SKS, GNUNET_MAX_MALLOC_CHECKED, GNUNET_memcpy, GNUNET_new, GNUNET_new_array, GNUNET_strdup, GNUNET_FS_Uri::identifier, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, ret, GNUNET_FS_Uri::sks, and uri.
Referenced by create_download_context(), GNUNET_FS_file_information_create_empty_directory(), GNUNET_FS_file_information_create_from_reader(), GNUNET_FS_probe(), GNUNET_FS_publish_ksk(), GNUNET_FS_publish_sks(), GNUNET_FS_tree_encoder_get_uri(), GNUNET_FS_uri_ksk_merge(), process_ksk_result(), process_sks_result(), publish_sblocks_cont(), search_start(), share_tree_trim(), and unindex_directory_scan_cb().
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_create | ( | const char * | keywords, |
char ** | emsg | ||
) |
Create an FS URI from a single user-supplied string of keywords.
The string is broken up at spaces into individual keywords. Keywords that start with "+" are mandatory. Double-quotes can be used to prevent breaking up strings at spaces (and also to specify non-mandatory keywords starting with "+").
Keywords must contain a balanced number of double quotes and double quotes can not be used in the actual keywords (for example, the string '""foo bar""' will be turned into two "OR"ed keywords 'foo' and 'bar', not into '"foo bar"'.
keywords | the keyword string |
emsg | where to store an error message |
Definition at line 1049 of file fs_uri.c.
References _, GNUNET_break, GNUNET_free, GNUNET_FS_uri_ksk_create_from_args(), GNUNET_new_array, GNUNET_strdup, GNUNET_FS_Uri::keywords, and uri.
Referenced by make_keywords().
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_create_from_args | ( | unsigned int | argc, |
const char ** | argv | ||
) |
Create an FS URI from a user-supplied command line of keywords.
Arguments should start with "+" to indicate mandatory keywords.
argc | number of keywords |
argv | keywords (double quotes are not required for keywords containing spaces; however, double quotes are required for keywords starting with "+"); there is no mechanism for having double quotes in the actual keywords (if the user did specifically specify double quotes, the caller should convert each double quote into two single quotes). |
Definition at line 1144 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_asprintf(), GNUNET_free, GNUNET_FS_URI_KSK, GNUNET_FS_uri_parse(), GNUNET_FS_URI_PREFIX, GNUNET_new, GNUNET_new_array, GNUNET_strdup, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::type, and uri.
Referenced by get_file_information(), GNUNET_FS_uri_ksk_create(), migrate_and_drop_keywords(), and run().
int GNUNET_FS_uri_test_equal | ( | const struct GNUNET_FS_Uri * | u1, |
const struct GNUNET_FS_Uri * | u2 | ||
) |
Test if two URIs are equal.
u1 | one of the URIs |
u2 | the other URI |
Definition at line 1201 of file fs_uri.c.
References GNUNET_FS_Uri::chk, GNUNET_FS_Uri::data, GNUNET_assert, GNUNET_FS_URI_CHK, GNUNET_FS_URI_KSK, GNUNET_FS_URI_LOC, GNUNET_FS_URI_SKS, GNUNET_NO, GNUNET_YES, GNUNET_FS_Uri::identifier, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::loc, GNUNET_FS_Uri::ns, ret, GNUNET_FS_Uri::sks, and GNUNET_FS_Uri::type.
Referenced by get_result_present(), test_result_present(), and trigger_recursive_download().
int GNUNET_FS_uri_test_sks | ( | const struct GNUNET_FS_Uri * | uri | ) |
Is this a namespace URI?
uri | the uri to check |
Definition at line 1271 of file fs_uri.c.
References GNUNET_FS_URI_SKS, GNUNET_FS_Uri::type, and uri.
Referenced by deserialize_fi_node(), deserialize_search(), GNUNET_FS_directory_builder_add(), GNUNET_FS_search_sync_(), GNUNET_FS_uri_sks_get_content_id(), GNUNET_FS_uri_sks_get_namespace(), run(), and schedule_transmit_search_request().
struct GNUNET_FS_Uri * GNUNET_FS_uri_sks_create | ( | const struct GNUNET_CRYPTO_EcdsaPublicKey * | ns, |
const char * | id | ||
) |
Create an SKS URI from a namespace ID and an identifier.
ns | pseudonym to use |
id | identifier |
ns | namespace ID |
id | identifier |
Definition at line 908 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_FS_URI_SKS, GNUNET_new, GNUNET_strdup, GNUNET_FS_Uri::identifier, ns, GNUNET_FS_Uri::ns, GNUNET_FS_Uri::sks, and GNUNET_FS_Uri::type.
int GNUNET_FS_uri_sks_get_namespace | ( | const struct GNUNET_FS_Uri * | uri, |
struct GNUNET_CRYPTO_EcdsaPublicKey * | pseudonym | ||
) |
Get the public key of a namespace from the given namespace URI.
uri | the uri to get the namespace ID from |
pseudonym | where to store the public key of the namespace |
Get the public key of a namespace from the given namespace URI.
uri | the uri to get the namespace ID from |
pseudonym | where to store the ID of the namespace |
Definition at line 1286 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_break, GNUNET_FS_uri_test_sks(), GNUNET_OK, GNUNET_SYSERR, GNUNET_FS_Uri::ns, pseudonym, GNUNET_FS_Uri::sks, and uri.
char * GNUNET_FS_uri_sks_get_content_id | ( | const struct GNUNET_FS_Uri * | uri | ) |
Get the content identifier of an SKS URI.
uri | the sks uri |
Definition at line 1306 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_break, GNUNET_FS_uri_test_sks(), GNUNET_strdup, GNUNET_FS_Uri::identifier, GNUNET_FS_Uri::sks, and uri.
int GNUNET_FS_uri_test_ksk | ( | const struct GNUNET_FS_Uri * | uri | ) |
Is this a keyword URI?
uri | the uri |
Definition at line 1324 of file fs_uri.c.
References GNUNET_FS_Uri::data, GNUNET_assert, GNUNET_FS_URI_KSK, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::keywords, GNUNET_FS_Uri::ksk, GNUNET_FS_Uri::type, and uri.
Referenced by deserialize_fi_node(), deserialize_search(), GNUNET_FS_directory_builder_add(), GNUNET_FS_directory_list_contents(), GNUNET_FS_search_signal_suspend_(), GNUNET_FS_search_start_searching_(), GNUNET_FS_search_stop(), GNUNET_FS_search_sync_(), run(), and schedule_transmit_search_request().
int GNUNET_FS_uri_test_chk | ( | const struct GNUNET_FS_Uri * | uri | ) |
Is this a file (or directory) URI?
uri | the uri to check |
Definition at line 1346 of file fs_uri.c.
References GNUNET_FS_URI_CHK, GNUNET_FS_Uri::type, and uri.
Referenced by create_download_context(), deserialize_download(), deserialize_fi_node(), GNUNET_FS_directory_builder_add(), GNUNET_FS_download_sync_(), progress_cb(), and run().
uint64_t GNUNET_FS_uri_chk_get_file_size | ( | const struct GNUNET_FS_Uri * | uri | ) |
What is the size of the file that this URI refers to?
uri | the CHK (or LOC) URI to inspect |
uri | the CHK URI to inspect |
Definition at line 1360 of file fs_uri.c.
References GNUNET_FS_Uri::chk, GNUNET_FS_Uri::data, Location::fi, FileIdentifier::file_length, GNUNET_assert, GNUNET_FS_URI_CHK, GNUNET_FS_URI_LOC, GNUNET_ntohll(), GNUNET_FS_Uri::loc, GNUNET_FS_Uri::type, and uri.
Referenced by create_download_context(), deserialize_download(), encode_cont(), full_recursive_download(), GNUNET_FS_directory_builder_add(), GNUNET_FS_download_start_task_(), GNUNET_FS_search_start_probe_(), match_full_data(), print_search_result(), progress_cb(), run(), trigger_recursive_download(), and try_top_down_reconstruction().
const struct GNUNET_HashCode * GNUNET_FS_uri_chk_get_file_hash | ( | const struct GNUNET_FS_Uri * | uri | ) |
What is the hash of the original file's content that this URI refers to?
uri | the CHK URI to inspect |
Definition at line 1385 of file fs_uri.c.
References FileIdentifier::chk, GNUNET_FS_Uri::chk, GNUNET_FS_Uri::data, GNUNET_assert, GNUNET_FS_URI_CHK, ContentHashKey::key, GNUNET_FS_Uri::type, and uri.
int GNUNET_FS_uri_test_loc | ( | const struct GNUNET_FS_Uri * | uri | ) |
Is this a location URI?
uri | the uri to check |
Definition at line 1401 of file fs_uri.c.
References GNUNET_FS_URI_LOC, GNUNET_FS_Uri::type, and uri.
Referenced by create_download_context(), deserialize_download(), GNUNET_FS_download_sync_(), GNUNET_FS_publish_main_(), and run().
struct GNUNET_FS_Uri * GNUNET_FS_uri_ksk_create_from_meta_data | ( | const struct GNUNET_FS_MetaData * | md | ) |
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).
md | metadata to use |
Definition at line 1788 of file fs_uri.c.
References DIR_SEPARATOR_STR, EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, filename, gather_uri_data(), get_keywords_from_parens(), get_keywords_from_tokens(), GNUNET_free, GNUNET_FS_meta_data_get_first_by_types(), GNUNET_FS_meta_data_iterate(), GNUNET_FS_URI_KSK, GNUNET_new, GNUNET_new_array, and ret.
Referenced by process_helper_msgs().
struct GNUNET_GETOPT_CommandLineOption GNUNET_FS_GETOPT_KEYWORDS | ( | char | shortName, |
const char * | name, | ||
const char * | argumentHelp, | ||
const char * | description, | ||
struct GNUNET_FS_Uri ** | topKeywords | ||
) |
Allow user to specify keywords.
shortName | short name of the option | |
name | long name of the option | |
argumentHelp | help text for the option argument | |
description | long help text for the option | |
[out] | topKeywords | set to the desired value |
Definition at line 129 of file fs_getopt.c.
References GNUNET_GETOPT_CommandLineOption::argumentHelp, GNUNET_GETOPT_CommandLineOption::description, getopt_set_keywords(), name, GNUNET_GETOPT_CommandLineOption::shortName, and topKeywords.
Referenced by main().
struct GNUNET_GETOPT_CommandLineOption GNUNET_FS_GETOPT_METADATA | ( | char | shortName, |
const char * | name, | ||
const char * | argumentHelp, | ||
const char * | description, | ||
struct GNUNET_FS_MetaData ** | meta | ||
) |
Allow user to specify metadata.
shortName | short name of the option | |
name | long name of the option | |
argumentHelp | help text for the option argument | |
description | long help text for the option | |
[out] | meta | metadata set to the desired value |
shortName | short name of the option | |
name | long name of the option | |
argumentHelp | help text for the option argument | |
description | long help text for the option | |
[out] | metadata | set to the desired value |
Definition at line 250 of file fs_getopt.c.
References GNUNET_GETOPT_CommandLineOption::argumentHelp, GNUNET_GETOPT_CommandLineOption::description, getopt_set_metadata(), meta, name, and GNUNET_GETOPT_CommandLineOption::shortName.
Referenced by main().
int GNUNET_FS_getopt_set_metadata | ( | struct 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.
ctx | command line processor context |
scls | must be of type struct GNUNET_FS_MetaData ** |
option | name of the option (typically 'k') |
value | command line argument given |
struct GNUNET_FS_Handle * GNUNET_FS_start | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | client_name, | ||
GNUNET_FS_ProgressCallback | upcb, | ||
void * | upcb_cls, | ||
enum GNUNET_FS_Flags | flags, | ||
... | |||
) |
Setup a connection to the file-sharing service.
cfg | configuration to use |
client_name | unique identifier for this client |
upcb | function to call to notify about FS actions |
upcb_cls | closure for upcb |
flags | specific attributes for fs-operations |
... | list of optional options, terminated with GNUNET_FS_OPTIONS_END |
Definition at line 3264 of file fs_api.c.
References cfg, GNUNET_FS_Handle::client_name, DEFAULT_MAX_PARALLEL_DOWNLOADS, DEFAULT_MAX_PARALLEL_REQUESTS, deserialization_master(), deserialize_download_file(), deserialize_publish_file(), deserialize_search_file(), deserialize_unindex_file(), GNUNET_FS_Handle::flags, GNUNET_break, GNUNET_free, GNUNET_FS_FLAGS_PERSISTENCE, GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, GNUNET_FS_OPTIONS_END, GNUNET_FS_OPTIONS_REQUEST_PARALLELISM, GNUNET_FS_SYNC_PATH_MASTER_DOWNLOAD, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, GNUNET_FS_SYNC_PATH_MASTER_SEARCH, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, GNUNET_new, GNUNET_strdup, GNUNET_TIME_UNIT_MINUTES, ret, GNUNET_FS_Handle::upcb, and GNUNET_FS_Handle::upcb_cls.
Referenced by run().
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. This function MUST NOT be called from within the callback itself.
h | handle that was returned from GNUNET_FS_start() |
Definition at line 3330 of file fs_api.c.
References GNUNET_free, GNUNET_SCHEDULER_cancel(), and h.
Referenced by clean_task(), cleanup_task(), do_shutdown(), do_stop_task(), run(), and shutdown_task().
const char * GNUNET_FS_file_information_get_id | ( | struct GNUNET_FS_FileInformation * | s | ) |
Obtain the name under which this file information structure is stored on disk.
Only works for top-level file information structures.
s | structure to get the filename for |
Definition at line 45 of file fs_file_information.c.
References GNUNET_FS_FileInformation::dir, and GNUNET_FS_FileInformation::serialization.
const char * GNUNET_FS_file_information_get_filename | ( | const struct GNUNET_FS_FileInformation * | s | ) |
Obtain the filename from the file information structure.
s | structure to get the filename for |
Definition at line 60 of file fs_file_information.c.
References GNUNET_FS_FileInformation::filename.
void GNUNET_FS_file_information_set_filename | ( | struct GNUNET_FS_FileInformation * | s, |
const char * | filename | ||
) |
Set the filename in the file information structure.
If filename was already set, frees it before setting the new one. Makes a copy of the argument.
s | structure to get the filename for |
filename | filename to set |
Definition at line 76 of file fs_file_information.c.
References filename, GNUNET_FS_FileInformation::filename, GNUNET_free, and GNUNET_strdup.
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_from_file | ( | struct GNUNET_FS_Handle * | h, |
void * | client_info, | ||
const char * | filename, | ||
const struct GNUNET_FS_Uri * | keywords, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
int | do_index, | ||
const struct GNUNET_FS_BlockOptions * | bo | ||
) |
Create an entry for a file in a publish-structure.
h | handle to the file sharing subsystem |
client_info | initial client-info value for this entry |
filename | name of the file or directory to publish |
keywords | under which keywords should this file be available directly; can be NULL |
meta | metadata for the file |
do_index | GNUNET_YES for index, GNUNET_NO for insertion, GNUNET_SYSERR for simulation |
bo | block options |
Definition at line 88 of file fs_file_information.c.
References bo, GNUNET_FS_FileInformation::client_info, DIR_SEPARATOR_STR, GNUNET_FS_FileInformation::do_index, EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, filename, GNUNET_break, GNUNET_DISK_file_size(), GNUNET_ERROR_TYPE_WARNING, GNUNET_FS_data_reader_file_(), GNUNET_FS_file_information_create_from_reader(), GNUNET_FS_make_file_reader_context_(), GNUNET_FS_meta_data_insert(), GNUNET_log_strerror_file, GNUNET_NO, GNUNET_OK, GNUNET_strdup, GNUNET_YES, h, GNUNET_FS_FileInformation::keywords, meta, and ret.
Referenced by get_file_information().
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_from_data | ( | struct GNUNET_FS_Handle * | h, |
void * | client_info, | ||
uint64_t | length, | ||
void * | data, | ||
const struct GNUNET_FS_Uri * | keywords, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
int | do_index, | ||
const struct GNUNET_FS_BlockOptions * | bo | ||
) |
Create an entry for a file in a publish-structure.
h | handle to the file sharing subsystem |
client_info | initial client-info value for this entry |
length | length of the file |
data | data for the file (should not be used afterwards by the caller; callee will "free") |
keywords | under which keywords should this file be available directly; can be NULL |
meta | metadata for the file |
do_index | GNUNET_YES for index, GNUNET_NO for insertion, GNUNET_SYSERR for simulation |
bo | block options |
Definition at line 148 of file fs_file_information.c.
References bo, GNUNET_FS_FileInformation::client_info, data, GNUNET_FS_FileInformation::do_index, GNUNET_break, GNUNET_FS_data_reader_copy_(), GNUNET_FS_file_information_create_from_reader(), GNUNET_YES, h, GNUNET_FS_FileInformation::keywords, and meta.
Referenced by make_file().
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_from_reader | ( | struct GNUNET_FS_Handle * | h, |
void * | client_info, | ||
uint64_t | length, | ||
GNUNET_FS_DataReader | reader, | ||
void * | reader_cls, | ||
const struct GNUNET_FS_Uri * | keywords, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
int | do_index, | ||
const struct GNUNET_FS_BlockOptions * | bo | ||
) |
Create an entry for a file in a publish-structure.
h | handle to the file sharing subsystem |
client_info | initial client-info value for this entry |
length | length of the file |
reader | function that can be used to obtain the data for the file |
reader_cls | closure for reader |
keywords | under which keywords should this file be available directly; can be NULL |
meta | metadata for the file |
do_index | GNUNET_YES for index, GNUNET_NO for insertion, GNUNET_SYSERR for simulation |
bo | block options |
Definition at line 177 of file fs_file_information.c.
References bo, GNUNET_FS_FileInformation::client_info, GNUNET_FS_FileInformation::do_index, GNUNET_break, GNUNET_FS_data_reader_file_(), GNUNET_FS_meta_data_create(), GNUNET_FS_meta_data_duplicate(), GNUNET_FS_uri_dup(), GNUNET_new, GNUNET_YES, h, GNUNET_FS_FileInformation::keywords, meta, GNUNET_FS_FileInformation::reader, GNUNET_FS_FileInformation::reader_cls, and ret.
Referenced by GNUNET_FS_file_information_create_from_data(), and GNUNET_FS_file_information_create_from_file().
struct GNUNET_FS_FileInformation * GNUNET_FS_file_information_create_empty_directory | ( | struct GNUNET_FS_Handle * | h, |
void * | client_info, | ||
const struct GNUNET_FS_Uri * | keywords, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
const struct GNUNET_FS_BlockOptions * | bo, | ||
const char * | filename | ||
) |
Create an entry for an empty directory in a publish-structure.
h | handle to the file sharing subsystem |
client_info | initial client-info value for this entry |
keywords | under which keywords should this directory be available directly; can be NULL |
meta | metadata for the directory |
bo | block options |
filename | name of the directory; can be NULL |
Definition at line 226 of file fs_file_information.c.
References bo, GNUNET_FS_FileInformation::client_info, filename, GNUNET_FS_meta_data_duplicate(), GNUNET_FS_uri_dup(), GNUNET_new, GNUNET_strdup, GNUNET_YES, h, GNUNET_FS_FileInformation::keywords, meta, and ret.
Referenced by get_file_information().
int GNUNET_FS_file_information_is_directory | ( | const struct GNUNET_FS_FileInformation * | ent | ) |
Test if a given entry represents a directory.
ent | check if this FI represents a directory |
Definition at line 218 of file fs_file_information.c.
References GNUNET_FS_FileInformation::is_directory.
int GNUNET_FS_file_information_add | ( | struct GNUNET_FS_FileInformation * | dir, |
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 GNUNET_FS_publish_start() already.
dir | the directory |
ent | the entry to add; the entry must not have been added to any other directory at this point and must not include dir in its structure |
Definition at line 250 of file fs_file_information.c.
References dir, GNUNET_FS_FileInformation::dir, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and GNUNET_FS_FileInformation::next.
Referenced by get_file_information().
void GNUNET_FS_file_information_inspect | ( | struct GNUNET_FS_FileInformation * | dir, |
GNUNET_FS_FileInformationProcessor | proc, | ||
void * | proc_cls | ||
) |
Inspect a file or directory in a publish-structure.
Clients should never modify publish structures that were passed to GNUNET_FS_publish_start already. When called on a directory, this function will FIRST call proc with information about the directory itself and then for each of the files in the directory (but not for files in subdirectories). When called on a file, proc will be called exactly once (with information about the specific file).
dir | the directory |
proc | function to call on each entry |
proc_cls | closure for proc |
Definition at line 282 of file fs_file_information.c.
References GNUNET_FS_FileInformation::bo, GNUNET_FS_FileInformation::client_info, GNUNET_FS_FileInformation::data, dir, GNUNET_FS_FileInformation::dir, GNUNET_FS_FileInformation::dir_size, GNUNET_FS_FileInformation::do_index, GNUNET_FS_FileInformation::file, GNUNET_FS_FileInformation::file_size, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_FS_FileInformation::is_directory, GNUNET_FS_FileInformation::keywords, GNUNET_FS_FileInformation::meta, and GNUNET_FS_FileInformation::next.
Referenced by deserialize_publish_file(), directory_trim_complete(), fip_signal_resume(), fip_signal_start(), fip_signal_stop(), fip_signal_suspend(), GNUNET_FS_publish_signal_suspend_(), GNUNET_FS_publish_start(), GNUNET_FS_publish_stop(), and publish_inspector().
void GNUNET_FS_file_information_destroy | ( | struct GNUNET_FS_FileInformation * | fi, |
GNUNET_FS_FileInformationProcessor | cleaner, | ||
void * | cleaner_cls | ||
) |
Destroy publish-structure.
Clients should never destroy publish structures that were passed to GNUNET_FS_publish_start already.
fi | structure to destroy |
cleaner | function to call on each entry in the structure (useful to clean up client_info); can be NULL; return values are ignored |
cleaner_cls | closure for cleaner |
Definition at line 335 of file fs_file_information.c.
References GNUNET_FS_FileInformation::bo, GNUNET_FS_FileInformation::chk_uri, GNUNET_FS_FileInformation::client_info, GNUNET_FS_FileInformation::data, GNUNET_FS_FileInformation::dir, GNUNET_FS_FileInformation::dir_data, GNUNET_FS_FileInformation::dir_size, GNUNET_FS_FileInformation::do_index, GNUNET_FS_FileInformation::emsg, GNUNET_FS_FileInformation::entries, GNUNET_FS_FileInformation::file, GNUNET_FS_FileInformation::file_size, GNUNET_FS_FileInformation::filename, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_FS_file_information_destroy(), GNUNET_FS_meta_data_destroy(), GNUNET_FS_tree_encoder_finish(), GNUNET_FS_uri_destroy(), GNUNET_log_strerror_file, GNUNET_NO, GNUNET_YES, GNUNET_FS_FileInformation::is_directory, GNUNET_FS_FileInformation::keywords, GNUNET_FS_FileInformation::meta, GNUNET_FS_FileInformation::next, GNUNET_FS_FileInformation::reader, GNUNET_FS_FileInformation::reader_cls, GNUNET_FS_FileInformation::serialization, GNUNET_FS_FileInformation::sks_uri, and GNUNET_FS_FileInformation::te.
Referenced by deserialize_fi_node(), deserialize_publish_file(), directory_trim_complete(), GNUNET_FS_file_information_destroy(), and publish_cleanup().
struct GNUNET_FS_PublishContext * GNUNET_FS_publish_start | ( | struct GNUNET_FS_Handle * | h, |
struct GNUNET_FS_FileInformation * | fi, | ||
const struct GNUNET_CRYPTO_EcdsaPrivateKey * | ns, | ||
const char * | nid, | ||
const char * | nuid, | ||
enum GNUNET_FS_PublishOptions | options | ||
) |
Publish a file or directory.
h | handle to the file sharing subsystem |
fi | information about the file or directory structure to publish |
ns | namespace to publish the file in, NULL for no namespace |
nid | identifier to use for the published content in the namespace (can be NULL, must be NULL if namespace is NULL) |
nuid | update-identifier that will be used for future updates (can be NULL, must be NULL if namespace or nid is NULL) |
options | options for the publication |
Definition at line 1443 of file fs_publish.c.
References _, GNUNET_ARM_Handle::cfg, compute_contents_size(), dsh, finish_reserve(), fip_signal_start(), GNUNET_assert, GNUNET_DATASTORE_connect(), GNUNET_DATASTORE_reserve(), GNUNET_ERROR_TYPE_INFO, GNUNET_FS_file_information_inspect(), GNUNET_FS_make_top(), GNUNET_FS_publish_main_(), GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY, GNUNET_FS_publish_signal_suspend_(), GNUNET_FS_publish_sync_(), GNUNET_log, GNUNET_new, GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, GNUNET_strdup, h, ns, options, and ret.
Referenced by directory_trim_complete(), and start_publish().
void GNUNET_FS_publish_stop | ( | struct GNUNET_FS_PublishContext * | pc | ) |
Stop a publication.
Will abort incomplete publications (but not remove blocks that have already been published) or simply clean up the state for completed publications. Must NOT be called from within the event callback!
pc | context for the publication to stop |
Stop a publication.
Will abort incomplete uploads (but not remove blocks that have already been published) or simply clean up the state for completed uploads. Must NOT be called from within the event callback!
pc | context for the upload to stop |
Definition at line 1571 of file fs_publish.c.
References GNUNET_FS_Uri::chk, GNUNET_FS_FileInformation::chk_uri, GNUNET_FS_Uri::data, GNUNET_FS_PublishContext::fi, FileIdentifier::file_length, fip_signal_stop(), GNUNET_break, GNUNET_DATASTORE_cancel(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_FS_end_top(), GNUNET_FS_file_information_inspect(), GNUNET_FS_publish_ksk_cancel(), GNUNET_FS_publish_make_status_(), GNUNET_FS_publish_sks_cancel(), GNUNET_FS_remove_sync_file_(), GNUNET_FS_STATUS_PUBLISH_STOPPED, GNUNET_FS_SYNC_PATH_FILE_INFO, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, GNUNET_log, GNUNET_ntohll(), GNUNET_SCHEDULER_cancel(), GNUNET_YES, GNUNET_FS_PublishContext::h, GNUNET_FS_PublishContext::ksk_pc, pc, publish_cleanup(), GNUNET_FS_PublishContext::qre, GNUNET_FS_FileInformation::serialization, GNUNET_FS_PublishContext::serialization, GNUNET_FS_PublishContext::skip_next_fi_callback, GNUNET_FS_PublishContext::sks_pc, GNUNET_FS_ProgressInfo::status, GNUNET_FS_PublishContext::top, and GNUNET_FS_PublishContext::upload_task.
Referenced by do_stop_task(), publish_stop_task(), and shutdown_task().
struct GNUNET_FS_PublishKskContext * GNUNET_FS_publish_ksk | ( | struct GNUNET_FS_Handle * | h, |
const struct GNUNET_FS_Uri * | ksk_uri, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
const struct GNUNET_FS_Uri * | uri, | ||
const struct GNUNET_FS_BlockOptions * | bo, | ||
enum GNUNET_FS_PublishOptions | options, | ||
GNUNET_FS_PublishContinuation | cont, | ||
void * | cont_cls | ||
) |
Publish a KBlock on GNUnet.
h | handle to the file sharing subsystem |
ksk_uri | keywords to use |
meta | metadata to use |
uri | URI to refer to in the KBlock |
bo | block options |
options | publication options |
cont | continuation |
cont_cls | closure for cont |
Publish a KBlock on GNUnet.
h | handle to the file sharing subsystem |
ksk_uri | keywords to use |
meta | metadata to use |
uri | URI to refer to in the KBlock |
bo | per-block options |
options | publication options |
cont | continuation |
cont_cls | closure for cont |
Definition at line 188 of file fs_publish_ksk.c.
References _, bo, GNUNET_FS_PublishKskContext::bo, GNUNET_ARM_Handle::cfg, GNUNET_FS_PublishKskContext::cont, GNUNET_FS_PublishKskContext::cont_cls, GNUNET_FS_PublishKskContext::dsh, GNUNET_assert, GNUNET_DATASTORE_connect(), GNUNET_free, GNUNET_FS_meta_data_duplicate(), GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY, GNUNET_FS_uri_dup(), GNUNET_new, GNUNET_SCHEDULER_add_now(), h, GNUNET_FS_PublishKskContext::h, GNUNET_FS_PublishKskContext::ksk_task, GNUNET_FS_PublishKskContext::ksk_uri, meta, GNUNET_FS_PublishKskContext::meta, options, GNUNET_FS_PublishKskContext::options, publish_ksk_cont(), uri, and GNUNET_FS_PublishKskContext::uri.
Referenced by identity_continuation(), and publish_kblocks().
void GNUNET_FS_publish_ksk_cancel | ( | struct GNUNET_FS_PublishKskContext * | pkc | ) |
Abort the KSK publishing operation.
pkc | context of the operation to abort. |
Definition at line 231 of file fs_publish_ksk.c.
References GNUNET_FS_PublishKskContext::dsh, GNUNET_DATASTORE_disconnect(), GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_publish_ublock_cancel_(), GNUNET_FS_uri_destroy(), GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_FS_PublishKskContext::ksk_task, GNUNET_FS_PublishKskContext::ksk_uri, GNUNET_FS_PublishKskContext::meta, GNUNET_FS_PublishKskContext::uc, and GNUNET_FS_PublishKskContext::uri.
Referenced by GNUNET_FS_publish_stop(), kb_put_cont(), publish_ksk_cont(), and suspend_operation().
struct GNUNET_FS_PublishSksContext * GNUNET_FS_publish_sks | ( | struct GNUNET_FS_Handle * | h, |
const struct GNUNET_CRYPTO_EcdsaPrivateKey * | ns, | ||
const char * | identifier, | ||
const char * | update, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
const struct GNUNET_FS_Uri * | uri, | ||
const struct GNUNET_FS_BlockOptions * | bo, | ||
enum GNUNET_FS_PublishOptions | options, | ||
GNUNET_FS_PublishContinuation | cont, | ||
void * | cont_cls | ||
) |
Publish an SBlock on GNUnet.
h | handle to the file sharing subsystem |
ns | namespace to publish in |
identifier | identifier to use |
update | update identifier to use |
meta | metadata to use |
uri | URI to refer to in the SBlock |
bo | block options |
options | publication options |
cont | continuation |
cont_cls | closure for cont |
Definition at line 432 of file fs_namespace.c.
References _, bo, GNUNET_ARM_Handle::cfg, GNUNET_FS_PublishSksContext::cont, GNUNET_FS_PublishSksContext::cont_cls, GNUNET_FS_Uri::data, GNUNET_FS_PublishSksContext::dsh, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_DATASTORE_connect(), GNUNET_FS_meta_data_duplicate(), GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY, GNUNET_FS_publish_ublock_(), GNUNET_FS_uri_dup(), GNUNET_FS_URI_SKS, GNUNET_new, GNUNET_strdup, h, GNUNET_FS_PublishSksContext::h, NamespaceUpdateNode::id, GNUNET_FS_Uri::identifier, NamespaceUpdateNode::md, meta, ns, GNUNET_FS_Uri::ns, GNUNET_FS_PublishSksContext::ns, GNUNET_FS_PublishSksContext::nsn, options, GNUNET_FS_Uri::sks, sks_publish_cont(), GNUNET_FS_Uri::type, GNUNET_FS_PublishSksContext::uc, NamespaceUpdateNode::update, uri, NamespaceUpdateNode::uri, and GNUNET_FS_PublishSksContext::uri.
Referenced by publish_sblock(), and uri_ksk_continuation().
void GNUNET_FS_publish_sks_cancel | ( | struct GNUNET_FS_PublishSksContext * | psc | ) |
Abort the SKS publishing operation.
psc | context of the operation to abort. |
Definition at line 495 of file fs_namespace.c.
References GNUNET_FS_PublishSksContext::dsh, GNUNET_DATASTORE_disconnect(), GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_publish_ublock_cancel_(), GNUNET_FS_uri_destroy(), GNUNET_NO, NamespaceUpdateNode::id, NamespaceUpdateNode::md, GNUNET_FS_PublishSksContext::nsn, GNUNET_FS_PublishSksContext::uc, NamespaceUpdateNode::update, NamespaceUpdateNode::uri, and GNUNET_FS_PublishSksContext::uri.
Referenced by GNUNET_FS_publish_stop(), sks_publish_cont(), and suspend_operation().
struct GNUNET_FS_GetIndexedContext * GNUNET_FS_get_indexed_files | ( | struct GNUNET_FS_Handle * | h, |
GNUNET_FS_IndexedFileProcessor | iterator, | ||
void * | iterator_cls | ||
) |
Iterate over all indexed files.
h | handle to the file sharing subsystem |
iterator | function to call on each indexed file |
iterator_cls | closure for iterator |
Definition at line 163 of file fs_list_indexed.c.
References _, GNUNET_ARM_Handle::cfg, env, gic, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_END, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY, GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, h, handlers, GNUNET_FS_GetIndexedContext::iterator, GNUNET_FS_GetIndexedContext::iterator_cls, GNUNET_FS_GetIndexedContext::mq, mq_error_handler(), and msg.
Referenced by run().
void GNUNET_FS_get_indexed_files_cancel | ( | struct GNUNET_FS_GetIndexedContext * | gic | ) |
Cancel iteration over all indexed files.
gic | operation to cancel |
Definition at line 212 of file fs_list_indexed.c.
References gic, GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_FS_GetIndexedContext::mq.
Referenced by do_shutdown(), handle_index_info(), handle_index_info_end(), and mq_error_handler().
struct GNUNET_FS_UnindexContext * GNUNET_FS_unindex_start | ( | struct GNUNET_FS_Handle * | h, |
const char * | filename, | ||
void * | cctx | ||
) |
Unindex a file.
h | handle to the file sharing subsystem |
filename | file to unindex |
cctx | initial value for the client context |
Definition at line 796 of file fs_unindex.c.
References GNUNET_FS_ProgressInfo::cctx, GNUNET_FS_UnindexContext::client_info, GNUNET_FS_UnindexContext::fhc, GNUNET_FS_UnindexContext::file_size, filename, GNUNET_FS_UnindexContext::filename, GNUNET_CRYPTO_hash_file(), GNUNET_DISK_file_size(), GNUNET_FS_make_top(), GNUNET_FS_STATUS_UNINDEX_START, GNUNET_FS_unindex_make_status_(), GNUNET_FS_unindex_process_hash_(), GNUNET_FS_unindex_signal_suspend_(), GNUNET_FS_unindex_sync_(), GNUNET_new, GNUNET_OK, GNUNET_SCHEDULER_PRIORITY_IDLE, GNUNET_strdup, GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, h, GNUNET_FS_UnindexContext::h, HASHING_BLOCKSIZE, size, GNUNET_FS_UnindexContext::start_time, GNUNET_FS_ProgressInfo::status, GNUNET_FS_UnindexContext::top, uc, GNUNET_FS_ProgressInfo::unindex, and GNUNET_FS_ProgressInfo::value.
Referenced by ds_put_cont(), run(), and signal_publish_error().
void GNUNET_FS_unindex_stop | ( | struct GNUNET_FS_UnindexContext * | uc | ) |
Clean up after completion of an unindex operation.
uc | handle |
Definition at line 838 of file fs_unindex.c.
References GNUNET_FS_UnindexContext::client_info, GNUNET_FS_UnindexContext::dqe, GNUNET_FS_UnindexContext::dscan, GNUNET_FS_UnindexContext::dsh, GNUNET_FS_UnindexContext::emsg, GNUNET_FS_UnindexContext::fh, GNUNET_FS_UnindexContext::fhc, GNUNET_FS_UnindexContext::file_size, GNUNET_FS_UnindexContext::filename, GNUNET_break, GNUNET_CRYPTO_hash_file_cancel(), GNUNET_DATASTORE_cancel(), GNUNET_DATASTORE_disconnect(), GNUNET_DISK_file_close(), GNUNET_free, GNUNET_FS_directory_scan_abort(), GNUNET_FS_end_top(), GNUNET_FS_remove_sync_file_(), GNUNET_FS_STATUS_UNINDEX_STOPPED, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, GNUNET_FS_tree_encoder_finish(), GNUNET_FS_unindex_make_status_(), GNUNET_FS_uri_destroy(), GNUNET_MQ_destroy(), GNUNET_NO, GNUNET_TIME_UNIT_ZERO, GNUNET_FS_UnindexContext::h, GNUNET_FS_UnindexContext::ksk_uri, GNUNET_FS_UnindexContext::mq, GNUNET_FS_UnindexContext::serialization, GNUNET_FS_UnindexContext::state, GNUNET_FS_ProgressInfo::status, GNUNET_FS_UnindexContext::tc, GNUNET_FS_UnindexContext::top, uc, GNUNET_FS_ProgressInfo::unindex, UNINDEX_STATE_COMPLETE, and GNUNET_FS_ProgressInfo::value.
Referenced by GNUNET_FS_unindex_process_hash_(), progress_cb(), and shutdown_task().
void GNUNET_FS_namespace_list_updateable | ( | struct GNUNET_FS_Handle * | h, |
const struct GNUNET_CRYPTO_EcdsaPrivateKey * | ns, | ||
const char * | next_id, | ||
GNUNET_FS_IdentifierProcessor | ip, | ||
void * | ip_cls | ||
) |
List all of the identifiers in the namespace for which we could produce an update.
Namespace updates form a graph where each node has a name. Each node can have any number of URI/meta-data entries which can each be linked to other nodes. Cycles are possible.
Calling this function with next_id NULL will cause the library to call ip with a root for each strongly connected component of the graph (a root being a node from which all other nodes in the Scc are reachable).
Calling this function with next_id being the name of a node will cause the library to call ip with all children of the node. Note that cycles within an SCC are possible (including self-loops).
h | fs handle to use |
ns | namespace to inspect for updateable content |
next_id | ID to look for; use NULL to look for SCC roots |
ip | function to call on each updateable identifier |
ip_cls | closure for ip |
Namespace updates form a graph where each node has a name. Each node can have any number of URI/meta-data entries which can each be linked to other nodes. Cycles are possible.
Calling this function with "next_id" NULL will cause the library to call "ip" with a root for each strongly connected component of the graph (a root being a node from which all other nodes in the Tree are reachable).
Calling this function with "next_id" being the name of a node will cause the library to call "ip" with all children of the node. Note that cycles within the final tree are possible (including self-loops). I know, odd definition of a tree, but the GUI will display an actual tree (GtkTreeView), so that's what counts for the term here.
h | fs handle to use |
ns | namespace to inspect for updateable content |
next_id | ID to look for; use NULL to look for tree roots |
ip | function to call on each updateable identifier |
ip_cls | closure for ip |
Definition at line 671 of file fs_namespace.c.
References find_trees(), free_update_information_graph(), GNUNET_array_append, GNUNET_array_grow, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, h, NamespaceUpdateNode::id, FindTreeClosure::id, NamespaceUpdateNode::md, next_id, ns, NamespaceUpdateNode::nug, FindTreeClosure::nug, GNUNET_FS_UpdateInformationGraph::nug_gen, pc, process_update_node(), read_update_information_graph(), FindTreeClosure::tree_array, FindTreeClosure::tree_array_size, NamespaceUpdateNode::tree_id, FindTreeClosure::uig, NamespaceUpdateNode::update, GNUNET_FS_UpdateInformationGraph::update_map, GNUNET_FS_UpdateInformationGraph::update_node_count, GNUNET_FS_UpdateInformationGraph::update_nodes, and NamespaceUpdateNode::uri.
struct GNUNET_FS_SearchContext * GNUNET_FS_search_start | ( | struct GNUNET_FS_Handle * | h, |
const struct GNUNET_FS_Uri * | uri, | ||
uint32_t | anonymity, | ||
enum GNUNET_FS_SearchOptions | options, | ||
void * | cctx | ||
) |
Start search for content.
h | handle to the file sharing subsystem |
uri | specifies the search parameters; can be a KSK URI or an SKS URI. |
anonymity | desired level of anonymity |
options | options for the search |
cctx | initial value for the client context |
Definition at line 1607 of file fs_search.c.
References anonymity, GNUNET_FS_make_top(), GNUNET_FS_search_signal_suspend_(), h, options, ret, search_start(), and uri.
Referenced by run(), and start_download().
void GNUNET_FS_search_pause | ( | struct GNUNET_FS_SearchContext * | sc | ) |
Pause search.
sc | context for the search that should be paused |
Definition at line 1627 of file fs_search.c.
References GNUNET_FS_SearchContext::client_info, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_FS_search_make_status_(), GNUNET_FS_search_sync_(), GNUNET_FS_STATUS_SEARCH_PAUSED, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_FS_SearchContext::h, GNUNET_FS_SearchContext::master_result_map, GNUNET_FS_SearchContext::mq, sc, search_result_freeze_probes(), GNUNET_FS_ProgressInfo::status, and GNUNET_FS_SearchContext::task.
Referenced by search_result_freeze_probes().
void GNUNET_FS_search_continue | ( | struct GNUNET_FS_SearchContext * | sc | ) |
Continue paused search.
sc | context for the search that should be resumed |
Definition at line 1658 of file fs_search.c.
References GNUNET_FS_SearchContext::client_info, do_reconnect(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_FS_search_make_status_(), GNUNET_FS_search_sync_(), GNUNET_FS_STATUS_SEARCH_CONTINUED, GNUNET_FS_SearchContext::h, GNUNET_FS_SearchContext::master_result_map, GNUNET_FS_SearchContext::mq, sc, search_result_resume_probes(), GNUNET_FS_ProgressInfo::status, and GNUNET_FS_SearchContext::task.
Referenced by search_result_resume_probes().
void GNUNET_FS_search_stop | ( | struct GNUNET_FS_SearchContext * | sc | ) |
Stop search for content.
sc | context for the search that should be stopped |
Definition at line 1766 of file fs_search.c.
References GNUNET_FS_SearchContext::client_info, GNUNET_FS_Uri::data, GNUNET_FS_SearchContext::emsg, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_FS_end_top(), GNUNET_FS_remove_sync_dir_(), GNUNET_FS_remove_sync_file_(), GNUNET_FS_search_make_status_(), GNUNET_FS_STATUS_SEARCH_STOPPED, GNUNET_FS_SYNC_PATH_CHILD_SEARCH, GNUNET_FS_SYNC_PATH_MASTER_SEARCH, GNUNET_FS_uri_destroy(), GNUNET_FS_uri_test_ksk(), GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_FS_SearchContext::h, SearchRequestEntry::keyword, GNUNET_FS_Uri::keywordCount, GNUNET_FS_Uri::ksk, GNUNET_FS_SearchContext::master_result_map, GNUNET_FS_SearchContext::mq, GNUNET_FS_SearchContext::psearch_result, GNUNET_FS_SearchContext::requests, SearchRequestEntry::results, sc, search_result_free(), search_result_stop(), GNUNET_FS_SearchContext::serialization, GNUNET_FS_ProgressInfo::status, GNUNET_FS_SearchContext::task, GNUNET_FS_SearchContext::top, GNUNET_FS_SearchResult::update_search, and GNUNET_FS_SearchContext::uri.
Referenced by search_result_free(), search_stop_task(), and shutdown_task().
struct GNUNET_FS_SearchResult * GNUNET_FS_probe | ( | struct GNUNET_FS_Handle * | h, |
const struct GNUNET_FS_Uri * | uri, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
void * | client_info, | ||
uint32_t | anonymity | ||
) |
Start download probes for the given search result.
h | file-sharing handle to use for the operation |
uri | URI to probe |
meta | meta data associated with the URI |
client_info | client info pointer to use for associated events |
anonymity | anonymity level to use for the probes |
Definition at line 489 of file fs_search.c.
References anonymity, GNUNET_FS_SearchResult::anonymity, GNUNET_FS_SearchResult::client_info, GNUNET_assert, GNUNET_FS_meta_data_duplicate(), GNUNET_FS_search_start_probe_(), GNUNET_FS_uri_dup(), GNUNET_new, h, GNUNET_FS_SearchResult::h, meta, GNUNET_FS_SearchResult::meta, uri, and GNUNET_FS_SearchResult::uri.
void * GNUNET_FS_probe_stop | ( | struct GNUNET_FS_SearchResult * | sr | ) |
Stop probe activity.
Must ONLY be used on values returned from GNUNET_FS_probe.
sr | search result to stop probing for (freed) |
Definition at line 540 of file fs_search.c.
References GNUNET_FS_SearchResult::client_info, GNUNET_assert, GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_search_stop_probe_(), GNUNET_FS_uri_destroy(), GNUNET_FS_SearchResult::meta, GNUNET_FS_SearchResult::sc, and GNUNET_FS_SearchResult::uri.
struct GNUNET_FS_DownloadContext * GNUNET_FS_download_start | ( | struct GNUNET_FS_Handle * | h, |
const struct GNUNET_FS_Uri * | uri, | ||
const struct GNUNET_FS_MetaData * | meta, | ||
const char * | filename, | ||
const char * | tempname, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
uint32_t | anonymity, | ||
enum GNUNET_FS_DownloadOptions | options, | ||
void * | cctx, | ||
struct GNUNET_FS_DownloadContext * | parent | ||
) |
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).
The given range can be used to focus a download towards a particular portion of the file (optimization), not to strictly limit the download to exactly those bytes.
h | handle to the file sharing subsystem |
uri | the URI of the file (determines what to download); CHK or LOC URI |
meta | known metadata for the file (can be NULL) |
filename | where to store the file, maybe NULL (then no file is created on disk and data must be grabbed from the callbacks) |
tempname | where to store temporary file data, not used if filename is non-NULL; can be NULL (in which case we will pick a name if needed); the temporary file may already exist, in which case we will try to use the data that is there and if it is not what is desired, will overwrite it |
offset | at what offset should we start the download (typically 0) |
length | how many bytes should be downloaded starting at offset |
anonymity | anonymity level to use for the download |
options | various download options |
cctx | initial value for the client context for this download |
parent | parent download to associate this download with (use NULL for top-level downloads; useful for manually-triggered recursive downloads) |
Definition at line 2099 of file fs_download.c.
References anonymity, GNUNET_FS_DownloadContext::child_head, GNUNET_FS_DownloadContext::child_tail, create_download_context(), dc, filename, GNUNET_CONTAINER_DLL_insert, GNUNET_FS_DOWNLOAD_IS_PROBE, GNUNET_FS_download_signal_suspend_(), GNUNET_FS_make_top(), h, GNUNET_FS_DownloadContext::h, GNUNET_FS_DownloadContext::length, meta, GNUNET_FS_DownloadContext::offset, options, GNUNET_FS_DownloadContext::parent, GNUNET_FS_DownloadContext::top, and uri.
Referenced by GNUNET_FS_search_start_probe_(), progress_cb(), run(), and trigger_recursive_download().
struct GNUNET_FS_DownloadContext * GNUNET_FS_download_start_from_search | ( | struct GNUNET_FS_Handle * | h, |
struct GNUNET_FS_SearchResult * | sr, | ||
const char * | filename, | ||
const char * | tempname, | ||
uint64_t | offset, | ||
uint64_t | length, | ||
uint32_t | anonymity, | ||
enum GNUNET_FS_DownloadOptions | options, | ||
void * | cctx | ||
) |
Download parts of a file based on a search result.
The download will be associated with the search result (and the association will be preserved when serializing/deserializing the state). If the search is stopped, the download will not be aborted but be 'promoted' to a stand-alone download.
As with the other download function, 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).
The given range can be used to focus a download towards a particular portion of the file (optimization), not to strictly limit the download to exactly those bytes.
h | handle to the file sharing subsystem |
sr | the search result to use for the download (determines uri and meta data and associations) |
filename | where to store the file, maybe NULL (then no file is created on disk and data must be grabbed from the callbacks) |
tempname | where to store temporary file data, not used if filename is non-NULL; can be NULL (in which case we will pick a name if needed); the temporary file may already exist, in which case we will try to use the data that is there and if it is not what is desired, will overwrite it |
offset | at what offset should we start the download (typically 0) |
length | how many bytes should be downloaded starting at offset |
anonymity | anonymity level to use for the download |
options | various download options |
cctx | initial value for the client context for this download |
Definition at line 2136 of file fs_download.c.
References anonymity, create_download_context(), dc, GNUNET_FS_SearchResult::download, filename, GNUNET_break, GNUNET_FS_download_stop(), GNUNET_FS_stop_probe_ping_task_(), GNUNET_YES, h, GNUNET_FS_DownloadContext::length, GNUNET_FS_SearchResult::meta, GNUNET_FS_DownloadContext::offset, options, GNUNET_FS_SearchResult::probe_ctx, GNUNET_FS_DownloadContext::search, and GNUNET_FS_SearchResult::uri.
void GNUNET_FS_download_stop | ( | struct GNUNET_FS_DownloadContext * | dc, |
int | do_delete | ||
) |
Stop a download (aborts if download is incomplete).
dc | handle for the download |
do_delete | delete files of incomplete downloads |
Definition at line 2253 of file fs_download.c.
References GNUNET_FS_DownloadContext::active, GNUNET_FS_DownloadContext::child_head, GNUNET_FS_DownloadContext::child_tail, GNUNET_FS_DownloadContext::completed, dc, GNUNET_FS_SearchResult::download, GNUNET_FS_DownloadContext::filename, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_FS_dequeue_(), GNUNET_FS_download_make_status_(), GNUNET_FS_download_stop(), GNUNET_FS_end_top(), GNUNET_FS_free_download_request_(), GNUNET_FS_meta_data_destroy(), GNUNET_FS_remove_sync_dir_(), GNUNET_FS_remove_sync_file_(), GNUNET_FS_search_result_sync_(), GNUNET_FS_STATUS_DOWNLOAD_STOPPED, GNUNET_FS_SYNC_PATH_CHILD_DOWNLOAD, GNUNET_FS_SYNC_PATH_MASTER_DOWNLOAD, GNUNET_FS_tree_encoder_finish(), GNUNET_FS_uri_destroy(), GNUNET_log_strerror_file, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_YES, GNUNET_FS_DownloadContext::h, GNUNET_FS_DownloadContext::job_queue, GNUNET_FS_DownloadContext::length, GNUNET_FS_DownloadContext::meta, GNUNET_FS_DownloadContext::parent, GNUNET_FS_DownloadContext::search, GNUNET_FS_DownloadContext::serialization, GNUNET_FS_ProgressInfo::status, GNUNET_FS_DownloadContext::task, GNUNET_FS_DownloadContext::te, GNUNET_FS_DownloadContext::temp_filename, GNUNET_FS_DownloadContext::top, GNUNET_FS_DownloadContext::top_request, and GNUNET_FS_DownloadContext::uri.
Referenced by download_stop_task(), GNUNET_FS_download_start_from_search(), GNUNET_FS_download_stop(), GNUNET_FS_search_stop_probe_(), probe_failure_handler(), probe_success_handler(), search_result_freeze_probes(), and shutdown_task().
void GNUNET_FS_download_suspend | ( | struct GNUNET_FS_DownloadContext * | dc | ) |
Suspend a download.
dc | handle for the download |
Definition at line 2214 of file fs_download.c.
References dc, and deactivate_fs_download().
void GNUNET_FS_download_resume | ( | struct GNUNET_FS_DownloadContext * | dc | ) |
Resume a suspended download.
dc | handle for the download |
Definition at line 2226 of file fs_download.c.
References activate_fs_download(), DBLOCK_SIZE, dc, deactivate_fs_download(), GNUNET_assert, GNUNET_FS_DOWNLOAD_IS_PROBE, GNUNET_FS_download_make_status_(), GNUNET_FS_queue_(), GNUNET_FS_QUEUE_PRIORITY_NORMAL, GNUNET_FS_QUEUE_PRIORITY_PROBE, GNUNET_FS_STATUS_DOWNLOAD_ACTIVE, GNUNET_FS_DownloadContext::h, GNUNET_FS_DownloadContext::job_queue, GNUNET_FS_DownloadContext::length, GNUNET_FS_DownloadContext::options, GNUNET_FS_ProgressInfo::status, and GNUNET_FS_DownloadContext::task.
int GNUNET_FS_meta_data_test_for_directory | ( | const struct GNUNET_FS_MetaData * | md | ) |
Does the meta-data claim that this is a directory? Checks if the mime-type is that of a GNUnet directory.
Definition at line 55 of file fs_directory.c.
References GNUNET_free, GNUNET_FS_DIRECTORY_MIME, GNUNET_FS_meta_data_get_by_type(), GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, and ret.
Referenced by fip_signal_resume(), fip_signal_stop(), fip_signal_suspend(), is_recursive_download(), progress_cb(), publish_inspector(), and trigger_recursive_download().
void GNUNET_FS_meta_data_make_directory | ( | struct GNUNET_FS_MetaData * | md | ) |
Set the MIMETYPE information for the given metadata to "application/gnunet-directory".
md | metadata to add mimetype to |
Definition at line 81 of file fs_directory.c.
References GNUNET_break, GNUNET_free, GNUNET_FS_DIRECTORY_MIME, GNUNET_FS_meta_data_get_by_type(), and GNUNET_FS_meta_data_insert().
Referenced by get_file_information(), and GNUNET_FS_directory_builder_create().
char * GNUNET_FS_meta_data_suggest_filename | ( | const struct GNUNET_FS_MetaData * | md | ) |
Suggest a filename based on given metadata.
md | given meta data |
Definition at line 39 of file fs_misc.c.
References _, EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, GNUNET_asprintf(), GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_FS_meta_data_get_by_type(), GNUNET_FS_meta_data_get_first_by_types(), GNUNET_log, GNUNET_strdup, and ret.
Referenced by trigger_recursive_download().
int GNUNET_FS_directory_list_contents | ( | size_t | size, |
const void * | data, | ||
uint64_t | offset, | ||
GNUNET_FS_DirectoryEntryProcessor | dep, | ||
void * | dep_cls | ||
) |
Iterate over all entries in a directory.
Note that directories are structured such that it is possible to iterate over the individual blocks as well as over the entire directory. Thus a client can call this function on the buffer in the GNUNET_FS_ProgressCallback. Also, directories can optionally include the contents of (small) files embedded in the directory itself; for those files, the processor may be given the contents of the file directly by this function.
size | number of bytes in data |
data | pointer to the beginning of the directory |
offset | offset of data in the directory |
dep | function to call on each entry |
dep_cls | closure for dep |
Note that directories are structured such that it is possible to iterate over the individual blocks as well as over the entire directory. Thus a client can call this function on the buffer in the GNUNET_FS_ProgressCallback. Also, directories can optionally include the contents of (small) files embedded in the directory itself; for those files, the processor may be given the contents of the file directly by this function.
Note that this function maybe called on parts of directories. Thus parser errors should not be reported at all (with GNUNET_break). Still, if some entries can be recovered despite these parsing errors, the function should try to do this.
size | number of bytes in data |
data | pointer to the beginning of the directory |
offset | offset of data in the directory |
dep | function to call on each entry |
dep_cls | closure for dep |
Definition at line 182 of file fs_directory.c.
References _, data, GetFullDataClosure::data, DBLOCK_SIZE, EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, filename, find_full_data(), GNUNET_break, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_FS_DIRECTORY_MAGIC, GNUNET_FS_meta_data_deserialize(), GNUNET_FS_meta_data_destroy(), GNUNET_FS_meta_data_get_by_type(), GNUNET_FS_meta_data_iterate(), GNUNET_FS_uri_destroy(), GNUNET_FS_uri_parse(), GNUNET_FS_uri_test_ksk(), GNUNET_log, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, size, GetFullDataClosure::size, and uri.
Referenced by full_recursive_download(), process_result_with_request(), and run().
struct GNUNET_FS_DirectoryBuilder * GNUNET_FS_directory_builder_create | ( | const struct GNUNET_FS_MetaData * | mdir | ) |
Create a directory builder.
mdir | metadata for the directory |
Definition at line 366 of file fs_directory.c.
References GNUNET_FS_meta_data_create(), GNUNET_FS_meta_data_duplicate(), GNUNET_FS_meta_data_make_directory(), GNUNET_new, and ret.
Referenced by publish_content(), and run().
void GNUNET_FS_directory_builder_add | ( | struct GNUNET_FS_DirectoryBuilder * | bld, |
const struct GNUNET_FS_Uri * | uri, | ||
const struct GNUNET_FS_MetaData * | md, | ||
const void * | data | ||
) |
Add an entry to a directory.
bld | directory to extend |
uri | uri of the entry (must not be a KSK) |
md | metadata of the entry |
data | raw data of the entry, can be NULL, otherwise data must point to exactly the number of bytes specified by the uri |
bld | directory to extend |
uri | uri of the entry (must not be a KSK) |
md | metadata of the entry |
data | raw data of the entry, can be NULL, otherwise data must point to exactly the number of bytes specified by the uri which must be of type LOC or CHK |
Definition at line 392 of file fs_directory.c.
References GNUNET_FS_DirectoryBuilder::count, data, DBLOCK_SIZE, GNUNET_assert, GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_meta_data_duplicate(), GNUNET_FS_meta_data_get_serialized_size(), GNUNET_FS_meta_data_insert(), GNUNET_FS_meta_data_serialize(), GNUNET_FS_META_DATA_SERIALIZE_PART, GNUNET_FS_uri_chk_get_file_size(), GNUNET_FS_uri_destroy(), GNUNET_FS_uri_loc_get_uri(), GNUNET_FS_uri_test_chk(), GNUNET_FS_uri_test_ksk(), GNUNET_FS_uri_test_sks(), GNUNET_FS_uri_to_string(), GNUNET_malloc, GNUNET_MAX_MALLOC_CHECKED, GNUNET_memcpy, GNUNET_FS_DirectoryBuilder::head, BuilderEntry::len, MAX_INLINE_SIZE, meta, BuilderEntry::next, ret, and uri.
Referenced by progress_cb(), and publish_content().
int GNUNET_FS_directory_builder_finish | ( | struct GNUNET_FS_DirectoryBuilder * | bld, |
size_t * | rsize, | ||
void ** | rdata | ||
) |
Finish building the directory.
Frees the builder context and returns the directory in-memory.
bld | directory to finish |
rsize | set to the number of bytes needed |
rdata | set to the encoded directory |
Definition at line 578 of file fs_directory.c.
References block_align(), GNUNET_FS_DirectoryBuilder::count, data, do_align(), GNUNET_assert, GNUNET_DIRECTORY_MAGIC, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_meta_data_get_serialized_size(), GNUNET_FS_meta_data_serialize(), GNUNET_FS_META_DATA_SERIALIZE_FULL, GNUNET_log_strerror, GNUNET_malloc_large, GNUNET_memcpy, GNUNET_new_array, GNUNET_OK, GNUNET_SYSERR, GNUNET_FS_DirectoryBuilder::head, BuilderEntry::len, GNUNET_FS_DirectoryBuilder::meta, BuilderEntry::next, ret, and size.
Referenced by clean_task(), and publish_content().
struct GNUNET_FS_DirScanner * GNUNET_FS_directory_scan_start | ( | const char * | filename, |
int | disable_extractor, | ||
const char * | ex, | ||
GNUNET_FS_DirScannerProgressCallback | cb, | ||
void * | cb_cls | ||
) |
Start a directory scanner.
filename | name of the directory to scan |
disable_extractor | GNUNET_YES to not run libextractor on files (only build a tree) |
ex | if not NULL, must be a list of extra plugins for extractor |
cb | the callback to call when there are scanning progress messages |
cb_cls | closure for cb |
Start a directory scanner.
filename | name of the directory to scan |
disable_extractor | GNUNET_YES to not run libextractor on files (only build a tree) |
ex | if not NULL, must be a list of extra plugins for extractor |
cb | the callback to call when there are scanning progress messages |
cb_cls | closure for 'cb' |
Definition at line 450 of file fs_dirmetascan.c.
References GNUNET_FS_DirScanner::args, disable_extractor, ds, GNUNET_FS_DirScanner::ex_arg, filename, GNUNET_FS_DirScanner::filename_expanded, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_HELPER_start(), GNUNET_log, GNUNET_new, GNUNET_NO, GNUNET_OS_project_data_gnunet(), GNUNET_strdup, GNUNET_STRINGS_filename_expand(), GNUNET_FS_DirScanner::helper, helper_died_cb(), process_helper_msgs(), GNUNET_FS_DirScanner::progress_callback, and GNUNET_FS_DirScanner::progress_callback_cls.
Referenced by GNUNET_FS_unindex_do_extract_keywords_(), and identity_continuation().
void GNUNET_FS_directory_scan_abort | ( | struct GNUNET_FS_DirScanner * | ds | ) |
Abort the scan.
Must not be called from within the progress_callback function.
ds | directory scanner structure |
Definition at line 99 of file fs_dirmetascan.c.
References ds, GNUNET_FS_DirScanner::ex_arg, GNUNET_FS_DirScanner::filename_expanded, GNUNET_free, GNUNET_FS_share_tree_free(), GNUNET_HELPER_stop(), GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_FS_DirScanner::helper, GNUNET_FS_DirScanner::stop_task, and GNUNET_FS_DirScanner::toplevel.
Referenced by do_stop_task(), GNUNET_FS_directory_scan_get_result(), GNUNET_FS_unindex_signal_suspend_(), GNUNET_FS_unindex_stop(), and unindex_directory_scan_cb().
struct GNUNET_FS_ShareTreeItem * GNUNET_FS_directory_scan_get_result | ( | struct GNUNET_FS_DirScanner * | ds | ) |
Obtain the result of the scan after the scan has signalled completion.
Must not be called prior to completion. The ds is freed as part of this call.
ds | directory scanner structure |
Definition at line 117 of file fs_dirmetascan.c.
References ds, GNUNET_assert, GNUNET_FS_directory_scan_abort(), GNUNET_FS_DirScanner::helper, result, and GNUNET_FS_DirScanner::toplevel.
Referenced by directory_scan_cb(), and unindex_directory_scan_cb().
void GNUNET_FS_share_tree_trim | ( | struct GNUNET_FS_ShareTreeItem * | toplevel | ) |
Process a share item tree, moving frequent keywords up and copying frequent metadata up.
toplevel | toplevel directory in the tree, returned by the scanner |
Definition at line 417 of file fs_sharetree.c.
References GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_NO, share_tree_trim(), and tc.
Referenced by directory_scan_cb().
void GNUNET_FS_share_tree_free | ( | struct GNUNET_FS_ShareTreeItem * | toplevel | ) |
Release memory of a share item tree.
toplevel | toplevel of the tree to be freed |
Definition at line 437 of file fs_sharetree.c.
References GNUNET_FS_ShareTreeItem::children_head, GNUNET_FS_ShareTreeItem::children_tail, GNUNET_FS_ShareTreeItem::filename, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_FS_meta_data_destroy(), GNUNET_FS_share_tree_free(), GNUNET_FS_uri_destroy(), GNUNET_FS_ShareTreeItem::ksk_uri, GNUNET_FS_ShareTreeItem::meta, GNUNET_FS_ShareTreeItem::parent, and GNUNET_FS_ShareTreeItem::short_filename.
Referenced by directory_trim_complete(), GNUNET_FS_directory_scan_abort(), GNUNET_FS_share_tree_free(), and unindex_directory_scan_cb().
enum GNUNET_GenericReturnValue GNUNET_FS_write_meta_data | ( | struct GNUNET_BIO_WriteHandle * | h, |
const char * | what, | ||
const struct GNUNET_FS_MetaData * | m | ||
) |
Write a metadata container.
h | the IO handle to write to |
what | what is being written (for error message creation) |
m | metadata to write |
Definition at line 1110 of file meta_data.c.
References _, GNUNET_BIO_write(), GNUNET_BIO_write_int32(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_FS_meta_data_serialize(), GNUNET_FS_META_DATA_SERIALIZE_PART, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, h, m, MAX_META_DATA, and size.
Referenced by write_spec_handler_meta_data().
struct GNUNET_BIO_ReadSpec GNUNET_FS_read_spec_meta_data | ( | const char * | what, |
struct GNUNET_FS_MetaData ** | result | ||
) |
Create the specification to read a metadata container.
what | describes what is being read (for error message creation) |
result | the buffer to store a pointer to the (allocated) metadata |
Definition at line 1185 of file meta_data.c.
References read_spec_handler_meta_data(), result, and GNUNET_BIO_ReadSpec::rh.
Referenced by deserialize_download(), and read_update_information_graph().
struct GNUNET_BIO_WriteSpec GNUNET_FS_write_spec_meta_data | ( | const char * | what, |
const struct GNUNET_FS_MetaData * | m | ||
) |
Create the specification to write a metadata container.
what | what is being written (for error message creation) |
m | metadata to write |
Definition at line 1223 of file meta_data.c.
References m, GNUNET_BIO_WriteSpec::source_size, GNUNET_BIO_WriteSpec::wh, GNUNET_BIO_WriteSpec::what, and write_spec_handler_meta_data().
Referenced by GNUNET_FS_download_sync_(), GNUNET_FS_file_information_sync_(), GNUNET_FS_search_result_sync_(), and write_update_information_graph().
enum GNUNET_GenericReturnValue GNUNET_FS_read_meta_data | ( | struct GNUNET_BIO_ReadHandle * | h, |
const char * | what, | ||
struct GNUNET_FS_MetaData ** | result | ||
) |
Read a metadata container.
h | handle to an open file |
what | describes what is being read (for error message creation) |
result | the buffer to store a pointer to the (allocated) metadata |
Definition at line 1051 of file meta_data.c.
References _, GNUNET_asprintf(), GNUNET_BIO_read(), GNUNET_BIO_read_int32(), GNUNET_BIO_read_set_error(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_FS_meta_data_deserialize(), GNUNET_log, GNUNET_malloc, GNUNET_OK, GNUNET_SYSERR, h, MAX_META_DATA, meta, result, and size.
Referenced by deserialize_fi_node(), deserialize_search_result(), and read_spec_handler_meta_data().