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 3, 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
29 #include "gnunet_constants.h"
30 #include "gnunet_datastore_service.h"
31 #include "gnunet_dht_service.h"
32 #include "gnunet_fs_service.h"
33 #include "gnunet_block_lib.h"
38 * Maximum number of outgoing messages we queue per peer.
40 * Performance measurements for 2 peer setup for 50 MB file
41 * (with MAX_DATASTORE_QUEUE = 1 and RETRY_PROBABILITY_INV = 1):
43 * 2: 1700 kb/s, 1372 kb/s
44 * 8: 2117 kb/s, 1284 kb/s, 1112 kb/s
45 * 16: 3500 kb/s, 3200 kb/s, 3388 kb/s
46 * 32: 3441 kb/s, 3163 kb/s, 3277 kb/s
47 * 128: 1700 kb/s; 2010 kb/s, 3383 kb/s, 1156 kb/s
49 * Conclusion: 16 seems to be a pretty good value (stable
50 * and high performance, no excessive memory use).
52 #define MAX_QUEUE_PER_PEER 16
55 * Maximum size of the datastore queue for P2P operations.
56 * Needs to be large enough to queue MAX_QUEUE_PER_PEER
57 * operations for roughly the number of active (connected)
60 #define MAX_DATASTORE_QUEUE (16 * MAX_QUEUE_PER_PEER)
63 * Maximum number of blocks we keep in memory for migration.
65 #define MAX_MIGRATION_QUEUE 8
68 * Blocks are at most migrated to this number of peers
69 * plus one, each time they are fetched from the database.
71 #define MIGRATION_LIST_SIZE 2
74 * To how many peers do we forward each migration block ultimately?
75 * This number must be smaller or equal to MIGRATION_LIST_SIZE. Using
76 * a smaller value allows for variation in available bandwidth (for
77 * migration) between the peers.
79 #define MIGRATION_TARGET_COUNT 2
82 * Ratio for moving average delay calculation. The previous
83 * average goes in with a factor of (n-1) into the calculation.
86 #define RUNAVG_DELAY_N 16
89 * Size of the individual blocks used for file-sharing.
91 #define DBLOCK_SIZE (32*1024)
94 * Maximum legal size for a kblock.
96 #define MAX_KBLOCK_SIZE (60 * 1024)
99 * Maximum legal size for an sblock.
101 #define MAX_SBLOCK_SIZE (60 * 1024)
104 * Maximum legal size for an nblock.
106 #define MAX_NBLOCK_SIZE (60 * 1024)
109 * Pick a multiple of 2 here to achive 8-byte alignment!
110 * We also probably want DBlocks to have (roughly) the
111 * same size as IBlocks. With SHA-512, the optimal
112 * value is 32768 byte / 128 byte = 256
113 * (128 byte = 2 * 512 bits). DO NOT CHANGE!
115 #define CHK_PER_INODE 256
119 * Maximum size for a file to be considered for
120 * inlining in a directory.
122 #define MAX_INLINE_SIZE 65536
126 * Blocksize to use when hashing files
127 * for indexing (blocksize for IO, not for
128 * the DBlocks). Larger blocksizes can
129 * be more efficient but will be more disruptive
130 * as far as the scheduler is concerned.
132 #define HASHING_BLOCKSIZE (1024 * 128)
135 * Number of bits we set per entry in the bloomfilter.
138 #define BLOOMFILTER_K GNUNET_DHT_GET_BLOOMFILTER_K
141 * Number of availability trials we perform per search result.
143 #define AVAILABILITY_TRIALS_MAX 8
146 * Length of the P2P success tracker. Note that
147 * having a very long list can also hurt performance.
149 #define P2P_SUCCESS_LIST_SIZE 8
153 * Length of the CS-2-P success tracker. Note that
154 * having a very long list can also hurt performance.
156 #define CS2P_SUCCESS_LIST_SIZE 8
159 * How long are we willing to wait for the datastore to be ready to
160 * process a request for a query without priority?
162 #define BASIC_DATASTORE_REQUEST_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
166 * How long are we willing to wait for the core to be ready to
167 * transmit a reply to the target peer (if we can not transmit
168 * until then, we will discard the reply).
170 #define ACCEPTABLE_REPLY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
174 * Bandwidth value of an (effectively) 0-priority query.
176 #define QUERY_BANDWIDTH_VALUE 1
179 * Bandwidth value of a 0-priority content (must be
180 * fairly high compared to query since content is
181 * typically significantly larger -- and more valueable
182 * since it can take many queries to get one piece of
185 #define CONTENT_BANDWIDTH_VALUE 800
188 * By which amount do we decrement the TTL for simple forwarding /
189 * indirection of the query; in milli-seconds. Set somewhat in
190 * accordance to your network latency (above the time it'll take you
191 * to send a packet and get a reply).
193 #define TTL_DECREMENT 5000
196 * Until which load do we consider the peer idle and do not
197 * charge at all? (should be larger than GNUNET_IDLE_LOAD_THRESHOLD used
198 * by the rest of the code)!
200 #define IDLE_LOAD_THRESHOLD ((100 + GNUNET_CONSTANTS_IDLE_LOAD_THRESHOLD) / 2)
203 * Name of the directory with top-level searches.
205 #define GNUNET_FS_SYNC_PATH_MASTER_SEARCH "search"
208 * Name of the directory with sub-searches (namespace-updates).
210 #define GNUNET_FS_SYNC_PATH_CHILD_SEARCH "search-child"
213 * Name of the directory with master downloads (not associated
214 * with search or part of another download).
216 #define GNUNET_FS_SYNC_PATH_MASTER_DOWNLOAD "download"
219 * Name of the directory with downloads that are part of another
220 * download or a search.
222 #define GNUNET_FS_SYNC_PATH_CHILD_DOWNLOAD "download-child"
225 * Name of the directory with publishing operations.
227 #define GNUNET_FS_SYNC_PATH_MASTER_PUBLISH "publish"
230 * Name of the directory with files that are being published
232 #define GNUNET_FS_SYNC_PATH_FILE_INFO "publish-file"
235 * Name of the directory with unindex operations.
237 #define GNUNET_FS_SYNC_PATH_MASTER_UNINDEX "unindex"
241 * @brief content hash key
243 struct ContentHashKey
246 * Hash of the original content, used for encryption.
251 * Hash of the encrypted content, used for querying.
253 GNUNET_HashCode query;
258 * @brief complete information needed
259 * to download a file.
261 struct FileIdentifier
265 * Total size of the file in bytes. (network byte order (!))
267 uint64_t file_length;
270 * Query and key of the top GNUNET_EC_IBlock.
272 struct ContentHashKey chk;
278 * Information about a file and its location
279 * (peer claiming to share the file).
284 * Information about the shared file.
286 struct FileIdentifier fi;
289 * Identity of the peer sharing the file.
291 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded peer;
294 * Time when this location URI expires.
296 struct GNUNET_TIME_Absolute expirationTime;
299 * RSA signature over the GNUNET_EC_FileIdentifier,
300 * GNUNET_hash of the peer and expiration time.
302 struct GNUNET_CRYPTO_RsaSignature contentSignature;
312 * Content-hash-key (simple file).
317 * Signed key space (file in namespace).
322 * Keyword search key (query with keywords).
327 * Location (chk with identity of hosting peer).
333 * A Universal Resource Identifier (URI), opaque.
347 * Keywords start with a '+' if they are
348 * mandatory (in which case the '+' is NOT
349 * part of the keyword) and with a
350 * simple space if they are optional
351 * (in which case the space is ALSO not
352 * part of the actual keyword).
354 * Double-quotes to protect spaces and
355 * %-encoding are NOT used internally
356 * (only in URI-strings).
361 * Size of the keywords array.
363 unsigned int keywordCount;
369 * Hash of the public key for the namespace.
371 GNUNET_HashCode namespace;
374 * Human-readable identifier chosen for this
375 * entry in the namespace.
381 * Information needed to retrieve a file (content-hash-key
384 struct FileIdentifier chk;
387 * Information needed to retrieve a file including signed
388 * location (identity of a peer) of the content.
397 * Information for a file or directory that is
398 * about to be published.
400 struct GNUNET_FS_FileInformation
404 * Files in a directory are kept as a linked list.
406 struct GNUNET_FS_FileInformation *next;
409 * If this is a file in a directory, "dir" refers to
410 * the directory; otherwise NULL.
412 struct GNUNET_FS_FileInformation *dir;
415 * Handle to the master context.
417 struct GNUNET_FS_Handle *h;
420 * Pointer kept for the client.
425 * Metadata to use for the file.
427 struct GNUNET_CONTAINER_MetaData *meta;
430 * Keywords to use for KBlocks.
432 struct GNUNET_FS_Uri *keywords;
435 * CHK for this file or directory. NULL if
436 * we have not yet computed it.
438 struct GNUNET_FS_Uri *chk_uri;
441 * Block options for the file.
443 struct GNUNET_FS_BlockOptions bo;
446 * At what time did we start this upload?
448 struct GNUNET_TIME_Absolute start_time;
451 * Under what filename is this struct serialized
452 * (for operational persistence). Should be determined
458 * Encoder being used to publish this file.
460 struct GNUNET_FS_TreeEncoder *te;
463 * Error message (non-NULL if this operation failed).
468 * Name of the file or directory (must be an absolute path).
473 * Data describing either the file or the directory.
485 * Function that can be used to read the data for the file.
487 GNUNET_FS_DataReader reader;
490 * Closure for reader.
495 * If this file is being indexed, this value is set to the hash
496 * over the entire file (when the indexing process is started).
497 * Otherwise this field is not used.
499 GNUNET_HashCode file_id;
502 * Size of the file (in bytes).
507 * Should the file be indexed or inserted?
512 * Is "file_id" already valid? Set to GNUNET_YES once the hash
513 * has been calculated.
518 * Has the service confirmed our INDEX_START request?
519 * GNUNET_YES if this step has been completed.
521 int index_start_confirmed;
526 * Data for a directory.
532 * Linked list of entries in the directory.
534 struct GNUNET_FS_FileInformation *entries;
537 * Size of the directory itself (in bytes); 0 if the
538 * size has not yet been calculated.
543 * Pointer to the data for the directory (or NULL if not
553 * Is this struct for a file or directory?
558 * Are we done publishing this file?
566 * The job is now ready to run and should use the given client
567 * handle to communicate with the FS service.
570 * @param client handle to use for FS communication
572 typedef void (*GNUNET_FS_QueueStart) (void *cls,
573 struct GNUNET_CLIENT_Connection * client);
577 * The job must now stop to run and should destry the client handle as
578 * soon as possible (ideally prior to returning).
580 typedef void (*GNUNET_FS_QueueStop) (void *cls);
584 * Entry in the job queue.
586 struct GNUNET_FS_QueueEntry
589 * This is a linked list.
591 struct GNUNET_FS_QueueEntry *next;
594 * This is a linked list.
596 struct GNUNET_FS_QueueEntry *prev;
599 * Function to call when the job is started.
601 GNUNET_FS_QueueStart start;
604 * Function to call when the job needs to stop (or is done / dequeued).
606 GNUNET_FS_QueueStop stop;
609 * Closure for start and stop.
614 * Handle to FS primary context.
616 struct GNUNET_FS_Handle *h;
619 * Client handle, or NULL if job is not running.
621 struct GNUNET_CLIENT_Connection *client;
624 * Time the job was originally queued.
626 struct GNUNET_TIME_Absolute queue_time;
629 * Time the job was started last.
631 struct GNUNET_TIME_Absolute start_time;
634 * Total amount of time the job has been running (except for the
637 struct GNUNET_TIME_Relative run_time;
640 * How many blocks do the active downloads have?
645 * How often have we (re)started this download?
647 unsigned int start_times;
655 * Information we store for each search result.
657 struct GNUNET_FS_SearchResult
661 * Search context this result belongs to.
663 struct GNUNET_FS_SearchContext *sc;
666 * URI to which this search result refers to.
668 struct GNUNET_FS_Uri *uri;
671 * Metadata for the search result.
673 struct GNUNET_CONTAINER_MetaData *meta;
676 * Client info for this search result.
681 * ID of a job that is currently probing this results' availability
682 * (NULL if we are not currently probing).
684 struct GNUNET_FS_DownloadContext *probe_ctx;
687 * ID of an associated download based on this search result (or
690 struct GNUNET_FS_DownloadContext *download;
693 * If this search result triggered an update search, this field
694 * links to the update search.
696 struct GNUNET_FS_SearchContext *update_search;
699 * Name under which this search result is stored on disk.
704 * Key for the search result
709 * ID of the task that will clean up the probe_ctx should it not
710 * complete on time (and that will need to be cancelled if we clean
711 * up the search result before then).
713 GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task;
716 * When did the current probe become active?
718 struct GNUNET_TIME_Absolute probe_active_time;
721 * How much longer should we run the current probe before giving up?
723 struct GNUNET_TIME_Relative remaining_probe_time;
726 * Number of mandatory keywords for which we have NOT yet found the
727 * search result; when this value hits zero, the search result is
728 * given to the callback.
730 uint32_t mandatory_missing;
733 * Number of optional keywords under which this result was also
736 uint32_t optional_support;
739 * Number of availability tests that have succeeded for this result.
741 uint32_t availability_success;
744 * Number of availability trials that we have performed for this
747 uint32_t availability_trials;
753 * Add a job to the queue.
755 * @param h handle to the overall FS state
756 * @param start function to call to begin the job
757 * @param stop function to call to pause the job, or on dequeue (if the job was running)
758 * @param cls closure for start and stop
759 * @param blocks number of blocks this download has
760 * @return queue handle
762 struct GNUNET_FS_QueueEntry *
763 GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start,
764 GNUNET_FS_QueueStop stop, void *cls, unsigned int blocks);
768 * Dequeue a job from the queue.
769 * @param qh handle for the job
772 GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh);
776 * Function that provides data by reading from a file.
778 * @param cls closure (points to the file information)
779 * @param offset offset to read from; it is possible
780 * that the caller might need to go backwards
782 * @param max maximum number of bytes that should be
783 * copied to buf; readers are not allowed
784 * to provide less data unless there is an error;
785 * a value of "0" will be used at the end to allow
786 * the reader to clean up its internal state
787 * @param buf where the reader should write the data
788 * @param emsg location for the reader to store an error message
789 * @return number of bytes written, usually "max", 0 on error
792 GNUNET_FS_data_reader_file_ (void *cls, uint64_t offset, size_t max, void *buf,
797 * Create the closure for the 'GNUNET_FS_data_reader_file_' callback.
799 * @param filename file to read
800 * @return closure to use
803 GNUNET_FS_make_file_reader_context_ (const char *filename);
808 * Function that provides data by copying from a buffer.
810 * @param cls closure (points to the buffer)
811 * @param offset offset to read from; it is possible
812 * that the caller might need to go backwards
814 * @param max maximum number of bytes that should be
815 * copied to buf; readers are not allowed
816 * to provide less data unless there is an error;
817 * a value of "0" will be used at the end to allow
818 * the reader to clean up its internal state
819 * @param buf where the reader should write the data
820 * @param emsg location for the reader to store an error message
821 * @return number of bytes written, usually "max", 0 on error
824 GNUNET_FS_data_reader_copy_ (void *cls, uint64_t offset, size_t max, void *buf,
828 * Notification of FS that a search probe has made progress.
829 * This function is used INSTEAD of the client's event handler
830 * for downloads where the GNUNET_FS_DOWNLOAD_IS_PROBE flag is set.
832 * @param cls closure, always NULL (!), actual closure
833 * is in the client-context of the info struct
834 * @param info details about the event, specifying the event type
835 * and various bits about the event
836 * @return client-context (for the next progress call
837 * for this operation; should be set to NULL for
838 * SUSPEND and STOPPED events). The value returned
839 * will be passed to future callbacks in the respective
840 * field in the GNUNET_FS_ProgressInfo struct.
843 GNUNET_FS_search_probe_progress_ (void *cls,
844 const struct GNUNET_FS_ProgressInfo *info);
848 * Main function that performs the upload.
850 * @param cls "struct GNUNET_FS_PublishContext" identifies the upload
851 * @param tc task context
854 GNUNET_FS_publish_main_ (void *cls,
855 const struct GNUNET_SCHEDULER_TaskContext *tc);
859 * Function called once the hash of the file
860 * that is being unindexed has been computed.
862 * @param cls closure, unindex context
863 * @param file_id computed hash, NULL on error
866 GNUNET_FS_unindex_process_hash_ (void *cls, const GNUNET_HashCode * file_id);
870 * Fill in all of the generic fields for a publish event and call the
873 * @param pi structure to fill in
874 * @param pc overall publishing context
875 * @param p file information for the file being published
876 * @param offset where in the file are we so far
877 * @return value returned from callback
880 GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
881 struct GNUNET_FS_PublishContext *pc,
882 const struct GNUNET_FS_FileInformation *p,
887 * Fill in all of the generic fields for a download event and call the
890 * @param pi structure to fill in
891 * @param dc overall download context
894 GNUNET_FS_download_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
895 struct GNUNET_FS_DownloadContext *dc);
899 * Task that creates the initial (top-level) download
900 * request for the file.
902 * @param cls the 'struct GNUNET_FS_DownloadContext'
903 * @param tc scheduler context
906 GNUNET_FS_download_start_task_ (void *cls,
907 const struct GNUNET_SCHEDULER_TaskContext *tc);
912 * Fill in all of the generic fields for
913 * an unindex event and call the callback.
915 * @param pi structure to fill in
916 * @param uc overall unindex context
917 * @param offset where we are in the file (for progress)
920 GNUNET_FS_unindex_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
921 struct GNUNET_FS_UnindexContext *uc,
925 * Fill in all of the generic fields for a search event and
928 * @param pi structure to fill in
929 * @param sc overall search context
930 * @return value returned by the callback
933 GNUNET_FS_search_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
934 struct GNUNET_FS_SearchContext *sc);
938 * Connect to the datastore and remove the blocks.
940 * @param uc context for the unindex operation.
943 GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc);
946 * Build the request and actually initiate the search using the
949 * @param sc search context
950 * @return GNUNET_OK on success, GNUNET_SYSERR on error
953 GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc);
956 * Start the downloading process (by entering the queue).
958 * @param dc our download context
961 GNUNET_FS_download_start_downloading_ (struct GNUNET_FS_DownloadContext *dc);
965 * Start download probes for the given search result.
967 * @param sr the search result
970 GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr);
973 * Remove serialization/deserialization file from disk.
975 * @param h master context
976 * @param ext component of the path
977 * @param ent entity identifier
980 GNUNET_FS_remove_sync_file_ (struct GNUNET_FS_Handle *h, const char *ext,
985 * Remove serialization/deserialization directory from disk.
987 * @param h master context
988 * @param ext component of the path
989 * @param uni unique name of parent
992 GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, const char *ext,
997 * Synchronize this file-information struct with its mirror
998 * on disk. Note that all internal FS-operations that change
999 * file information data should already call "sync" internally,
1000 * so this function is likely not useful for clients.
1002 * @param fi the struct to sync
1005 GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f);
1008 * Synchronize this publishing struct with its mirror
1009 * on disk. Note that all internal FS-operations that change
1010 * publishing structs should already call "sync" internally,
1011 * so this function is likely not useful for clients.
1013 * @param pc the struct to sync
1016 GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc);
1019 * Synchronize this unindex struct with its mirror
1020 * on disk. Note that all internal FS-operations that change
1021 * publishing structs should already call "sync" internally,
1022 * so this function is likely not useful for clients.
1024 * @param uc the struct to sync
1027 GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc);
1030 * Synchronize this search struct with its mirror
1031 * on disk. Note that all internal FS-operations that change
1032 * publishing structs should already call "sync" internally,
1033 * so this function is likely not useful for clients.
1035 * @param sc the struct to sync
1038 GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc);
1041 * Synchronize this search result with its mirror
1042 * on disk. Note that all internal FS-operations that change
1043 * publishing structs should already call "sync" internally,
1044 * so this function is likely not useful for clients.
1046 * @param sr the struct to sync
1049 GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr);
1052 * Synchronize this download struct with its mirror
1053 * on disk. Note that all internal FS-operations that change
1054 * publishing structs should already call "sync" internally,
1055 * so this function is likely not useful for clients.
1057 * @param dc the struct to sync
1060 GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc);
1063 * Create SUSPEND event for the given publish operation
1064 * and then clean up our state (without stop signal).
1066 * @param cls the 'struct GNUNET_FS_PublishContext' to signal for
1069 GNUNET_FS_publish_signal_suspend_ (void *cls);
1072 * Create SUSPEND event for the given search operation
1073 * and then clean up our state (without stop signal).
1075 * @param cls the 'struct GNUNET_FS_SearchContext' to signal for
1078 GNUNET_FS_search_signal_suspend_ (void *cls);
1081 * Create SUSPEND event for the given download operation
1082 * and then clean up our state (without stop signal).
1084 * @param cls the 'struct GNUNET_FS_DownloadContext' to signal for
1087 GNUNET_FS_download_signal_suspend_ (void *cls);
1090 * Create SUSPEND event for the given unindex operation
1091 * and then clean up our state (without stop signal).
1093 * @param cls the 'struct GNUNET_FS_UnindexContext' to signal for
1096 GNUNET_FS_unindex_signal_suspend_ (void *cls);
1099 * Function signature of the functions that can be called
1100 * to trigger suspend signals and clean-up for top-level
1103 * @param cls closure
1105 typedef void (*SuspendSignalFunction) (void *cls);
1108 * We track all of the top-level activities of FS
1109 * so that we can signal 'suspend' on shutdown.
1111 struct TopLevelActivity
1114 * This is a doubly-linked list.
1116 struct TopLevelActivity *next;
1119 * This is a doubly-linked list.
1121 struct TopLevelActivity *prev;
1124 * Function to call for suspend-signalling and clean up.
1126 SuspendSignalFunction ssf;
1129 * Closure for 'ssf' (some struct GNUNET_FS_XXXHandle*)
1136 * Create a top-level activity entry.
1138 * @param h global fs handle
1139 * @param ssf suspend signal function to use
1140 * @param ssf_cls closure for ssf
1141 * @return fresh top-level activity handle
1143 struct TopLevelActivity *
1144 GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, SuspendSignalFunction ssf,
1149 * Destroy a top-level activity entry.
1151 * @param h global fs handle
1152 * @param top top level activity entry
1155 GNUNET_FS_end_top (struct GNUNET_FS_Handle *h, struct TopLevelActivity *top);
1160 * Master context for most FS operations.
1162 struct GNUNET_FS_Handle
1165 * Configuration to use.
1167 const struct GNUNET_CONFIGURATION_Handle *cfg;
1170 * Name of our client.
1175 * Function to call with updates on our progress.
1177 GNUNET_FS_ProgressCallback upcb;
1185 * Head of DLL of top-level activities.
1187 struct TopLevelActivity *top_head;
1190 * Tail of DLL of top-level activities.
1192 struct TopLevelActivity *top_tail;
1195 * Head of DLL of running jobs.
1197 struct GNUNET_FS_QueueEntry *running_head;
1200 * Tail of DLL of running jobs.
1202 struct GNUNET_FS_QueueEntry *running_tail;
1205 * Head of DLL of pending jobs.
1207 struct GNUNET_FS_QueueEntry *pending_head;
1210 * Tail of DLL of pending jobs.
1212 struct GNUNET_FS_QueueEntry *pending_tail;
1215 * Task that processes the jobs in the running and pending queues
1216 * (and moves jobs around as needed).
1218 GNUNET_SCHEDULER_TaskIdentifier queue_job;
1221 * Average time we take for a single request to be satisfied.
1222 * FIXME: not yet calcualted properly...
1224 struct GNUNET_TIME_Relative avg_block_latency;
1227 * How many actual downloads do we have running right now?
1229 unsigned int active_downloads;
1232 * How many blocks do the active downloads have?
1234 unsigned int active_blocks;
1239 enum GNUNET_FS_Flags flags;
1242 * Maximum number of parallel downloads.
1244 unsigned int max_parallel_downloads;
1247 * Maximum number of parallel requests.
1249 unsigned int max_parallel_requests;
1255 * Handle for controlling a publication process.
1257 struct GNUNET_FS_PublishContext
1260 * Handle to the global fs context.
1262 struct GNUNET_FS_Handle *h;
1265 * Our top-level activity entry (if we are top-level, otherwise NULL).
1267 struct TopLevelActivity *top;
1270 * File-structure that is being shared.
1272 struct GNUNET_FS_FileInformation *fi;
1275 * Namespace that we are publishing in, NULL if we have no namespace.
1277 struct GNUNET_FS_Namespace *namespace;
1280 * ID of the content in the namespace, NULL if we have no namespace.
1285 * ID for future updates, NULL if we have no namespace or no updates.
1290 * Filename used for serializing information about this operation
1291 * (should be determined using 'mktemp').
1293 char *serialization;
1296 * Our own client handle for the FS service; only briefly used when
1297 * we start to index a file, otherwise NULL.
1299 struct GNUNET_CLIENT_Connection *client;
1302 * Current position in the file-tree for the upload.
1304 struct GNUNET_FS_FileInformation *fi_pos;
1307 * Non-null if we are currently hashing a file.
1309 struct GNUNET_CRYPTO_FileHashContext *fhc;
1312 * Connection to the datastore service.
1314 struct GNUNET_DATASTORE_Handle *dsh;
1317 * Queue entry for reservation/unreservation.
1319 struct GNUNET_DATASTORE_QueueEntry *qre;
1322 * ID of the task performing the upload. NO_TASK if the upload has
1325 GNUNET_SCHEDULER_TaskIdentifier upload_task;
1328 * Storage space to reserve for the operation.
1330 uint64_t reserve_space;
1333 * Overall number of entries to reserve for the
1334 * publish operation.
1336 uint32_t reserve_entries;
1339 * Typically GNUNET_NO. Set to GNUNET_YES if "upload_task" is
1340 * GNUNET_SCHEDULER_NO_TASK and we're waiting for a response from
1341 * the datastore service (in which case this struct must not be
1342 * freed until we have that response). If someone tries to stop the
1343 * download for good during this period, "in_network_wait" is set to
1344 * GNUNET_SYSERR which will cause the struct to be destroyed right
1345 * after we have the reply (or timeout) from the datastore service.
1347 int in_network_wait;
1350 * Options for publishing.
1352 enum GNUNET_FS_PublishOptions options;
1355 * Space reservation ID with datastore service
1361 * Set to GNUNET_YES if all processing has completed.
1368 * Phases of unindex processing (state machine).
1373 * We're currently hashing the file.
1375 UNINDEX_STATE_HASHING = 0,
1378 * We're telling the datastore to delete
1379 * the respective entries.
1381 UNINDEX_STATE_DS_REMOVE = 1,
1384 * We're notifying the FS service about
1387 UNINDEX_STATE_FS_NOTIFY = 2,
1392 UNINDEX_STATE_COMPLETE = 3,
1395 * We've encountered a fatal error.
1397 UNINDEX_STATE_ERROR = 4
1402 * Handle for controlling an unindexing operation.
1404 struct GNUNET_FS_UnindexContext
1408 * Global FS context.
1410 struct GNUNET_FS_Handle *h;
1413 * Our top-level activity entry.
1415 struct TopLevelActivity *top;
1418 * Name of the file that we are unindexing.
1423 * Short name under which we are serializing the state of this operation.
1425 char *serialization;
1428 * Connection to the FS service, only valid during the
1429 * UNINDEX_STATE_FS_NOTIFY phase.
1431 struct GNUNET_CLIENT_Connection *client;
1434 * Connection to the datastore service, only valid during the
1435 * UNINDEX_STATE_DS_NOTIFY phase.
1437 struct GNUNET_DATASTORE_Handle *dsh;
1440 * Pointer kept for the client.
1445 * Merkle-ish tree encoder context.
1447 struct GNUNET_FS_TreeEncoder *tc;
1450 * Handle used to read the file.
1452 struct GNUNET_DISK_FileHandle *fh;
1455 * Error message, NULL on success.
1460 * Context for hashing of the file.
1462 struct GNUNET_CRYPTO_FileHashContext *fhc;
1465 * Overall size of the file.
1470 * When did we start?
1472 struct GNUNET_TIME_Absolute start_time;
1475 * Hash of the file's contents (once computed).
1477 GNUNET_HashCode file_id;
1480 * Current operatinonal phase.
1482 enum UnindexState state;
1488 * Information we keep for each keyword in
1491 struct SearchRequestEntry
1494 * Hash of the original keyword, also known as the
1495 * key (for decrypting the KBlock).
1497 GNUNET_HashCode key;
1500 * Hash of the public key, also known as the query.
1502 GNUNET_HashCode query;
1505 * Map that contains a "struct GNUNET_FS_SearchResult" for each result that
1506 * was found under this keyword. Note that the entries will point
1507 * to the same locations as those in the master result map (in
1508 * "struct GNUNET_FS_SearchContext"), so they should not be freed.
1509 * The key for each entry is the XOR of the key and query in the CHK
1510 * URI (as a unique identifier for the search result).
1512 struct GNUNET_CONTAINER_MultiHashMap *results;
1515 * Is this keyword a mandatory keyword
1516 * (started with '+')?
1524 * Handle for controlling a search.
1526 struct GNUNET_FS_SearchContext
1529 * Handle to the global FS context.
1531 struct GNUNET_FS_Handle *h;
1534 * Our top-level activity entry (if we are top-level, otherwise NULL).
1536 struct TopLevelActivity *top;
1539 * List of keywords that we're looking for.
1541 struct GNUNET_FS_Uri *uri;
1544 * For update-searches, link to the search result that triggered
1545 * the update search; otherwise NULL.
1547 struct GNUNET_FS_SearchResult *psearch_result;
1550 * Connection to the FS service.
1552 struct GNUNET_CLIENT_Connection *client;
1555 * Pointer we keep for the client.
1560 * Name of the file on disk we use for persistence.
1562 char *serialization;
1565 * Error message (non-NULL if this operation failed).
1570 * Map that contains a "struct GNUNET_FS_SearchResult" for each result that
1571 * was found in the search. The key for each entry is the XOR of
1572 * the key and query in the CHK URI (as a unique identifier for the
1575 struct GNUNET_CONTAINER_MultiHashMap *master_result_map;
1578 * Per-keyword information for a keyword search. This array will
1579 * have exactly as many entries as there were keywords.
1581 struct SearchRequestEntry *requests;
1584 * When did we start?
1586 struct GNUNET_TIME_Absolute start_time;
1589 * ID of a task that is using this struct and that must be cancelled
1590 * when the search is being stopped (if not
1591 * GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some
1592 * artificial delay when trying to reconnect to the FS service.
1594 GNUNET_SCHEDULER_TaskIdentifier task;
1597 * How many of the entries in the search request
1598 * map have been passed to the service so far?
1600 unsigned int search_request_map_offset;
1603 * How many of the keywords in the KSK
1604 * map have been passed to the service so far?
1606 unsigned int keyword_offset;
1609 * Anonymity level for the search.
1614 * Number of mandatory keywords in this query.
1616 uint32_t mandatory_count;
1619 * Options for the search.
1621 enum GNUNET_FS_SearchOptions options;
1626 * FSM for possible states a block can go through. The typical
1627 * order of progression is linear through the states, alternatives
1628 * are documented in the comments.
1630 enum BlockRequestState
1633 * Initial state, block has only been allocated (since it is
1634 * relevant to the overall download request).
1639 * We've checked the block on the path down the tree, and the
1640 * content on disk did match the desired CHK, but not all
1641 * the way down, so at the bottom some blocks will still
1642 * need to be reconstructed).
1644 BRS_RECONSTRUCT_DOWN = 1,
1647 * We've calculated the CHK bottom-up based on the meta data.
1648 * This may work, but if it did we have to write the meta data to
1649 * disk at the end (and we still need to check against the
1652 BRS_RECONSTRUCT_META_UP = 2,
1655 * We've calculated the CHK bottom-up based on what we have on
1656 * disk, which may not be what the desired CHK is. If the
1657 * reconstructed CHKs match whatever comes from above, we're
1658 * done with the respective subtree.
1660 BRS_RECONSTRUCT_UP = 3,
1663 * We've determined the real, desired CHK for this block
1664 * (full tree reconstruction failed), request is now pending.
1665 * If the CHK that bubbled up through reconstruction did match
1666 * the top-level request, the state machine for the subtree
1667 * would have moved to BRS_DOWNLOAD_UP.
1672 * We've successfully downloaded this block, but the children
1673 * still need to be either downloaded or verified (download
1674 * request propagates down). If the download fails, the
1675 * state machine for this block may move to
1676 * BRS_DOWNLOAD_ERROR instead.
1678 BRS_DOWNLOAD_DOWN = 5,
1681 * This block and all of its children have been downloaded
1682 * successfully (full completion propagates up).
1684 BRS_DOWNLOAD_UP = 6,
1687 * We got a block back that matched the query but did not hash to
1688 * the key (malicious publisher or hash collision); this block
1689 * can never be downloaded (error propagates up).
1696 * Information about an active download request.
1698 struct DownloadRequest
1701 * While pending, we keep all download requests in a doubly-linked list.
1703 struct DownloadRequest *next;
1706 * While pending, we keep all download requests in a doubly-linked list.
1708 struct DownloadRequest *prev;
1711 * Parent in the CHK-tree.
1713 struct DownloadRequest *parent;
1716 * Array (!) of child-requests, or NULL for the bottom of the tree.
1718 struct DownloadRequest **children;
1721 * CHK for the request for this block (set during reconstruction
1722 * to what we have on disk, later to what we want to have).
1724 struct ContentHashKey chk;
1727 * Offset of the corresponding block. Specifically, first (!) byte of
1728 * the first DBLOCK in the subtree induced by block represented by
1734 * Number of entries in 'children' array.
1736 unsigned int num_children;
1739 * Depth of the corresponding block in the tree. 0==DBLOCKs.
1746 enum BlockRequestState state;
1749 * GNUNET_YES if this entry is in the pending list.
1757 * (recursively) free download request structure
1759 * @param dr request to free
1762 GNUNET_FS_free_download_request_ (struct DownloadRequest *dr);
1766 * Context for controlling a download.
1768 struct GNUNET_FS_DownloadContext
1772 * Global FS context.
1774 struct GNUNET_FS_Handle *h;
1777 * Our top-level activity entry (if we are top-level, otherwise NULL).
1779 struct TopLevelActivity *top;
1782 * Connection to the FS service.
1784 struct GNUNET_CLIENT_Connection *client;
1787 * Parent download (used when downloading files
1790 struct GNUNET_FS_DownloadContext *parent;
1793 * Associated search (used when downloading files
1794 * based on search results), or NULL for none.
1796 struct GNUNET_FS_SearchResult *search;
1799 * Head of list of child downloads.
1801 struct GNUNET_FS_DownloadContext *child_head;
1804 * Tail of list of child downloads.
1806 struct GNUNET_FS_DownloadContext *child_tail;
1809 * Previous download belonging to the same parent.
1811 struct GNUNET_FS_DownloadContext *prev;
1814 * Next download belonging to the same parent.
1816 struct GNUNET_FS_DownloadContext *next;
1819 * Context kept for the client.
1824 * URI that identifies the file that we are downloading.
1826 struct GNUNET_FS_Uri *uri;
1829 * Known meta-data for the file (can be NULL).
1831 struct GNUNET_CONTAINER_MetaData *meta;
1834 * Error message, NULL if we're doing OK.
1839 * Random portion of filename we use for syncing state of this
1842 char *serialization;
1845 * Where are we writing the data (name of the
1846 * file, can be NULL!).
1851 * Where are we writing the data temporarily (name of the
1852 * file, can be NULL!); used if we do not have a permanent
1853 * name and we are a directory and we do a recursive download.
1855 char *temp_filename;
1858 * Our entry in the job queue.
1860 struct GNUNET_FS_QueueEntry *job_queue;
1863 * Non-NULL if we are currently having a request for
1864 * transmission pending with the client handle.
1866 struct GNUNET_CLIENT_TransmitHandle *th;
1869 * Tree encoder used for the reconstruction.
1871 struct GNUNET_FS_TreeEncoder *te;
1874 * File handle for reading data from an existing file
1875 * (to pass to tree encoder).
1877 struct GNUNET_DISK_FileHandle *rfh;
1880 * Map of active requests (those waiting for a response). The key
1881 * is the hash of the encryped block (aka query).
1883 struct GNUNET_CONTAINER_MultiHashMap *active;
1886 * Head of linked list of pending requests.
1888 struct DownloadRequest *pending_head;
1891 * Head of linked list of pending requests.
1893 struct DownloadRequest *pending_tail;
1896 * Top-level download request.
1898 struct DownloadRequest *top_request;
1901 * Identity of the peer having the content, or all-zeros
1902 * if we don't know of such a peer.
1904 struct GNUNET_PeerIdentity target;
1907 * ID of a task that is using this struct and that must be cancelled
1908 * when the download is being stopped (if not
1909 * GNUNET_SCHEDULER_NO_TASK). Used for the task that adds some
1910 * artificial delay when trying to reconnect to the FS service or
1911 * the task processing incrementally the data on disk, or the
1912 * task requesting blocks, etc.
1914 GNUNET_SCHEDULER_TaskIdentifier task;
1917 * What is the first offset that we're interested
1923 * How many bytes starting from offset are desired?
1924 * This is NOT the overall length of the file!
1929 * How many bytes have we already received within
1930 * the specified range (DBlocks only).
1935 * What was the size of the file on disk that we're downloading
1936 * before we started? Used to detect if there is a point in
1937 * checking an existing block on disk for matching the desired
1938 * content. 0 if the file did not exist already.
1940 uint64_t old_file_size;
1943 * Time download was started.
1945 struct GNUNET_TIME_Absolute start_time;
1948 * Desired level of anonymity.
1953 * The depth of the file-tree.
1955 unsigned int treedepth;
1958 * Options for the download.
1960 enum GNUNET_FS_DownloadOptions options;
1963 * Flag set upon transitive completion (includes child downloads).
1964 * This flag is only set to GNUNET_YES for directories where all
1965 * child-downloads have also completed (and signalled completion).
1970 * Have we started the receive continuation yet?
1978 * Information about an (updateable) node in the
1981 struct NamespaceUpdateNode
1984 * Identifier for this node.
1989 * Identifier of children of this node.
1994 * Metadata for this entry.
1996 struct GNUNET_CONTAINER_MetaData *md;
1999 * URI of this entry in the namespace.
2001 struct GNUNET_FS_Uri *uri;
2004 * Namespace update generation ID. Used to ensure
2005 * freshness of the tree_id.
2010 * TREE this entry belongs to (if nug is current).
2012 unsigned int tree_id;
2017 struct GNUNET_FS_Namespace
2021 * Handle to the FS service context.
2023 struct GNUNET_FS_Handle *h;
2026 * Array with information about nodes in the namespace.
2028 struct NamespaceUpdateNode **update_nodes;
2031 * Private key for the namespace.
2033 struct GNUNET_CRYPTO_RsaPrivateKey *key;
2036 * Hash map mapping identifiers of update nodes
2037 * to the update nodes (initialized on-demand).
2039 struct GNUNET_CONTAINER_MultiHashMap *update_map;
2042 * Name of the file with the private key.
2047 * Name of the namespace.
2052 * Size of the update nodes array.
2054 unsigned int update_node_count;
2057 * Reference counter.
2062 * Generator for unique nug numbers.
2064 unsigned int nug_gen;
2069 * Message sent from a GNUnet (fs) publishing activity to the
2070 * gnunet-fs-service to initiate indexing of a file. The service is
2071 * supposed to check if the specified file is available and has the
2072 * same cryptographic hash. It should then respond with either a
2073 * confirmation or a denial.
2075 * On OSes where this works, it is considered acceptable if the
2076 * service only checks that the path, device and inode match (it can
2077 * then be assumed that the hash will also match without actually
2078 * computing it; this is an optimization that should be safe given
2079 * that the client is not our adversary).
2081 struct IndexStartMessage
2085 * Message type will be GNUNET_MESSAGE_TYPE_FS_INDEX_START.
2087 struct GNUNET_MessageHeader header;
2092 uint32_t reserved GNUNET_PACKED;
2095 * ID of device containing the file, as seen by the client. This
2096 * device ID is obtained using a call like "statvfs" (and converting
2097 * the "f_fsid" field to a 32-bit big-endian number). Use 0 if the
2098 * OS does not support this, in which case the service must do a
2099 * full hash recomputation.
2101 uint64_t device GNUNET_PACKED;
2104 * Inode of the file on the given device, as seen by the client
2105 * ("st_ino" field from "struct stat"). Use 0 if the OS does not
2106 * support this, in which case the service must do a full hash
2109 uint64_t inode GNUNET_PACKED;
2112 * Hash of the file that we would like to index.
2114 GNUNET_HashCode file_id;
2116 /* this is followed by a 0-terminated
2117 * filename of a file with the hash
2118 * "file_id" as seen by the client */
2124 * Message send by FS service in response to a request
2125 * asking for a list of all indexed files.
2127 struct IndexInfoMessage
2130 * Message type will be
2131 * GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY.
2133 struct GNUNET_MessageHeader header;
2138 uint32_t reserved GNUNET_PACKED;
2141 * Hash of the indexed file.
2143 GNUNET_HashCode file_id;
2145 /* this is followed by a 0-terminated
2146 * filename of a file with the hash
2147 * "file_id" as seen by the client */
2153 * Message sent from a GNUnet (fs) unindexing activity to the
2154 * gnunet-service-fs to indicate that a file will be unindexed. The
2155 * service is supposed to remove the file from the list of indexed
2156 * files and response with a confirmation message (even if the file
2157 * was already not on the list).
2159 struct UnindexMessage
2163 * Message type will be
2164 * GNUNET_MESSAGE_TYPE_FS_UNINDEX.
2166 struct GNUNET_MessageHeader header;
2171 uint32_t reserved GNUNET_PACKED;
2174 * Hash of the file that we will unindex.
2176 GNUNET_HashCode file_id;
2182 * Message sent from a GNUnet (fs) search activity to the
2183 * gnunet-service-fs to start a search.
2185 struct SearchMessage
2189 * Message type will be
2190 * GNUNET_MESSAGE_TYPE_FS_START_SEARCH.
2192 struct GNUNET_MessageHeader header;
2195 * Bitmask with options. Zero for no options, one for loopback-only.
2196 * Other bits are currently not defined.
2198 int32_t options GNUNET_PACKED;
2201 * Type of the content that we're looking for.
2203 uint32_t type GNUNET_PACKED;
2206 * Desired anonymity level, big-endian.
2208 uint32_t anonymity_level GNUNET_PACKED;
2211 * If the request is for a DBLOCK or IBLOCK, this is the identity of
2212 * the peer that is known to have a response. Set to all-zeros if
2213 * such a target is not known (note that even if OUR anonymity
2214 * level is >0 we may happen to know the responder's identity;
2215 * nevertheless, we should probably not use it for a DHT-lookup
2216 * or similar blunt actions in order to avoid exposing ourselves).
2218 * If the request is for an SBLOCK, this is the identity of the
2219 * pseudonym to which the SBLOCK belongs.
2221 * If the request is for a KBLOCK, "target" must be all zeros.
2223 GNUNET_HashCode target;
2226 * Hash of the keyword (aka query) for KBLOCKs; Hash of
2227 * the CHK-encoded block for DBLOCKS and IBLOCKS (aka query)
2228 * and hash of the identifier XORed with the target for
2229 * SBLOCKS (aka query).
2231 GNUNET_HashCode query;
2233 /* this is followed by the hash codes of already-known
2234 * results (which should hence be excluded from what
2235 * the service returns); naturally, this only applies
2236 * to queries that can have multiple results, such as
2237 * those for KBLOCKS (KSK) and SBLOCKS (SKS) */
2242 * Only the (mandatory) query is included.
2244 #define GET_MESSAGE_BIT_QUERY_ONLY 0
2247 * The peer identity of a peer waiting for the
2248 * reply is included (used if the response
2249 * should be transmitted to someone other than
2250 * the sender of the GET).
2252 #define GET_MESSAGE_BIT_RETURN_TO 1
2255 * The hash of the public key of the target
2256 * namespace is included (for SKS queries).
2258 #define GET_MESSAGE_BIT_SKS_NAMESPACE 2
2261 * The peer identity of a peer that had claimed to have the content
2262 * previously is included (can be used if responder-anonymity is not
2263 * desired; note that the precursor presumably lacked a direct
2264 * connection to the specified peer; still, the receiver is in no way
2265 * required to limit forwarding only to the specified peer, it should
2266 * only prefer it somewhat if possible).
2268 #define GET_MESSAGE_BIT_TRANSMIT_TO 4
2272 * Message sent between peers asking for FS-content.
2278 * Message type will be GNUNET_MESSAGE_TYPE_FS_GET.
2280 struct GNUNET_MessageHeader header;
2283 * Type of the query (block type).
2285 uint32_t type GNUNET_PACKED;
2288 * How important is this request (network byte order)
2290 uint32_t priority GNUNET_PACKED;
2293 * Relative time to live in MILLISECONDS (network byte order)
2295 int32_t ttl GNUNET_PACKED;
2298 * The content hash should be mutated using this value
2299 * before checking against the bloomfilter (used to
2300 * get many different filters for the same hash codes).
2301 * The number should be in big-endian format when used
2304 uint32_t filter_mutator GNUNET_PACKED;
2307 * Which of the optional hash codes are present at the end of the
2308 * message? See GET_MESSAGE_BIT_xx constants. For each bit that is
2309 * set, an additional GNUNET_HashCode with the respective content
2310 * (in order of the bits) will be appended to the end of the GET
2313 uint32_t hash_bitmap GNUNET_PACKED;
2316 * Hashcodes of the file(s) we're looking for.
2317 * Details depend on the query type.
2319 GNUNET_HashCode query GNUNET_PACKED;
2321 /* this is followed by hash codes
2322 * as specified in the "hash_bitmap";
2323 * after that, an optional bloomfilter
2324 * (with bits set for replies that should
2325 * be suppressed) can be present */
2330 * Response from FS service with a result for a previous FS search.
2331 * Note that queries for DBLOCKS and IBLOCKS that have received a
2332 * single response are considered done. This message is transmitted
2333 * between peers as well as between the service and a client.
2339 * Message type will be GNUNET_MESSAGE_TYPE_FS_PUT.
2341 struct GNUNET_MessageHeader header;
2344 * Type of the block (in big endian). Should never be zero.
2346 uint32_t type GNUNET_PACKED;
2349 * When does this result expire?
2351 struct GNUNET_TIME_AbsoluteNBO expiration;
2353 /* this is followed by the actual encrypted content */
2359 * Message send by a peer that wants to be excluded
2360 * from migration for a while.
2362 struct MigrationStopMessage
2365 * Message type will be
2366 * GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP.
2368 struct GNUNET_MessageHeader header;
2373 uint32_t reserved GNUNET_PACKED;
2376 * How long should the block last?
2378 struct GNUNET_TIME_RelativeNBO duration;