GNUnet  0.11.x
fs_api.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
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  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
26 #ifndef FS_API_H
27 #define FS_API_H
28 
29 #include "gnunet_constants.h"
31 #include "gnunet_dht_service.h"
32 #include "gnunet_fs_service.h"
33 #include "gnunet_block_lib.h"
34 #include "block_fs.h"
35 #include "fs.h"
36 
43 #define CHK_PER_INODE 256
44 
49 #define MAX_INLINE_SIZE 65536
50 
54 #define GNUNET_FS_SYNC_PATH_MASTER_SEARCH "search"
55 
59 #define GNUNET_FS_SYNC_PATH_CHILD_SEARCH "search-child"
60 
65 #define GNUNET_FS_SYNC_PATH_MASTER_DOWNLOAD "download"
66 
71 #define GNUNET_FS_SYNC_PATH_CHILD_DOWNLOAD "download-child"
72 
76 #define GNUNET_FS_SYNC_PATH_MASTER_PUBLISH "publish"
77 
81 #define GNUNET_FS_SYNC_PATH_FILE_INFO "publish-file"
82 
86 #define GNUNET_FS_SYNC_PATH_MASTER_UNINDEX "unindex"
87 
88 
94 {
98  uint64_t file_length;
99 
103  struct ContentHashKey chk;
104 };
105 
106 
111 struct Location
112 {
116  struct FileIdentifier fi;
117 
121  struct GNUNET_PeerIdentity peer;
122 
127 
133 };
134 
139 {
144 
149 
154 
159 };
160 
161 
166 {
170  enum GNUNET_FS_UriType type;
171 
172  union
173  {
174  struct
175  {
185  char **keywords;
186 
190  unsigned int keywordCount;
191  } ksk;
192 
193  struct
194  {
199 
204  char *identifier;
205  } sks;
206 
211  struct FileIdentifier chk;
212 
217  struct Location loc;
218  } data;
219 };
220 
221 
227 {
232 
238 
243 
247  void *client_info;
248 
253 
258 
264 
270 
274  struct GNUNET_FS_BlockOptions bo;
275 
280 
287 
292 
296  char *emsg;
297 
301  char *filename;
302 
306  union
307  {
311  struct
312  {
317 
321  void *reader_cls;
322 
328  struct GNUNET_HashCode file_id;
329 
333  uint64_t file_size;
334 
338  int do_index;
339 
345 
351  } file;
352 
356  struct
357  {
362 
367  size_t dir_size;
368 
373  void *dir_data;
374 
379 
383  uint64_t contents_size;
384  } dir;
385  } data;
386 
391 
396 };
397 
398 
403 {
408 
413 };
414 
415 
420 {
425 
430 
435 
440 
444  void *cls;
445 
450 
455 
460 
465 
471 
475  unsigned int blocks;
476 
481 
485  unsigned int start_times;
486 
490  int active;
491 };
492 
493 
498 {
503 
508 
513 
519 
524 
529 
533  void *client_info;
534 
540 
546 
552 
557 
561  uint8_t *keyword_bitmap;
562 
566  struct GNUNET_HashCode key;
567 
574 
579 
584 
588  uint32_t anonymity;
589 
596 
602 
607 
613 };
614 
615 
627 struct GNUNET_FS_QueueEntry *
631  void *cls,
632  unsigned int blocks,
634 
635 
641 void
643 
644 
661 size_t
663  uint64_t offset,
664  size_t max,
665  void *buf,
666  char **emsg);
667 
668 
675 void *
677 
678 
695 size_t
697  uint64_t offset,
698  size_t max,
699  void *buf,
700  char **emsg);
701 
702 
718 void *
720  const struct GNUNET_FS_ProgressInfo *info);
721 
722 
728 void
730 
731 
739 void
741  const struct GNUNET_HashCode *file_id);
742 
743 
749 void
751 
752 
758 void
760 
761 
772 void *
775  const struct GNUNET_FS_FileInformation *p,
776  uint64_t offset);
777 
778 
786 void
788  struct GNUNET_FS_DownloadContext *dc);
789 
790 
797 void
799 
800 
809 void
812  uint64_t offset);
813 
823 void *
825  struct GNUNET_FS_Handle *h,
826  struct GNUNET_FS_SearchContext *sc);
827 
828 
834 void
836 
844 int
846 
852 void
854 
855 
861 void
863 
864 
872 void
874  const char *ext,
875  const char *ent);
876 
877 
885 void
887  const char *ext,
888  const char *uni);
889 
890 
899 void
901 
902 
911 void
913 
914 
923 void
925 
926 
935 void
937 
938 
947 void
949 
950 
959 void
961 
962 
969 void
971 
972 
979 void
981 
982 
989 void
991 
992 
999 void
1001 
1002 
1010 typedef void (*SuspendSignalFunction) (void *cls);
1011 
1017 {
1022 
1027 
1032 
1036  void *ssf_cls;
1037 };
1038 
1039 
1048 struct TopLevelActivity *
1051  void *ssf_cls);
1052 
1053 
1060 void
1062  struct TopLevelActivity *top);
1063 
1064 
1069 {
1074 
1079 
1084 
1088  void *upcb_cls;
1089 
1094 
1099 
1104 
1109 
1114 
1119 
1124 
1129 
1135 
1141 
1147 
1151  unsigned int active_downloads;
1152 
1156  unsigned int active_blocks;
1157 
1161  enum GNUNET_FS_Flags flags;
1162 
1167 
1172 };
1173 
1174 
1179 {
1184 
1189 
1194 
1199 
1203  char *nid;
1204 
1208  char *nuid;
1209 
1215 
1221 
1226 
1231 
1236 
1241 
1247 
1253 
1259 
1263  uint64_t reserve_space;
1264 
1270 
1275 
1280  int rid;
1281 
1287 
1292 
1299 };
1300 
1301 
1306 {
1311 
1317 
1322 
1327 
1333 
1338 
1343 };
1344 
1345 
1350 {
1355  struct ContentHashKey chk;
1356 
1361 
1366 
1371 
1376 
1380  uint32_t ksk_offset;
1381 
1385  char *filename;
1386 
1391 
1397 
1403 
1408 
1413 
1418 
1424 
1428  struct GNUNET_HashCode ukey;
1429 
1433  struct GNUNET_HashCode uquery;
1434 
1438  char *emsg;
1439 
1444 
1448  uint64_t file_size;
1449 
1454 
1458  struct GNUNET_HashCode file_id;
1459 
1463  enum UnindexState state;
1464 };
1465 
1466 
1471 {
1475  struct GNUNET_HashCode uquery;
1476 
1481 
1486  char *keyword;
1487 
1497 
1503 };
1504 
1505 
1510 {
1515 
1520 
1525 
1531 
1536 
1541 
1546 
1550  char *emsg;
1551 
1559 
1565 
1570 
1575 
1583 
1587  uint32_t anonymity;
1588 
1593 
1598 };
1599 
1600 
1607 {
1613 
1621 
1629 
1637 
1646 
1655 
1661 
1667  BRS_ERROR = 7
1668 };
1669 
1670 
1675 {
1680 
1685 
1690  struct ContentHashKey chk;
1691 
1697  uint64_t offset;
1698 
1702  unsigned int num_children;
1703 
1707  unsigned int depth;
1708 
1712  unsigned int chk_idx;
1713 
1717  enum BlockRequestState state;
1718 };
1719 
1720 
1726 void
1728 
1729 
1735 void
1737 
1738 
1743 {
1748 
1753 
1758 
1764 
1770 
1775 
1780 
1785 
1790 
1795 
1800 
1805 
1809  char *emsg;
1810 
1816 
1821  char *filename;
1822 
1829 
1834 
1839 
1845 
1851 
1856 
1861  struct GNUNET_PeerIdentity target;
1862 
1872 
1877  uint64_t offset;
1878 
1883  uint64_t length;
1884 
1889  uint64_t completed;
1890 
1897  uint64_t old_file_size;
1898 
1903 
1908 
1912  uint32_t anonymity;
1913 
1917  unsigned int treedepth;
1918 
1923 
1930 
1935 };
1936 
1937 
1938 #endif
1939 
1940 /* end of fs_api.h */
definitions for the entire fs module
BlockRequestState
FSM for possible states a block can go through.
Definition: fs_api.h:1607
@ BRS_DOWNLOAD_UP
This block and all of its children have been downloaded successfully (full completion propagates up).
Definition: fs_api.h:1660
@ BRS_RECONSTRUCT_META_UP
We've calculated the CHK bottom-up based on the meta data.
Definition: fs_api.h:1628
@ BRS_CHK_SET
We've determined the real, desired CHK for this block (full tree reconstruction failed),...
Definition: fs_api.h:1645
@ BRS_ERROR
We got a block back that matched the query but did not hash to the key (malicious publisher or hash c...
Definition: fs_api.h:1667
@ BRS_RECONSTRUCT_DOWN
We've checked the block on the path down the tree, and the content on disk did match the desired CHK,...
Definition: fs_api.h:1620
@ BRS_INIT
Initial state, block has only been allocated (since it is relevant to the overall download request).
Definition: fs_api.h:1612
@ BRS_DOWNLOAD_DOWN
We've successfully downloaded this block, but the children still need to be either downloaded or veri...
Definition: fs_api.h:1654
@ BRS_RECONSTRUCT_UP
We've calculated the CHK bottom-up based on what we have on disk, which may not be what the desired C...
Definition: fs_api.h:1636
void GNUNET_FS_download_signal_suspend_(void *cls)
Create SUSPEND event for the given download operation and then clean up our state (without stop signa...
Definition: fs_download.c:1968
void GNUNET_FS_search_result_sync_(struct GNUNET_FS_SearchResult *sr)
Synchronize this search result with its mirror on disk.
Definition: fs_api.c:2165
UnindexState
Phases of unindex processing (state machine).
Definition: fs_api.h:1306
@ UNINDEX_STATE_EXTRACT_KEYWORDS
Find out which keywords apply.
Definition: fs_api.h:1321
@ UNINDEX_STATE_COMPLETE
We're done.
Definition: fs_api.h:1337
@ UNINDEX_STATE_DS_REMOVE
We're telling the datastore to delete the respective DBlocks and IBlocks.
Definition: fs_api.h:1316
@ UNINDEX_STATE_HASHING
We're currently hashing the file.
Definition: fs_api.h:1310
@ UNINDEX_STATE_ERROR
We've encountered a fatal error.
Definition: fs_api.h:1342
@ UNINDEX_STATE_FS_NOTIFY
We're notifying the FS service about the unindexing.
Definition: fs_api.h:1332
@ UNINDEX_STATE_DS_REMOVE_KBLOCKS
We're telling the datastore to remove KBlocks.
Definition: fs_api.h:1326
GNUNET_FS_UriType
Types of URIs.
Definition: fs_api.h:139
@ GNUNET_FS_URI_LOC
Location (chk with identity of hosting peer).
Definition: fs_api.h:158
@ GNUNET_FS_URI_CHK
Content-hash-key (simple file).
Definition: fs_api.h:143
@ GNUNET_FS_URI_SKS
Signed key space (file in namespace).
Definition: fs_api.h:148
@ GNUNET_FS_URI_KSK
Keyword search key (query with keywords).
Definition: fs_api.h:153
void GNUNET_FS_unindex_sync_(struct GNUNET_FS_UnindexContext *uc)
Synchronize this unindex struct with its mirror on disk.
Definition: fs_api.c:1839
void GNUNET_FS_unindex_do_remove_kblocks_(struct GNUNET_FS_UnindexContext *uc)
If necessary, connect to the datastore and remove the KBlocks.
Definition: fs_unindex.c:580
void * GNUNET_FS_make_file_reader_context_(const char *filename)
Create the closure for the GNUNET_FS_data_reader_file_() callback.
Definition: fs_api.c:525
struct TopLevelActivity * GNUNET_FS_make_top(struct GNUNET_FS_Handle *h, SuspendSignalFunction ssf, void *ssf_cls)
Create a top-level activity entry.
Definition: fs_api.c:391
void * GNUNET_FS_search_make_status_(struct GNUNET_FS_ProgressInfo *pi, struct GNUNET_FS_Handle *h, struct GNUNET_FS_SearchContext *sc)
Fill in all of the generic fields for a search event and call the callback.
Definition: fs_search.c:48
void GNUNET_FS_search_sync_(struct GNUNET_FS_SearchContext *sc)
Synchronize this search struct with its mirror on disk.
Definition: fs_api.c:2264
void GNUNET_FS_free_download_request_(struct DownloadRequest *dr)
(recursively) free download request structure
Definition: fs_download.c:996
void GNUNET_FS_stop_probe_ping_task_(struct GNUNET_FS_SearchResult *sr)
Stop the ping task for this search result.
Definition: fs_search.c:409
void GNUNET_FS_publish_signal_suspend_(void *cls)
Create SUSPEND event for the given publish operation and then clean up our state (without stop signal...
Definition: fs_publish.c:1354
void GNUNET_FS_unindex_make_status_(struct GNUNET_FS_ProgressInfo *pi, struct GNUNET_FS_UnindexContext *uc, uint64_t offset)
Fill in all of the generic fields for an unindex event and call the callback.
Definition: fs_unindex.c:84
size_t GNUNET_FS_data_reader_copy_(void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
Function that provides data by copying from a buffer.
Definition: fs_api.c:561
void GNUNET_FS_download_make_status_(struct GNUNET_FS_ProgressInfo *pi, struct GNUNET_FS_DownloadContext *dc)
Fill in all of the generic fields for a download event and call the callback.
Definition: fs_download.c:103
void GNUNET_FS_download_start_task_(void *cls)
Task that creates the initial (top-level) download request for the file.
Definition: fs_download.c:1809
void GNUNET_FS_unindex_do_extract_keywords_(struct GNUNET_FS_UnindexContext *uc)
Extract the keywords for KBlock removal.
Definition: fs_unindex.c:406
void GNUNET_FS_unindex_do_remove_(struct GNUNET_FS_UnindexContext *uc)
Connect to the datastore and remove the blocks.
Definition: fs_unindex.c:649
void GNUNET_FS_search_start_probe_(struct GNUNET_FS_SearchResult *sr)
Start download probes for the given search result.
Definition: fs_search.c:430
void GNUNET_FS_download_sync_(struct GNUNET_FS_DownloadContext *dc)
Synchronize this download struct with its mirror on disk.
Definition: fs_api.c:2052
GNUNET_FS_QueuePriority
Priorities for the queue.
Definition: fs_api.h:403
@ GNUNET_FS_QUEUE_PRIORITY_NORMAL
Default priority.
Definition: fs_api.h:412
@ GNUNET_FS_QUEUE_PRIORITY_PROBE
This is a probe (low priority).
Definition: fs_api.h:407
void GNUNET_FS_file_information_sync_(struct GNUNET_FS_FileInformation *f)
Synchronize this file-information struct with its mirror on disk.
Definition: fs_api.c:1344
void(* SuspendSignalFunction)(void *cls)
Function signature of the functions that can be called to trigger suspend signals and clean-up for to...
Definition: fs_api.h:1010
void GNUNET_FS_remove_sync_file_(struct GNUNET_FS_Handle *h, const char *ext, const char *ent)
Remove serialization/deserialization file from disk.
Definition: fs_api.c:744
void * GNUNET_FS_search_probe_progress_(void *cls, const struct GNUNET_FS_ProgressInfo *info)
Notification of FS that a search probe has made progress.
Definition: fs_search.c:280
void GNUNET_FS_unindex_signal_suspend_(void *cls)
Create SUSPEND event for the given unindex operation and then clean up our state (without stop signal...
Definition: fs_unindex.c:727
void GNUNET_FS_download_start_downloading_(struct GNUNET_FS_DownloadContext *dc)
Start the downloading process (by entering the queue).
Definition: fs_download.c:2263
int GNUNET_FS_search_start_searching_(struct GNUNET_FS_SearchContext *sc)
Build the request and actually initiate the search using the GNUnet FS service.
Definition: fs_search.c:1408
void * GNUNET_FS_publish_make_status_(struct GNUNET_FS_ProgressInfo *pi, struct GNUNET_FS_PublishContext *pc, const struct GNUNET_FS_FileInformation *p, uint64_t offset)
Fill in all of the generic fields for a publish event and call the callback.
Definition: fs_publish.c:47
void GNUNET_FS_remove_sync_dir_(struct GNUNET_FS_Handle *h, const char *ext, const char *uni)
Remove serialization/deserialization directory from disk.
Definition: fs_api.c:803
void GNUNET_FS_unindex_process_hash_(void *cls, const struct GNUNET_HashCode *file_id)
Function called once the hash of the file that is being unindexed has been computed.
Definition: fs_unindex.c:694
void GNUNET_FS_dequeue_(struct GNUNET_FS_QueueEntry *qe)
Dequeue a job from the queue.
Definition: fs_api.c:366
struct GNUNET_FS_QueueEntry * GNUNET_FS_queue_(struct GNUNET_FS_Handle *h, GNUNET_SCHEDULER_TaskCallback start, GNUNET_SCHEDULER_TaskCallback stop, void *cls, unsigned int blocks, enum GNUNET_FS_QueuePriority priority)
Add a job to the queue.
Definition: fs_api.c:331
void GNUNET_FS_publish_main_(void *cls)
Main function that performs the upload.
Definition: fs_publish.c:1062
size_t GNUNET_FS_data_reader_file_(void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
Function that provides data by reading from a file.
Definition: fs_api.c:457
void GNUNET_FS_end_top(struct GNUNET_FS_Handle *h, struct TopLevelActivity *top)
Destroy a top-level activity entry.
Definition: fs_api.c:412
void GNUNET_FS_publish_sync_(struct GNUNET_FS_PublishContext *pc)
Synchronize this publishing struct with its mirror on disk.
Definition: fs_api.c:1763
void GNUNET_FS_search_signal_suspend_(void *cls)
Create SUSPEND event for the given search operation and then clean up our state (without stop signal)...
Definition: fs_search.c:1567
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
static struct GNUNET_PEERINFO_Handle * pi
Handle to peerinfo service.
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
static struct GNUNET_FS_DownloadContext * dc
static char * filename
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
static char buf[2048]
static struct GNUNET_FS_UnindexContext * uc
GNUNET_FS_Flags
General (global) option flags for file-sharing.
GNUNET_FS_SearchOptions
Options for searching.
GNUNET_FS_DownloadOptions
Options for downloading.
void *(* GNUNET_FS_ProgressCallback)(void *cls, const struct GNUNET_FS_ProgressInfo *info)
Notification of FS to a client about the progress of an operation.
size_t(* GNUNET_FS_DataReader)(void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
Function that provides data.
GNUNET_FS_PublishOptions
Options for publishing.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
#define max(x, y)
content hash key
Definition: fs.h:54
Information about an active download request.
Definition: fs_api.h:1675
struct DownloadRequest ** children
Array (!) of child-requests, or NULL for the bottom of the tree.
Definition: fs_api.h:1684
unsigned int chk_idx
Offset of the CHK for this block in the parent block.
Definition: fs_api.h:1712
unsigned int num_children
Number of entries in children array.
Definition: fs_api.h:1702
uint64_t offset
Offset of the corresponding block.
Definition: fs_api.h:1697
enum BlockRequestState state
State in the FSM.
Definition: fs_api.h:1717
unsigned int depth
Depth of the corresponding block in the tree.
Definition: fs_api.h:1707
struct DownloadRequest * parent
Parent in the CHK-tree.
Definition: fs_api.h:1679
struct ContentHashKey chk
CHK for the request for this block (set during reconstruction to what we have on disk,...
Definition: fs_api.h:1690
complete information needed to download a file.
Definition: fs_api.h:94
struct ContentHashKey chk
Query and key of the top GNUNET_EC_IBlock.
Definition: fs_api.h:103
uint64_t file_length
Total size of the file in bytes.
Definition: fs_api.h:98
Meta data to associate with a file, directory or namespace.
Internal representation of the hash map.
Private ECC key encoded for transmission.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
an ECC signature using EdDSA.
Context used when hashing a file.
Handle to the datastore service.
Entry in our priority queue.
Handle used to access files (and pipes).
Settings for publishing a block (which may of course also apply to an entire directory or file).
An opaque structure a pointer to which is returned to the caller to be used to control the scanner.
Context for controlling a download.
Definition: fs_api.h:1743
int has_finished
Flag set upon transitive completion (includes child downloads).
Definition: fs_api.h:1929
unsigned int treedepth
The depth of the file-tree.
Definition: fs_api.h:1917
char * filename
Where are we writing the data (name of the file, can be NULL!).
Definition: fs_api.h:1821
struct GNUNET_FS_Uri * uri
URI that identifies the file that we are downloading.
Definition: fs_api.h:1799
struct GNUNET_DISK_FileHandle * rfh
File handle for reading data from an existing file (to pass to tree encoder).
Definition: fs_api.h:1844
void * client_info
Context kept for the client.
Definition: fs_api.h:1794
uint64_t old_file_size
What was the size of the file on disk that we're downloading before we started? Used to detect if the...
Definition: fs_api.h:1897
int issue_requests
Are we ready to issue requests (reconstructions are finished)?
Definition: fs_api.h:1934
uint64_t completed
How many bytes have we already received within the specified range (DBlocks only).
Definition: fs_api.h:1889
uint64_t offset
What is the first offset that we're interested in?
Definition: fs_api.h:1877
struct GNUNET_FS_QueueEntry * job_queue
Our entry in the job queue.
Definition: fs_api.h:1833
char * emsg
Error message, NULL if we're doing OK.
Definition: fs_api.h:1809
struct GNUNET_SCHEDULER_Task * task
ID of a task that is using this struct and that must be cancelled when the download is being stopped ...
Definition: fs_api.h:1871
struct GNUNET_FS_TreeEncoder * te
Tree encoder used for the reconstruction.
Definition: fs_api.h:1838
struct GNUNET_FS_SearchResult * search
Associated search (used when downloading files based on search results), or NULL for none.
Definition: fs_api.h:1769
struct GNUNET_FS_DownloadContext * child_tail
Tail of list of child downloads.
Definition: fs_api.h:1779
struct GNUNET_FS_DownloadContext * prev
Previous download belonging to the same parent.
Definition: fs_api.h:1784
struct GNUNET_CONTAINER_MultiHashMap * active
Map of active requests (those waiting for a response).
Definition: fs_api.h:1850
struct GNUNET_FS_DownloadContext * child_head
Head of list of child downloads.
Definition: fs_api.h:1774
struct GNUNET_TIME_Relative reconnect_backoff
How long to wait before we try to reconnect to FS service?
Definition: fs_api.h:1907
uint64_t length
How many bytes starting from offset are desired? This is NOT the overall length of the file!
Definition: fs_api.h:1883
char * serialization
Random portion of filename we use for syncing state of this download.
Definition: fs_api.h:1815
struct GNUNET_MQ_Handle * mq
Connection to the FS service.
Definition: fs_api.h:1757
uint32_t anonymity
Desired level of anonymity.
Definition: fs_api.h:1912
char * temp_filename
Where are we writing the data temporarily (name of the file, can be NULL!); used if we do not have a ...
Definition: fs_api.h:1828
struct GNUNET_FS_DownloadContext * next
Next download belonging to the same parent.
Definition: fs_api.h:1789
struct GNUNET_FS_DownloadContext * parent
Parent download (used when downloading files in directories).
Definition: fs_api.h:1763
struct DownloadRequest * top_request
Top-level download request.
Definition: fs_api.h:1855
struct GNUNET_PeerIdentity target
Identity of the peer having the content, or all-zeros if we don't know of such a peer.
Definition: fs_api.h:1861
struct GNUNET_CONTAINER_MetaData * meta
Known meta-data for the file (can be NULL).
Definition: fs_api.h:1804
enum GNUNET_FS_DownloadOptions options
Options for the download.
Definition: fs_api.h:1922
struct GNUNET_FS_Handle * h
Global FS context.
Definition: fs_api.h:1747
struct GNUNET_TIME_Absolute start_time
Time download was started.
Definition: fs_api.h:1902
struct TopLevelActivity * top
Our top-level activity entry (if we are top-level, otherwise NULL).
Definition: fs_api.h:1752
Information for a file or directory that is about to be published.
Definition: fs_api.h:227
char * serialization
Under what filename is this struct serialized (for operational persistence).
Definition: fs_api.h:286
struct GNUNET_FS_Uri * keywords
Keywords to use for KBlocks.
Definition: fs_api.h:257
char * filename
Name of the file or directory (must be an absolute path).
Definition: fs_api.h:301
size_t dir_size
Size of the directory itself (in bytes); 0 if the size has not yet been calculated.
Definition: fs_api.h:367
uint64_t contents_completed
How much of the directory have we published (relative to contents_size).
Definition: fs_api.h:378
struct GNUNET_FS_FileInformation::@16::@17 file
Data for a file.
struct GNUNET_FS_TreeEncoder * te
Encoder being used to publish this file.
Definition: fs_api.h:291
GNUNET_FS_DataReader reader
Function that can be used to read the data for the file.
Definition: fs_api.h:316
struct GNUNET_HashCode file_id
If this file is being indexed, this value is set to the hash over the entire file (when the indexing ...
Definition: fs_api.h:328
uint64_t file_size
Size of the file (in bytes).
Definition: fs_api.h:333
char * emsg
Error message (non-NULL if this operation failed).
Definition: fs_api.h:296
void * client_info
Pointer kept for the client.
Definition: fs_api.h:247
struct GNUNET_FS_FileInformation * next
Files in a directory are kept as a linked list.
Definition: fs_api.h:231
struct GNUNET_FS_BlockOptions bo
Block options for the file.
Definition: fs_api.h:274
struct GNUNET_CONTAINER_MetaData * meta
Metadata to use for the file.
Definition: fs_api.h:252
int is_published
Are we done publishing this file?
Definition: fs_api.h:395
int have_hash
Is "file_id" already valid? Set to GNUNET_YES once the hash has been calculated.
Definition: fs_api.h:344
struct GNUNET_FS_Uri * sks_uri
SKS URI for this file or directory.
Definition: fs_api.h:269
int index_start_confirmed
Has the service confirmed our INDEX_START request? GNUNET_YES if this step has been completed.
Definition: fs_api.h:350
void * dir_data
Pointer to the data for the directory (or NULL if not available).
Definition: fs_api.h:373
uint64_t contents_size
Sum of all of the sizes of all of the files in the directory.
Definition: fs_api.h:383
int do_index
Should the file be indexed or inserted?
Definition: fs_api.h:338
void * reader_cls
Closure for reader.
Definition: fs_api.h:321
union GNUNET_FS_FileInformation::@16 data
Data describing either the file or the directory.
struct GNUNET_FS_Handle * h
Handle to the master context.
Definition: fs_api.h:242
struct GNUNET_TIME_Absolute start_time
At what time did we start this upload?
Definition: fs_api.h:279
struct GNUNET_FS_FileInformation * entries
Linked list of entries in the directory.
Definition: fs_api.h:361
struct GNUNET_FS_FileInformation * dir
If this is a file in a directory, "dir" refers to the directory; otherwise NULL.
Definition: fs_api.h:237
struct GNUNET_FS_Uri * chk_uri
CHK for this file or directory.
Definition: fs_api.h:263
int is_directory
Is this struct for a file or directory?
Definition: fs_api.h:390
Master context for most FS operations.
Definition: fs_api.h:1069
enum GNUNET_FS_Flags flags
General flags.
Definition: fs_api.h:1161
char * client_name
Name of our client.
Definition: fs_api.h:1078
struct GNUNET_SCHEDULER_Task * queue_job
Task that processes the jobs in the running and pending queues (and moves jobs around as needed).
Definition: fs_api.h:1134
struct TopLevelActivity * top_tail
Tail of DLL of top-level activities.
Definition: fs_api.h:1098
struct GNUNET_FS_QueueEntry * pending_head
Head of DLL of pending jobs.
Definition: fs_api.h:1113
unsigned int max_parallel_requests
Maximum number of parallel requests.
Definition: fs_api.h:1171
struct GNUNET_FS_QueueEntry * running_head
Head of DLL of running jobs.
Definition: fs_api.h:1103
unsigned int active_downloads
How many actual downloads do we have running right now?
Definition: fs_api.h:1151
void * upcb_cls
Closure for upcb.
Definition: fs_api.h:1088
struct GNUNET_SCHEDULER_Task * probe_ping_task
Task we use to report periodically to the application that certain search probes (from probes_head) a...
Definition: fs_api.h:1140
struct GNUNET_FS_SearchResult * probes_tail
Tail of active probes.
Definition: fs_api.h:1128
GNUNET_FS_ProgressCallback upcb
Function to call with updates on our progress.
Definition: fs_api.h:1083
struct GNUNET_TIME_Relative avg_block_latency
Average time we take for a single request to be satisfied.
Definition: fs_api.h:1146
struct TopLevelActivity * top_head
Head of DLL of top-level activities.
Definition: fs_api.h:1093
struct GNUNET_FS_QueueEntry * running_tail
Tail of DLL of running jobs.
Definition: fs_api.h:1108
unsigned int active_blocks
How many blocks do the active downloads have?
Definition: fs_api.h:1156
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Definition: fs_api.h:1073
struct GNUNET_FS_SearchResult * probes_head
Head of active probes.
Definition: fs_api.h:1123
struct GNUNET_FS_QueueEntry * pending_tail
Tail of DLL of pending jobs.
Definition: fs_api.h:1118
unsigned int max_parallel_downloads
Maximum number of parallel downloads.
Definition: fs_api.h:1166
Argument given to the progress callback with information about what is going on.
Handle for controlling a publication process.
Definition: fs_api.h:1179
int skip_next_fi_callback
Flag set to GNUNET_YES if the next callback from GNUNET_FS_file_information_inspect should be skipped...
Definition: fs_api.h:1298
struct GNUNET_FS_PublishKskContext * ksk_pc
Context for KSK publishing operation that is part of this publishing operation (NULL if not active).
Definition: fs_api.h:1252
uint32_t reserve_entries
Overall number of entries to reserve for the publish operation.
Definition: fs_api.h:1269
enum GNUNET_FS_PublishOptions options
Options for publishing.
Definition: fs_api.h:1274
struct GNUNET_DATASTORE_Handle * dsh
Connection to the datastore service.
Definition: fs_api.h:1235
struct GNUNET_CRYPTO_FileHashContext * fhc
Non-null if we are currently hashing a file.
Definition: fs_api.h:1230
struct TopLevelActivity * top
Our top-level activity entry (if we are top-level, otherwise NULL).
Definition: fs_api.h:1188
struct GNUNET_FS_FileInformation * fi_pos
Current position in the file-tree for the upload.
Definition: fs_api.h:1225
char * nuid
ID for future updates, NULL if we have no namespace or no updates.
Definition: fs_api.h:1208
int any_done
Set to GNUNET_YES if we were able to publish any block.
Definition: fs_api.h:1286
int all_done
Set to GNUNET_YES if all processing has completed.
Definition: fs_api.h:1291
struct GNUNET_DATASTORE_QueueEntry * qre
Queue entry for reservation/unreservation.
Definition: fs_api.h:1240
struct GNUNET_FS_FileInformation * fi
File-structure that is being shared.
Definition: fs_api.h:1193
struct GNUNET_MQ_Handle * mq
Our own message queue for the FS service; only briefly used when we start to index a file,...
Definition: fs_api.h:1220
uint64_t reserve_space
Storage space to reserve for the operation.
Definition: fs_api.h:1263
char * nid
ID of the content in the namespace, NULL if we have no namespace.
Definition: fs_api.h:1203
struct GNUNET_FS_Handle * h
Handle to the global fs context.
Definition: fs_api.h:1183
struct GNUNET_CRYPTO_EcdsaPrivateKey * ns
Namespace that we are publishing in, NULL if we have no namespace.
Definition: fs_api.h:1198
struct GNUNET_SCHEDULER_Task * upload_task
ID of the task performing the upload.
Definition: fs_api.h:1258
int rid
Space reservation ID with datastore service for this upload.
Definition: fs_api.h:1280
struct GNUNET_FS_PublishSksContext * sks_pc
Context for SKS publishing operation that is part of this publishing operation (NULL if not active).
Definition: fs_api.h:1246
char * serialization
Filename used for serializing information about this operation (should be determined using 'mktemp').
Definition: fs_api.h:1214
Context for the KSK publication.
Context for the SKS publication.
Definition: fs_namespace.c:344
Entry in the job queue.
Definition: fs_api.h:420
unsigned int start_times
How often have we (re)started this download?
Definition: fs_api.h:485
int active
GNUNET_YES if the job is active now.
Definition: fs_api.h:490
GNUNET_SCHEDULER_TaskCallback start
Function to call when the job is started.
Definition: fs_api.h:434
struct GNUNET_TIME_Relative run_time
Total amount of time the job has been running (except for the current run).
Definition: fs_api.h:470
GNUNET_SCHEDULER_TaskCallback stop
Function to call when the job needs to stop (or is done / dequeued).
Definition: fs_api.h:439
struct GNUNET_FS_QueueEntry * prev
This is a linked list.
Definition: fs_api.h:429
struct GNUNET_TIME_Absolute queue_time
Time the job was originally queued.
Definition: fs_api.h:459
void * cls
Closure for start and stop.
Definition: fs_api.h:444
enum GNUNET_FS_QueuePriority priority
How important is this download?
Definition: fs_api.h:480
struct GNUNET_TIME_Absolute start_time
Time the job was started last.
Definition: fs_api.h:464
unsigned int blocks
How many blocks do the active downloads have?
Definition: fs_api.h:475
struct GNUNET_MQ_Handle * mq
Message queue handle, or NULL if job is not running.
Definition: fs_api.h:454
struct GNUNET_FS_Handle * h
Handle to FS primary context.
Definition: fs_api.h:449
struct GNUNET_FS_QueueEntry * next
This is a linked list.
Definition: fs_api.h:424
Handle for controlling a search.
Definition: fs_api.h:1510
struct GNUNET_CONTAINER_MultiHashMap * master_result_map
Map that contains a struct GNUNET_FS_SearchResult for each result that was found in the search.
Definition: fs_api.h:1558
char * emsg
Error message (non-NULL if this operation failed).
Definition: fs_api.h:1550
struct SearchRequestEntry * requests
Per-keyword information for a keyword search.
Definition: fs_api.h:1564
char * serialization
Name of the file on disk we use for persistence.
Definition: fs_api.h:1545
void * client_info
Pointer we keep for the client.
Definition: fs_api.h:1540
struct GNUNET_FS_SearchResult * psearch_result
For update-searches, link to the search result that triggered the update search; otherwise NULL.
Definition: fs_api.h:1530
struct GNUNET_SCHEDULER_Task * task
ID of a task that is using this struct and that must be cancelled when the search is being stopped (i...
Definition: fs_api.h:1582
struct GNUNET_TIME_Relative reconnect_backoff
How long to wait before we try to reconnect to FS service?
Definition: fs_api.h:1574
enum GNUNET_FS_SearchOptions options
Options for the search.
Definition: fs_api.h:1597
uint32_t anonymity
Anonymity level for the search.
Definition: fs_api.h:1587
struct TopLevelActivity * top
Our top-level activity entry (if we are top-level, otherwise NULL).
Definition: fs_api.h:1519
struct GNUNET_FS_Uri * uri
List of keywords that we're looking for.
Definition: fs_api.h:1524
uint32_t mandatory_count
Number of mandatory keywords in this query.
Definition: fs_api.h:1592
struct GNUNET_FS_Handle * h
Handle to the global FS context.
Definition: fs_api.h:1514
struct GNUNET_MQ_Handle * mq
Connection to the FS service.
Definition: fs_api.h:1535
struct GNUNET_TIME_Absolute start_time
When did we start?
Definition: fs_api.h:1569
Information we store for each search result.
Definition: fs_api.h:498
uint32_t optional_support
Number of optional keywords under which this result was also found.
Definition: fs_api.h:601
struct GNUNET_FS_DownloadContext * download
ID of an associated download based on this search result (or NULL for none).
Definition: fs_api.h:545
struct GNUNET_FS_SearchContext * update_search
If this search result triggered an update search, this field links to the update search.
Definition: fs_api.h:551
void * client_info
Client info for this search result.
Definition: fs_api.h:533
struct GNUNET_FS_DownloadContext * probe_ctx
ID of a job that is currently probing this results' availability (NULL if we are not currently probin...
Definition: fs_api.h:539
uint32_t availability_trials
Number of availability trials that we have performed for this search result.
Definition: fs_api.h:612
struct GNUNET_FS_Uri * uri
URI to which this search result refers to.
Definition: fs_api.h:523
uint8_t * keyword_bitmap
Bitmap that specifies precisely which keywords have been matched already.
Definition: fs_api.h:561
struct GNUNET_FS_Handle * h
File-sharing context this result belongs to.
Definition: fs_api.h:502
struct GNUNET_HashCode key
Key for the search result based on the URI.
Definition: fs_api.h:566
char * serialization
Name under which this search result is stored on disk.
Definition: fs_api.h:556
struct GNUNET_CONTAINER_MetaData * meta
Metadata for the search result.
Definition: fs_api.h:528
uint32_t anonymity
Anonymity level to use for probes using this search result.
Definition: fs_api.h:588
uint32_t availability_success
Number of availability tests that have succeeded for this result.
Definition: fs_api.h:606
struct GNUNET_FS_SearchContext * sc
Search context this result belongs to; can be NULL for probes that come from a directory result.
Definition: fs_api.h:518
struct GNUNET_FS_SearchResult * prev
Kept in a DLL while probing.
Definition: fs_api.h:512
struct GNUNET_FS_SearchResult * next
Kept in a DLL while probing.
Definition: fs_api.h:507
struct GNUNET_TIME_Absolute probe_active_time
When did the current probe become active?
Definition: fs_api.h:578
struct GNUNET_TIME_Relative remaining_probe_time
How much longer should we run the current probe before giving up?
Definition: fs_api.h:583
uint32_t mandatory_missing
Number of mandatory keywords for which we have NOT yet found the search result; when this value hits ...
Definition: fs_api.h:595
struct GNUNET_SCHEDULER_Task * probe_cancel_task
ID of the task that will clean up the probe_ctx should it not complete on time (and that will need to...
Definition: fs_api.h:573
Context for an ECRS-based file encoder that computes the Merkle-ish-CHK tree.
Definition: fs_tree.c:36
Handle for controlling an unindexing operation.
Definition: fs_api.h:1350
struct GNUNET_FS_TreeEncoder * tc
Merkle-ish tree encoder context.
Definition: fs_api.h:1412
struct GNUNET_FS_DirScanner * dscan
Directory scanner to find keywords (KBlock removal).
Definition: fs_api.h:1370
enum UnindexState state
Current operatinonal phase.
Definition: fs_api.h:1463
void * client_info
Pointer kept for the client.
Definition: fs_api.h:1407
char * emsg
Error message, NULL on success.
Definition: fs_api.h:1438
struct GNUNET_DISK_FileHandle * fh
Handle used to read the file.
Definition: fs_api.h:1417
struct GNUNET_TIME_Absolute start_time
When did we start?
Definition: fs_api.h:1453
struct ContentHashKey chk
The content hash key of the last block we processed, will in the end be set to the CHK from the URI.
Definition: fs_api.h:1355
struct GNUNET_DATASTORE_QueueEntry * dqe
Handle to datastore 'get_key' operation issued for obtaining KBlocks.
Definition: fs_api.h:1423
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
Definition: fs_api.h:1443
struct TopLevelActivity * top
Our top-level activity entry.
Definition: fs_api.h:1365
char * filename
Name of the file that we are unindexing.
Definition: fs_api.h:1385
struct GNUNET_DATASTORE_Handle * dsh
Connection to the datastore service, only valid during the UNINDEX_STATE_DS_NOTIFY phase.
Definition: fs_api.h:1402
struct GNUNET_FS_Handle * h
Global FS context.
Definition: fs_api.h:1360
uint32_t ksk_offset
Current offset in KSK removal.
Definition: fs_api.h:1380
char * serialization
Short name under which we are serializing the state of this operation.
Definition: fs_api.h:1390
struct GNUNET_HashCode uquery
Current query of 'get_key' operation.
Definition: fs_api.h:1433
struct GNUNET_HashCode ukey
Current key for decrypting UBLocks from 'get_key' operation.
Definition: fs_api.h:1428
struct GNUNET_FS_Uri * ksk_uri
Keywords found (telling us which KBlocks to remove).
Definition: fs_api.h:1375
struct GNUNET_HashCode file_id
Hash of the file's contents (once computed).
Definition: fs_api.h:1458
uint64_t file_size
Overall size of the file.
Definition: fs_api.h:1448
struct GNUNET_MQ_Handle * mq
Connection to the FS service, only valid during the UNINDEX_STATE_FS_NOTIFY phase.
Definition: fs_api.h:1396
A Universal Resource Identifier (URI), opaque.
Definition: fs_api.h:166
struct GNUNET_FS_Uri::@13::@14 ksk
union GNUNET_FS_Uri::@13 data
struct GNUNET_FS_Uri::@13::@15 sks
char ** keywords
Keywords start with a '+' if they are mandatory (in which case the '+' is NOT part of the keyword) an...
Definition: fs_api.h:185
enum GNUNET_FS_UriType type
Type of the URI.
Definition: fs_api.h:170
struct GNUNET_CRYPTO_EcdsaPublicKey ns
Identifier of the namespace.
Definition: fs_api.h:198
struct Location loc
Information needed to retrieve a file including signed location (identity of a peer) of the content.
Definition: fs_api.h:217
unsigned int keywordCount
Size of the keywords array.
Definition: fs_api.h:190
char * identifier
Human-readable identifier chosen for this entry in the namespace.
Definition: fs_api.h:204
struct FileIdentifier chk
Information needed to retrieve a file (content-hash-key plus file size).
Definition: fs_api.h:211
A 512-bit hashcode.
Handle to a message queue.
Definition: mq.c:86
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Definition: scheduler.c:135
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
Information about a file and its location (peer claiming to share the file).
Definition: fs_api.h:112
struct GNUNET_TIME_Absolute expirationTime
Time when this location URI expires.
Definition: fs_api.h:126
struct GNUNET_CRYPTO_EddsaSignature contentSignature
Signature over the GNUNET_EC_FileIdentifier, peer identity and expiration time.
Definition: fs_api.h:132
struct FileIdentifier fi
Information about the shared file.
Definition: fs_api.h:116
struct GNUNET_PeerIdentity peer
Identity of the peer sharing the file.
Definition: fs_api.h:121
Information we keep for each keyword in a keyword search.
Definition: fs_api.h:1471
int mandatory
Is this keyword a mandatory keyword (started with '+')?
Definition: fs_api.h:1502
struct GNUNET_CONTAINER_MultiHashMap * results
Map that contains a "struct GNUNET_FS_SearchResult" for each result that was found under this keyword...
Definition: fs_api.h:1496
struct GNUNET_CRYPTO_EcdsaPublicKey dpub
Derived public key, hashes to 'uquery'.
Definition: fs_api.h:1480
char * keyword
The original keyword, used to derive the key (for decrypting the UBlock).
Definition: fs_api.h:1486
struct GNUNET_HashCode uquery
Hash of the public key, also known as the query.
Definition: fs_api.h:1475
We track all of the top-level activities of FS so that we can signal 'suspend' on shutdown.
Definition: fs_api.h:1017
void * ssf_cls
Closure for 'ssf' (some struct GNUNET_FS_XXXHandle*)
Definition: fs_api.h:1036
SuspendSignalFunction ssf
Function to call for suspend-signalling and clean up.
Definition: fs_api.h:1031
struct TopLevelActivity * prev
This is a doubly-linked list.
Definition: fs_api.h:1026
struct TopLevelActivity * next
This is a doubly-linked list.
Definition: fs_api.h:1021