GNUnet 0.21.0
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
33#include "gnunet_fs_service.h"
34#include "gnunet_block_lib.h"
35#include "block_fs.h"
36#include "fs.h"
37
44#define CHK_PER_INODE 256
45
50#define MAX_INLINE_SIZE 65536
51
55#define GNUNET_FS_SYNC_PATH_MASTER_SEARCH "search"
56
60#define GNUNET_FS_SYNC_PATH_CHILD_SEARCH "search-child"
61
66#define GNUNET_FS_SYNC_PATH_MASTER_DOWNLOAD "download"
67
72#define GNUNET_FS_SYNC_PATH_CHILD_DOWNLOAD "download-child"
73
77#define GNUNET_FS_SYNC_PATH_MASTER_PUBLISH "publish"
78
82#define GNUNET_FS_SYNC_PATH_FILE_INFO "publish-file"
83
87#define GNUNET_FS_SYNC_PATH_MASTER_UNINDEX "unindex"
88
89
95{
99 uint64_t file_length;
100
105};
106
107
113{
118
123
128
134};
135
140{
145
150
155
161
162
167{
172
173 union
174 {
175 struct
176 {
186 char **keywords;
187
191 unsigned int keywordCount;
193
194 struct
195 {
200
207
213
218 struct Location loc;
220};
221
222
228{
233
239
244
249
254
259
265
271
276
281
288
293
297 char *emsg;
298
302 char *filename;
303
307 union
308 {
312 struct
313 {
318
323
330
334 uint64_t file_size;
335
340
346
353
357 struct
358 {
363
368 size_t dir_size;
369
374 void *dir_data;
375
380
387
392
397};
398
399
404{
409
415
416
421{
426
431
436
441
445 void *cls;
446
451
456
461
466
472
476 unsigned int blocks;
477
482
486 unsigned int start_times;
487
492};
493
494
499{
504
509
514
520
525
530
535
541
547
553
558
563
568
575
580
585
589 uint32_t anonymity;
590
597
603
608
614};
615
616
632 void *cls,
633 unsigned int blocks,
635
636
642void
644
645
662size_t
664 uint64_t offset,
665 size_t max,
666 void *buf,
667 char **emsg);
668
669
676void *
678
679
696size_t
698 uint64_t offset,
699 size_t max,
700 void *buf,
701 char **emsg);
702
703
719void *
721 const struct GNUNET_FS_ProgressInfo *info);
722
723
729void
731
732
740void
742 const struct GNUNET_HashCode *file_id);
743
744
750void
752
753
759void
761
762
773void *
776 const struct GNUNET_FS_FileInformation *p,
777 uint64_t offset);
778
779
787void
790
791
798void
800
801
810void
813 uint64_t offset);
814
824void *
826 struct GNUNET_FS_Handle *h,
828
829
835void
837
845int
847
853void
855
856
862void
864
865
873void
875 const char *ext,
876 const char *ent);
877
878
886void
888 const char *ext,
889 const char *uni);
890
891
900void
902
903
912void
914
915
924void
926
927
936void
938
939
948void
950
951
960void
962
963
970void
972
973
980void
982
983
990void
992
993
1000void
1002
1003
1011typedef void (*SuspendSignalFunction) (void *cls);
1012
1018{
1023
1028
1033
1037 void *ssf_cls;
1038};
1039
1040
1049struct TopLevelActivity *
1052 void *ssf_cls);
1053
1054
1061void
1063 struct TopLevelActivity *top);
1064
1065
1070{
1075
1080
1085
1090
1095
1100
1105
1110
1115
1120
1125
1130
1136
1142
1148
1152 unsigned int active_downloads;
1153
1157 unsigned int active_blocks;
1158
1163
1168
1173};
1174
1175
1180{
1185
1190
1195
1200
1204 char *nid;
1205
1209 char *nuid;
1210
1216
1222
1227
1232
1237
1242
1248
1254
1260
1265
1271
1276
1281 int rid;
1282
1288
1293
1300};
1301
1302
1307{
1312
1318
1323
1328
1334
1339
1345
1346
1351{
1357
1362
1367
1372
1377
1381 uint32_t ksk_offset;
1382
1387
1392
1398
1404
1409
1414
1419
1425
1430
1435
1439 char *emsg;
1440
1445
1449 uint64_t file_size;
1450
1455
1460
1465};
1466
1467
1472{
1477
1482
1487 char *keyword;
1488
1498
1504};
1505
1506
1511{
1516
1521
1526
1532
1537
1542
1547
1551 char *emsg;
1552
1560
1566
1571
1576
1584
1588 uint32_t anonymity;
1589
1594
1599};
1600
1601
1608{
1614
1622
1630
1638
1647
1656
1662
1668 BRS_ERROR = 7
1670
1671
1676{
1681
1686
1692
1698 uint64_t offset;
1699
1703 unsigned int num_children;
1704
1708 unsigned int depth;
1709
1713 unsigned int chk_idx;
1714
1719};
1720
1721
1727void
1729
1730
1736void
1738
1739
1744{
1749
1754
1759
1765
1771
1776
1781
1786
1791
1796
1801
1806
1810 char *emsg;
1811
1817
1823
1830
1835
1840
1846
1852
1857
1863
1873
1878 uint64_t offset;
1879
1884 uint64_t length;
1885
1890 uint64_t completed;
1891
1899
1904
1909
1913 uint32_t anonymity;
1914
1918 unsigned int treedepth;
1919
1924
1931
1936};
1937
1938
1939#endif
1940
1941/* end of fs_api.h */
FS block formats (shared between FS and Block)
definitions for the entire fs module
BlockRequestState
FSM for possible states a block can go through.
Definition: fs_api.h:1608
@ BRS_DOWNLOAD_UP
This block and all of its children have been downloaded successfully (full completion propagates up).
Definition: fs_api.h:1661
@ BRS_RECONSTRUCT_META_UP
We've calculated the CHK bottom-up based on the meta data.
Definition: fs_api.h:1629
@ BRS_CHK_SET
We've determined the real, desired CHK for this block (full tree reconstruction failed),...
Definition: fs_api.h:1646
@ 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:1668
@ 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:1621
@ BRS_INIT
Initial state, block has only been allocated (since it is relevant to the overall download request).
Definition: fs_api.h:1613
@ BRS_DOWNLOAD_DOWN
We've successfully downloaded this block, but the children still need to be either downloaded or veri...
Definition: fs_api.h:1655
@ 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:1637
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:1952
void GNUNET_FS_search_result_sync_(struct GNUNET_FS_SearchResult *sr)
Synchronize this search result with its mirror on disk.
Definition: fs_api.c:2149
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:49
UnindexState
Phases of unindex processing (state machine).
Definition: fs_api.h:1307
@ UNINDEX_STATE_EXTRACT_KEYWORDS
Find out which keywords apply.
Definition: fs_api.h:1322
@ UNINDEX_STATE_COMPLETE
We're done.
Definition: fs_api.h:1338
@ UNINDEX_STATE_DS_REMOVE
We're telling the datastore to delete the respective DBlocks and IBlocks.
Definition: fs_api.h:1317
@ UNINDEX_STATE_HASHING
We're currently hashing the file.
Definition: fs_api.h:1311
@ UNINDEX_STATE_ERROR
We've encountered a fatal error.
Definition: fs_api.h:1343
@ UNINDEX_STATE_FS_NOTIFY
We're notifying the FS service about the unindexing.
Definition: fs_api.h:1333
@ UNINDEX_STATE_DS_REMOVE_KBLOCKS
We're telling the datastore to remove KBlocks.
Definition: fs_api.h:1327
GNUNET_FS_UriType
Types of URIs.
Definition: fs_api.h:140
@ GNUNET_FS_URI_LOC
Location (chk with identity of hosting peer).
Definition: fs_api.h:159
@ GNUNET_FS_URI_CHK
Content-hash-key (simple file).
Definition: fs_api.h:144
@ GNUNET_FS_URI_SKS
Signed key space (file in namespace).
Definition: fs_api.h:149
@ GNUNET_FS_URI_KSK
Keyword search key (query with keywords).
Definition: fs_api.h:154
void GNUNET_FS_unindex_sync_(struct GNUNET_FS_UnindexContext *uc)
Synchronize this unindex struct with its mirror on disk.
Definition: fs_api.c:1823
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:581
void GNUNET_FS_search_sync_(struct GNUNET_FS_SearchContext *sc)
Synchronize this search struct with its mirror on disk.
Definition: fs_api.c:2248
void GNUNET_FS_free_download_request_(struct DownloadRequest *dr)
(recursively) free download request structure
Definition: fs_download.c:997
void GNUNET_FS_stop_probe_ping_task_(struct GNUNET_FS_SearchResult *sr)
Stop the ping task for this search result.
Definition: fs_search.c:410
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:1355
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:321
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:281
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:85
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:509
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:545
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:104
void GNUNET_FS_download_start_task_(void *cls)
Task that creates the initial (top-level) download request for the file.
Definition: fs_download.c:1799
void GNUNET_FS_unindex_do_extract_keywords_(struct GNUNET_FS_UnindexContext *uc)
Extract the keywords for KBlock removal.
Definition: fs_unindex.c:407
void GNUNET_FS_unindex_do_remove_(struct GNUNET_FS_UnindexContext *uc)
Connect to the datastore and remove the blocks.
Definition: fs_unindex.c:650
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:48
void GNUNET_FS_search_start_probe_(struct GNUNET_FS_SearchResult *sr)
Start download probes for the given search result.
Definition: fs_search.c:431
void GNUNET_FS_download_sync_(struct GNUNET_FS_DownloadContext *dc)
Synchronize this download struct with its mirror on disk.
Definition: fs_api.c:2036
GNUNET_FS_QueuePriority
Priorities for the queue.
Definition: fs_api.h:404
@ GNUNET_FS_QUEUE_PRIORITY_NORMAL
Default priority.
Definition: fs_api.h:413
@ GNUNET_FS_QUEUE_PRIORITY_PROBE
This is a probe (low priority).
Definition: fs_api.h:408
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:1328
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:1011
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:728
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:728
void GNUNET_FS_download_start_downloading_(struct GNUNET_FS_DownloadContext *dc)
Start the downloading process (by entering the queue).
Definition: fs_download.c:2183
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:1402
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:381
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:787
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:695
void GNUNET_FS_dequeue_(struct GNUNET_FS_QueueEntry *qe)
Dequeue a job from the queue.
Definition: fs_api.c:356
void GNUNET_FS_publish_main_(void *cls)
Main function that performs the upload.
Definition: fs_publish.c:1063
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:447
void GNUNET_FS_end_top(struct GNUNET_FS_Handle *h, struct TopLevelActivity *top)
Destroy a top-level activity entry.
Definition: fs_api.c:402
void GNUNET_FS_publish_sync_(struct GNUNET_FS_PublishContext *pc)
Synchronize this publishing struct with its mirror on disk.
Definition: fs_api.c:1747
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:1555
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_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.
#define info
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:87
static struct GNUNET_FS_UnindexContext * uc
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-uri.c:38
Library for data block manipulation.
API to the DHT service.
API for file sharing via GNUnet.
GNUNET_FS_Flags
General (global) option flags for file-sharing.
GNUNET_FS_SearchOptions
Options for searching.
GNUNET_FS_DownloadOptions
Options for downloading.
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_FS_ProgressCallback)(void *cls, const struct GNUNET_FS_ProgressInfo *info)
Notification of FS to a client about the progress of an operation.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
#define max(x, y)
content hash key
Definition: fs.h:55
Information about an active download request.
Definition: fs_api.h:1676
struct DownloadRequest ** children
Array (!) of child-requests, or NULL for the bottom of the tree.
Definition: fs_api.h:1685
unsigned int chk_idx
Offset of the CHK for this block in the parent block.
Definition: fs_api.h:1713
unsigned int num_children
Number of entries in children array.
Definition: fs_api.h:1703
uint64_t offset
Offset of the corresponding block.
Definition: fs_api.h:1698
enum BlockRequestState state
State in the FSM.
Definition: fs_api.h:1718
unsigned int depth
Depth of the corresponding block in the tree.
Definition: fs_api.h:1708
struct DownloadRequest * parent
Parent in the CHK-tree.
Definition: fs_api.h:1680
struct ContentHashKey chk
CHK for the request for this block (set during reconstruction to what we have on disk,...
Definition: fs_api.h:1691
complete information needed to download a file.
Definition: fs_api.h:95
struct ContentHashKey chk
Query and key of the top GNUNET_EC_IBlock.
Definition: fs_api.h:104
uint64_t file_length
Total size of the file in bytes.
Definition: fs_api.h:99
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:1744
int has_finished
Flag set upon transitive completion (includes child downloads).
Definition: fs_api.h:1930
unsigned int treedepth
The depth of the file-tree.
Definition: fs_api.h:1918
char * filename
Where are we writing the data (name of the file, can be NULL!).
Definition: fs_api.h:1822
struct GNUNET_FS_Uri * uri
URI that identifies the file that we are downloading.
Definition: fs_api.h:1800
struct GNUNET_DISK_FileHandle * rfh
File handle for reading data from an existing file (to pass to tree encoder).
Definition: fs_api.h:1845
struct GNUNET_FS_MetaData * meta
Known meta-data for the file (can be NULL).
Definition: fs_api.h:1805
void * client_info
Context kept for the client.
Definition: fs_api.h:1795
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:1898
int issue_requests
Are we ready to issue requests (reconstructions are finished)?
Definition: fs_api.h:1935
uint64_t completed
How many bytes have we already received within the specified range (DBlocks only).
Definition: fs_api.h:1890
uint64_t offset
What is the first offset that we're interested in?
Definition: fs_api.h:1878
struct GNUNET_FS_QueueEntry * job_queue
Our entry in the job queue.
Definition: fs_api.h:1834
char * emsg
Error message, NULL if we're doing OK.
Definition: fs_api.h:1810
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:1872
struct GNUNET_FS_TreeEncoder * te
Tree encoder used for the reconstruction.
Definition: fs_api.h:1839
struct GNUNET_FS_SearchResult * search
Associated search (used when downloading files based on search results), or NULL for none.
Definition: fs_api.h:1770
struct GNUNET_FS_DownloadContext * child_tail
Tail of list of child downloads.
Definition: fs_api.h:1780
struct GNUNET_FS_DownloadContext * prev
Previous download belonging to the same parent.
Definition: fs_api.h:1785
struct GNUNET_CONTAINER_MultiHashMap * active
Map of active requests (those waiting for a response).
Definition: fs_api.h:1851
struct GNUNET_FS_DownloadContext * child_head
Head of list of child downloads.
Definition: fs_api.h:1775
struct GNUNET_TIME_Relative reconnect_backoff
How long to wait before we try to reconnect to FS service?
Definition: fs_api.h:1908
uint64_t length
How many bytes starting from offset are desired? This is NOT the overall length of the file!
Definition: fs_api.h:1884
char * serialization
Random portion of filename we use for syncing state of this download.
Definition: fs_api.h:1816
struct GNUNET_MQ_Handle * mq
Connection to the FS service.
Definition: fs_api.h:1758
uint32_t anonymity
Desired level of anonymity.
Definition: fs_api.h:1913
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:1829
struct GNUNET_FS_DownloadContext * next
Next download belonging to the same parent.
Definition: fs_api.h:1790
struct GNUNET_FS_DownloadContext * parent
Parent download (used when downloading files in directories).
Definition: fs_api.h:1764
struct DownloadRequest * top_request
Top-level download request.
Definition: fs_api.h:1856
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:1862
enum GNUNET_FS_DownloadOptions options
Options for the download.
Definition: fs_api.h:1923
struct GNUNET_FS_Handle * h
Global FS context.
Definition: fs_api.h:1748
struct GNUNET_TIME_Absolute start_time
Time download was started.
Definition: fs_api.h:1903
struct TopLevelActivity * top
Our top-level activity entry (if we are top-level, otherwise NULL).
Definition: fs_api.h:1753
Information for a file or directory that is about to be published.
Definition: fs_api.h:228
char * serialization
Under what filename is this struct serialized (for operational persistence).
Definition: fs_api.h:287
struct GNUNET_FS_Uri * keywords
Keywords to use for KBlocks.
Definition: fs_api.h:258
char * filename
Name of the file or directory (must be an absolute path).
Definition: fs_api.h:302
size_t dir_size
Size of the directory itself (in bytes); 0 if the size has not yet been calculated.
Definition: fs_api.h:368
uint64_t contents_completed
How much of the directory have we published (relative to contents_size).
Definition: fs_api.h:379
struct GNUNET_FS_TreeEncoder * te
Encoder being used to publish this file.
Definition: fs_api.h:292
struct GNUNET_FS_FileInformation::@52::@53 file
Data for a file.
GNUNET_FS_DataReader reader
Function that can be used to read the data for the file.
Definition: fs_api.h:317
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:329
uint64_t file_size
Size of the file (in bytes).
Definition: fs_api.h:334
char * emsg
Error message (non-NULL if this operation failed).
Definition: fs_api.h:297
void * client_info
Pointer kept for the client.
Definition: fs_api.h:248
struct GNUNET_FS_FileInformation * next
Files in a directory are kept as a linked list.
Definition: fs_api.h:232
struct GNUNET_FS_BlockOptions bo
Block options for the file.
Definition: fs_api.h:275
int is_published
Are we done publishing this file?
Definition: fs_api.h:396
struct GNUNET_FS_MetaData * meta
Metadata to use for the file.
Definition: fs_api.h:253
union GNUNET_FS_FileInformation::@52 data
Data describing either the file or the directory.
int have_hash
Is "file_id" already valid? Set to GNUNET_YES once the hash has been calculated.
Definition: fs_api.h:345
struct GNUNET_FS_Uri * sks_uri
SKS URI for this file or directory.
Definition: fs_api.h:270
int index_start_confirmed
Has the service confirmed our INDEX_START request? GNUNET_YES if this step has been completed.
Definition: fs_api.h:351
void * dir_data
Pointer to the data for the directory (or NULL if not available).
Definition: fs_api.h:374
uint64_t contents_size
Sum of all of the sizes of all of the files in the directory.
Definition: fs_api.h:384
int do_index
Should the file be indexed or inserted?
Definition: fs_api.h:339
void * reader_cls
Closure for reader.
Definition: fs_api.h:322
struct GNUNET_FS_Handle * h
Handle to the master context.
Definition: fs_api.h:243
struct GNUNET_TIME_Absolute start_time
At what time did we start this upload?
Definition: fs_api.h:280
struct GNUNET_FS_FileInformation * entries
Linked list of entries in the directory.
Definition: fs_api.h:362
struct GNUNET_FS_FileInformation * dir
If this is a file in a directory, "dir" refers to the directory; otherwise NULL.
Definition: fs_api.h:238
struct GNUNET_FS_Uri * chk_uri
CHK for this file or directory.
Definition: fs_api.h:264
int is_directory
Is this struct for a file or directory?
Definition: fs_api.h:391
Master context for most FS operations.
Definition: fs_api.h:1070
enum GNUNET_FS_Flags flags
General flags.
Definition: fs_api.h:1162
char * client_name
Name of our client.
Definition: fs_api.h:1079
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:1135
struct TopLevelActivity * top_tail
Tail of DLL of top-level activities.
Definition: fs_api.h:1099
struct GNUNET_FS_QueueEntry * pending_head
Head of DLL of pending jobs.
Definition: fs_api.h:1114
unsigned int max_parallel_requests
Maximum number of parallel requests.
Definition: fs_api.h:1172
struct GNUNET_FS_QueueEntry * running_head
Head of DLL of running jobs.
Definition: fs_api.h:1104
unsigned int active_downloads
How many actual downloads do we have running right now?
Definition: fs_api.h:1152
void * upcb_cls
Closure for upcb.
Definition: fs_api.h:1089
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:1141
struct GNUNET_FS_SearchResult * probes_tail
Tail of active probes.
Definition: fs_api.h:1129
GNUNET_FS_ProgressCallback upcb
Function to call with updates on our progress.
Definition: fs_api.h:1084
struct GNUNET_TIME_Relative avg_block_latency
Average time we take for a single request to be satisfied.
Definition: fs_api.h:1147
struct TopLevelActivity * top_head
Head of DLL of top-level activities.
Definition: fs_api.h:1094
struct GNUNET_FS_QueueEntry * running_tail
Tail of DLL of running jobs.
Definition: fs_api.h:1109
unsigned int active_blocks
How many blocks do the active downloads have?
Definition: fs_api.h:1157
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Definition: fs_api.h:1074
struct GNUNET_FS_SearchResult * probes_head
Head of active probes.
Definition: fs_api.h:1124
struct GNUNET_FS_QueueEntry * pending_tail
Tail of DLL of pending jobs.
Definition: fs_api.h:1119
unsigned int max_parallel_downloads
Maximum number of parallel downloads.
Definition: fs_api.h:1167
Meta data to associate with a file, directory or namespace.
Definition: meta_data.c:92
Argument given to the progress callback with information about what is going on.
Handle for controlling a publication process.
Definition: fs_api.h:1180
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:1299
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:1253
uint32_t reserve_entries
Overall number of entries to reserve for the publish operation.
Definition: fs_api.h:1270
enum GNUNET_FS_PublishOptions options
Options for publishing.
Definition: fs_api.h:1275
struct GNUNET_DATASTORE_Handle * dsh
Connection to the datastore service.
Definition: fs_api.h:1236
struct GNUNET_CRYPTO_FileHashContext * fhc
Non-null if we are currently hashing a file.
Definition: fs_api.h:1231
struct TopLevelActivity * top
Our top-level activity entry (if we are top-level, otherwise NULL).
Definition: fs_api.h:1189
struct GNUNET_FS_FileInformation * fi_pos
Current position in the file-tree for the upload.
Definition: fs_api.h:1226
char * nuid
ID for future updates, NULL if we have no namespace or no updates.
Definition: fs_api.h:1209
int any_done
Set to GNUNET_YES if we were able to publish any block.
Definition: fs_api.h:1287
int all_done
Set to GNUNET_YES if all processing has completed.
Definition: fs_api.h:1292
struct GNUNET_DATASTORE_QueueEntry * qre
Queue entry for reservation/unreservation.
Definition: fs_api.h:1241
struct GNUNET_FS_FileInformation * fi
File-structure that is being shared.
Definition: fs_api.h:1194
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:1221
uint64_t reserve_space
Storage space to reserve for the operation.
Definition: fs_api.h:1264
char * nid
ID of the content in the namespace, NULL if we have no namespace.
Definition: fs_api.h:1204
struct GNUNET_FS_Handle * h
Handle to the global fs context.
Definition: fs_api.h:1184
struct GNUNET_CRYPTO_EcdsaPrivateKey * ns
Namespace that we are publishing in, NULL if we have no namespace.
Definition: fs_api.h:1199
struct GNUNET_SCHEDULER_Task * upload_task
ID of the task performing the upload.
Definition: fs_api.h:1259
int rid
Space reservation ID with datastore service for this upload.
Definition: fs_api.h:1281
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:1247
char * serialization
Filename used for serializing information about this operation (should be determined using 'mktemp').
Definition: fs_api.h:1215
Context for the KSK publication.
Context for the SKS publication.
Definition: fs_namespace.c:345
Entry in the job queue.
Definition: fs_api.h:421
unsigned int start_times
How often have we (re)started this download?
Definition: fs_api.h:486
int active
GNUNET_YES if the job is active now.
Definition: fs_api.h:491
GNUNET_SCHEDULER_TaskCallback start
Function to call when the job is started.
Definition: fs_api.h:435
struct GNUNET_TIME_Relative run_time
Total amount of time the job has been running (except for the current run).
Definition: fs_api.h:471
GNUNET_SCHEDULER_TaskCallback stop
Function to call when the job needs to stop (or is done / dequeued).
Definition: fs_api.h:440
struct GNUNET_FS_QueueEntry * prev
This is a linked list.
Definition: fs_api.h:430
struct GNUNET_TIME_Absolute queue_time
Time the job was originally queued.
Definition: fs_api.h:460
void * cls
Closure for start and stop.
Definition: fs_api.h:445
enum GNUNET_FS_QueuePriority priority
How important is this download?
Definition: fs_api.h:481
struct GNUNET_TIME_Absolute start_time
Time the job was started last.
Definition: fs_api.h:465
unsigned int blocks
How many blocks do the active downloads have?
Definition: fs_api.h:476
struct GNUNET_MQ_Handle * mq
Message queue handle, or NULL if job is not running.
Definition: fs_api.h:455
struct GNUNET_FS_Handle * h
Handle to FS primary context.
Definition: fs_api.h:450
struct GNUNET_FS_QueueEntry * next
This is a linked list.
Definition: fs_api.h:425
Handle for controlling a search.
Definition: fs_api.h:1511
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:1559
char * emsg
Error message (non-NULL if this operation failed).
Definition: fs_api.h:1551
struct SearchRequestEntry * requests
Per-keyword information for a keyword search.
Definition: fs_api.h:1565
char * serialization
Name of the file on disk we use for persistence.
Definition: fs_api.h:1546
void * client_info
Pointer we keep for the client.
Definition: fs_api.h:1541
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:1531
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:1583
struct GNUNET_TIME_Relative reconnect_backoff
How long to wait before we try to reconnect to FS service?
Definition: fs_api.h:1575
enum GNUNET_FS_SearchOptions options
Options for the search.
Definition: fs_api.h:1598
uint32_t anonymity
Anonymity level for the search.
Definition: fs_api.h:1588
struct TopLevelActivity * top
Our top-level activity entry (if we are top-level, otherwise NULL).
Definition: fs_api.h:1520
struct GNUNET_FS_Uri * uri
List of keywords that we're looking for.
Definition: fs_api.h:1525
uint32_t mandatory_count
Number of mandatory keywords in this query.
Definition: fs_api.h:1593
struct GNUNET_FS_Handle * h
Handle to the global FS context.
Definition: fs_api.h:1515
struct GNUNET_MQ_Handle * mq
Connection to the FS service.
Definition: fs_api.h:1536
struct GNUNET_TIME_Absolute start_time
When did we start?
Definition: fs_api.h:1570
Information we store for each search result.
Definition: fs_api.h:499
uint32_t optional_support
Number of optional keywords under which this result was also found.
Definition: fs_api.h:602
struct GNUNET_FS_DownloadContext * download
ID of an associated download based on this search result (or NULL for none).
Definition: fs_api.h:546
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:552
void * client_info
Client info for this search result.
Definition: fs_api.h:534
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:540
uint32_t availability_trials
Number of availability trials that we have performed for this search result.
Definition: fs_api.h:613
struct GNUNET_FS_Uri * uri
URI to which this search result refers to.
Definition: fs_api.h:524
uint8_t * keyword_bitmap
Bitmap that specifies precisely which keywords have been matched already.
Definition: fs_api.h:562
struct GNUNET_FS_Handle * h
File-sharing context this result belongs to.
Definition: fs_api.h:503
struct GNUNET_HashCode key
Key for the search result based on the URI.
Definition: fs_api.h:567
char * serialization
Name under which this search result is stored on disk.
Definition: fs_api.h:557
uint32_t anonymity
Anonymity level to use for probes using this search result.
Definition: fs_api.h:589
uint32_t availability_success
Number of availability tests that have succeeded for this result.
Definition: fs_api.h:607
struct GNUNET_FS_MetaData * meta
Metadata for the search result.
Definition: fs_api.h:529
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:519
struct GNUNET_FS_SearchResult * prev
Kept in a DLL while probing.
Definition: fs_api.h:513
struct GNUNET_FS_SearchResult * next
Kept in a DLL while probing.
Definition: fs_api.h:508
struct GNUNET_TIME_Absolute probe_active_time
When did the current probe become active?
Definition: fs_api.h:579
struct GNUNET_TIME_Relative remaining_probe_time
How much longer should we run the current probe before giving up?
Definition: fs_api.h:584
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:596
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:574
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:1351
struct GNUNET_FS_TreeEncoder * tc
Merkle-ish tree encoder context.
Definition: fs_api.h:1413
struct GNUNET_FS_DirScanner * dscan
Directory scanner to find keywords (KBlock removal).
Definition: fs_api.h:1371
enum UnindexState state
Current operatinonal phase.
Definition: fs_api.h:1464
void * client_info
Pointer kept for the client.
Definition: fs_api.h:1408
char * emsg
Error message, NULL on success.
Definition: fs_api.h:1439
struct GNUNET_DISK_FileHandle * fh
Handle used to read the file.
Definition: fs_api.h:1418
struct GNUNET_TIME_Absolute start_time
When did we start?
Definition: fs_api.h:1454
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:1356
struct GNUNET_DATASTORE_QueueEntry * dqe
Handle to datastore 'get_key' operation issued for obtaining KBlocks.
Definition: fs_api.h:1424
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
Definition: fs_api.h:1444
struct TopLevelActivity * top
Our top-level activity entry.
Definition: fs_api.h:1366
char * filename
Name of the file that we are unindexing.
Definition: fs_api.h:1386
struct GNUNET_DATASTORE_Handle * dsh
Connection to the datastore service, only valid during the UNINDEX_STATE_DS_NOTIFY phase.
Definition: fs_api.h:1403
struct GNUNET_FS_Handle * h
Global FS context.
Definition: fs_api.h:1361
uint32_t ksk_offset
Current offset in KSK removal.
Definition: fs_api.h:1381
char * serialization
Short name under which we are serializing the state of this operation.
Definition: fs_api.h:1391
struct GNUNET_HashCode uquery
Current query of 'get_key' operation.
Definition: fs_api.h:1434
struct GNUNET_HashCode ukey
Current key for decrypting UBLocks from 'get_key' operation.
Definition: fs_api.h:1429
struct GNUNET_FS_Uri * ksk_uri
Keywords found (telling us which KBlocks to remove).
Definition: fs_api.h:1376
struct GNUNET_HashCode file_id
Hash of the file's contents (once computed).
Definition: fs_api.h:1459
uint64_t file_size
Overall size of the file.
Definition: fs_api.h:1449
struct GNUNET_MQ_Handle * mq
Connection to the FS service, only valid during the UNINDEX_STATE_FS_NOTIFY phase.
Definition: fs_api.h:1397
A Universal Resource Identifier (URI), opaque.
Definition: fs_api.h:167
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:186
union GNUNET_FS_Uri::@49 data
struct GNUNET_FS_Uri::@49::@51 sks
enum GNUNET_FS_UriType type
Type of the URI.
Definition: fs_api.h:171
struct GNUNET_FS_Uri::@49::@50 ksk
struct GNUNET_CRYPTO_EcdsaPublicKey ns
Identifier of the namespace.
Definition: fs_api.h:199
struct Location loc
Information needed to retrieve a file including signed location (identity of a peer) of the content.
Definition: fs_api.h:218
unsigned int keywordCount
Size of the keywords array.
Definition: fs_api.h:191
char * identifier
Human-readable identifier chosen for this entry in the namespace.
Definition: fs_api.h:205
struct FileIdentifier chk
Information needed to retrieve a file (content-hash-key plus file size).
Definition: fs_api.h:212
A 512-bit hashcode.
Handle to a message queue.
Definition: mq.c:87
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Definition: scheduler.c:136
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:113
struct GNUNET_TIME_Absolute expirationTime
Time when this location URI expires.
Definition: fs_api.h:127
struct GNUNET_CRYPTO_EddsaSignature contentSignature
Signature over the GNUNET_EC_FileIdentifier, peer identity and expiration time.
Definition: fs_api.h:133
struct FileIdentifier fi
Information about the shared file.
Definition: fs_api.h:117
struct GNUNET_PeerIdentity peer
Identity of the peer sharing the file.
Definition: fs_api.h:122
Information we keep for each keyword in a keyword search.
Definition: fs_api.h:1472
int mandatory
Is this keyword a mandatory keyword (started with '+')?
Definition: fs_api.h:1503
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:1497
struct GNUNET_CRYPTO_EcdsaPublicKey dpub
Derived public key, hashes to 'uquery'.
Definition: fs_api.h:1481
char * keyword
The original keyword, used to derive the key (for decrypting the UBlock).
Definition: fs_api.h:1487
struct GNUNET_HashCode uquery
Hash of the public key, also known as the query.
Definition: fs_api.h:1476
We track all of the top-level activities of FS so that we can signal 'suspend' on shutdown.
Definition: fs_api.h:1018
void * ssf_cls
Closure for 'ssf' (some struct GNUNET_FS_XXXHandle*)
Definition: fs_api.h:1037
SuspendSignalFunction ssf
Function to call for suspend-signalling and clean up.
Definition: fs_api.h:1032
struct TopLevelActivity * prev
This is a doubly-linked list.
Definition: fs_api.h:1027
struct TopLevelActivity * next
This is a doubly-linked list.
Definition: fs_api.h:1022