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
29 #include "gnunet_constants.h"
30 #include "gnunet_datastore_service.h"
31 #include "gnunet_fs_service.h"
34 * Size of the individual blocks used for file-sharing.
36 #define DBLOCK_SIZE (32*1024)
40 * Pick a multiple of 2 here to achive 8-byte alignment!
41 * We also probably want DBlocks to have (roughly) the
42 * same size as IBlocks. With SHA-512, the optimal
43 * value is 32768 byte / 128 byte = 256
44 * (128 byte = 2 * 512 bits). DO NOT CHANGE!
46 #define CHK_PER_INODE 256
50 * Maximum size for a file to be considered for
51 * inlining in a directory.
53 #define MAX_INLINE_SIZE 65536
57 * Blocksize to use when hashing files
58 * for indexing (blocksize for IO, not for
59 * the DBlocks). Larger blocksizes can
60 * be more efficient but will be more disruptive
61 * as far as the scheduler is concerned.
63 #define HASHING_BLOCKSIZE (1024 * 1024)
66 * Number of bits we set per entry in the bloomfilter.
69 #define BLOOMFILTER_K 16
72 * By how much (in ms) do we decrement the TTL
75 #define TTL_DECREMENT 5000
78 * How long are we willing to wait for the datastore to be ready to
79 * process a request for a query without priority?
81 #define BASIC_DATASTORE_REQUEST_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
85 * How long are we willing to wait for the core to be ready to
86 * transmit a reply to the target peer (if we can not transmit
87 * until then, we will discard the reply).
89 #define ACCEPTABLE_REPLY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
93 * Bandwidth value of an (effectively) 0-priority query.
95 #define QUERY_BANDWIDTH_VALUE 0.001
98 * Bandwidth value of a 0-priority content (must be
99 * fairly high compared to query since content is
100 * typically significantly larger -- and more valueable
101 * since it can take many queries to get one piece of
104 #define CONTENT_BANDWIDTH_VALUE 0.8
107 * By which amount do we decrement the TTL for simple forwarding /
108 * indirection of the query; in milli-seconds. Set somewhat in
109 * accordance to your network latency (above the time it'll take you
110 * to send a packet and get a reply).
112 #define TTL_DECREMENT 5000
115 * Until which load do we consider the peer idle and do not
116 * charge at all? (should be larger than GNUNET_IDLE_LOAD_THRESHOLD used
117 * by the rest of the code)!
119 #define IDLE_LOAD_THRESHOLD ((100 + GNUNET_CONSTANTS_IDLE_LOAD_THRESHOLD) / 2)
124 * @brief content hash key
126 struct ContentHashKey
129 GNUNET_HashCode query;
134 * @brief complete information needed
135 * to download a file.
137 struct FileIdentifier
141 * Total size of the file in bytes. (network byte order (!))
143 uint64_t file_length;
146 * Query and key of the top GNUNET_EC_IBlock.
148 struct ContentHashKey chk;
154 * Information about a file and its location
155 * (peer claiming to share the file).
160 * Information about the shared file.
162 struct FileIdentifier fi;
165 * Identity of the peer sharing the file.
167 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded peer;
170 * Time when this location URI expires.
172 struct GNUNET_TIME_Absolute expirationTime;
175 * RSA signature over the GNUNET_EC_FileIdentifier,
176 * GNUNET_hash of the peer and expiration time.
178 struct GNUNET_CRYPTO_RsaSignature contentSignature;
183 { chk, sks, ksk, loc };
186 * A Universal Resource Identifier (URI), opaque.
196 * Keywords start with a '+' if they are
197 * mandatory (in which case the '+' is NOT
198 * part of the keyword) and with a
199 * simple space if they are optional
200 * (in which case the space is ALSO not
201 * part of the actual keyword).
203 * Double-quotes to protect spaces and
204 * %-encoding are NOT used internally
205 * (only in URI-strings).
210 * Size of the keywords array.
212 unsigned int keywordCount;
218 * Hash of the public key for the namespace.
220 GNUNET_HashCode namespace;
223 * Human-readable identifier chosen for this
224 * entry in the namespace.
230 * Information needed to retrieve a file (content-hash-key
233 struct FileIdentifier chk;
236 * Information needed to retrieve a file including signed
237 * location (identity of a peer) of the content.
246 * Information for a file or directory that is
247 * about to be published.
249 struct GNUNET_FS_FileInformation
253 * Files in a directory are kept as a linked list.
255 struct GNUNET_FS_FileInformation *next;
258 * If this is a file in a directory, "dir" refers to
259 * the directory; otherwise NULL.
261 struct GNUNET_FS_FileInformation *dir;
264 * Pointer kept for the client.
269 * Metadata to use for the file.
271 struct GNUNET_CONTAINER_MetaData *meta;
274 * Keywords to use for KBlocks.
276 struct GNUNET_FS_Uri *keywords;
279 * CHK for this file or directory. NULL if
280 * we have not yet computed it.
282 struct GNUNET_FS_Uri *chk_uri;
285 * At what time should the content expire?
287 struct GNUNET_TIME_Absolute expirationTime;
290 * At what time did we start this upload?
292 struct GNUNET_TIME_Absolute start_time;
295 * Under what filename is this struct serialized
296 * (for operational persistence).
301 * Encoder being used to publish this file.
303 struct GNUNET_FS_TreeEncoder *te;
306 * Error message (non-NULL if this operation
312 * Data describing either the file or the directory.
323 * Function that can be used to read the data for the file.
325 GNUNET_FS_DataReader reader;
328 * Closure for reader.
333 * Name of the file (must be an absolute path).
334 * Only required for indexing. FIXME: not yet
340 * If this file is being indexed, this value
341 * is set to the hash over the entire file
342 * (when the indexing process is started).
343 * Otherwise this field is not used.
345 GNUNET_HashCode file_id;
348 * Size of the file (in bytes).
353 * Should the file be indexed or inserted?
360 * Data for a directory.
365 * Name of the directory.
370 * Linked list of entries in the directory.
372 struct GNUNET_FS_FileInformation *entries;
375 * Size of the directory itself (in bytes); 0 if the
376 * size has not yet been calculated.
381 * Pointer to the data for the directory (or NULL if not
391 * Is this struct for a file or directory?
396 * Desired anonymity level.
401 * Desired priority (for keeping the content in the DB).
409 * Master context for most FS operations.
411 struct GNUNET_FS_Handle
416 struct GNUNET_SCHEDULER_Handle *sched;
419 * Configuration to use.
421 const struct GNUNET_CONFIGURATION_Handle *cfg;
424 * Name of our client.
429 * Function to call with updates on our progress.
431 GNUNET_FS_ProgressCallback upcb;
439 * Connection to the FS service.
441 struct GNUNET_CLIENT_Connection *client;
444 * How many downloads probing availability
445 * of search results do we have running
448 unsigned int active_probes;
453 enum GNUNET_FS_Flags flags;
459 * Handle for controlling an upload.
461 struct GNUNET_FS_PublishContext
464 * Handle to the global fs context.
466 struct GNUNET_FS_Handle *h;
469 * Argument to pass to the client in callbacks.
474 * File-structure that is being shared.
476 struct GNUNET_FS_FileInformation *fi;
479 * Namespace that we are publishing in, NULL if we have no namespace.
481 struct GNUNET_FS_Namespace *namespace;
484 * ID of the content in the namespace, NULL if we have no namespace.
489 * ID for future updates, NULL if we have no namespace or no updates.
494 * Our own client handle for the FS service;
495 * only briefly used when we start to index a
496 * file, otherwise NULL.
498 struct GNUNET_CLIENT_Connection *client;
501 * Current position in the file-tree for the
504 struct GNUNET_FS_FileInformation *fi_pos;
507 * Connection to the datastore service.
509 struct GNUNET_DATASTORE_Handle *dsh;
512 * ID of the task performing the upload. NO_TASK
513 * if the upload has completed.
515 GNUNET_SCHEDULER_TaskIdentifier upload_task;
518 * Typically GNUNET_NO. Set to GNUNET_YES if
519 * "upload_task" is GNUNET_SCHEDULER_NO_TASK
520 * and we're waiting for a response from the
521 * datastore service (in which case this
522 * struct must not be freed until we have that
523 * response). If someone tries to stop the
524 * download for good during this period,
525 * "in_network_wait" is set to GNUNET_SYSERR
526 * which will cause the struct to be destroyed
527 * right after we have the reply (or timeout)
528 * from the datastore service.
533 * Options for publishing.
535 enum GNUNET_FS_PublishOptions options;
538 * Space reservation ID with datastore service
546 * Phases of unindex processing (state machine).
551 * We're currently hashing the file.
553 UNINDEX_STATE_HASHING = 0,
556 * We're notifying the FS service about
559 UNINDEX_STATE_FS_NOTIFY = 1,
562 * We're telling the datastore to delete
563 * the respective entries.
565 UNINDEX_STATE_DS_REMOVE = 2,
570 UNINDEX_STATE_COMPLETE = 3,
573 * We've encountered a fatal error.
575 UNINDEX_STATE_ERROR = 4,
578 * We've been aborted. The next callback should clean up the
581 UNINDEX_STATE_ABORTED = 5
586 * Handle for controlling an unindexing operation.
588 struct GNUNET_FS_UnindexContext
594 struct GNUNET_FS_Handle *h;
597 * Name of the file that we are unindexing.
602 * Connection to the FS service,
603 * only valid during the UNINDEX_STATE_FS_NOTIFY
606 struct GNUNET_CLIENT_Connection *client;
609 * Connection to the datastore service,
610 * only valid during the UNINDEX_STATE_DS_NOTIFY
613 struct GNUNET_DATASTORE_Handle *dsh;
616 * Pointer kept for the client.
621 * Merkle-ish tree encoder context.
623 struct GNUNET_FS_TreeEncoder *tc;
626 * Handle used to read the file.
628 struct GNUNET_DISK_FileHandle *fh;
631 * Overall size of the file.
638 struct GNUNET_TIME_Absolute start_time;
641 * Hash of the file's contents (once
644 GNUNET_HashCode file_id;
647 * Current operatinonal phase.
649 enum UnindexState state;
655 * Information we store for each search result.
661 * URI to which this search result
664 struct GNUNET_FS_Uri *uri;
667 * Metadata for the search result.
669 struct GNUNET_CONTAINER_MetaData *meta;
672 * Client info for this search result.
677 * ID of a job that is currently probing
678 * this results' availability (NULL if we
679 * are not currently probing).
681 struct GNUNET_FS_DownloadContext *probe_ctx;
684 * ID of the task that will clean up the probe_ctx
685 * should it not complete on time (and that will
686 * need to be cancelled if we clean up the search
687 * result before then).
689 GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task;
692 * Number of mandatory keywords for which
693 * we have NOT yet found the search result;
694 * when this value hits zero, the search
695 * result is given to the callback.
697 uint32_t mandatory_missing;
700 * Number of optional keywords under which
701 * this result was also found.
703 uint32_t optional_support;
706 * Number of availability tests that
707 * have succeeded for this result.
709 uint32_t availability_success;
712 * Number of availability trials that we
713 * have performed for this search result.
715 uint32_t availability_trials;
721 * Information we keep for each keyword in
724 struct SearchRequestEntry
727 * Hash of the original keyword, also known as the
728 * key (for decrypting the KBlock).
733 * Hash of the public key, also known as the query.
735 GNUNET_HashCode query;
738 * Map that contains a "struct SearchResult" for each result that
739 * was found under this keyword. Note that the entries will point
740 * to the same locations as those in the master result map (in
741 * "struct GNUNET_FS_SearchContext"), so they should not be freed.
742 * The key for each entry is the XOR of the key and query in the CHK
743 * URI (as a unique identifier for the search result).
745 struct GNUNET_CONTAINER_MultiHashMap *results;
748 * Is this keyword a mandatory keyword
749 * (started with '+')?
757 * Handle for controlling a search.
759 struct GNUNET_FS_SearchContext
762 * Handle to the global FS context.
764 struct GNUNET_FS_Handle *h;
767 * List of keywords that we're looking for.
769 struct GNUNET_FS_Uri *uri;
772 * For update-searches, link to the
773 * base-SKS search that triggered the
774 * update search; otherwise NULL.
776 struct GNUNET_FS_SearchContext *parent;
779 * Connection to the FS service.
781 struct GNUNET_CLIENT_Connection *client;
784 * Pointer we keep for the client.
789 * Map that contains a "struct SearchResult" for each result that
790 * was found in the search. The key for each entry is the XOR of
791 * the key and query in the CHK URI (as a unique identifier for the
794 struct GNUNET_CONTAINER_MultiHashMap *master_result_map;
797 * Per-keyword information for a keyword search.
798 * This array will have exactly as many entries
799 * as there were keywords.
801 struct SearchRequestEntry *requests;
806 struct GNUNET_TIME_Absolute start_time;
809 * ID of a task that is using this struct
810 * and that must be cancelled when the search
811 * is being stopped (if not GNUNET_SCHEDULER_NO_TASK).
812 * Used for the task that adds some artificial
813 * delay when trying to reconnect to the FS
816 GNUNET_SCHEDULER_TaskIdentifier task;
819 * Anonymity level for the search.
824 * Number of mandatory keywords in this query.
826 uint32_t mandatory_count;
831 * Information about an active download request.
833 struct DownloadRequest
836 * While pending, we keep all download requests
839 struct DownloadRequest *next;
842 * CHK for the request.
844 struct ContentHashKey chk;
847 * Offset of the corresponding block.
852 * Depth of the corresponding block in the tree.
857 * Set if this request is currently in the linked list of pending
858 * requests. Needed in case we get a response for a request that we
859 * have not yet send (due to FS bug or two blocks with identical
860 * content); in this case, we would need to remove the block from
861 * the pending list (and need a fast way to check if the block is on
870 * Context for controlling a download.
872 struct GNUNET_FS_DownloadContext
878 struct GNUNET_FS_Handle *h;
881 * Connection to the FS service.
883 struct GNUNET_CLIENT_Connection *client;
886 * Parent download (used when downloading files
889 struct GNUNET_FS_DownloadContext *parent;
892 * Context kept for the client.
897 * URI that identifies the file that
898 * we are downloading.
900 struct GNUNET_FS_Uri *uri;
903 * Known meta-data for the file (can be NULL).
905 struct GNUNET_CONTAINER_MetaData *meta;
908 * Error message, NULL if we're doing OK.
913 * Where are we writing the data (name of the
914 * file, can be NULL!).
919 * Map of active requests (those waiting
920 * for a response). The key is the hash
921 * of the encryped block (aka query).
923 struct GNUNET_CONTAINER_MultiHashMap *active;
926 * Linked list of pending requests.
928 struct DownloadRequest *pending;
931 * The file handle, NULL if we don't create
934 struct GNUNET_DISK_FileHandle *handle;
937 * Identity of the peer having the content, or all-zeros
938 * if we don't know of such a peer.
940 struct GNUNET_PeerIdentity target;
943 * ID of a task that is using this struct
944 * and that must be cancelled when the download
945 * is being stopped (if not GNUNET_SCHEDULER_NO_TASK).
946 * Used for the task that adds some artificial
947 * delay when trying to reconnect to the FS
950 GNUNET_SCHEDULER_TaskIdentifier task;
953 * What was the size of the file on disk that we're downloading
954 * before we started? Used to detect if there is a point in
955 * checking an existing block on disk for matching the desired
956 * content. 0 if the file did not exist already.
958 uint64_t old_file_size;
961 * What is the first offset that we're interested
967 * How many bytes starting from offset are desired?
968 * This is NOT the overall length of the file!
973 * How many bytes have we already received within
974 * the specified range (DBlocks only).
979 * Time download was started.
981 struct GNUNET_TIME_Absolute start_time;
984 * Desired level of anonymity.
989 * The depth of the file-tree.
991 unsigned int treedepth;
994 * Options for the download.
996 enum GNUNET_FS_DownloadOptions options;
1000 struct GNUNET_FS_Namespace
1004 * Private key for the namespace.
1006 struct GNUNET_CRYPTO_RsaPrivateKey *key;
1009 * Reference counter.
1016 * @brief index block (indexing a DBlock that
1017 * can be obtained directly from reading
1018 * the plaintext file)
1020 struct OnDemandBlock
1023 * Hash code of the entire content of the
1024 * file that was indexed (used to uniquely
1025 * identify the plaintext file).
1027 GNUNET_HashCode file_id;
1030 * At which offset should we be able to find
1031 * this on-demand encoded block?
1033 uint64_t offset GNUNET_PACKED;
1039 * @brief keyword block (advertising data under a keyword)
1045 * GNUNET_RSA_Signature using RSA-key generated from search keyword.
1047 struct GNUNET_CRYPTO_RsaSignature signature;
1050 * What is being signed and why?
1052 struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
1055 * Key generated (!) from the H(keyword) as the seed!
1057 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
1059 /* 0-terminated URI here */
1061 /* variable-size Meta-Data follows here */
1066 * @brief namespace content block (advertising data under an identifier in a namespace)
1072 * GNUNET_RSA_Signature using RSA-key of the namespace
1074 struct GNUNET_CRYPTO_RsaSignature signature;
1077 * What is being signed and why?
1079 struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
1082 * Hash of the hash of the human-readable identifier used for
1083 * this entry (the hash of the human-readable identifier is
1084 * used as the key for decryption; the xor of this identifier
1085 * and the hash of the "keyspace" is the datastore-query hash).
1087 GNUNET_HashCode identifier;
1090 * Public key of the namespace.
1092 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
1094 /* 0-terminated update-identifier here */
1096 /* 0-terminated URI here */
1098 /* variable-size Meta-Data follows here */
1104 * Message sent from a GNUnet (fs) publishing
1105 * activity to the gnunet-fs-service to
1106 * initiate indexing of a file. The service
1107 * is supposed to check if the specified file
1108 * is available and has the same cryptographic
1109 * hash. It should then respond with either
1110 * a confirmation or a denial.
1112 * On OSes where this works, it is considered
1113 * acceptable if the service only checks that
1114 * the path, device and inode match (it can
1115 * then be assumed that the hash will also match
1116 * without actually computing it; this is an
1117 * optimization that should be safe given that
1118 * the client is not our adversary).
1120 struct IndexStartMessage
1124 * Message type will be
1125 * GNUNET_MESSAGE_TYPE_FS_INDEX_START.
1127 struct GNUNET_MessageHeader header;
1130 * ID of device containing the file, as seen by the client. This
1131 * device ID is obtained using a call like "statvfs" (and converting
1132 * the "f_fsid" field to a 32-bit big-endian number). Use 0 if the
1133 * OS does not support this, in which case the service must do a
1134 * full hash recomputation.
1136 uint32_t device GNUNET_PACKED;
1139 * Inode of the file on the given device, as seen by the client
1140 * ("st_ino" field from "struct stat"). Use 0 if the OS does not
1141 * support this, in which case the service must do a full hash
1144 uint64_t inode GNUNET_PACKED;
1147 * Hash of the file that we would like to index.
1149 GNUNET_HashCode file_id;
1151 /* this is followed by a 0-terminated
1152 filename of a file with the hash
1153 "file_id" as seen by the client */
1159 * Message send by FS service in response to a request
1160 * asking for a list of all indexed files.
1162 struct IndexInfoMessage
1165 * Message type will be
1166 * GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY.
1168 struct GNUNET_MessageHeader header;
1173 uint32_t reserved GNUNET_PACKED;
1176 * Hash of the indexed file.
1178 GNUNET_HashCode file_id;
1180 /* this is followed by a 0-terminated
1181 filename of a file with the hash
1182 "file_id" as seen by the client */
1188 * Message sent from a GNUnet (fs) unindexing
1189 * activity to the gnunet-fs-service to
1190 * indicate that a file will be unindexed. The service
1191 * is supposed to remove the file from the
1192 * list of indexed files and response with
1193 * a confirmation message (even if the file
1194 * was already not on the list).
1196 struct UnindexMessage
1200 * Message type will be
1201 * GNUNET_MESSAGE_TYPE_FS_UNINDEX.
1203 struct GNUNET_MessageHeader header;
1208 uint32_t reserved GNUNET_PACKED;
1211 * Hash of the file that we will unindex.
1213 GNUNET_HashCode file_id;
1219 * Message sent from a GNUnet (fs) search
1220 * activity to the gnunet-fs-service to
1223 struct SearchMessage
1227 * Message type will be
1228 * GNUNET_MESSAGE_TYPE_FS_START_SEARCH.
1230 struct GNUNET_MessageHeader header;
1235 int32_t reserved GNUNET_PACKED;
1238 * Type of the content that we're looking for.
1241 uint32_t type GNUNET_PACKED;
1244 * Desired anonymity level, big-endian.
1246 uint32_t anonymity_level GNUNET_PACKED;
1249 * If the request is for a DBLOCK or IBLOCK, this is the identity of
1250 * the peer that is known to have a response. Set to all-zeros if
1251 * such a target is not known (note that even if OUR anonymity
1252 * level is >0 we may happen to know the responder's identity;
1253 * nevertheless, we should probably not use it for a DHT-lookup
1254 * or similar blunt actions in order to avoid exposing ourselves).
1256 * If the request is for an SBLOCK, this is the identity of the
1257 * pseudonym to which the SBLOCK belongs.
1259 * If the request is for a KBLOCK, "target" must be all zeros.
1261 GNUNET_HashCode target;
1264 * Hash of the keyword (aka query) for KBLOCKs; Hash of
1265 * the CHK-encoded block for DBLOCKS and IBLOCKS (aka query)
1266 * and hash of the identifier XORed with the target for
1267 * SBLOCKS (aka query).
1269 GNUNET_HashCode query;
1271 /* this is followed by the hash codes of already-known
1272 results (which should hence be excluded from what
1273 the service returns); naturally, this only applies
1274 to queries that can have multiple results, such as
1275 those for KBLOCKS (KSK) and SBLOCKS (SKS) */
1280 * Response from FS service with a result for
1281 * a previous FS search. Note that queries
1282 * for DBLOCKS and IBLOCKS that have received
1283 * a single response are considered done.
1285 struct ContentMessage
1289 * Message type will be
1290 * GNUNET_MESSAGE_TYPE_FS_CONTENT.
1292 struct GNUNET_MessageHeader header;
1295 * Type of the content that was found,
1296 * should never be 0.
1298 uint32_t type GNUNET_PACKED;
1301 * When will this result expire?
1303 struct GNUNET_TIME_AbsoluteNBO expiration;
1305 /* followed by the actual block of data */
1310 * Only the (mandatory) query is included.
1312 #define GET_MESSAGE_BIT_QUERY_ONLY 0
1315 * The peer identity of a peer waiting for the
1316 * reply is included (used if the response
1317 * should be transmitted to someone other than
1318 * the sender of the GET).
1320 #define GET_MESSAGE_BIT_RETURN_TO 1
1323 * The hash of the public key of the target
1324 * namespace is included (for SKS queries).
1326 #define GET_MESSAGE_BIT_SKS_NAMESPACE 2
1329 * The peer identity of a peer that had claimed to have the content
1330 * previously is included (can be used if responder-anonymity is not
1331 * desired; note that the precursor presumably lacked a direct
1332 * connection to the specified peer; still, the receiver is in no way
1333 * required to limit forwarding only to the specified peer, it should
1334 * only prefer it somewhat if possible).
1336 #define GET_MESSAGE_BIT_TRANSMIT_TO 4
1340 * Message sent between peers asking for FS-content.
1346 * Message type will be GNUNET_MESSAGE_TYPE_FS_GET.
1348 struct GNUNET_MessageHeader header;
1351 * Type of the query (block type).
1353 uint32_t type GNUNET_PACKED;
1356 * How important is this request (network byte order)
1358 uint32_t priority GNUNET_PACKED;
1361 * Relative time to live in GNUNET_CRON_MILLISECONDS (network byte order)
1363 int32_t ttl GNUNET_PACKED;
1366 * The content hash should be mutated using this value
1367 * before checking against the bloomfilter (used to
1368 * get many different filters for the same hash codes).
1369 * The number should be in big-endian format when used
1372 int32_t filter_mutator GNUNET_PACKED;
1375 * Which of the optional hash codes are present at the end of the
1376 * message? See GET_MESSAGE_BIT_xx constants. For each bit that is
1377 * set, an additional GNUNET_HashCode with the respective content
1378 * (in order of the bits) will be appended to the end of the GET
1381 uint32_t hash_bitmap GNUNET_PACKED;
1384 * Hashcodes of the file(s) we're looking for.
1385 * Details depend on the query type.
1387 GNUNET_HashCode query GNUNET_PACKED;
1389 /* this is followed by hash codes
1390 as specified in the "hash_bitmap";
1391 after that, an optional bloomfilter
1392 (with bits set for replies that should
1393 be suppressed) can be present */
1398 * Message sent between peers providing FS-content.
1404 * Message type will be GNUNET_MESSAGE_TYPE_FS_PUT.
1406 struct GNUNET_MessageHeader header;
1409 * Type of the block (in big endian).
1411 uint32_t type GNUNET_PACKED;
1414 * When does this result expire?
1416 struct GNUNET_TIME_RelativeNBO expiration;
1418 /* this is followed by the actual encrypted content */