diff options
-rw-r--r-- | TODO | 181 | ||||
-rw-r--r-- | doc/man/gnunet-pseudonym.1 | 6 | ||||
-rw-r--r-- | doc/man/gnunet-search.1 | 10 | ||||
-rw-r--r-- | src/fs/Makefile.am | 1 | ||||
-rw-r--r-- | src/fs/fs_directory.c | 5 | ||||
-rw-r--r-- | src/fs/fs_download.c | 4 | ||||
-rw-r--r-- | src/fs/fs_search.c | 7 | ||||
-rw-r--r-- | src/fs/fs_uri.c | 28 | ||||
-rw-r--r-- | src/fs/gnunet-download.c | 111 | ||||
-rw-r--r-- | src/fs/gnunet-pseudonym.c | 105 | ||||
-rw-r--r-- | src/fs/gnunet-publish.c | 47 | ||||
-rw-r--r-- | src/fs/gnunet-search.c | 47 | ||||
-rw-r--r-- | src/include/gnunet_fs_service.h | 26 |
13 files changed, 383 insertions, 195 deletions
@@ -1,77 +1,55 @@ | |||
1 | Implementable right now (but not necessarily important), with caveats | 1 | Implementable right now (but not necessarily important), with caveats |
2 | (unavailable components that will limit what can be implemented right | 2 | (unavailable components that will limit what can be implemented right |
3 | away), in order in which they will likely be done: | 3 | away), in order in which they will likely be done: |
4 | * TESTING-TESTBED [Nate] | 4 | * TESTING [Nate] |
5 | * SETUP | ||
6 | * DV [Nate] | 5 | * DV [Nate] |
7 | * TBENCH | 6 | * DHT [Nate] |
8 | * TRACEKIT | 7 | * TBENCH [MW] |
8 | * TRACEKIT [MW] | ||
9 | * FRAGMENTATION [Ji Lu] | 9 | * FRAGMENTATION [Ji Lu] |
10 | * HTTP transport | 10 | * HTTP transport [Matthias] |
11 | * MySQL / Postgres plugins (datastore, datacache) | ||
12 | * UPNP [Milan] | 11 | * UPNP [Milan] |
13 | * ARM [Safey] | 12 | * ARM [Safey] |
14 | * FS [Christian] | 13 | * FS [CG] |
14 | * SETUP | ||
15 | * MySQL / Postgres plugins (datastore, datacache) | ||
15 | 16 | ||
16 | 0.9.0pre0: | 17 | 0.9.0pre0 [April]: |
17 | * CORE: | 18 | * CORE: [CG] |
18 | - "Forcing disconnect of XXX due to inactivity" -- can happen every few MS!? | 19 | - "Forcing disconnect of XXX due to inactivity" -- can happen every few MS!? |
19 | (disconnect does not really succeed, or what?) | 20 | (disconnect does not really succeed, or what?) |
20 | Also, core does not seem to actually decrement the number of active | 21 | Also, core does not seem to actually decrement the number of active |
21 | sessions even if no connections exist for a while! (likely related...) | 22 | sessions even if no connections exist for a while! (likely related...) |
22 | - transport reports bw quota violations on big-endian systems (core or | 23 | - transport reports bw quota violations on slow systems (core or |
23 | transport issue?) | 24 | transport issue?) |
24 | * DATASTORE: | 25 | * DATASTORE: [CG] |
25 | - utilization can (easily, restart?) go out of control (very large), causing | 26 | - utilization can (easily, restart?) go out of control (very large), causing |
26 | content expiration job to go crazy and delete everything! | 27 | content expiration job to go crazy and delete everything! |
27 | * FS: | 28 | * FS: [CG] |
28 | - gnunet-publish cannot be aborted using CTRL-C | 29 | T gnunet-publish cannot be aborted using CTRL-C |
29 | - on some systems, keyword search does not find locally published content | 30 | - on some systems, keyword search does not find locally published content |
30 | (need testcase of command-line tools! - also good to cover getopt API!) | 31 | (need testcase of command-line tools! - also good to cover getopt API!) |
31 | [could be related to datastore issue above!] | 32 | [could be related to datastore issue above!] |
32 | - 2-peer download is still too slow (why?) | 33 | - 2-peer download is still too slow (why?) |
33 | - advanced FS API parts | 34 | - advanced FS API parts |
34 | + search: SBlocks, NBlocks, probes, notify FS-service of known results | 35 | T gnunet-download (directory-file download [easy]) |
35 | + gnunet-publish (URI args) | 36 | T fs_download (recursive download; bounded parallelism) |
36 | + gnunet-download (directory) | 37 | T indexing: index-failure-cleanup [easy] |
37 | + gnunet-search (options, incl. namespace search) | ||
38 | + gnunet-download (many options) | ||
39 | + gnunet-directory (man page, options) | ||
40 | + gnunet-pseudonym (listing of namespaces, advertisement uris, testing) | ||
41 | + gnunet-service-fs (remove failing on-demand blocks, hot-path routing, | 38 | + gnunet-service-fs (remove failing on-demand blocks, hot-path routing, |
42 | load-based routing, nitpicks) | 39 | load-based routing, nitpicks) |
43 | + indexing: index-failure-cleanup | 40 | - [gnunet-service-fs.c:208]: member 'LocalGetContext::results_bf_size' is never used |
44 | - implement adv. FS testcases | 41 | - [gnunet-service-fs.c:501]: member 'PendingRequest::used_pids_size' is never used |
45 | - [./fs/gnunet-service-fs.c:208]: (style) struct or union member 'LocalGetContext::results_bf_size' is never used | 42 | - [gnunet-service-fs.c:654]: member 'ConnectedPeer::last_client_replies' is never used |
46 | - [./fs/gnunet-service-fs.c:501]: (style) struct or union member 'PendingRequest::used_pids_size' is never used | 43 | - [gnunet-service-fs.c:669]: member 'ConnectedPeer::avg_delay' is never used |
47 | - [./fs/gnunet-service-fs.c:654]: (style) struct or union member 'ConnectedPeer::last_client_replies' is never used | 44 | - [gnunet-service-fs.c:675]: member 'ConnectedPeer::avg_priority' is never used |
48 | - [./fs/gnunet-service-fs.c:669]: (style) struct or union member 'ConnectedPeer::avg_delay' is never used | 45 | - [gnunet-service-fs.c:688]: member 'ConnectedPeer::pending_requests' is never used |
49 | - [./fs/gnunet-service-fs.c:675]: (style) struct or union member 'ConnectedPeer::avg_priority' is never used | 46 | - [gnunet-service-fs.c:694]: member 'ConnectedPeer::last_p2p_replies_woff' is never used |
50 | - [./fs/gnunet-service-fs.c:688]: (style) struct or union member 'ConnectedPeer::pending_requests' is never used | 47 | - [gnunet-service-fs.c:700]: member 'ConnectedPeer::last_client_replies_woff' is never used |
51 | - [./fs/gnunet-service-fs.c:694]: (style) struct or union member 'ConnectedPeer::last_p2p_replies_woff' is never used | ||
52 | - [./fs/gnunet-service-fs.c:700]: (style) struct or union member 'ConnectedPeer::last_client_replies_woff' is never used | ||
53 | * WWW: | 48 | * WWW: |
54 | - Get IPv6 hooked up | 49 | - Get IPv6 hooked up |
55 | - change DNS | 50 | - change DNS |
56 | 51 | ||
57 | 0.9.0pre1: | 52 | 0.9.0pre1: |
58 | * Module features to implement: | ||
59 | - tbench (RC-pre1) | ||
60 | + good to have for DV evaluation! [MW] | ||
61 | - DV (RC-pre1) | ||
62 | + write DV API | ||
63 | + implement DV service [Nate & CG] | ||
64 | + implement DV library [Nate] | ||
65 | + implement DV transport plugin [Nate & CG] | ||
66 | + implement testcases [Nate] | ||
67 | + implement performance tests [Nate] | ||
68 | * SETUP: | ||
69 | - design & implement new setup tool | ||
70 | * GUIs to implement: | ||
71 | - gtk (RC-pre1) | ||
72 | + how to integrate scheduler with GTK event loop! | ||
73 | * STATISTICS: | ||
74 | - does not seem to work with timeouts (especially if service is not running) | ||
75 | * PEERINFO: | 53 | * PEERINFO: |
76 | - trust: need *fast* way to check/update trust in peers | 54 | - trust: need *fast* way to check/update trust in peers |
77 | (async peerinfo would not be right; certainly not with the | 55 | (async peerinfo would not be right; certainly not with the |
@@ -82,17 +60,21 @@ away), in order in which they will likely be done: | |||
82 | - only connect() sockets that are ready (select()) [Nils] | 60 | - only connect() sockets that are ready (select()) [Nils] |
83 | [On W32, we need to select after calling socket before | 61 | [On W32, we need to select after calling socket before |
84 | doing connect etc.] | 62 | doing connect etc.] |
85 | * FS: | 63 | * HELLO: [CG] |
86 | - datastore reservation (publishing) | 64 | - need function to test "equivalency" of HELLOs (or integrate with "merge"?); use in PEERINFO |
87 | - persistence support (publish, unindex, search, download) | 65 | * SETUP: |
88 | - download: management/bounding of parallel downloads (for recursive dl.) | 66 | - design & implement new setup tool |
89 | - non-anonymous FS service (needs DHT) | 67 | * TBENCH: [MW] |
90 | + basic DHT integration | 68 | - good to have for transport/DV evaluation! |
91 | + CS-DHT-functions (DHT-put of LOC) | 69 | * DV: [Nate] |
92 | + P2P-functions (DHT-get) | 70 | - write DV API |
93 | - active migration support (in fs or in datastore or new daemon?) | 71 | - implement DV service |
94 | - GAP improvements: | 72 | - implement DV library |
95 | + active reply route caching design & implementation of service; gap extension! | 73 | - implement DV transport plugin |
74 | - implement testcases | ||
75 | - implement performance tests | ||
76 | * STATISTICS: | ||
77 | - does not seem to work with timeouts (especially if service is not running) | ||
96 | * TOPOLOGY: | 78 | * TOPOLOGY: |
97 | - needs more testing (especially F2F topology) | 79 | - needs more testing (especially F2F topology) |
98 | - needs to re-try connecting after disconnect (currently, it | 80 | - needs to re-try connecting after disconnect (currently, it |
@@ -110,37 +92,40 @@ away), in order in which they will likely be done: | |||
110 | disconnect-reconnect events and the implicit whitelisting | 92 | disconnect-reconnect events and the implicit whitelisting |
111 | that might happen here; that's not so bad since we will | 93 | that might happen here; that's not so bad since we will |
112 | re-blacklist on pre-connect attempts anyway, so this is | 94 | re-blacklist on pre-connect attempts anyway, so this is |
113 | a minor issue). | 95 | a minor issue; OTOH, we might want to be more explicit about |
96 | allowing/forbidding connects on pre-connect to avoid | ||
97 | entering connect attempts to just be blacklisted shortly afterwards). | ||
114 | - the code uses the term 'blacklist' for both peers that are forbidden | 98 | - the code uses the term 'blacklist' for both peers that are forbidden |
115 | to connect (i.e. F2F mode) as well as peers that we currently | 99 | to connect (i.e. F2F mode) as well as peers that we currently |
116 | won't try to actively connect to ourselves (since we just tried); | 100 | won't try to actively connect to ourselves (since we just tried); |
117 | This is confusing. We need two distinct terms. | 101 | This is confusing. We need two distinct terms (greylist?). |
118 | - move code to use hash table instead of linked list | 102 | - move code to use hash table instead of linked list |
119 | - instead of periodically discarding blacklisted entries, | 103 | - instead of periodically discarding blacklisted entries, |
120 | simply add task that is triggered at the right time (earlier free, | 104 | simply add task that is triggered at the right time (earlier free, |
121 | more balanced load) | 105 | more balanced load) |
122 | - check if new HELLO learned is different from old HELLO | 106 | - check if new HELLO learned is different from old HELLO |
123 | before resetting entire state! | 107 | before resetting entire state! |
124 | * HELLO: | 108 | * FS: [CG] |
125 | - need function to test "equivalency" of HELLOs (or integrate with "merge"?); use in PEERINFO | 109 | - datastore reservation (publishing) |
110 | - search: availability probes | ||
111 | - persistence support (publish, unindex, search, download) | ||
112 | - active migration support (in fs or in datastore or new daemon?) | ||
113 | - GAP improvements: | ||
114 | + active reply route caching design & implementation of service; gap extension! | ||
115 | * GNUNET-GTK: | ||
116 | - how to integrate scheduler with GTK event loop!? | ||
126 | 117 | ||
127 | 0.9.0pre2: | 118 | 0.9.0pre2: |
128 | * Module features to implement: | 119 | * TRACEKIT: [MW] |
129 | - tracekit (RC-pre2) | 120 | - good to have for DV/DHT evaluation! |
130 | + good to have for DV/DHT evaluation! | 121 | * DHT: [Nate] |
131 | - DHT (RC-pre2) | 122 | - implement DHT service (needs DV, DATACACHE) |
132 | + implement DHT service (needs DV, DATACACHE) | 123 | - implement DHT library |
133 | + implement DHT library | 124 | - implement testcases |
134 | + implement testcases | 125 | - implement performance tests |
135 | + implement performance tests | 126 | * TRANSPORT: |
136 | * GUIs to implement: | 127 | - HTTP backend [MW] |
137 | - fuse (RC-pre2) | 128 | * ARM: [Safey] |
138 | * Plugins to implement: | ||
139 | - UDP backend (RC-pre2) | ||
140 | + Fragmentation library | ||
141 | + actual plugin | ||
142 | - HTTP backend (RC-pre2) | ||
143 | * ARM: | ||
144 | - need to get rid of synchronous API for service starts (cause all kinds of problems) | 129 | - need to get rid of synchronous API for service starts (cause all kinds of problems) |
145 | [=> eliminate for need to tell ARM about service starts most of the time!] [Safey] | 130 | [=> eliminate for need to tell ARM about service starts most of the time!] [Safey] |
146 | - better tracking of which config changes actually need to cause process restarts by ARM. | 131 | - better tracking of which config changes actually need to cause process restarts by ARM. |
@@ -149,8 +134,12 @@ away), in order in which they will likely be done: | |||
149 | - better crash management (attach debugging support, capture and analyze | 134 | - better crash management (attach debugging support, capture and analyze |
150 | debug output, detect random vs. deterministic crashes) | 135 | debug output, detect random vs. deterministic crashes) |
151 | - shutdown sequence? | 136 | - shutdown sequence? |
152 | * FS: | 137 | * FS: [CG] |
153 | - location URIs (publish, search, download) | 138 | - location URIs (publish, search, download) |
139 | - non-anonymous FS service (needs DHT) | ||
140 | + DHT integration for search | ||
141 | + CS-DHT-functions (DHT-put of LOC) | ||
142 | + P2P-functions (DHT-get) | ||
154 | - collection API & tests | 143 | - collection API & tests |
155 | + gnunet-pseudonym (collection support) | 144 | + gnunet-pseudonym (collection support) |
156 | - implement FS performance tests | 145 | - implement FS performance tests |
@@ -159,28 +148,20 @@ away), in order in which they will likely be done: | |||
159 | + search | 148 | + search |
160 | + unindex | 149 | + unindex |
161 | 150 | ||
162 | |||
163 | 0.9.0pre3: | 151 | 0.9.0pre3: |
164 | * GUIs to implement: | ||
165 | - qt (RC-pre3) | ||
166 | + see discussions @ FISL about integration with event loop! | ||
167 | * Determine RC bugs and fix those! | 152 | * Determine RC bugs and fix those! |
168 | * TESTING: | 153 | * TESTING: [Nate] |
169 | - modify configuration to allow controlling connections for non-local starts | 154 | - modify configuration to allow controlling connections for non-local starts |
170 | - testbed creation with topology (needs working F2F topology) [Nate] | 155 | - testbed creation with topology (needs working F2F topology) |
171 | - testbed with churn [Nate] | 156 | - testbed with churn |
172 | - implement testcases for distributed testing [Nate] | 157 | - implement testcases for distributed testing |
173 | - test basic peer re-configure [Nate] | 158 | - test basic peer re-configure |
174 | - test topology creation [Nate] | 159 | - test topology creation |
175 | - test churn generation [Nate] | 160 | - test churn generation |
176 | - consider changing API for peer-group termination to | 161 | - consider changing API for peer-group termination to |
177 | call continuation when done | 162 | call continuation when done |
178 | 163 | ||
179 | |||
180 | 0.9.0: | 164 | 0.9.0: |
181 | * Documentation | ||
182 | - update man pages | ||
183 | - update webpage documentation | ||
184 | * new webpage: | 165 | * new webpage: |
185 | - expand bibliography | 166 | - expand bibliography |
186 | - convert documentation pages to books | 167 | - convert documentation pages to books |
@@ -190,20 +171,18 @@ away), in order in which they will likely be done: | |||
190 | enable developers to publish TGZs nicely | 171 | enable developers to publish TGZs nicely |
191 | - port "contact" page | 172 | - port "contact" page |
192 | - add content type for "todo" items? | 173 | - add content type for "todo" items? |
193 | - DNS activation | 174 | * Plugins to implement: [CG] |
194 | * Plugins to implement: | ||
195 | - MySQL database backends | 175 | - MySQL database backends |
196 | + datacache | 176 | + datacache |
197 | + datastore | 177 | + datastore |
198 | - Postgres database backends | 178 | - Postgres database backends |
199 | + datacache | 179 | + datacache |
200 | + datastore | 180 | + datastore |
201 | - vpn | 181 | * VPN |
202 | * Determine RC bugs and fix those! | 182 | * Determine RC bugs and fix those! |
203 | 183 | ||
204 | |||
205 | 0.9.x: | 184 | 0.9.x: |
206 | * TRANSPORT: | 185 | * TRANSPORT: [MW] |
207 | - SMTP transport backend | 186 | - SMTP transport backend |
208 | - HTTPS transport backend | 187 | - HTTPS transport backend |
209 | + improved HTTPS support in MHD | 188 | + improved HTTPS support in MHD |
@@ -226,11 +205,11 @@ away), in order in which they will likely be done: | |||
226 | - implement gnunet-transport (transport configurator / tester) | 205 | - implement gnunet-transport (transport configurator / tester) |
227 | - UPnP-based IP detection | 206 | - UPnP-based IP detection |
228 | (Note: build library always, build service when libxml2/etc. are available) | 207 | (Note: build library always, build service when libxml2/etc. are available) |
229 | * FS: | 208 | * FS: [CG] |
230 | - Remove KBlocks in gnunet-unindex (see discussion with Kenneth Almquist on gnunet-devs in 9/2009) | 209 | - Remove KBlocks in gnunet-unindex (see discussion with Kenneth Almquist on gnunet-devs in 9/2009) |
231 | - Allow checking of presence of search results and/or content via command-line tools | 210 | - Allow checking of presence of search results and/or content via command-line tools |
232 | (add options to gnunet-search / gnunet-download to limit search to local peer) | 211 | (add options to gnunet-search / gnunet-download to limit search to local peer) |
233 | * PEERINFO: | 212 | * PEERINFO: [CG] |
234 | - expire 'ancient' HELLOs (those without valid addresses AND that | 213 | - expire 'ancient' HELLOs (those without valid addresses AND that |
235 | we have not 'used' (for their public keys) in a while; need a way | 214 | we have not 'used' (for their public keys) in a while; need a way |
236 | to track actual 'use') | 215 | to track actual 'use') |
diff --git a/doc/man/gnunet-pseudonym.1 b/doc/man/gnunet-pseudonym.1 index 60e3c9ba9..f07359bdb 100644 --- a/doc/man/gnunet-pseudonym.1 +++ b/doc/man/gnunet-pseudonym.1 | |||
@@ -57,10 +57,6 @@ display names of local namespaces (those that we can extend with content because | |||
57 | For the main file (or directory), set the metadata of the given TYPE to the given VALUE. Note that this will not add the respective VALUE to the set of keywords under which the file can be found. | 57 | For the main file (or directory), set the metadata of the given TYPE to the given VALUE. Note that this will not add the respective VALUE to the set of keywords under which the file can be found. |
58 | 58 | ||
59 | .TP | 59 | .TP |
60 | \fB\-n\fR, \fB\-\-no\-advertisement\fR | ||
61 | Do not generate an advertisement for the namespace (use with \-C). | ||
62 | |||
63 | .TP | ||
64 | \fB\-p \fIPRIORITY\fR, \fB\-\-prio=\fIPRIORITY\fR | 60 | \fB\-p \fIPRIORITY\fR, \fB\-\-prio=\fIPRIORITY\fR |
65 | Set the priority of the namespace advertisement (default: 365). If the local database is full, GNUnet will discard the content with the lowest ranking. Note that ranks change over time depending on popularity. The default should be high enough to preserve the locally inserted content in favor of content that migrates from other peers. | 61 | Set the priority of the namespace advertisement (default: 365). If the local database is full, GNUnet will discard the content with the lowest ranking. Note that ranks change over time depending on popularity. The default should be high enough to preserve the locally inserted content in favor of content that migrates from other peers. |
66 | 62 | ||
@@ -70,7 +66,7 @@ Do not print the list of pseudonyms (only perform create or delete operation). | |||
70 | 66 | ||
71 | .TP | 67 | .TP |
72 | \fB\-r IDENTIFIER\fR, \fB\-\-root=IDENTIFIER\fR | 68 | \fB\-r IDENTIFIER\fR, \fB\-\-root=IDENTIFIER\fR |
73 | Specify the identifier for the root of the namespace. Used in the namespace advertisement to tell users that find the namespace advertisement about an entry\-point into the namespace (use with \-C). | 69 | Specify the identifier for the root of the namespace. Used in the namespace advertisement to tell users that find the namespace advertisement about an entry\-point into the namespace (use with \-C). Advertisements are only created if "\-C" and "\-r" are specified. |
74 | 70 | ||
75 | .TP | 71 | .TP |
76 | \fB\-s ID:VALUE\fR, \fB\-\-set-rating=ID:VALUE\fR | 72 | \fB\-s ID:VALUE\fR, \fB\-\-set-rating=ID:VALUE\fR |
diff --git a/doc/man/gnunet-search.1 b/doc/man/gnunet-search.1 index 5f6fffedd..248932d02 100644 --- a/doc/man/gnunet-search.1 +++ b/doc/man/gnunet-search.1 | |||
@@ -31,14 +31,14 @@ print help page | |||
31 | Change the loglevel. Possible values for LOGLEVEL are | 31 | Change the loglevel. Possible values for LOGLEVEL are |
32 | ERROR, WARNING, INFO and DEBUG. | 32 | ERROR, WARNING, INFO and DEBUG. |
33 | .TP | 33 | .TP |
34 | \fB\-o \fIPREFIX\fR, \fB\-\-output=\fIPREFIX\fR | 34 | \fB\-o \fIFILENAME\fR, \fB\-\-output=\fIFILENAME\fR |
35 | Writes 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. | 35 | Writes a GNUnet directory containing all of the search results to FILENAME. |
36 | .TP | 36 | .TP |
37 | \fB\-v\fR, \fB\-\-version\fR | 37 | \fB\-v\fR, \fB\-\-version\fR |
38 | print the version number | 38 | print the version number |
39 | .SH NOTES | 39 | .SH NOTES |
40 | 40 | ||
41 | You 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. | 41 | You 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://fs/ksk/KEYWORD[+KEYWORD]*. If the format does not correspond to a GNUnet URI, GNUnet will automatically assume that keywords are supplied directly. |
42 | 42 | ||
43 | If multiple keywords are passed, gnunet-search will look for content matching any of the keywords. The prefix "+" makes a keyword mandatory. | 43 | If multiple keywords are passed, gnunet-search will look for content matching any of the keywords. The prefix "+" makes a keyword mandatory. |
44 | 44 | ||
@@ -60,13 +60,13 @@ Search results are printed by gnunet\-search like this: | |||
60 | Mime-type: text/plain | 60 | Mime-type: text/plain |
61 | .ad b | 61 | .ad b |
62 | 62 | ||
63 | The 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). | 63 | The 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\-publish on how to supply meta-data by hand). |
64 | 64 | ||
65 | .SH FILES | 65 | .SH FILES |
66 | .TP | 66 | .TP |
67 | ~/.gnunet/gnunet.conf | 67 | ~/.gnunet/gnunet.conf |
68 | GNUnet configuration file; specifies the default value for the timeout | 68 | GNUnet configuration file; specifies the default value for the timeout |
69 | .SH "REPORTING BUGS" | 69 | .SH "REPORTING BUGS" |
70 | Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet-developers@gnu.org> | 70 | Report bugs to <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> |
71 | .SH "SEE ALSO" | 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) | 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/src/fs/Makefile.am b/src/fs/Makefile.am index a83eef460..df781e1e6 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am | |||
@@ -82,6 +82,7 @@ gnunet_pseudonym_SOURCES = \ | |||
82 | gnunet_pseudonym_LDADD = \ | 82 | gnunet_pseudonym_LDADD = \ |
83 | $(top_builddir)/src/fs/libgnunetfs.la \ | 83 | $(top_builddir)/src/fs/libgnunetfs.la \ |
84 | $(top_builddir)/src/util/libgnunetutil.la \ | 84 | $(top_builddir)/src/util/libgnunetutil.la \ |
85 | -lextractor \ | ||
85 | $(GN_LIBINTL) | 86 | $(GN_LIBINTL) |
86 | 87 | ||
87 | gnunet_search_SOURCES = \ | 88 | gnunet_search_SOURCES = \ |
diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c index 48578c650..82d0e8690 100644 --- a/src/fs/fs_directory.c +++ b/src/fs/fs_directory.c | |||
@@ -291,7 +291,10 @@ GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData *mdir | |||
291 | struct GNUNET_FS_DirectoryBuilder *ret; | 291 | struct GNUNET_FS_DirectoryBuilder *ret; |
292 | 292 | ||
293 | ret = GNUNET_malloc(sizeof(struct GNUNET_FS_DirectoryBuilder)); | 293 | ret = GNUNET_malloc(sizeof(struct GNUNET_FS_DirectoryBuilder)); |
294 | ret->meta = GNUNET_CONTAINER_meta_data_duplicate (mdir); | 294 | if (mdir != NULL) |
295 | ret->meta = GNUNET_CONTAINER_meta_data_duplicate (mdir); | ||
296 | else | ||
297 | ret->meta = GNUNET_CONTAINER_meta_data_create (); | ||
295 | GNUNET_FS_meta_data_make_directory (ret->meta); | 298 | GNUNET_FS_meta_data_make_directory (ret->meta); |
296 | return ret; | 299 | return ret; |
297 | } | 300 | } |
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 12d6ff0b6..3de192e12 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -23,10 +23,10 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | * | 24 | * |
25 | * TODO: | 25 | * TODO: |
26 | * - handle recursive downloads (need directory & | ||
27 | * fs-level download-parallelism management) | ||
26 | * - location URI suppport (can wait, easy) | 28 | * - location URI suppport (can wait, easy) |
27 | * - check if blocks exist already (can wait, easy) | 29 | * - check if blocks exist already (can wait, easy) |
28 | * - handle recursive downloads (need directory & | ||
29 | * fs-level download-parallelism management, can wait) | ||
30 | * - check if iblocks can be computed from existing blocks (can wait, hard) | 30 | * - check if iblocks can be computed from existing blocks (can wait, hard) |
31 | * - persistence (can wait) | 31 | * - persistence (can wait) |
32 | */ | 32 | */ |
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 596ea0c63..c4994b6a6 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -24,12 +24,11 @@ | |||
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | 25 | * |
26 | * TODO: | 26 | * TODO: |
27 | * - handle SKS updates searches nicely (can wait) | 27 | * - handle namespace advertisements (can wait; might already work!?) |
28 | * - handle availability probes (can wait) | ||
29 | * - make operations persistent (can wait) | ||
30 | * - handle namespace advertisements (can wait) | ||
31 | * - add support for pushing "already seen" information | 28 | * - add support for pushing "already seen" information |
32 | * to FS service for bloomfilter (can wait) | 29 | * to FS service for bloomfilter (can wait) |
30 | * - handle availability probes (can wait) | ||
31 | * - make operations persistent (can wait) | ||
33 | */ | 32 | */ |
34 | 33 | ||
35 | #include "platform.h" | 34 | #include "platform.h" |
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index b402fa830..5ddb48f2a 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c | |||
@@ -882,6 +882,34 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, | |||
882 | 882 | ||
883 | 883 | ||
884 | /** | 884 | /** |
885 | * Create an SKS URI from a namespace and an identifier. | ||
886 | * | ||
887 | * @param ns namespace | ||
888 | * @param id identifier | ||
889 | * @param emsg where to store an error message | ||
890 | * @return an FS URI for the given namespace and identifier | ||
891 | */ | ||
892 | struct GNUNET_FS_Uri * | ||
893 | GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, | ||
894 | const char *id, | ||
895 | char **emsg) | ||
896 | { | ||
897 | struct GNUNET_FS_Uri *ns_uri; | ||
898 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk; | ||
899 | |||
900 | ns_uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri)); | ||
901 | ns_uri->type = sks; | ||
902 | GNUNET_CRYPTO_rsa_key_get_public (ns->key, | ||
903 | &pk); | ||
904 | GNUNET_CRYPTO_hash (&pk, | ||
905 | sizeof (pk), | ||
906 | &ns_uri->data.sks.namespace); | ||
907 | ns_uri->data.sks.identifier = GNUNET_strdup (id); | ||
908 | return ns_uri; | ||
909 | } | ||
910 | |||
911 | |||
912 | /** | ||
885 | * Canonicalize a keyword. | 913 | * Canonicalize a keyword. |
886 | * | 914 | * |
887 | * @param in input string (the keyword) | 915 | * @param in input string (the keyword) |
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 5279ce459..63895d4b2 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * @author Igor Wronsky | 26 | * @author Igor Wronsky |
27 | * | 27 | * |
28 | * TODO: | 28 | * TODO: |
29 | * - many command-line options | 29 | * - download-directory option support (do_directory) |
30 | */ | 30 | */ |
31 | #include "platform.h" | 31 | #include "platform.h" |
32 | #include "gnunet_fs_service.h" | 32 | #include "gnunet_fs_service.h" |
@@ -47,6 +47,12 @@ static struct GNUNET_FS_DownloadContext *dc; | |||
47 | 47 | ||
48 | static unsigned int anonymity = 1; | 48 | static unsigned int anonymity = 1; |
49 | 49 | ||
50 | static unsigned int parallelism = 16; | ||
51 | |||
52 | static int do_recursive; | ||
53 | |||
54 | static int do_directory; | ||
55 | |||
50 | static char *filename; | 56 | static char *filename; |
51 | 57 | ||
52 | 58 | ||
@@ -127,8 +133,15 @@ progress_cb (void *cls, | |||
127 | info->value.download.filename, | 133 | info->value.download.filename, |
128 | s); | 134 | s); |
129 | GNUNET_free (s); | 135 | GNUNET_free (s); |
130 | if (info->value.download.dc == dc) | 136 | if (do_directory) |
131 | GNUNET_SCHEDULER_shutdown (sched); | 137 | { |
138 | GNUNET_break (0); //FIXME: not implemented | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | if (info->value.download.dc == dc) | ||
143 | GNUNET_SCHEDULER_shutdown (sched); | ||
144 | } | ||
132 | break; | 145 | break; |
133 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: | 146 | case GNUNET_FS_STATUS_DOWNLOAD_STOPPED: |
134 | if (info->value.download.dc == dc) | 147 | if (info->value.download.dc == dc) |
@@ -168,25 +181,31 @@ run (void *cls, | |||
168 | enum GNUNET_FS_DownloadOptions options; | 181 | enum GNUNET_FS_DownloadOptions options; |
169 | 182 | ||
170 | sched = s; | 183 | sched = s; |
171 | /* FIXME: check arguments */ | 184 | if (do_directory) |
172 | uri = GNUNET_FS_uri_parse (args[0], | ||
173 | &emsg); | ||
174 | if (NULL == uri) | ||
175 | { | 185 | { |
176 | fprintf (stderr, | 186 | GNUNET_break (0); //FIXME: not implemented |
177 | _("Failed to parse URI: %s\n"), | ||
178 | emsg); | ||
179 | GNUNET_free (emsg); | ||
180 | ret = 1; | ||
181 | return; | ||
182 | } | 187 | } |
183 | if (! GNUNET_FS_uri_test_chk (uri)) | 188 | else |
184 | { | 189 | { |
185 | fprintf (stderr, | 190 | uri = GNUNET_FS_uri_parse (args[0], |
186 | "Only CHK URIs supported right now.\n"); | 191 | &emsg); |
187 | ret = 1; | 192 | if (NULL == uri) |
188 | GNUNET_FS_uri_destroy (uri); | 193 | { |
189 | return; | 194 | fprintf (stderr, |
195 | _("Failed to parse URI: %s\n"), | ||
196 | emsg); | ||
197 | GNUNET_free (emsg); | ||
198 | ret = 1; | ||
199 | return; | ||
200 | } | ||
201 | if (! GNUNET_FS_uri_test_chk (uri)) | ||
202 | { | ||
203 | fprintf (stderr, | ||
204 | "Only CHK URIs supported right now.\n"); | ||
205 | ret = 1; | ||
206 | GNUNET_FS_uri_destroy (uri); | ||
207 | return; | ||
208 | } | ||
190 | } | 209 | } |
191 | if (NULL == filename) | 210 | if (NULL == filename) |
192 | { | 211 | { |
@@ -203,6 +222,8 @@ run (void *cls, | |||
203 | &progress_cb, | 222 | &progress_cb, |
204 | NULL, | 223 | NULL, |
205 | GNUNET_FS_FLAGS_NONE, | 224 | GNUNET_FS_FLAGS_NONE, |
225 | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM, | ||
226 | parallelism, | ||
206 | GNUNET_FS_OPTIONS_END); | 227 | GNUNET_FS_OPTIONS_END); |
207 | if (NULL == ctx) | 228 | if (NULL == ctx) |
208 | { | 229 | { |
@@ -214,22 +235,31 @@ run (void *cls, | |||
214 | return; | 235 | return; |
215 | } | 236 | } |
216 | options = GNUNET_FS_DOWNLOAD_OPTION_NONE; | 237 | options = GNUNET_FS_DOWNLOAD_OPTION_NONE; |
217 | dc = GNUNET_FS_download_start (ctx, | 238 | if (do_recursive) |
218 | uri, | 239 | options |= GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE; |
219 | NULL, | 240 | if (do_directory) |
220 | filename, | ||
221 | 0, | ||
222 | GNUNET_FS_uri_chk_get_file_size (uri), | ||
223 | anonymity, | ||
224 | options, | ||
225 | NULL, | ||
226 | NULL); | ||
227 | GNUNET_FS_uri_destroy (uri); | ||
228 | if (dc == NULL) | ||
229 | { | 241 | { |
230 | GNUNET_FS_stop (ctx); | 242 | GNUNET_break (0); //FIXME: not implemented |
231 | ctx = NULL; | 243 | } |
232 | return; | 244 | else |
245 | { | ||
246 | dc = GNUNET_FS_download_start (ctx, | ||
247 | uri, | ||
248 | NULL, | ||
249 | filename, | ||
250 | 0, | ||
251 | GNUNET_FS_uri_chk_get_file_size (uri), | ||
252 | anonymity, | ||
253 | options, | ||
254 | NULL, | ||
255 | NULL); | ||
256 | GNUNET_FS_uri_destroy (uri); | ||
257 | if (dc == NULL) | ||
258 | { | ||
259 | GNUNET_FS_stop (ctx); | ||
260 | ctx = NULL; | ||
261 | return; | ||
262 | } | ||
233 | } | 263 | } |
234 | GNUNET_SCHEDULER_add_delayed (sched, | 264 | GNUNET_SCHEDULER_add_delayed (sched, |
235 | GNUNET_TIME_UNIT_FOREVER_REL, | 265 | GNUNET_TIME_UNIT_FOREVER_REL, |
@@ -245,28 +275,23 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = { | |||
245 | {'a', "anonymity", "LEVEL", | 275 | {'a', "anonymity", "LEVEL", |
246 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), | 276 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), |
247 | 1, &GNUNET_GETOPT_set_uint, &anonymity}, | 277 | 1, &GNUNET_GETOPT_set_uint, &anonymity}, |
248 | #if 0 | ||
249 | // FIXME: options! | ||
250 | {'d', "directory", NULL, | 278 | {'d', "directory", NULL, |
251 | gettext_noop | 279 | gettext_noop |
252 | ("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."), | 280 | ("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."), |
253 | 0, &GNUNET_getopt_configure_set_one, &do_directory}, | 281 | 0, &GNUNET_GETOPT_set_one, &do_directory}, |
254 | {'D', "delete-incomplete", NULL, | 282 | {'D', "delete-incomplete", NULL, |
255 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), | 283 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), |
256 | 0, &GNUNET_getopt_configure_set_one, &do_delete_incomplete}, | 284 | 0, &GNUNET_GETOPT_set_one, &delete_incomplete}, |
257 | #endif | ||
258 | {'o', "output", "FILENAME", | 285 | {'o', "output", "FILENAME", |
259 | gettext_noop ("write the file to FILENAME"), | 286 | gettext_noop ("write the file to FILENAME"), |
260 | 1, &GNUNET_GETOPT_set_string, &filename}, | 287 | 1, &GNUNET_GETOPT_set_string, &filename}, |
261 | #if 0 | ||
262 | {'p', "parallelism", "DOWNLOADS", | 288 | {'p', "parallelism", "DOWNLOADS", |
263 | gettext_noop | 289 | gettext_noop |
264 | ("set the maximum number of parallel downloads that are allowed"), | 290 | ("set the maximum number of parallel downloads that are allowed"), |
265 | 1, &GNUNET_getopt_configure_set_uint, ¶llelism}, | 291 | 1, &GNUNET_GETOPT_set_uint, ¶llelism}, |
266 | {'R', "recursive", NULL, | 292 | {'R', "recursive", NULL, |
267 | gettext_noop ("download a GNUnet directory recursively"), | 293 | gettext_noop ("download a GNUnet directory recursively"), |
268 | 0, &GNUNET_getopt_configure_set_one, &do_recursive}, | 294 | 0, &GNUNET_GETOPT_set_one, &do_recursive}, |
269 | #endif | ||
270 | {'V', "verbose", NULL, | 295 | {'V', "verbose", NULL, |
271 | gettext_noop ("be verbose (print progress information)"), | 296 | gettext_noop ("be verbose (print progress information)"), |
272 | 0, &GNUNET_GETOPT_set_one, &verbose}, | 297 | 0, &GNUNET_GETOPT_set_one, &verbose}, |
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c index 2d35e8e8c..b8bd12b35 100644 --- a/src/fs/gnunet-pseudonym.c +++ b/src/fs/gnunet-pseudonym.c | |||
@@ -66,11 +66,6 @@ static int print_local_only; | |||
66 | static struct GNUNET_CONTAINER_MetaData *adv_metadata; | 66 | static struct GNUNET_CONTAINER_MetaData *adv_metadata; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * -n option. | ||
70 | */ | ||
71 | static int no_advertising; | ||
72 | |||
73 | /** | ||
74 | * -p option. | 69 | * -p option. |
75 | */ | 70 | */ |
76 | static unsigned int priority = 365; | 71 | static unsigned int priority = 365; |
@@ -100,6 +95,10 @@ static struct GNUNET_FS_Handle *h; | |||
100 | */ | 95 | */ |
101 | static struct GNUNET_FS_Namespace *ns; | 96 | static struct GNUNET_FS_Namespace *ns; |
102 | 97 | ||
98 | /** | ||
99 | * Our configuration. | ||
100 | */ | ||
101 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
103 | 102 | ||
104 | static int ret; | 103 | static int ret; |
105 | 104 | ||
@@ -126,11 +125,45 @@ ns_printer (void *cls, | |||
126 | } | 125 | } |
127 | 126 | ||
128 | 127 | ||
128 | static int | ||
129 | pseudo_printer (void *cls, | ||
130 | const GNUNET_HashCode * | ||
131 | pseudonym, | ||
132 | const struct | ||
133 | GNUNET_CONTAINER_MetaData * md, | ||
134 | int rating) | ||
135 | { | ||
136 | char *id; | ||
137 | |||
138 | id = GNUNET_PSEUDONYM_id_to_name (cfg, | ||
139 | pseudonym); | ||
140 | if (id == NULL) | ||
141 | { | ||
142 | GNUNET_break (0); | ||
143 | return GNUNET_OK; | ||
144 | } | ||
145 | fprintf (stdout, | ||
146 | "%s (%d):\n", | ||
147 | id, | ||
148 | rating); | ||
149 | GNUNET_CONTAINER_meta_data_iterate (md, | ||
150 | &EXTRACTOR_meta_data_print, | ||
151 | stdout); | ||
152 | fprintf (stdout, "\n"); | ||
153 | GNUNET_free (id); | ||
154 | return GNUNET_OK; | ||
155 | } | ||
156 | |||
157 | |||
129 | static void | 158 | static void |
130 | post_advertising (void *cls, | 159 | post_advertising (void *cls, |
131 | const struct GNUNET_FS_Uri *uri, | 160 | const struct GNUNET_FS_Uri *uri, |
132 | const char *emsg) | 161 | const char *emsg) |
133 | { | 162 | { |
163 | GNUNET_HashCode nsid; | ||
164 | char *set; | ||
165 | int delta; | ||
166 | |||
134 | if (emsg != NULL) | 167 | if (emsg != NULL) |
135 | { | 168 | { |
136 | fprintf (stderr, "%s", emsg); | 169 | fprintf (stderr, "%s", emsg); |
@@ -153,7 +186,39 @@ post_advertising (void *cls, | |||
153 | } | 186 | } |
154 | if (NULL != rating_change) | 187 | if (NULL != rating_change) |
155 | { | 188 | { |
156 | GNUNET_break (0); // FIXME: not implemented | 189 | set = rating_change; |
190 | while ((*set != '\0') && (*set != ':')) | ||
191 | set++; | ||
192 | if (*set != ':') | ||
193 | { | ||
194 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
195 | _("Invalid argument `%s'\n"), | ||
196 | rating_change); | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | *set = '\0'; | ||
201 | delta = strtol (&set[1], NULL, /* no error handling yet */ | ||
202 | 10); | ||
203 | if (GNUNET_OK == | ||
204 | GNUNET_PSEUDONYM_name_to_id (cfg, | ||
205 | rating_change, | ||
206 | &nsid)) | ||
207 | { | ||
208 | GNUNET_PSEUDONYM_rank (cfg, | ||
209 | &nsid, | ||
210 | delta); | ||
211 | |||
212 | } | ||
213 | else | ||
214 | { | ||
215 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
216 | _("Namespace `%s' unknown.\n"), | ||
217 | rating_change); | ||
218 | } | ||
219 | } | ||
220 | GNUNET_free (rating_change); | ||
221 | rating_change = NULL; | ||
157 | } | 222 | } |
158 | if (0 != print_local_only) | 223 | if (0 != print_local_only) |
159 | { | 224 | { |
@@ -163,10 +228,10 @@ post_advertising (void *cls, | |||
163 | } | 228 | } |
164 | else if (0 == no_remote_printing) | 229 | else if (0 == no_remote_printing) |
165 | { | 230 | { |
166 | GNUNET_break (0); // FIXME: not implemented | 231 | GNUNET_PSEUDONYM_list_all (cfg, |
232 | &pseudo_printer, | ||
233 | NULL); | ||
167 | } | 234 | } |
168 | /* FIXME: is this OK here, or do we need | ||
169 | for completion of previous requests? */ | ||
170 | GNUNET_FS_stop (h); | 235 | GNUNET_FS_stop (h); |
171 | } | 236 | } |
172 | 237 | ||
@@ -178,18 +243,20 @@ post_advertising (void *cls, | |||
178 | * @param sched the scheduler to use | 243 | * @param sched the scheduler to use |
179 | * @param args remaining command-line arguments | 244 | * @param args remaining command-line arguments |
180 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 245 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) |
181 | * @param cfg configuration | 246 | * @param c configuration |
182 | */ | 247 | */ |
183 | static void | 248 | static void |
184 | run (void *cls, | 249 | run (void *cls, |
185 | struct GNUNET_SCHEDULER_Handle *sched, | 250 | struct GNUNET_SCHEDULER_Handle *sched, |
186 | char *const *args, | 251 | char *const *args, |
187 | const char *cfgfile, | 252 | const char *cfgfile, |
188 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 253 | const struct GNUNET_CONFIGURATION_Handle *c) |
189 | { | 254 | { |
190 | struct GNUNET_FS_Uri *ns_uri; | 255 | struct GNUNET_FS_Uri *ns_uri; |
191 | struct GNUNET_TIME_Absolute expiration; | 256 | struct GNUNET_TIME_Absolute expiration; |
257 | char *emsg; | ||
192 | 258 | ||
259 | cfg = c; | ||
193 | h = GNUNET_FS_start (sched, | 260 | h = GNUNET_FS_start (sched, |
194 | cfg, | 261 | cfg, |
195 | "gnunet-pseudonym", | 262 | "gnunet-pseudonym", |
@@ -221,11 +288,18 @@ run (void *cls, | |||
221 | } | 288 | } |
222 | else | 289 | else |
223 | { | 290 | { |
224 | if (0 == no_advertising) | 291 | if (NULL != root_identifier) |
225 | { | 292 | { |
226 | GNUNET_break (0); // FIXME: not implemented | 293 | emsg = NULL; |
227 | ns_uri = NULL; // FIXME!! | 294 | ns_uri = GNUNET_FS_uri_sks_create (ns, root_identifier, &emsg); |
295 | GNUNET_assert (emsg == NULL); | ||
228 | expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS); | 296 | expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS); |
297 | if (ksk_uri == NULL) | ||
298 | { | ||
299 | emsg = NULL; | ||
300 | ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/namespace", &emsg); | ||
301 | GNUNET_assert (NULL == emsg); | ||
302 | } | ||
229 | GNUNET_FS_publish_ksk (h, | 303 | GNUNET_FS_publish_ksk (h, |
230 | ksk_uri, | 304 | ksk_uri, |
231 | adv_metadata, | 305 | adv_metadata, |
@@ -275,9 +349,6 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = { | |||
275 | {'m', "meta", "TYPE:VALUE", | 349 | {'m', "meta", "TYPE:VALUE", |
276 | gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), | 350 | gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), |
277 | 1, &GNUNET_FS_getopt_set_metadata, &adv_metadata}, | 351 | 1, &GNUNET_FS_getopt_set_metadata, &adv_metadata}, |
278 | {'n', "no-advertisement", NULL, | ||
279 | gettext_noop ("do not create an advertisement"), | ||
280 | 0, &GNUNET_GETOPT_set_one, &no_advertising}, | ||
281 | {'p', "priority", "PRIORITY", | 352 | {'p', "priority", "PRIORITY", |
282 | gettext_noop ("use the given PRIORITY for the advertisments"), | 353 | gettext_noop ("use the given PRIORITY for the advertisments"), |
283 | 1, &GNUNET_GETOPT_set_uint, &priority}, | 354 | 1, &GNUNET_GETOPT_set_uint, &priority}, |
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 860a81522..1e0884361 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -24,9 +24,6 @@ | |||
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 | * - support for some options is still missing (uri argument) | ||
30 | */ | 27 | */ |
31 | #include "platform.h" | 28 | #include "platform.h" |
32 | #include "gnunet_fs_service.h" | 29 | #include "gnunet_fs_service.h" |
@@ -307,6 +304,22 @@ publish_inspector (void *cls, | |||
307 | } | 304 | } |
308 | 305 | ||
309 | 306 | ||
307 | static void | ||
308 | uri_ksk_continuation (void *cls, | ||
309 | const struct GNUNET_FS_Uri *uri, | ||
310 | const char *emsg) | ||
311 | { | ||
312 | if (emsg != NULL) | ||
313 | { | ||
314 | fprintf (stderr, | ||
315 | "%s\n", | ||
316 | emsg); | ||
317 | ret = 1; | ||
318 | } | ||
319 | GNUNET_FS_stop (ctx); | ||
320 | } | ||
321 | |||
322 | |||
310 | /** | 323 | /** |
311 | * Main function that will be run by the scheduler. | 324 | * Main function that will be run by the scheduler. |
312 | * | 325 | * |
@@ -329,6 +342,7 @@ run (void *cls, | |||
329 | struct stat sbuf; | 342 | struct stat sbuf; |
330 | char *ex; | 343 | char *ex; |
331 | char *emsg; | 344 | char *emsg; |
345 | struct GNUNET_FS_Uri *uri; | ||
332 | 346 | ||
333 | sched = s; | 347 | sched = s; |
334 | /* check arguments */ | 348 | /* check arguments */ |
@@ -421,11 +435,32 @@ run (void *cls, | |||
421 | } | 435 | } |
422 | } | 436 | } |
423 | if (NULL != uri_string) | 437 | if (NULL != uri_string) |
424 | { | 438 | { |
425 | // FIXME -- implement! | 439 | emsg = NULL; |
440 | uri = GNUNET_FS_uri_parse (uri_string, | ||
441 | &emsg); | ||
442 | if (uri == NULL) | ||
443 | { | ||
444 | fprintf (stderr, | ||
445 | _("Failed to parse URI: %s\n"), | ||
446 | emsg); | ||
447 | GNUNET_free (emsg); | ||
448 | GNUNET_FS_stop (ctx); | ||
449 | ret = 1; | ||
450 | return; | ||
451 | } | ||
452 | GNUNET_FS_publish_ksk (ctx, | ||
453 | topKeywords, | ||
454 | meta, | ||
455 | uri, | ||
456 | GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION), | ||
457 | anonymity, | ||
458 | priority, | ||
459 | GNUNET_FS_PUBLISH_OPTION_NONE, | ||
460 | &uri_ksk_continuation, | ||
461 | NULL); | ||
426 | return; | 462 | return; |
427 | } | 463 | } |
428 | |||
429 | l = NULL; | 464 | l = NULL; |
430 | if (! disable_extractor) | 465 | if (! disable_extractor) |
431 | { | 466 | { |
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index 462f432c8..33c81c9d7 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c | |||
@@ -24,9 +24,6 @@ | |||
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 | * - add many options (timeout, namespace search, etc.) | ||
30 | */ | 27 | */ |
31 | #include "platform.h" | 28 | #include "platform.h" |
32 | #include "gnunet_fs_service.h" | 29 | #include "gnunet_fs_service.h" |
@@ -41,6 +38,10 @@ static struct GNUNET_FS_Handle *ctx; | |||
41 | 38 | ||
42 | static struct GNUNET_FS_SearchContext *sc; | 39 | static struct GNUNET_FS_SearchContext *sc; |
43 | 40 | ||
41 | static char *output_filename; | ||
42 | |||
43 | static struct GNUNET_FS_DirectoryBuilder *db; | ||
44 | |||
44 | static unsigned int anonymity = 1; | 45 | static unsigned int anonymity = 1; |
45 | 46 | ||
46 | static int verbose; | 47 | static int verbose; |
@@ -64,12 +65,39 @@ item_printer (void *cls, | |||
64 | return GNUNET_OK; | 65 | return GNUNET_OK; |
65 | } | 66 | } |
66 | 67 | ||
68 | |||
67 | static void | 69 | static void |
68 | clean_task (void *cls, | 70 | clean_task (void *cls, |
69 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 71 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
70 | { | 72 | { |
73 | size_t dsize; | ||
74 | void *ddata; | ||
75 | |||
71 | GNUNET_FS_stop (ctx); | 76 | GNUNET_FS_stop (ctx); |
72 | ctx = NULL; | 77 | ctx = NULL; |
78 | if (output_filename == NULL) | ||
79 | return; | ||
80 | if (GNUNET_OK != | ||
81 | GNUNET_FS_directory_builder_finish (db, | ||
82 | &dsize, | ||
83 | &ddata)) | ||
84 | { | ||
85 | GNUNET_break (0); | ||
86 | GNUNET_free (output_filename); | ||
87 | return; | ||
88 | } | ||
89 | if (dsize != | ||
90 | GNUNET_DISK_fn_write (output_filename, | ||
91 | ddata, | ||
92 | dsize, | ||
93 | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)) | ||
94 | { | ||
95 | fprintf (stderr, | ||
96 | _("Failed to write directory with search results to `%s'\n"), | ||
97 | output_filename); | ||
98 | } | ||
99 | GNUNET_free_non_null (ddata); | ||
100 | GNUNET_free (output_filename); | ||
73 | } | 101 | } |
74 | 102 | ||
75 | 103 | ||
@@ -99,6 +127,11 @@ progress_cb (void *cls, | |||
99 | case GNUNET_FS_STATUS_SEARCH_START: | 127 | case GNUNET_FS_STATUS_SEARCH_START: |
100 | break; | 128 | break; |
101 | case GNUNET_FS_STATUS_SEARCH_RESULT: | 129 | case GNUNET_FS_STATUS_SEARCH_RESULT: |
130 | if (db != NULL) | ||
131 | GNUNET_FS_directory_builder_add (db, | ||
132 | info->value.search.specifics.result.uri, | ||
133 | info->value.search.specifics.result.meta, | ||
134 | NULL); | ||
102 | uri = GNUNET_FS_uri_to_string (info->value.search.specifics.result.uri); | 135 | uri = GNUNET_FS_uri_to_string (info->value.search.specifics.result.uri); |
103 | printf ("%s:\n", uri); | 136 | printf ("%s:\n", uri); |
104 | filename = | 137 | filename = |
@@ -135,7 +168,6 @@ progress_cb (void *cls, | |||
135 | GNUNET_SCHEDULER_shutdown (sched); | 168 | GNUNET_SCHEDULER_shutdown (sched); |
136 | break; | 169 | break; |
137 | case GNUNET_FS_STATUS_SEARCH_STOPPED: | 170 | case GNUNET_FS_STATUS_SEARCH_STOPPED: |
138 | sc = NULL; | ||
139 | GNUNET_SCHEDULER_add_continuation (sched, | 171 | GNUNET_SCHEDULER_add_continuation (sched, |
140 | &clean_task, | 172 | &clean_task, |
141 | NULL, | 173 | NULL, |
@@ -214,6 +246,8 @@ run (void *cls, | |||
214 | ret = 1; | 246 | ret = 1; |
215 | return; | 247 | return; |
216 | } | 248 | } |
249 | if (output_filename != NULL) | ||
250 | db = GNUNET_FS_directory_builder_create (NULL); | ||
217 | sc = GNUNET_FS_search_start (ctx, | 251 | sc = GNUNET_FS_search_start (ctx, |
218 | uri, | 252 | uri, |
219 | anonymity, | 253 | anonymity, |
@@ -241,7 +275,10 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = { | |||
241 | {'a', "anonymity", "LEVEL", | 275 | {'a', "anonymity", "LEVEL", |
242 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), | 276 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), |
243 | 1, &GNUNET_GETOPT_set_uint, &anonymity}, | 277 | 1, &GNUNET_GETOPT_set_uint, &anonymity}, |
244 | // FIXME: options! | 278 | {'o', "output", "PREFIX", |
279 | gettext_noop | ||
280 | ("write search results to file starting with PREFIX"), | ||
281 | 1, &GNUNET_GETOPT_set_string, &output_filename}, | ||
245 | GNUNET_GETOPT_OPTION_END | 282 | GNUNET_GETOPT_OPTION_END |
246 | }; | 283 | }; |
247 | 284 | ||
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 18e7afcc2..961dab4e2 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -312,6 +312,26 @@ GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); | |||
312 | 312 | ||
313 | 313 | ||
314 | /** | 314 | /** |
315 | * Handle to one of our namespaces. | ||
316 | */ | ||
317 | struct GNUNET_FS_Namespace; | ||
318 | |||
319 | |||
320 | /** | ||
321 | * Create an SKS URI from a namespace and an identifier. | ||
322 | * | ||
323 | * @param ns namespace | ||
324 | * @param id identifier | ||
325 | * @param emsg where to store an error message | ||
326 | * @return an FS URI for the given namespace and identifier | ||
327 | */ | ||
328 | struct GNUNET_FS_Uri * | ||
329 | GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, | ||
330 | const char *id, | ||
331 | char **emsg); | ||
332 | |||
333 | |||
334 | /** | ||
315 | * Get the ID of a namespace from the given | 335 | * Get the ID of a namespace from the given |
316 | * namespace URI. | 336 | * namespace URI. |
317 | * | 337 | * |
@@ -655,12 +675,6 @@ enum GNUNET_FS_Status | |||
655 | 675 | ||
656 | 676 | ||
657 | /** | 677 | /** |
658 | * Handle to one of our namespaces. | ||
659 | */ | ||
660 | struct GNUNET_FS_Namespace; | ||
661 | |||
662 | |||
663 | /** | ||
664 | * Handle for controlling an upload. | 678 | * Handle for controlling an upload. |
665 | */ | 679 | */ |
666 | struct GNUNET_FS_PublishContext; | 680 | struct GNUNET_FS_PublishContext; |