aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO9
-rw-r--r--doc/man/Makefile.am5
-rw-r--r--doc/man/gnunet-download.168
-rw-r--r--doc/man/gnunet-peerinfo.12
-rw-r--r--doc/man/gnunet-publish.18
-rw-r--r--doc/man/gnunet-search.172
-rw-r--r--doc/man/gnunet-statistics.12
-rw-r--r--doc/man/gnunet-unindex.137
-rw-r--r--src/fs/fs.c9
-rw-r--r--src/fs/fs.h5
-rw-r--r--src/fs/fs_download.c2
-rw-r--r--src/fs/fs_publish.c2
-rw-r--r--src/fs/gnunet-download.c120
-rw-r--r--src/fs/gnunet-publish.c62
-rw-r--r--src/fs/gnunet-search.c104
-rw-r--r--src/fs/gnunet-unindex.c54
-rw-r--r--src/include/gnunet_fs_service.h59
17 files changed, 577 insertions, 43 deletions
diff --git a/TODO b/TODO
index 24c12a1bf..fe9f791c4 100644
--- a/TODO
+++ b/TODO
@@ -36,11 +36,6 @@ Urgent items (before announcing ng.gnunet.org):
36* HOSTLIST: 36* HOSTLIST:
37 - implement testcases 37 - implement testcases
38* FS (basic anonymous FS only) 38* FS (basic anonymous FS only)
39 - implement basic FS library
40 - gnunet-publish (progress CB, shutdown, URI args)
41 - gnunet-unindex (progress CB, shutdown, error checking)
42 - gnunet-search (start search, progress CB, shutdown, options)
43 - gnunet-download (start download, progress CB, shutdown, options)
44 - design network structs (P2P) 39 - design network structs (P2P)
45 + query 40 + query
46 + response 41 + response
@@ -80,6 +75,10 @@ Urgent items (before announcing ng.gnunet.org):
80 + indexing: index-failure-cleanup 75 + indexing: index-failure-cleanup
81 + download: management/bounding of parallel downloads (for recursive dl.) 76 + download: management/bounding of parallel downloads (for recursive dl.)
82 + datastore reservation (publishing) 77 + datastore reservation (publishing)
78 + gnunet-publish (URI args)
79 + gnunet-download (directory)
80 + gnunet-search (options, incl. namespace search)
81 - gnunet-download (many options)
83 - implement adv. FS testcases 82 - implement adv. FS testcases
84 + insert: sblocks, loc uris 83 + insert: sblocks, loc uris
85 + download: loc uris 84 + download: loc uris
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index b5af700e0..aa8c737d7 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -1,8 +1,11 @@
1man_MANS = \ 1man_MANS = \
2 gnunet-arm.1 \ 2 gnunet-arm.1 \
3 gnunet-download.1 \
3 gnunet-peerinfo.1 \ 4 gnunet-peerinfo.1 \
4 gnunet-publish.1 \ 5 gnunet-publish.1 \
6 gnunet-search.1 \
5 gnunet-statistics.1 \ 7 gnunet-statistics.1 \
6 gnunet-transport.c 8 gnunet-transport.1 \
9 gnunet-unindex.1
7 10
8EXTRA_DIST = ${man_MANS} 11EXTRA_DIST = ${man_MANS}
diff --git a/doc/man/gnunet-download.1 b/doc/man/gnunet-download.1
new file mode 100644
index 000000000..c729683e9
--- /dev/null
+++ b/doc/man/gnunet-download.1
@@ -0,0 +1,68 @@
1.TH GNUNET-DOWNLOAD "1" "6 Sep 2009" "GNUnet"
2.SH NAME
3gnunet\-download \- a command line interface for downloading files from GNUnet
4.SH SYNOPSIS
5.B gnunet\-download
6[\fIOPTIONS\fR] \-\- GNUNET_URI
7.SH DESCRIPTION
8.PP
9Download files from GNUnet.
10.TP
11\fB\-a \fILEVEL\fR, \fB\-\-anonymity=LEVEL\fR
12set desired level of receiver anonymity. Default is 1.
13.TP
14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
15use config file (defaults: ~/.gnunet/gnunet.conf)
16.TP
17\fB\-d, \fB\-\-directory\fR
18download a GNUnet directory that has already been downloaded. Requires that a filename of an existing file is specified instead of the URI. The download will only download the top\-level files in the directory unless the `\-R' option is also specified.
19.TP
20\fB\-D, \fB\-\-delete\-incomplete\fR
21causes gnunet\-download to delete incomplete downloads when aborted with CTRL\-C. Note that complete files that are part of an incomplete recursive download will not be deleted even with this option. Without this option, terminating gnunet\-download with a signal will cause incomplete downloads to stay on disk. If gnunet\-download runs to (normal) completion finishing the download, this option has no effect.
22.TP
23\fB\-h\fR, \fB\-\-help\fR
24print help page
25.TP
26\fB\-H \fIHOSTNAME\fR, \fB\-\-host=\fIHOSTNAME\fR
27on which host is gnunetd running (default: localhost). You can also specify a port using the syntax HOSTNAME:PORT. The default port is 2087.
28.TP
29\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR
30Change the loglevel. Possible values for LOGLEVEL are
31ERROR, WARNING, INFO and DEBUG.
32.TP
33\fB\-o \fIFILENAME\fR, \fB\-\-output=FILENAME\fR
34write the file to FILENAME. Hint: when recursively downloading a directory, append a '/' to the end of the FILENAME to create a directory of that name. If no FILENAME is specified, gnunet\-download constructs a temporary ID from the URI of the file. The final filename is constructed based on meta\-data extracted using libextractor (if available).
35.TP
36\fB\-p \fIDOWNLOADS\fR, \fB\-\-parallelism=DOWNLOADS\fR
37set the maximum number of parallel downloads that is allowed. More parallel downloads can, to some extent, improve the overall time to download content. However, parallel downloads also take more memory. The specified number is the number of files that are downloaded in parallel, not the number of blocks that are concurrently requested. As a result, the number only matters for recursive downloads. The default value is 32.
38.TP
39\fB\-R\fR, \fB\-\-recursive\fR
40download directories recursively (and in parallel); note that the URI must belong to a GNUnet directory and that the filename given must end with a '/' \-\- otherwise, only the file corresponding to the URI will be downloaded.
41.TP
42\fB\-v\fR, \fB\-\-version\fR
43print the version number
44.TP
45\fB\-V\fR, \fB\-\-verbose\fR
46print progress information
47.SH NOTES
48The GNUNET_URI is typically obtained from gnunet\-search. gnunet\-gtk can also be used instead of gnunet\-download.
49If you ever have to abort a download, you can at any time continue it by re\-issuing gnunet\-download with the same filename. In that case GNUnet will not download blocks again that are already present. GNUnets file\-encoding will ensure file integrity, even if the existing file was not downloaded from GNUnet in the first place. Temporary information will be appended to the target file until the download is completed.
50
51.SH SETTING ANONYMITY LEVEL
52
53The \fB\-a\fR option can be used to specify additional anonymity constraints. If set to 0, GNUnet will try to download the file as fast as possible without any additional slowdown by the anonymity code. Note that you will still have a fair degree of anonymity depending on the current network load and the power of the adversary. The download is still unlikely to be terribly fast since the sender may have requested sender\-anonymity and since in addition to that, GNUnet will still do the anonymous routing.
54
55This option can be used to limit requests further than that. In particular, you can require GNUnet to receive certain amounts of traffic from other peers before sending your queries. This way, you can gain very high levels of anonymity \- at the expense of much more traffic and much higher latency. So set it only if you really believe you need it.
56
57The definition of ANONYMITY\-RECEIVE is the following: If the value v is < 1000, it means that if GNUnet routes n bytes of messages from foreign peers, it may originate n/v bytes of queries in the same time\-period. The time\-period is twice the average delay that GNUnet deferrs forwarded queries. If the value v is >= 1000, it means that if GNUnet routes n bytes of QUERIES from at least (v % 1000) peers, it may originate n/v/1000 bytes of queries in the same time\-period.
58
59The default is 0 and this should be fine for most users. Also notice that if you choose values above 1000, you may end up having no throughput at all, especially if many of your fellow GNUnet\-peers do the same.
60
61.SH FILES
62.TP
63~/.gnunet/gnunet.conf
64GNUnet configuration file
65.SH "REPORTING BUGS"
66Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
67.SH "SEE ALSO"
68\fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-gtk\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1), \fBgnunet.conf\fP(5), \fBgnunetd\fP(1)
diff --git a/doc/man/gnunet-peerinfo.1 b/doc/man/gnunet-peerinfo.1
index 2980d3544..d25dfa3d3 100644
--- a/doc/man/gnunet-peerinfo.1
+++ b/doc/man/gnunet-peerinfo.1
@@ -1,4 +1,4 @@
1.TH GNUNET-PEERINFO 1 "Mar 15, 2009" "GNUnet" 1.TH GNUNET\-PEERINFO 1 "Mar 15, 2009" "GNUnet"
2 2
3.SH NAME 3.SH NAME
4gnunet\-peerinfo \- Display information about other peers. 4gnunet\-peerinfo \- Display information about other peers.
diff --git a/doc/man/gnunet-publish.1 b/doc/man/gnunet-publish.1
index 4926295cf..df2059629 100644
--- a/doc/man/gnunet-publish.1
+++ b/doc/man/gnunet-publish.1
@@ -50,10 +50,8 @@ additional key to index the content with (to add multiple keys, specify multiple
50 50
51.TP 51.TP
52\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=\fILOGLEVEL\fR 52\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=\fILOGLEVEL\fR
53Change the loglevel. Possible values for LOGLEVEL are NOTHING, FATAL, 53Change the loglevel. Possible values for LOGLEVEL are
54ERROR, WARNING, INFO, STATUS and DEBUG. Note that options in the 54ERROR, WARNING, INFO and DEBUG.
55configuration file take precedence over this option (the argument
56will be ignored in that case).
57 55
58.TP 56.TP
59\fB\-m \fITYPE:VALUE\fR, \fB\-\-meta=\fITYPE:VALUE\fR 57\fB\-m \fITYPE:VALUE\fR, \fB\-\-meta=\fITYPE:VALUE\fR
@@ -161,6 +159,6 @@ Update the previous entry, do not allow any future updates:
161~/.gnunet/gnunet.conf 159~/.gnunet/gnunet.conf
162GNUnet configuration file 160GNUnet configuration file
163.SH "REPORTING BUGS" 161.SH "REPORTING BUGS"
164Report bugs by using mantis <https://gnunet.org/mantis/> or by sending electronic mail to <gnunet\-developers@gnu.org> 162Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
165.SH "SEE ALSO" 163.SH "SEE ALSO"
166\fBgnunet\-auto\-share\fP(1), \fBgnunet\-gtk\fP(1), \fBgnunet\-pseudonym\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1), \fBgnunet.conf\fP(5), \fBgnunetd\fP(1), \fBextract\fP(1) 164\fBgnunet\-auto\-share\fP(1), \fBgnunet\-gtk\fP(1), \fBgnunet\-pseudonym\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1), \fBgnunet.conf\fP(5), \fBgnunetd\fP(1), \fBextract\fP(1)
diff --git a/doc/man/gnunet-search.1 b/doc/man/gnunet-search.1
new file mode 100644
index 000000000..5f6fffedd
--- /dev/null
+++ b/doc/man/gnunet-search.1
@@ -0,0 +1,72 @@
1.TH GNUNET-SEARCH "1" "6 Sep 2009" "GNUnet"
2.SH NAME
3gnunet\-search \- a command line interface to search for content on GNUnet
4.SH SYNOPSIS
5.B gnunet\-search
6[\fIOPTIONS\fR] [+]\fIKEYWORD\fR [[+]\fIKEYWORD\fR]*
7
8.B gnunet\-search
9[\fIOPTIONS\fR] [+]\fIURI\fR
10.SH DESCRIPTION
11.PP
12Search for content on GNUnet. The keywords are case\-sensitive. gnunet\-search can be used both for a search in the global namespace as well as for searching a private subspace.
13.TP
14\fB\-a \fILEVEL\fR, \fB\-\-anonymity=\fILEVEL\fR
15The \fB-a\fR option can be used to specify additional anonymity constraints. If set to 0, GNUnet will try to download the file as fast as possible without any additional slowdown for anonymous routing. Note that you may still have some amount of anonymity depending on the current network load and the power of the adversary. Use at least 1 to force GNUnet to use anonymous routing.
16
17This option can be used to limit requests further than that. In particular, you can require GNUnet to have a certain amount of cover traffic from other peers before sending your queries. This way, you can gain very high levels of anonymity \- at the expense of much more traffic and much higher latency. So set this option to values beyond 1 only if you really believe you need it.
18
19The definition of ANONYMITY\-RECEIVE is the following: If the value v is 0, anonymous routing is not required. For 1, anonymous routing is required, but there is no lower bound on how much cover traffic must be present. For values > 1 and < 1000, it means that if GNUnet routes n bytes of messages from foreign peers, it may originate n/v bytes of queries in the same time\-period. The time\-period is twice the average delay that GNUnet deferrs forwarded queries. If the value v is >= 1000, it means that if GNUnet routes n bytes of QUERIES from at least (v % 1000) peers, it may originate n/v/1000 bytes of queries in the same time\-period.
20
21The default is 1 and this should be fine for most users. Also notice that if you choose values above 1000, you may end up having no throughput at all, especially if many of your fellow GNUnet\-peers do the same.
22
23.TP
24\fB\-c \fIFILENAME\fR, \fB\-\-config=\fIFILENAME\fR
25use config file (defaults: ~/.gnunet/gnunet.conf)
26.TP
27\fB\-h\fR, \fB\-\-help\fR
28print help page
29.TP
30\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=\fILOGLEVEL\fR
31Change the loglevel. Possible values for LOGLEVEL are
32ERROR, WARNING, INFO and DEBUG.
33.TP
34\fB\-o \fIPREFIX\fR, \fB\-\-output=\fIPREFIX\fR
35Writes the encountered (unencrypted) RBlocks or SBlocks to files with name PREFIX.XXX, where XXX is a number. This is useful to keep search results around.
36.TP
37\fB\-v\fR, \fB\-\-version\fR
38print the version number
39.SH NOTES
40
41You can run gnunet\-search with an URI instead of a keyword. The URI can have the format for a namespace search or for a keyword search. For a namespace search, the format is gnunet://fs/sks/NAMESPACE/IDENTIFIER. For a keyword search, use gnunet://ecrs/ksk/KEYWORD[+KEYWORD]*. If the format does not correspond to a GNUnet URI, GNUnet will automatically assume that keywords are supplied directly.
42
43If multiple keywords are passed, gnunet-search will look for content matching any of the keywords. The prefix "+" makes a keyword mandatory.
44
45# gnunet\-search "Das Kapital"
46
47searches for content matching the keyword "Das Kapital". Whereas
48
49# gnunet\-search +Das +Kapital
50
51Searches for content matching both mandatory keywords "Das" and "Kapital".
52
53Search results are printed by gnunet\-search like this:
54.P
55.ad l
56 gnunet\-download \-o "COPYING" gnunet://fs/chk/HASH1.HASH2.SIZE
57
58 Description: The GNU Public License
59
60 Mime-type: text/plain
61.ad b
62
63The first line contains the command to run to download the file. The suggested filename in the example is COPYING. The GNUnet URI consists of the key and query hash of the file and finally the size of the file. After the command to download the file GNUnet will print meta\-data about the file as advertised in the search result, here "The GNU Public License" and the mime\-type (see the options for gnunet\-insert on how to supply meta-data by hand).
64
65.SH FILES
66.TP
67~/.gnunet/gnunet.conf
68GNUnet configuration file; specifies the default value for the timeout
69.SH "REPORTING BUGS"
70Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet-developers@gnu.org>
71.SH "SEE ALSO"
72\fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-download\fP(1), \fBgnunet\-pseudonym\fP(1), \fBgnunet.conf\fP(5), \fBgnunetd\fP(1)
diff --git a/doc/man/gnunet-statistics.1 b/doc/man/gnunet-statistics.1
index 8a23e01e0..25f548ef6 100644
--- a/doc/man/gnunet-statistics.1
+++ b/doc/man/gnunet-statistics.1
@@ -4,7 +4,7 @@
4gnunet\-statistics \- Display statistics about your GNUnet system 4gnunet\-statistics \- Display statistics about your GNUnet system
5 5
6.SH SYNOPSIS 6.SH SYNOPSIS
7.B gnunet-statistics 7.B gnunet\-statistics
8.RI [ options ] [ VALUE ] 8.RI [ options ] [ VALUE ]
9.br 9.br
10 10
diff --git a/doc/man/gnunet-unindex.1 b/doc/man/gnunet-unindex.1
new file mode 100644
index 000000000..be478eace
--- /dev/null
+++ b/doc/man/gnunet-unindex.1
@@ -0,0 +1,37 @@
1.TH GNUNET-UNINDEX "1" "6 Sep 2009" "GNUnet"
2.SH NAME
3gnunet\-unindex \- a command line interface for deleting indexed files from GNUnet
4.SH SYNOPSIS
5.B gnunet\-unindex
6[\fIOPTIONS\fR] FILENAME
7.SH DESCRIPTION
8.PP
9gnunet\-unindex is used for deleting indexed files from GNUnet.
10.TP
11\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
12use config file (defaults: ~/.gnunet/gnunet.conf)
13.TP
14\fB\-h\fR, \fB\-\-help\fR
15print help page
16.TP
17\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR
18Change the loglevel. Possible values for LOGLEVEL are NOTHING,
19ERROR, WARNING, INFO and DEBUG.
20
21.TP
22\fB\-v\fR, \fB\-\-version\fR
23print the version number
24.TP
25\fB\-V\fR, \fB\-\-verbose\fR
26be verbose
27.SH NOTES
28You can only unindex files that you indexed and that you still have available locally in full. You should use gnunet\-unindex on files that you indexed (not inserted) and that you are going to delete or move locally.
29.TP
30.SH FILES
31.TP
32~/.gnunet/gnunet.conf
33GNUnet configuration file
34.SH "REPORTING BUGS"
35Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
36.SH "SEE ALSO"
37\fBgnunet\-gtk\fP(1), \fBgnunet\-publish\fP(1), \fBgnunet\-gtk\fP(1), \fBgnunet\-search\fP(1), \fBgnunet\-download\fP(1), \fBgnunet.conf\fP(5), \fBgnunetd\fP(1)
diff --git a/src/fs/fs.c b/src/fs/fs.c
index 66699507b..8396fc18f 100644
--- a/src/fs/fs.c
+++ b/src/fs/fs.c
@@ -37,13 +37,18 @@
37 * @param client_name unique identifier for this client 37 * @param client_name unique identifier for this client
38 * @param upcb function to call to notify about FS actions 38 * @param upcb function to call to notify about FS actions
39 * @param upcb_cls closure for upcb 39 * @param upcb_cls closure for upcb
40 * @param flags specific attributes for fs-operations
41 * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END
42 * @return NULL on error
40 */ 43 */
41struct GNUNET_FS_Handle * 44struct GNUNET_FS_Handle *
42GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched, 45GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
43 const struct GNUNET_CONFIGURATION_Handle *cfg, 46 const struct GNUNET_CONFIGURATION_Handle *cfg,
44 const char *client_name, 47 const char *client_name,
45 GNUNET_FS_ProgressCallback upcb, 48 GNUNET_FS_ProgressCallback upcb,
46 void *upcb_cls) 49 void *upcb_cls,
50 enum GNUNET_FS_Flags flags,
51 ...)
47{ 52{
48 struct GNUNET_FS_Handle *ret; 53 struct GNUNET_FS_Handle *ret;
49 struct GNUNET_CLIENT_Connection *client; 54 struct GNUNET_CLIENT_Connection *client;
@@ -60,6 +65,8 @@ GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
60 ret->upcb = upcb; 65 ret->upcb = upcb;
61 ret->upcb_cls = upcb_cls; 66 ret->upcb_cls = upcb_cls;
62 ret->client = client; 67 ret->client = client;
68 ret->flags = flags;
69 // FIXME: process varargs!
63 // FIXME: setup receive-loop with client 70 // FIXME: setup receive-loop with client
64 71
65 // FIXME: deserialize state; use client-name to find master-directory! 72 // FIXME: deserialize state; use client-name to find master-directory!
diff --git a/src/fs/fs.h b/src/fs/fs.h
index 70e02360c..c2a2e7d03 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -389,6 +389,11 @@ struct GNUNET_FS_Handle
389 */ 389 */
390 unsigned int active_probes; 390 unsigned int active_probes;
391 391
392 /**
393 * General flags.
394 */
395 enum GNUNET_FS_Flags flags;
396
392}; 397};
393 398
394 399
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 145e16818..77fbb1139 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -142,6 +142,8 @@ make_download_status (struct GNUNET_FS_ProgressInfo *pi,
142 = (dc->parent == NULL) ? NULL : dc->parent->client_info; 142 = (dc->parent == NULL) ? NULL : dc->parent->client_info;
143 pi->value.download.uri 143 pi->value.download.uri
144 = dc->uri; 144 = dc->uri;
145 pi->value.download.filename
146 = dc->filename;
145 pi->value.download.length 147 pi->value.download.length
146 = dc->length; 148 = dc->length;
147 pi->value.download.duration 149 pi->value.download.duration
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index d58ea3f37..db38b76da 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -111,6 +111,8 @@ make_publish_status (struct GNUNET_FS_ProgressInfo *pi,
111 = p->client_info; 111 = p->client_info;
112 pi->value.publish.pctx 112 pi->value.publish.pctx
113 = (NULL == p->dir) ? NULL : p->dir->client_info; 113 = (NULL == p->dir) ? NULL : p->dir->client_info;
114 pi->value.publish.filename
115 = (p->is_directory) ? p->data.dir.dirname : p->data.file.filename;
114 pi->value.publish.size 116 pi->value.publish.size
115 = (p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size; 117 = (p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size;
116 pi->value.publish.eta 118 pi->value.publish.eta
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c
index c6bb7c115..681608d6b 100644
--- a/src/fs/gnunet-download.c
+++ b/src/fs/gnunet-download.c
@@ -26,21 +26,26 @@
26 * @author Igor Wronsky 26 * @author Igor Wronsky
27 * 27 *
28 * TODO: 28 * TODO:
29 * - all 29 * - many command-line options
30 */ 30 */
31#include "platform.h" 31#include "platform.h"
32#include "gnunet_fs_service.h" 32#include "gnunet_fs_service.h"
33 33
34static int ret; 34static int ret;
35 35
36static int verbose;
37
38static int delete_incomplete;
39
36static const struct GNUNET_CONFIGURATION_Handle *cfg; 40static const struct GNUNET_CONFIGURATION_Handle *cfg;
37 41
38static struct GNUNET_FS_Handle *ctx; 42static struct GNUNET_FS_Handle *ctx;
39 43
40static struct GNUNET_TIME_Absolute start_time; 44static struct GNUNET_FS_DownloadContext *dc;
41 45
42static unsigned int anonymity = 1; 46static unsigned int anonymity = 1;
43 47
48static char *filename;
44 49
45/** 50/**
46 * Called by FS client to give information about the progress of an 51 * Called by FS client to give information about the progress of an
@@ -59,6 +64,44 @@ static void *
59progress_cb (void *cls, 64progress_cb (void *cls,
60 const struct GNUNET_FS_ProgressInfo *info) 65 const struct GNUNET_FS_ProgressInfo *info)
61{ 66{
67 switch (info->status)
68 {
69 case GNUNET_FS_STATUS_DOWNLOAD_START:
70 break;
71 case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
72 if (verbose)
73 fprintf (stdout,
74 _("Downloading `%s' at %llu/%llu (%s remaining, %s/s)\n"),
75 info->value.download.filename,
76 (unsigned long long) info->value.download.completed,
77 (unsigned long long) info->value.download.length,
78 GNUNET_STRINGS_relative_time_to_string(info->value.download.eta),
79 GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 1000 / (info->value.download.duration.value + 1)));
80 break;
81 case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
82 fprintf (stderr,
83 _("Error downloading: %s.\n"),
84 info->value.download.specifics.error.message);
85 GNUNET_FS_file_download_stop (dc, delete_incomplete);
86 break;
87 case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
88 fprintf (stdout,
89 _("Downloading `%s' done (%s/s).\n"),
90 info->value.download.filename,
91 GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 1000 / (info->value.download.duration.value + 1)));
92 if (info->value.download.dc == dc)
93 GNUNET_FS_file_download_stop (dc, delete_incomplete);
94 break;
95 case GNUNET_FS_STATUS_DOWNLOAD_STOPPED:
96 if (info->value.download.dc == dc)
97 GNUNET_FS_stop (ctx);
98 break;
99 default:
100 fprintf (stderr,
101 _("Unexpected status: %d\n"),
102 info->status);
103 break;
104 }
62 return NULL; 105 return NULL;
63} 106}
64 107
@@ -79,23 +122,66 @@ run (void *cls,
79 const char *cfgfile, 122 const char *cfgfile,
80 const struct GNUNET_CONFIGURATION_Handle *c) 123 const struct GNUNET_CONFIGURATION_Handle *c)
81{ 124{
125 struct GNUNET_FS_Uri *uri;
126 char *emsg;
127 enum GNUNET_FS_DownloadOptions options;
128
82 /* FIXME: check arguments */ 129 /* FIXME: check arguments */
130 uri = GNUNET_FS_uri_parse (args[0],
131 &emsg);
132 if (NULL == uri)
133 {
134 fprintf (stderr,
135 _("Failed to parse URI: %s\n"),
136 emsg);
137 GNUNET_free (emsg);
138 ret = 1;
139 return;
140 }
141 if (! GNUNET_FS_uri_test_chk (uri))
142 {
143 fprintf (stderr,
144 "Only CHK URIs supported right now.\n");
145 ret = 1;
146 GNUNET_FS_uri_destroy (uri);
147 return;
148 }
149 if (NULL == filename)
150 {
151 fprintf (stderr,
152 "Target filename must be specified.\n");
153 ret = 1;
154 GNUNET_FS_uri_destroy (uri);
155 return;
156 }
83 cfg = c; 157 cfg = c;
84 ctx = GNUNET_FS_start (sched, 158 ctx = GNUNET_FS_start (sched,
85 cfg, 159 cfg,
86 "gnunet-download", 160 "gnunet-download",
87 &progress_cb, 161 &progress_cb,
88 NULL); 162 NULL,
163 GNUNET_FS_FLAGS_NONE,
164 GNUNET_FS_OPTIONS_END);
89 if (NULL == ctx) 165 if (NULL == ctx)
90 { 166 {
91 fprintf (stderr, 167 fprintf (stderr,
92 _("Could not initialize `%s' subsystem.\n"), 168 _("Could not initialize `%s' subsystem.\n"),
93 "FS"); 169 "FS");
170 GNUNET_FS_uri_destroy (uri);
94 ret = 1; 171 ret = 1;
95 return; 172 return;
96 } 173 }
97 start_time = GNUNET_TIME_absolute_get (); 174 options = GNUNET_FS_DOWNLOAD_OPTION_NONE;
98 // FIXME: start download 175 dc = GNUNET_FS_file_download_start (ctx,
176 uri,
177 NULL,
178 filename,
179 0,
180 GNUNET_FS_uri_chk_get_file_size (uri),
181 anonymity,
182 options,
183 NULL);
184 GNUNET_FS_uri_destroy (uri);
99} 185}
100 186
101 187
@@ -106,7 +192,31 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
106 {'a', "anonymity", "LEVEL", 192 {'a', "anonymity", "LEVEL",
107 gettext_noop ("set the desired LEVEL of receiver-anonymity"), 193 gettext_noop ("set the desired LEVEL of receiver-anonymity"),
108 1, &GNUNET_GETOPT_set_uint, &anonymity}, 194 1, &GNUNET_GETOPT_set_uint, &anonymity},
195#if 0
109 // FIXME: options! 196 // FIXME: options!
197 {'d', "directory", NULL,
198 gettext_noop
199 ("download a GNUnet directory that has already been downloaded. Requires that a filename of an existing file is specified instead of the URI. The download will only download the top-level files in the directory unless the `-R' option is also specified."),
200 0, &GNUNET_getopt_configure_set_one, &do_directory},
201 {'D', "delete-incomplete", NULL,
202 gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
203 0, &GNUNET_getopt_configure_set_one, &do_delete_incomplete},
204#endif
205 {'o', "output", "FILENAME",
206 gettext_noop ("write the file to FILENAME"),
207 1, &GNUNET_GETOPT_set_string, &filename},
208#if 0
209 {'p', "parallelism", "DOWNLOADS",
210 gettext_noop
211 ("set the maximum number of parallel downloads that are allowed"),
212 1, &GNUNET_getopt_configure_set_uint, &parallelism},
213 {'R', "recursive", NULL,
214 gettext_noop ("download a GNUnet directory recursively"),
215 0, &GNUNET_getopt_configure_set_one, &do_recursive},
216#endif
217 {'V', "verbose", NULL,
218 gettext_noop ("be verbose (print progress information)"),
219 0, &GNUNET_GETOPT_set_one, &verbose},
110 GNUNET_GETOPT_OPTION_END 220 GNUNET_GETOPT_OPTION_END
111}; 221};
112 222
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index b6b9199d0..a30b36c9e 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -27,8 +27,6 @@
27 * 27 *
28 * TODO: 28 * TODO:
29 * - support for some options is still missing (uri argument) 29 * - support for some options is still missing (uri argument)
30 * - progress callbacks not implemented (and need verbosity option)
31 * - clean shutdown is not implemented (stop ctx, etc.)
32 */ 30 */
33#include "platform.h" 31#include "platform.h"
34#include "gnunet_fs_service.h" 32#include "gnunet_fs_service.h"
@@ -37,14 +35,14 @@
37 35
38static int ret; 36static int ret;
39 37
38static int verbose;
39
40static const struct GNUNET_CONFIGURATION_Handle *cfg; 40static const struct GNUNET_CONFIGURATION_Handle *cfg;
41 41
42static struct GNUNET_FS_Handle *ctx; 42static struct GNUNET_FS_Handle *ctx;
43 43
44static struct GNUNET_FS_PublishContext *pc; 44static struct GNUNET_FS_PublishContext *pc;
45 45
46static struct GNUNET_TIME_Absolute start_time;
47
48static struct GNUNET_CONTAINER_MetaData *meta; 46static struct GNUNET_CONTAINER_MetaData *meta;
49 47
50static struct GNUNET_FS_Uri *topKeywords; 48static struct GNUNET_FS_Uri *topKeywords;
@@ -89,7 +87,43 @@ static void *
89progress_cb (void *cls, 87progress_cb (void *cls,
90 const struct GNUNET_FS_ProgressInfo *info) 88 const struct GNUNET_FS_ProgressInfo *info)
91{ 89{
92 return NULL; 90 switch (info->status)
91 {
92 case GNUNET_FS_STATUS_PUBLISH_START:
93 break;
94 case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
95 if (verbose)
96 fprintf (stdout,
97 _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
98 info->value.publish.filename,
99 (unsigned long long) info->value.publish.completed,
100 (unsigned long long) info->value.publish.size,
101 GNUNET_STRINGS_relative_time_to_string(info->value.publish.eta));
102 break;
103 case GNUNET_FS_STATUS_PUBLISH_ERROR:
104 fprintf (stderr,
105 _("Error publishing: %s.\n"),
106 info->value.publish.specifics.error.message);
107 GNUNET_FS_publish_stop (pc);
108 break;
109 case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
110 fprintf (stdout,
111 _("Publishing `%s' done.\n"),
112 info->value.publish.filename);
113 if (info->value.publish.pctx == NULL)
114 GNUNET_FS_publish_stop (pc);
115 break;
116 case GNUNET_FS_STATUS_PUBLISH_STOPPED:
117 if (info->value.publish.sc == pc)
118 GNUNET_FS_stop (ctx);
119 return NULL;
120 default:
121 fprintf (stderr,
122 _("Unexpected status: %d\n"),
123 info->status);
124 return NULL;
125 }
126 return ""; /* non-null */
93} 127}
94 128
95 129
@@ -302,7 +336,9 @@ run (void *cls,
302 cfg, 336 cfg,
303 "gnunet-publish", 337 "gnunet-publish",
304 &progress_cb, 338 &progress_cb,
305 NULL); 339 NULL,
340 GNUNET_FS_FLAGS_NONE,
341 GNUNET_FS_OPTIONS_END);
306 if (NULL == ctx) 342 if (NULL == ctx)
307 { 343 {
308 fprintf (stderr, 344 fprintf (stderr,
@@ -331,7 +367,6 @@ run (void *cls,
331 // FIXME -- implement! 367 // FIXME -- implement!
332 return; 368 return;
333 } 369 }
334 start_time = GNUNET_TIME_absolute_get ();
335 370
336 l = NULL; 371 l = NULL;
337 if (! disable_extractor) 372 if (! disable_extractor)
@@ -389,6 +424,14 @@ run (void *cls,
389 (do_simulate) 424 (do_simulate)
390 ? GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY 425 ? GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY
391 : GNUNET_FS_PUBLISH_OPTION_NONE); 426 : GNUNET_FS_PUBLISH_OPTION_NONE);
427 if (NULL == pc)
428 {
429 fprintf (stderr,
430 _("Could not start publishing.\n"));
431 GNUNET_FS_stop (ctx);
432 ret = 1;
433 return;
434 }
392} 435}
393 436
394 437
@@ -449,7 +492,10 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
449 {'u', "uri", "URI", 492 {'u', "uri", "URI",
450 gettext_noop ("URI to be published (can be used instead of passing a " 493 gettext_noop ("URI to be published (can be used instead of passing a "
451 "file to add keywords to the file with the respective URI)"), 494 "file to add keywords to the file with the respective URI)"),
452 1, &GNUNET_GETOPT_set_string, &uri_string}, 495 1, &GNUNET_GETOPT_set_string, &uri_string},
496 {'V', "verbose", NULL,
497 gettext_noop ("be verbose (print progress information)"),
498 0, &GNUNET_GETOPT_set_one, &verbose},
453 GNUNET_GETOPT_OPTION_END 499 GNUNET_GETOPT_OPTION_END
454}; 500};
455 501
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c
index 10a3c82fd..b744d2e1a 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -26,7 +26,7 @@
26 * @author Igor Wronsky 26 * @author Igor Wronsky
27 * 27 *
28 * TODO: 28 * TODO:
29 * - all 29 * - add many options (timeout, namespace search, etc.)
30 */ 30 */
31#include "platform.h" 31#include "platform.h"
32#include "gnunet_fs_service.h" 32#include "gnunet_fs_service.h"
@@ -37,10 +37,24 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
37 37
38static struct GNUNET_FS_Handle *ctx; 38static struct GNUNET_FS_Handle *ctx;
39 39
40static struct GNUNET_TIME_Absolute start_time; 40static struct GNUNET_FS_SearchContext *sc;
41 41
42static unsigned int anonymity = 1; 42static unsigned int anonymity = 1;
43 43
44static int verbose;
45
46static int
47item_printer (void *cls,
48 EXTRACTOR_KeywordType type,
49 const char *data)
50{
51 printf ("\t%20s: %s\n",
52 dgettext (LIBEXTRACTOR_GETTEXT_DOMAIN,
53 EXTRACTOR_getKeywordTypeAsString (type)),
54 data);
55 return GNUNET_OK;
56}
57
44 58
45/** 59/**
46 * Called by FS client to give information about the progress of an 60 * Called by FS client to give information about the progress of an
@@ -59,6 +73,56 @@ static void *
59progress_cb (void *cls, 73progress_cb (void *cls,
60 const struct GNUNET_FS_ProgressInfo *info) 74 const struct GNUNET_FS_ProgressInfo *info)
61{ 75{
76 char *uri;
77 char *dotdot;
78 char *filename;
79
80 switch (info->status)
81 {
82 case GNUNET_FS_STATUS_SEARCH_START:
83 break;
84 case GNUNET_FS_STATUS_SEARCH_RESULT:
85 uri = GNUNET_FS_uri_to_string (info->value.search.specifics.result.uri);
86 printf ("%s:\n", uri);
87 filename =
88 GNUNET_CONTAINER_meta_data_get_by_type (info->value.search.specifics.result.meta,
89 EXTRACTOR_FILENAME);
90 if (filename != NULL)
91 {
92 while (NULL != (dotdot = strstr (filename, "..")))
93 dotdot[0] = dotdot[1] = '_';
94 printf ("gnunet-download -o \"%s\" %s\n",
95 filename,
96 uri);
97 }
98 else
99 printf ("gnunet-download %s\n", uri);
100 if (verbose)
101 GNUNET_CONTAINER_meta_data_get_contents (info->value.search.specifics.result.meta,
102 &item_printer,
103 NULL);
104 printf ("\n");
105 fflush(stdout);
106 GNUNET_free_non_null (filename);
107 GNUNET_free (uri);
108 break;
109 case GNUNET_FS_STATUS_SEARCH_UPDATE:
110 break;
111 case GNUNET_FS_STATUS_SEARCH_ERROR:
112 fprintf (stderr,
113 _("Error searching: %s.\n"),
114 info->value.search.specifics.error.message);
115 GNUNET_FS_search_stop (sc);
116 break;
117 case GNUNET_FS_STATUS_SEARCH_STOPPED:
118 GNUNET_FS_stop (ctx);
119 break;
120 default:
121 fprintf (stderr,
122 _("Unexpected status: %d\n"),
123 info->status);
124 break;
125 }
62 return NULL; 126 return NULL;
63} 127}
64 128
@@ -79,23 +143,51 @@ run (void *cls,
79 const char *cfgfile, 143 const char *cfgfile,
80 const struct GNUNET_CONFIGURATION_Handle *c) 144 const struct GNUNET_CONFIGURATION_Handle *c)
81{ 145{
82 /* FIXME: check arguments */ 146 struct GNUNET_FS_Uri *uri;
147 unsigned int argc;
148
149 argc = 0;
150 while (NULL != args[argc])
151 argc++;
152 uri = GNUNET_FS_uri_ksk_create_from_args (argc,
153 (const char **) args);
154 if (NULL == uri)
155 {
156 fprintf (stderr,
157 _("Could not create keyword URI from arguments.\n"));
158 ret = 1;
159 GNUNET_FS_uri_destroy (uri);
160 return;
161 }
83 cfg = c; 162 cfg = c;
84 ctx = GNUNET_FS_start (sched, 163 ctx = GNUNET_FS_start (sched,
85 cfg, 164 cfg,
86 "gnunet-search", 165 "gnunet-search",
87 &progress_cb, 166 &progress_cb,
88 NULL); 167 NULL,
168 GNUNET_FS_FLAGS_NONE,
169 GNUNET_FS_OPTIONS_END);
89 if (NULL == ctx) 170 if (NULL == ctx)
90 { 171 {
91 fprintf (stderr, 172 fprintf (stderr,
92 _("Could not initialize `%s' subsystem.\n"), 173 _("Could not initialize `%s' subsystem.\n"),
93 "FS"); 174 "FS");
175 GNUNET_FS_uri_destroy (uri);
176 GNUNET_FS_stop (ctx);
177 ret = 1;
178 return;
179 }
180 sc = GNUNET_FS_search_start (ctx,
181 uri,
182 anonymity);
183 GNUNET_FS_uri_destroy (uri);
184 if (NULL == sc)
185 {
186 fprintf (stderr,
187 _("Could not start searching.\n"));
94 ret = 1; 188 ret = 1;
95 return; 189 return;
96 } 190 }
97 start_time = GNUNET_TIME_absolute_get ();
98 // FIXME: start search
99} 191}
100 192
101 193
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c
index 2dfef9432..9b335eec0 100644
--- a/src/fs/gnunet-unindex.c
+++ b/src/fs/gnunet-unindex.c
@@ -24,24 +24,20 @@
24 * @author Krista Bennett 24 * @author Krista Bennett
25 * @author James Blackwell 25 * @author James Blackwell
26 * @author Igor Wronsky 26 * @author Igor Wronsky
27 *
28 * TODO:
29 * - progress callback
30 * - error checking
31 */ 27 */
32#include "platform.h" 28#include "platform.h"
33#include "gnunet_fs_service.h" 29#include "gnunet_fs_service.h"
34 30
35static int ret; 31static int ret;
36 32
33static int verbose;
34
37static const struct GNUNET_CONFIGURATION_Handle *cfg; 35static const struct GNUNET_CONFIGURATION_Handle *cfg;
38 36
39static struct GNUNET_FS_Handle *ctx; 37static struct GNUNET_FS_Handle *ctx;
40 38
41static struct GNUNET_FS_UnindexContext *uc; 39static struct GNUNET_FS_UnindexContext *uc;
42 40
43static struct GNUNET_TIME_Absolute start_time;
44
45 41
46/** 42/**
47 * Called by FS client to give information about the progress of an 43 * Called by FS client to give information about the progress of an
@@ -60,6 +56,38 @@ static void *
60progress_cb (void *cls, 56progress_cb (void *cls,
61 const struct GNUNET_FS_ProgressInfo *info) 57 const struct GNUNET_FS_ProgressInfo *info)
62{ 58{
59 switch (info->status)
60 {
61 case GNUNET_FS_STATUS_UNINDEX_START:
62 break;
63 case GNUNET_FS_STATUS_UNINDEX_PROGRESS:
64 if (verbose)
65 fprintf (stdout,
66 _("Unindexing at %llu/%llu (%s remaining)\n"),
67 (unsigned long long) info->value.unindex.completed,
68 (unsigned long long) info->value.unindex.size,
69 GNUNET_STRINGS_relative_time_to_string(info->value.unindex.eta));
70 break;
71 case GNUNET_FS_STATUS_UNINDEX_ERROR:
72 fprintf (stderr,
73 _("Error unindexing: %s.\n"),
74 info->value.unindex.specifics.error.message);
75 GNUNET_FS_unindex_stop (uc);
76 break;
77 case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
78 fprintf (stdout,
79 _("Unindexing done.\n"));
80 GNUNET_FS_unindex_stop (uc);
81 break;
82 case GNUNET_FS_STATUS_UNINDEX_STOPPED:
83 GNUNET_FS_stop (ctx);
84 break;
85 default:
86 fprintf (stderr,
87 _("Unexpected status: %d\n"),
88 info->status);
89 break;
90 }
63 return NULL; 91 return NULL;
64} 92}
65 93
@@ -93,7 +121,9 @@ run (void *cls,
93 cfg, 121 cfg,
94 "gnunet-unindex", 122 "gnunet-unindex",
95 &progress_cb, 123 &progress_cb,
96 NULL); 124 NULL,
125 GNUNET_FS_FLAGS_NONE,
126 GNUNET_FS_OPTIONS_END);
97 if (NULL == ctx) 127 if (NULL == ctx)
98 { 128 {
99 fprintf (stderr, 129 fprintf (stderr,
@@ -102,9 +132,14 @@ run (void *cls,
102 ret = 1; 132 ret = 1;
103 return; 133 return;
104 } 134 }
105 start_time = GNUNET_TIME_absolute_get ();
106 uc = GNUNET_FS_unindex (ctx, 135 uc = GNUNET_FS_unindex (ctx,
107 args[0]); 136 args[0]);
137 if (NULL == uc)
138 {
139 fprintf (stderr,
140 _("Could not start unindex operation.\n"));
141 GNUNET_FS_stop (ctx);
142 }
108} 143}
109 144
110 145
@@ -112,6 +147,9 @@ run (void *cls,
112 * gnunet-unindex command line options 147 * gnunet-unindex command line options
113 */ 148 */
114static struct GNUNET_GETOPT_CommandLineOption options[] = { 149static struct GNUNET_GETOPT_CommandLineOption options[] = {
150 {'V', "verbose", NULL,
151 gettext_noop ("be verbose (print progress information)"),
152 0, &GNUNET_GETOPT_set_one, &verbose},
115 GNUNET_GETOPT_OPTION_END 153 GNUNET_GETOPT_OPTION_END
116}; 154};
117 155
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index ee10a0156..114128823 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -360,7 +360,7 @@ GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri);
360 * What is the size of the file that this URI 360 * What is the size of the file that this URI
361 * refers to? 361 * refers to?
362 * 362 *
363 * @param uri the CHK URI to inspect 363 * @param uri the CHK (or LOC) URI to inspect
364 * @return size of the file as specified in the CHK URI 364 * @return size of the file as specified in the CHK URI
365 */ 365 */
366uint64_t 366uint64_t
@@ -718,6 +718,11 @@ struct GNUNET_FS_ProgressInfo
718 * (if this is a file in a directory or a subdirectory). 718 * (if this is a file in a directory or a subdirectory).
719 */ 719 */
720 void *pctx; 720 void *pctx;
721
722 /**
723 * Name of the file being published; can be NULL.
724 */
725 const char *filename;
721 726
722 /** 727 /**
723 * How large is the file overall? For directories, 728 * How large is the file overall? For directories,
@@ -862,6 +867,11 @@ struct GNUNET_FS_ProgressInfo
862 * URI used for this download. 867 * URI used for this download.
863 */ 868 */
864 const struct GNUNET_FS_Uri *uri; 869 const struct GNUNET_FS_Uri *uri;
870
871 /**
872 * Name of the file that we are downloading.
873 */
874 const char *filename;
865 875
866 /** 876 /**
867 * How large is the download overall? This 877 * How large is the download overall? This
@@ -1394,6 +1404,46 @@ typedef void* (*GNUNET_FS_ProgressCallback)
1394 1404
1395 1405
1396/** 1406/**
1407 * General (global) option flags for file-sharing.
1408 */
1409enum GNUNET_FS_Flags
1410 {
1411 /**
1412 * No special flags set.
1413 */
1414 GNUNET_FS_FLAGS_NONE = 0,
1415
1416 /**
1417 * Is persistence of operations desired?
1418 * (will create SUSPEND/RESUME events).
1419 */
1420 GNUNET_FS_FLAGS_PERSISTENCE = 1
1421
1422 };
1423
1424/**
1425 * Options specified in the VARARGs
1426 * portion of GNUNET_FS_start.
1427 */
1428enum GNUNET_FS_OPTIONS
1429 {
1430
1431 /**
1432 * Last option in the VARARG list.
1433 */
1434 GNUNET_FS_OPTIONS_END = 0,
1435
1436 /**
1437 * Select the desired amount of parallelism (this option should be
1438 * followed by an "unsigned int" giving the desired maximum number
1439 * of parallel downloads).
1440 */
1441 GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1
1442
1443 };
1444
1445
1446/**
1397 * Handle to the file-sharing service. 1447 * Handle to the file-sharing service.
1398 */ 1448 */
1399struct GNUNET_FS_Handle; 1449struct GNUNET_FS_Handle;
@@ -1407,13 +1457,18 @@ struct GNUNET_FS_Handle;
1407 * @param client_name unique identifier for this client 1457 * @param client_name unique identifier for this client
1408 * @param upcb function to call to notify about FS actions 1458 * @param upcb function to call to notify about FS actions
1409 * @param upcb_cls closure for upcb 1459 * @param upcb_cls closure for upcb
1460 * @param flags specific attributes for fs-operations
1461 * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END
1462 * @return NULL on error
1410 */ 1463 */
1411struct GNUNET_FS_Handle * 1464struct GNUNET_FS_Handle *
1412GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched, 1465GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
1413 const struct GNUNET_CONFIGURATION_Handle *cfg, 1466 const struct GNUNET_CONFIGURATION_Handle *cfg,
1414 const char *client_name, 1467 const char *client_name,
1415 GNUNET_FS_ProgressCallback upcb, 1468 GNUNET_FS_ProgressCallback upcb,
1416 void *upcb_cls); 1469 void *upcb_cls,
1470 enum GNUNET_FS_Flags flags,
1471 ...);
1417 1472
1418 1473
1419/** 1474/**