2 This file is part of GNUnet.
3 (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
23 * @brief definitions for the entire fs module
24 * @author Igor Wronsky, Christian Grothoff
30 * Size of the individual blocks used for file-sharing.
32 #define GNUNET_FS_DBLOCK_SIZE (32*1024)
35 * @brief content hash key
40 GNUNET_HashCode query;
45 * @brief complete information needed
52 * Total size of the file in bytes. (network byte order (!))
54 unsigned long long file_length;
57 * Query and key of the top GNUNET_EC_IBlock.
59 struct ContentHashKey chk;
65 * Information about a file and its location
66 * (peer claiming to share the file).
71 * Information about the shared file.
73 struct FileIdentifier fi;
76 * Identity of the peer sharing the file.
78 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded peer;
81 * Time when this location URI expires.
83 struct GNUNET_TIME_Absolute expirationTime;
86 * RSA signature over the GNUNET_EC_FileIdentifier,
87 * GNUNET_hash of the peer and expiration time.
89 struct GNUNET_CRYPTO_RsaSignature contentSignature;
94 { chk, sks, ksk, loc };
97 * A Universal Resource Identifier (URI), opaque.
107 * Keywords start with a '+' if they are
108 * mandatory (in which case the '+' is NOT
109 * part of the keyword) and with a
110 * simple space if they are optional
111 * (in which case the space is ALSO not
112 * part of the actual keyword).
114 * Double-quotes to protect spaces and
115 * %-encoding are NOT used internally
116 * (only in URI-strings).
121 * Size of the keywords array.
123 unsigned int keywordCount;
129 * Hash of the public key for the namespace.
131 GNUNET_HashCode namespace;
134 * Human-readable identifier chosen for this
135 * entry in the namespace.
141 * Information needed to retrieve a file (content-hash-key
144 struct FileIdentifier chk;
147 * Information needed to retrieve a file including signed
148 * location (identity of a peer) of the content.
157 * Information for a file or directory that is
158 * about to be published.
160 struct GNUNET_FS_FileInformation
164 * Files in a directory are kept as a linked list.
166 struct GNUNET_FS_FileInformation *next;
169 * If this is a file in a directory, "dir" refers to
170 * the directory; otherwise NULL.
172 struct GNUNET_FS_FileInformation *dir;
175 * Pointer kept for the client.
180 * Metadata to use for the file.
182 struct GNUNET_CONTAINER_MetaData *meta;
185 * Keywords to use for KBlocks.
187 struct GNUNET_FS_Uri *keywords;
190 * At what time should the content expire?
192 struct GNUNET_TIME_Absolute expirationTime;
195 * Under what filename is this struct serialized
196 * (for operational persistence).
201 * How many bytes of this file or directory have been
204 uint64_t publish_offset;
207 * Data describing either the file or the directory.
218 * Function that can be used to read the data for the file.
220 GNUNET_FS_DataReader reader;
223 * Closure for reader.
228 * Size of the file (in bytes).
233 * Should the file be indexed or inserted?
240 * Data for a directory.
245 * Name of the directory.
250 * Linked list of entries in the directory.
252 struct GNUNET_FS_FileInformation *entries;
255 * Size of the directory itself (in bytes); 0 if the
256 * size has not yet been calculated.
265 * Is this struct for a file or directory?
270 * Desired anonymity level.
272 unsigned int anonymity;
275 * Desired priority (for keeping the content in the DB).
277 unsigned int priority;
283 * Master context for most FS operations.
285 struct GNUNET_FS_Handle
290 struct GNUNET_SCHEDULER_Handle *sched;
293 * Configuration to use.
295 const struct GNUNET_CONFIGURATION_Handle *cfg;
298 * Name of our client.
303 * Function to call with updates on our progress.
305 GNUNET_FS_ProgressCallback upcb;
313 * Connection to the FS service.
315 struct GNUNET_CLIENT_Connection *client;
322 * Handle for controlling an upload.
324 struct GNUNET_FS_PublishContext
327 * Handle to the global fs context.
329 struct GNUNET_FS_Handle *h;
332 * Argument to pass to the client in callbacks.
337 * File-structure that is being shared.
339 struct GNUNET_FS_FileInformation *fi;
342 * Namespace that we are publishing in, NULL if we have no namespace.
344 struct GNUNET_FS_Namespace *namespace;
347 * ID of the content in the namespace, NULL if we have no namespace.
352 * ID for future updates, NULL if we have no namespace or no updates.
357 * ID of the task performing the upload. NO_TASK
358 * if the upload has completed.
360 GNUNET_SCHEDULER_TaskIdentifier upload_task;
365 * Handle for controlling an unindexing operation.
367 struct GNUNET_FS_UnindexContext
373 * Handle for controlling a search.
375 struct GNUNET_FS_SearchContext
381 * Context for controlling a download.
383 struct GNUNET_FS_DownloadContext
387 struct GNUNET_FS_Namespace