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)
39 * Maximum legal size for a kblock.
41 #define MAX_KBLOCK_SIZE (60 * 1024)
44 * Maximum legal size for an sblock.
46 #define MAX_SBLOCK_SIZE (60 * 1024)
49 * Maximum legal size for an nblock.
51 #define MAX_NBLOCK_SIZE (60 * 1024)
54 * Pick a multiple of 2 here to achive 8-byte alignment!
55 * We also probably want DBlocks to have (roughly) the
56 * same size as IBlocks. With SHA-512, the optimal
57 * value is 32768 byte / 128 byte = 256
58 * (128 byte = 2 * 512 bits). DO NOT CHANGE!
60 #define CHK_PER_INODE 256
64 * Maximum size for a file to be considered for
65 * inlining in a directory.
67 #define MAX_INLINE_SIZE 65536
71 * Blocksize to use when hashing files
72 * for indexing (blocksize for IO, not for
73 * the DBlocks). Larger blocksizes can
74 * be more efficient but will be more disruptive
75 * as far as the scheduler is concerned.
77 #define HASHING_BLOCKSIZE (1024 * 1024)
80 * Number of bits we set per entry in the bloomfilter.
83 #define BLOOMFILTER_K 16
86 * By how much (in ms) do we decrement the TTL
89 #define TTL_DECREMENT 5000
92 * Length of the P2P success tracker. Note that
93 * having a very long list can also hurt performance.
95 #define P2P_SUCCESS_LIST_SIZE 8
99 * Length of the CS-2-P success tracker. Note that
100 * having a very long list can also hurt performance.
102 #define CS2P_SUCCESS_LIST_SIZE 8
105 * How long are we willing to wait for the datastore to be ready to
106 * process a request for a query without priority?
108 #define BASIC_DATASTORE_REQUEST_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
112 * How long are we willing to wait for the core to be ready to
113 * transmit a reply to the target peer (if we can not transmit
114 * until then, we will discard the reply).
116 #define ACCEPTABLE_REPLY_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
120 * Bandwidth value of an (effectively) 0-priority query.
122 #define QUERY_BANDWIDTH_VALUE 0.001
125 * Bandwidth value of a 0-priority content (must be
126 * fairly high compared to query since content is
127 * typically significantly larger -- and more valueable
128 * since it can take many queries to get one piece of
131 #define CONTENT_BANDWIDTH_VALUE 0.8
134 * By which amount do we decrement the TTL for simple forwarding /
135 * indirection of the query; in milli-seconds. Set somewhat in
136 * accordance to your network latency (above the time it'll take you
137 * to send a packet and get a reply).
139 #define TTL_DECREMENT 5000
142 * Until which load do we consider the peer idle and do not
143 * charge at all? (should be larger than GNUNET_IDLE_LOAD_THRESHOLD used
144 * by the rest of the code)!
146 #define IDLE_LOAD_THRESHOLD ((100 + GNUNET_CONSTANTS_IDLE_LOAD_THRESHOLD) / 2)
151 * @brief content hash key
153 struct ContentHashKey
156 GNUNET_HashCode query;
161 * @brief complete information needed
162 * to download a file.
164 struct FileIdentifier
168 * Total size of the file in bytes. (network byte order (!))
170 uint64_t file_length;
173 * Query and key of the top GNUNET_EC_IBlock.
175 struct ContentHashKey chk;
181 * Information about a file and its location
182 * (peer claiming to share the file).
187 * Information about the shared file.
189 struct FileIdentifier fi;
192 * Identity of the peer sharing the file.
194 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded peer;
197 * Time when this location URI expires.
199 struct GNUNET_TIME_Absolute expirationTime;
202 * RSA signature over the GNUNET_EC_FileIdentifier,
203 * GNUNET_hash of the peer and expiration time.
205 struct GNUNET_CRYPTO_RsaSignature contentSignature;
210 { chk, sks, ksk, loc };
213 * A Universal Resource Identifier (URI), opaque.
223 * Keywords start with a '+' if they are
224 * mandatory (in which case the '+' is NOT
225 * part of the keyword) and with a
226 * simple space if they are optional
227 * (in which case the space is ALSO not
228 * part of the actual keyword).
230 * Double-quotes to protect spaces and
231 * %-encoding are NOT used internally
232 * (only in URI-strings).
237 * Size of the keywords array.
239 unsigned int keywordCount;
245 * Hash of the public key for the namespace.
247 GNUNET_HashCode namespace;
250 * Human-readable identifier chosen for this
251 * entry in the namespace.
257 * Information needed to retrieve a file (content-hash-key
260 struct FileIdentifier chk;
263 * Information needed to retrieve a file including signed
264 * location (identity of a peer) of the content.
273 * Information for a file or directory that is
274 * about to be published.
276 struct GNUNET_FS_FileInformation
280 * Files in a directory are kept as a linked list.
282 struct GNUNET_FS_FileInformation *next;
285 * If this is a file in a directory, "dir" refers to
286 * the directory; otherwise NULL.
288 struct GNUNET_FS_FileInformation *dir;
291 * Pointer kept for the client.
296 * Metadata to use for the file.
298 struct GNUNET_CONTAINER_MetaData *meta;
301 * Keywords to use for KBlocks.
303 struct GNUNET_FS_Uri *keywords;
306 * CHK for this file or directory. NULL if
307 * we have not yet computed it.
309 struct GNUNET_FS_Uri *chk_uri;
312 * At what time should the content expire?
314 struct GNUNET_TIME_Absolute expirationTime;
317 * At what time did we start this upload?
319 struct GNUNET_TIME_Absolute start_time;
322 * Under what filename is this struct serialized
323 * (for operational persistence).
328 * Encoder being used to publish this file.
330 struct GNUNET_FS_TreeEncoder *te;
333 * Error message (non-NULL if this operation
339 * Data describing either the file or the directory.
350 * Function that can be used to read the data for the file.
352 GNUNET_FS_DataReader reader;
355 * Closure for reader.
360 * Name of the file (must be an absolute path).
361 * Only required for indexing. FIXME: not yet
367 * If this file is being indexed, this value
368 * is set to the hash over the entire file
369 * (when the indexing process is started).
370 * Otherwise this field is not used.
372 GNUNET_HashCode file_id;
375 * Size of the file (in bytes).
380 * Should the file be indexed or inserted?
385 * Is "file_id" already valid? Set to GNUNET_YES
386 * once the hash has been calculated.
391 * Has the service confirmed our INDEX_START request?
392 * GNUNET_YES if this step has been completed.
394 int index_start_confirmed;
399 * Data for a directory.
404 * Name of the directory. FIXME: currently never set!
409 * Linked list of entries in the directory.
411 struct GNUNET_FS_FileInformation *entries;
414 * Size of the directory itself (in bytes); 0 if the
415 * size has not yet been calculated.
420 * Pointer to the data for the directory (or NULL if not
430 * Is this struct for a file or directory?
435 * Desired anonymity level.
440 * Desired priority (for keeping the content in the DB).
448 * Master context for most FS operations.
450 struct GNUNET_FS_Handle
455 struct GNUNET_SCHEDULER_Handle *sched;
458 * Configuration to use.
460 const struct GNUNET_CONFIGURATION_Handle *cfg;
463 * Name of our client.
468 * Function to call with updates on our progress.
470 GNUNET_FS_ProgressCallback upcb;
478 * Connection to the FS service.
480 struct GNUNET_CLIENT_Connection *client;
483 * How many downloads probing availability
484 * of search results do we have running
487 unsigned int active_probes;
492 enum GNUNET_FS_Flags flags;
498 * Handle for controlling an upload.
500 struct GNUNET_FS_PublishContext
503 * Handle to the global fs context.
505 struct GNUNET_FS_Handle *h;
508 * File-structure that is being shared.
510 struct GNUNET_FS_FileInformation *fi;
513 * Namespace that we are publishing in, NULL if we have no namespace.
515 struct GNUNET_FS_Namespace *namespace;
518 * ID of the content in the namespace, NULL if we have no namespace.
523 * ID for future updates, NULL if we have no namespace or no updates.
528 * Our own client handle for the FS service;
529 * only briefly used when we start to index a
530 * file, otherwise NULL.
532 struct GNUNET_CLIENT_Connection *client;
535 * Current position in the file-tree for the
538 struct GNUNET_FS_FileInformation *fi_pos;
541 * Connection to the datastore service.
543 struct GNUNET_DATASTORE_Handle *dsh;
546 * ID of the task performing the upload. NO_TASK
547 * if the upload has completed.
549 GNUNET_SCHEDULER_TaskIdentifier upload_task;
552 * Typically GNUNET_NO. Set to GNUNET_YES if
553 * "upload_task" is GNUNET_SCHEDULER_NO_TASK
554 * and we're waiting for a response from the
555 * datastore service (in which case this
556 * struct must not be freed until we have that
557 * response). If someone tries to stop the
558 * download for good during this period,
559 * "in_network_wait" is set to GNUNET_SYSERR
560 * which will cause the struct to be destroyed
561 * right after we have the reply (or timeout)
562 * from the datastore service.
567 * Options for publishing.
569 enum GNUNET_FS_PublishOptions options;
572 * Space reservation ID with datastore service
578 * Set to GNUNET_YES if all processing has completed.
585 * Phases of unindex processing (state machine).
590 * We're currently hashing the file.
592 UNINDEX_STATE_HASHING = 0,
595 * We're notifying the FS service about
598 UNINDEX_STATE_FS_NOTIFY = 1,
601 * We're telling the datastore to delete
602 * the respective entries.
604 UNINDEX_STATE_DS_REMOVE = 2,
609 UNINDEX_STATE_COMPLETE = 3,
612 * We've encountered a fatal error.
614 UNINDEX_STATE_ERROR = 4,
617 * We've been aborted. The next callback should clean up the
620 UNINDEX_STATE_ABORTED = 5
625 * Handle for controlling an unindexing operation.
627 struct GNUNET_FS_UnindexContext
633 struct GNUNET_FS_Handle *h;
636 * Name of the file that we are unindexing.
641 * Connection to the FS service,
642 * only valid during the UNINDEX_STATE_FS_NOTIFY
645 struct GNUNET_CLIENT_Connection *client;
648 * Connection to the datastore service,
649 * only valid during the UNINDEX_STATE_DS_NOTIFY
652 struct GNUNET_DATASTORE_Handle *dsh;
655 * Pointer kept for the client.
660 * Merkle-ish tree encoder context.
662 struct GNUNET_FS_TreeEncoder *tc;
665 * Handle used to read the file.
667 struct GNUNET_DISK_FileHandle *fh;
670 * Overall size of the file.
677 struct GNUNET_TIME_Absolute start_time;
680 * Hash of the file's contents (once
683 GNUNET_HashCode file_id;
686 * Current operatinonal phase.
688 enum UnindexState state;
694 * Information we store for each search result.
700 * URI to which this search result
703 struct GNUNET_FS_Uri *uri;
706 * Metadata for the search result.
708 struct GNUNET_CONTAINER_MetaData *meta;
711 * Client info for this search result.
716 * ID of a job that is currently probing
717 * this results' availability (NULL if we
718 * are not currently probing).
720 struct GNUNET_FS_DownloadContext *probe_ctx;
723 * ID of the task that will clean up the probe_ctx
724 * should it not complete on time (and that will
725 * need to be cancelled if we clean up the search
726 * result before then).
728 GNUNET_SCHEDULER_TaskIdentifier probe_cancel_task;
731 * Number of mandatory keywords for which
732 * we have NOT yet found the search result;
733 * when this value hits zero, the search
734 * result is given to the callback.
736 uint32_t mandatory_missing;
739 * Number of optional keywords under which
740 * this result was also found.
742 uint32_t optional_support;
745 * Number of availability tests that
746 * have succeeded for this result.
748 uint32_t availability_success;
751 * Number of availability trials that we
752 * have performed for this search result.
754 uint32_t availability_trials;
760 * Information we keep for each keyword in
763 struct SearchRequestEntry
766 * Hash of the original keyword, also known as the
767 * key (for decrypting the KBlock).
772 * Hash of the public key, also known as the query.
774 GNUNET_HashCode query;
777 * Map that contains a "struct SearchResult" for each result that
778 * was found under this keyword. Note that the entries will point
779 * to the same locations as those in the master result map (in
780 * "struct GNUNET_FS_SearchContext"), so they should not be freed.
781 * The key for each entry is the XOR of the key and query in the CHK
782 * URI (as a unique identifier for the search result).
784 struct GNUNET_CONTAINER_MultiHashMap *results;
787 * Is this keyword a mandatory keyword
788 * (started with '+')?
796 * Handle for controlling a search.
798 struct GNUNET_FS_SearchContext
801 * Handle to the global FS context.
803 struct GNUNET_FS_Handle *h;
806 * List of keywords that we're looking for.
808 struct GNUNET_FS_Uri *uri;
811 * For update-searches, link to the
812 * base-SKS search that triggered the
813 * update search; otherwise NULL.
815 struct GNUNET_FS_SearchContext *parent;
818 * Connection to the FS service.
820 struct GNUNET_CLIENT_Connection *client;
823 * Pointer we keep for the client.
828 * Map that contains a "struct SearchResult" for each result that
829 * was found in the search. The key for each entry is the XOR of
830 * the key and query in the CHK URI (as a unique identifier for the
833 struct GNUNET_CONTAINER_MultiHashMap *master_result_map;
836 * Per-keyword information for a keyword search.
837 * This array will have exactly as many entries
838 * as there were keywords.
840 struct SearchRequestEntry *requests;
845 struct GNUNET_TIME_Absolute start_time;
848 * ID of a task that is using this struct
849 * and that must be cancelled when the search
850 * is being stopped (if not GNUNET_SCHEDULER_NO_TASK).
851 * Used for the task that adds some artificial
852 * delay when trying to reconnect to the FS
855 GNUNET_SCHEDULER_TaskIdentifier task;
858 * Anonymity level for the search.
863 * Number of mandatory keywords in this query.
865 uint32_t mandatory_count;
870 * Information about an active download request.
872 struct DownloadRequest
875 * While pending, we keep all download requests
878 struct DownloadRequest *next;
881 * CHK for the request.
883 struct ContentHashKey chk;
886 * Offset of the corresponding block.
891 * Depth of the corresponding block in the tree.
896 * Set if this request is currently in the linked list of pending
897 * requests. Needed in case we get a response for a request that we
898 * have not yet send (due to FS bug or two blocks with identical
899 * content); in this case, we would need to remove the block from
900 * the pending list (and need a fast way to check if the block is on
909 * Context for controlling a download.
911 struct GNUNET_FS_DownloadContext
917 struct GNUNET_FS_Handle *h;
920 * Connection to the FS service.
922 struct GNUNET_CLIENT_Connection *client;
925 * Parent download (used when downloading files
928 struct GNUNET_FS_DownloadContext *parent;
931 * Context kept for the client.
936 * URI that identifies the file that
937 * we are downloading.
939 struct GNUNET_FS_Uri *uri;
942 * Known meta-data for the file (can be NULL).
944 struct GNUNET_CONTAINER_MetaData *meta;
947 * Error message, NULL if we're doing OK.
952 * Where are we writing the data (name of the
953 * file, can be NULL!).
958 * Map of active requests (those waiting
959 * for a response). The key is the hash
960 * of the encryped block (aka query).
962 struct GNUNET_CONTAINER_MultiHashMap *active;
965 * Linked list of pending requests.
967 struct DownloadRequest *pending;
970 * The file handle, NULL if we don't create
973 struct GNUNET_DISK_FileHandle *handle;
976 * Non-NULL if we are currently having a request for
977 * transmission pending with the client handle.
979 struct GNUNET_CLIENT_TransmitHandle *th;
982 * Identity of the peer having the content, or all-zeros
983 * if we don't know of such a peer.
985 struct GNUNET_PeerIdentity target;
988 * ID of a task that is using this struct
989 * and that must be cancelled when the download
990 * is being stopped (if not GNUNET_SCHEDULER_NO_TASK).
991 * Used for the task that adds some artificial
992 * delay when trying to reconnect to the FS
995 GNUNET_SCHEDULER_TaskIdentifier task;
998 * What was the size of the file on disk that we're downloading
999 * before we started? Used to detect if there is a point in
1000 * checking an existing block on disk for matching the desired
1001 * content. 0 if the file did not exist already.
1003 uint64_t old_file_size;
1006 * What is the first offset that we're interested
1012 * How many bytes starting from offset are desired?
1013 * This is NOT the overall length of the file!
1018 * How many bytes have we already received within
1019 * the specified range (DBlocks only).
1024 * Time download was started.
1026 struct GNUNET_TIME_Absolute start_time;
1029 * Desired level of anonymity.
1034 * The depth of the file-tree.
1036 unsigned int treedepth;
1039 * Options for the download.
1041 enum GNUNET_FS_DownloadOptions options;
1045 struct GNUNET_FS_Namespace
1049 * Private key for the namespace.
1051 struct GNUNET_CRYPTO_RsaPrivateKey *key;
1054 * Name of the file with the private key.
1059 * Reference counter.
1066 * @brief index block (indexing a DBlock that
1067 * can be obtained directly from reading
1068 * the plaintext file)
1070 struct OnDemandBlock
1073 * Hash code of the entire content of the
1074 * file that was indexed (used to uniquely
1075 * identify the plaintext file).
1077 GNUNET_HashCode file_id;
1080 * At which offset should we be able to find
1081 * this on-demand encoded block? (in NBO)
1083 uint64_t offset GNUNET_PACKED;
1089 * @brief keyword block (advertising data under a keyword)
1095 * GNUNET_RSA_Signature using RSA-key generated from search keyword.
1097 struct GNUNET_CRYPTO_RsaSignature signature;
1100 * What is being signed and why?
1102 struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
1105 * Key generated (!) from the H(keyword) as the seed!
1107 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
1109 /* 0-terminated URI here */
1111 /* variable-size Meta-Data follows here */
1116 * @brief namespace content block (advertising data under an identifier in a namespace)
1122 * GNUNET_RSA_Signature using RSA-key of the namespace
1124 struct GNUNET_CRYPTO_RsaSignature signature;
1127 * What is being signed and why?
1129 struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
1132 * Hash of the hash of the human-readable identifier used for
1133 * this entry (the hash of the human-readable identifier is
1134 * used as the key for decryption; the xor of this identifier
1135 * and the hash of the "keyspace" is the datastore-query hash).
1137 GNUNET_HashCode identifier;
1140 * Public key of the namespace.
1142 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
1144 /* 0-terminated update-identifier here */
1146 /* 0-terminated URI here (except for NBlocks) */
1148 /* variable-size Meta-Data follows here */
1154 * @brief namespace advertisement block (advertising root of a namespace)
1160 * GNUNET_RSA_Signature using RSA-key of the namespace
1162 struct GNUNET_CRYPTO_RsaSignature signature;
1165 * What is being signed and why?
1167 struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
1170 * Public key of the namespace.
1172 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
1174 /* 0-terminated root identifier here */
1176 /* variable-size Meta-Data follows here */
1182 * Message sent from a GNUnet (fs) publishing activity to the
1183 * gnunet-fs-service to initiate indexing of a file. The service is
1184 * supposed to check if the specified file is available and has the
1185 * same cryptographic hash. It should then respond with either a
1186 * confirmation or a denial.
1188 * On OSes where this works, it is considered acceptable if the
1189 * service only checks that the path, device and inode match (it can
1190 * then be assumed that the hash will also match without actually
1191 * computing it; this is an optimization that should be safe given
1192 * that the client is not our adversary).
1194 struct IndexStartMessage
1198 * Message type will be GNUNET_MESSAGE_TYPE_FS_INDEX_START.
1200 struct GNUNET_MessageHeader header;
1203 * ID of device containing the file, as seen by the client. This
1204 * device ID is obtained using a call like "statvfs" (and converting
1205 * the "f_fsid" field to a 32-bit big-endian number). Use 0 if the
1206 * OS does not support this, in which case the service must do a
1207 * full hash recomputation.
1209 uint32_t device GNUNET_PACKED;
1212 * Inode of the file on the given device, as seen by the client
1213 * ("st_ino" field from "struct stat"). Use 0 if the OS does not
1214 * support this, in which case the service must do a full hash
1217 uint64_t inode GNUNET_PACKED;
1220 * Hash of the file that we would like to index.
1222 GNUNET_HashCode file_id;
1224 /* this is followed by a 0-terminated
1225 filename of a file with the hash
1226 "file_id" as seen by the client */
1232 * Message send by FS service in response to a request
1233 * asking for a list of all indexed files.
1235 struct IndexInfoMessage
1238 * Message type will be
1239 * GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_ENTRY.
1241 struct GNUNET_MessageHeader header;
1246 uint32_t reserved GNUNET_PACKED;
1249 * Hash of the indexed file.
1251 GNUNET_HashCode file_id;
1253 /* this is followed by a 0-terminated
1254 filename of a file with the hash
1255 "file_id" as seen by the client */
1261 * Message sent from a GNUnet (fs) unindexing activity to the
1262 * gnunet-service-fs to indicate that a file will be unindexed. The
1263 * service is supposed to remove the file from the list of indexed
1264 * files and response with a confirmation message (even if the file
1265 * was already not on the list).
1267 struct UnindexMessage
1271 * Message type will be
1272 * GNUNET_MESSAGE_TYPE_FS_UNINDEX.
1274 struct GNUNET_MessageHeader header;
1279 uint32_t reserved GNUNET_PACKED;
1282 * Hash of the file that we will unindex.
1284 GNUNET_HashCode file_id;
1290 * Message sent from a GNUnet (fs) search activity to the
1291 * gnunet-service-fs to start a search.
1293 struct SearchMessage
1297 * Message type will be
1298 * GNUNET_MESSAGE_TYPE_FS_START_SEARCH.
1300 struct GNUNET_MessageHeader header;
1305 int32_t reserved GNUNET_PACKED;
1308 * Type of the content that we're looking for.
1311 uint32_t type GNUNET_PACKED;
1314 * Desired anonymity level, big-endian.
1316 uint32_t anonymity_level GNUNET_PACKED;
1319 * If the request is for a DBLOCK or IBLOCK, this is the identity of
1320 * the peer that is known to have a response. Set to all-zeros if
1321 * such a target is not known (note that even if OUR anonymity
1322 * level is >0 we may happen to know the responder's identity;
1323 * nevertheless, we should probably not use it for a DHT-lookup
1324 * or similar blunt actions in order to avoid exposing ourselves).
1326 * If the request is for an SBLOCK, this is the identity of the
1327 * pseudonym to which the SBLOCK belongs.
1329 * If the request is for a KBLOCK, "target" must be all zeros.
1331 GNUNET_HashCode target;
1334 * Hash of the keyword (aka query) for KBLOCKs; Hash of
1335 * the CHK-encoded block for DBLOCKS and IBLOCKS (aka query)
1336 * and hash of the identifier XORed with the target for
1337 * SBLOCKS (aka query).
1339 GNUNET_HashCode query;
1341 /* this is followed by the hash codes of already-known
1342 results (which should hence be excluded from what
1343 the service returns); naturally, this only applies
1344 to queries that can have multiple results, such as
1345 those for KBLOCKS (KSK) and SBLOCKS (SKS) */
1350 * Only the (mandatory) query is included.
1352 #define GET_MESSAGE_BIT_QUERY_ONLY 0
1355 * The peer identity of a peer waiting for the
1356 * reply is included (used if the response
1357 * should be transmitted to someone other than
1358 * the sender of the GET).
1360 #define GET_MESSAGE_BIT_RETURN_TO 1
1363 * The hash of the public key of the target
1364 * namespace is included (for SKS queries).
1366 #define GET_MESSAGE_BIT_SKS_NAMESPACE 2
1369 * The peer identity of a peer that had claimed to have the content
1370 * previously is included (can be used if responder-anonymity is not
1371 * desired; note that the precursor presumably lacked a direct
1372 * connection to the specified peer; still, the receiver is in no way
1373 * required to limit forwarding only to the specified peer, it should
1374 * only prefer it somewhat if possible).
1376 #define GET_MESSAGE_BIT_TRANSMIT_TO 4
1380 * Message sent between peers asking for FS-content.
1386 * Message type will be GNUNET_MESSAGE_TYPE_FS_GET.
1388 struct GNUNET_MessageHeader header;
1391 * Type of the query (block type).
1393 uint32_t type GNUNET_PACKED;
1396 * How important is this request (network byte order)
1398 uint32_t priority GNUNET_PACKED;
1401 * Relative time to live in GNUNET_CRON_MILLISECONDS (network byte order)
1403 int32_t ttl GNUNET_PACKED;
1406 * The content hash should be mutated using this value
1407 * before checking against the bloomfilter (used to
1408 * get many different filters for the same hash codes).
1409 * The number should be in big-endian format when used
1412 int32_t filter_mutator GNUNET_PACKED;
1415 * Which of the optional hash codes are present at the end of the
1416 * message? See GET_MESSAGE_BIT_xx constants. For each bit that is
1417 * set, an additional GNUNET_HashCode with the respective content
1418 * (in order of the bits) will be appended to the end of the GET
1421 uint32_t hash_bitmap GNUNET_PACKED;
1424 * Hashcodes of the file(s) we're looking for.
1425 * Details depend on the query type.
1427 GNUNET_HashCode query GNUNET_PACKED;
1429 /* this is followed by hash codes
1430 as specified in the "hash_bitmap";
1431 after that, an optional bloomfilter
1432 (with bits set for replies that should
1433 be suppressed) can be present */
1438 * Response from FS service with a result for a previous FS search.
1439 * Note that queries for DBLOCKS and IBLOCKS that have received a
1440 * single response are considered done. This message is transmitted
1441 * between peers as well as between the service and a client.
1447 * Message type will be GNUNET_MESSAGE_TYPE_FS_PUT.
1449 struct GNUNET_MessageHeader header;
1452 * Type of the block (in big endian). Should never be zero.
1454 uint32_t type GNUNET_PACKED;
1457 * When does this result expire?
1459 struct GNUNET_TIME_AbsoluteNBO expiration;
1461 /* this is followed by the actual encrypted content */