aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO70
-rw-r--r--src/Makefile.am3
-rw-r--r--src/fs/fs.h10
-rw-r--r--src/fs/fs_collection.c8
-rw-r--r--src/fs/fs_download.c322
-rw-r--r--src/fs/fs_file_information.c28
-rw-r--r--src/fs/fs_namespace.c16
-rw-r--r--src/fs/fs_publish.c22
-rw-r--r--src/fs/fs_search.c6
-rw-r--r--src/fs/fs_tree.h2
-rw-r--r--src/fs/fs_unindex.c2
-rw-r--r--src/include/gnunet_fs_service.h67
12 files changed, 350 insertions, 206 deletions
diff --git a/TODO b/TODO
index 5b3b4d48a..24c12a1bf 100644
--- a/TODO
+++ b/TODO
@@ -13,7 +13,7 @@ away), in order in which they will likely be done:
13* UPNP 13* UPNP
14 14
15 15
16PHASE #2: (Goal: recover basic file-sharing functionality) 16Urgent items (before announcing ng.gnunet.org):
17* TESTING (needed for DV, DHT, Topology) 17* TESTING (needed for DV, DHT, Topology)
18 - implement library for local testing 18 - implement library for local testing
19 + modify configuration to allow controlling 19 + modify configuration to allow controlling
@@ -37,10 +37,10 @@ PHASE #2: (Goal: recover basic file-sharing functionality)
37 - implement testcases 37 - implement testcases
38* FS (basic anonymous FS only) 38* FS (basic anonymous FS only)
39 - implement basic FS library 39 - implement basic FS library
40 - download API 40 - gnunet-publish (progress CB, shutdown, URI args)
41 - gnunet-search (binary) 41 - gnunet-unindex (progress CB, shutdown, error checking)
42 - gnunet-download (binary) 42 - gnunet-search (start search, progress CB, shutdown, options)
43 - API FIX: change type for anonymity/priority from unsigned int to uint32_t! 43 - gnunet-download (start download, progress CB, shutdown, options)
44 - design network structs (P2P) 44 - design network structs (P2P)
45 + query 45 + query
46 + response 46 + response
@@ -57,21 +57,18 @@ PHASE #2: (Goal: recover basic file-sharing functionality)
57 ~ download 57 ~ download
58 ~ search 58 ~ search
59 ~ unindex 59 ~ unindex
60 ~ namespaces
61 ~ collection
62 + directory API 60 + directory API
63* new webpage 61* new webpage
64 - lcov 62 - prevent?
65 - buildbot 63 - migrate Mantis!?
66 - migrate Mantis? 64 - Doxygen generation
67 - download links on Drupal? 65 - run peer => have a 0.9.x hostlist
68 - run peer 66 - improve basic documentation (configure, dependencies, what works, etc.)
69 - configure hostlist 67 - write minimal welcome/introduction to 0.9.x-development/webpage/status
70 - install on proper server
71=> Deploy(able) development network 68=> Deploy(able) development network
72 69
73 70
74PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009] 710.9.0pre0:
75* Module features to implement: 72* Module features to implement:
76 - advanced FS API parts 73 - advanced FS API parts
77 + namespaces 74 + namespaces
@@ -80,8 +77,9 @@ PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009]
80 + collection 77 + collection
81 + location URIs (publish, search, download) 78 + location URIs (publish, search, download)
82 + persistence support (publish, unindex, search, download) 79 + persistence support (publish, unindex, search, download)
83 + datastore reservation (publishing)
84 + indexing: index-failure-cleanup 80 + indexing: index-failure-cleanup
81 + download: management/bounding of parallel downloads (for recursive dl.)
82 + datastore reservation (publishing)
85 - implement adv. FS testcases 83 - implement adv. FS testcases
86 + insert: sblocks, loc uris 84 + insert: sblocks, loc uris
87 + download: loc uris 85 + download: loc uris
@@ -103,6 +101,9 @@ PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009]
103 - testing (RC-pre0) 101 - testing (RC-pre0)
104 + implement library for distributed testing [Nate] 102 + implement library for distributed testing [Nate]
105 + implement testcases for distributed testing [Nate] 103 + implement testcases for distributed testing [Nate]
104
1050.9.0pre1:
106* Module features to implement:
106 - tbench (RC-pre1) 107 - tbench (RC-pre1)
107 + good to have for DV evaluation! 108 + good to have for DV evaluation!
108 - DV (RC-pre1) 109 - DV (RC-pre1)
@@ -112,6 +113,12 @@ PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009]
112 + implement DV transport plugin [Nate & CG] 113 + implement DV transport plugin [Nate & CG]
113 + implement testcases [Nate] 114 + implement testcases [Nate]
114 + implement performance tests [Nate] 115 + implement performance tests [Nate]
116* GUIs to implement:
117 - gtk (RC-pre1)
118 + how to integrate scheduler with GTK event loop!
119
1200.9.0pre2:
121* Module features to implement:
115 - tracekit (RC-pre2) 122 - tracekit (RC-pre2)
116 + good to have for DV/DHT evaluation! 123 + good to have for DV/DHT evaluation!
117 - DHT (RC-pre2) 124 - DHT (RC-pre2)
@@ -120,25 +127,21 @@ PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009]
120 + implement testcases 127 + implement testcases
121 + implement performance tests 128 + implement performance tests
122* GUIs to implement: 129* GUIs to implement:
123 - gtk (RC-pre1)
124 + how to integrate scheduler with GTK event loop!
125 - fuse (RC-pre2) 130 - fuse (RC-pre2)
126 - qt (RC-pre3)
127 + see discussions @ FISL about integration with event loop!
128* Plugins to implement: 131* Plugins to implement:
129 - UDP backend (RC-pre2) 132 - UDP backend (RC-pre2)
130 + Fragmentation library 133 + Fragmentation library
131 + actual plugin 134 + actual plugin
132 - HTTP backend (RC-pre2) 135 - HTTP backend (RC-pre2)
133* Determine RC bugs and fix those!
134
135=> PRE-RELEASE
136 136
1370.9.0pre3:
138* GUIs to implement:
139 - qt (RC-pre3)
140 + see discussions @ FISL about integration with event loop!
141* Determine RC bugs and fix those!
137 142
138PHASE #4: [completion-goal: mid 2010] 1430.9.0:
139* Documentation 144* Documentation
140 - Doxygen generation
141 - lcov generation
142 - update man pages 145 - update man pages
143 - update webpage documentation 146 - update webpage documentation
144* new webpage: 147* new webpage:
@@ -161,13 +164,10 @@ PHASE #4: [completion-goal: mid 2010]
161 - vpn 164 - vpn
162* Determine RC bugs and fix those! 165* Determine RC bugs and fix those!
163 166
164=> 0.9.0 RELEASE
165
166
167 167
168 1680.9.x:
169Post 0.9.0 features: 169* Plugins to implement:
170* SMTP transport backend 170 - SMTP transport backend
171* HTTPS transport backend 171 - HTTPS transport backend
172 - improved HTTPS support in MHD 172 + improved HTTPS support in MHD
173 - actual plugin 173 + actual plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index 9b3aa46ab..7e92437c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,5 +23,6 @@ SUBDIRS = \
23 core \ 23 core \
24 testing \ 24 testing \
25 $(HOSTLIST_DIR) \ 25 $(HOSTLIST_DIR) \
26 topology 26 topology \
27 fs
27 28
diff --git a/src/fs/fs.h b/src/fs/fs.h
index 50090c6fd..70e02360c 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -837,6 +837,16 @@ struct GNUNET_FS_DownloadContext
837 struct GNUNET_FS_Uri *uri; 837 struct GNUNET_FS_Uri *uri;
838 838
839 /** 839 /**
840 * Known meta-data for the file (can be NULL).
841 */
842 struct GNUNET_CONTAINER_MetaData *meta;
843
844 /**
845 * Error message, NULL if we're doing OK.
846 */
847 char *emsg;
848
849 /**
840 * Where are we writing the data (name of the 850 * Where are we writing the data (name of the
841 * file, can be NULL!). 851 * file, can be NULL!).
842 */ 852 */
diff --git a/src/fs/fs_collection.c b/src/fs/fs_collection.c
index 01c7e3298..f94ef250d 100644
--- a/src/fs/fs_collection.c
+++ b/src/fs/fs_collection.c
@@ -139,12 +139,12 @@ typedef struct CollectionData
139 /** 139 /**
140 * Anonymity level for the collection. (NBO) 140 * Anonymity level for the collection. (NBO)
141 */ 141 */
142 unsigned int anonymityLevel; 142 uint32_t anonymityLevel;
143 143
144 /** 144 /**
145 * Priority of the collection (NBO). 145 * Priority of the collection (NBO).
146 */ 146 */
147 unsigned int priority; 147 uint32_t priority;
148 148
149 /** 149 /**
150 * Has this collection changed since the last publication? 150 * Has this collection changed since the last publication?
@@ -465,8 +465,8 @@ GNUNET_CO_done ()
465 * is destroyed (i.e. on exit from the UI). 465 * is destroyed (i.e. on exit from the UI).
466 */ 466 */
467int 467int
468GNUNET_CO_collection_start (unsigned int anonymityLevel, 468GNUNET_CO_collection_start (uint32_t anonymityLevel,
469 unsigned int prio, 469 uint32_t prio,
470 const struct GNUNET_MetaData *meta) 470 const struct GNUNET_MetaData *meta)
471{ 471{
472 struct GNUNET_ECRS_URI *advertisement; 472 struct GNUNET_ECRS_URI *advertisement;
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index c5bfec52c..145e16818 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -23,10 +23,11 @@
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * 24 *
25 * TODO: 25 * TODO:
26 * - offset calculations 26 * - location URI suppport (can wait, easy)
27 * - callback signaling 27 * - check if blocks exist already (can wait, easy)
28 * - check if blocks exist already (can wait) 28 * - handle recursive downloads (need directory &
29 * - location URI suppport (can wait) 29 * fs-level download-parallelism management, can wait)
30 * - check if iblocks can be computed from existing blocks (can wait, hard)
30 * - persistence (can wait) 31 * - persistence (can wait)
31 */ 32 */
32#include "platform.h" 33#include "platform.h"
@@ -46,6 +47,7 @@
46 * to the DBLOCKS) and its depth, return the 47 * to the DBLOCKS) and its depth, return the
47 * offset where we would store this block 48 * offset where we would store this block
48 * in the file. 49 * in the file.
50
49 * 51 *
50 * @param fsize overall file size 52 * @param fsize overall file size
51 * @param off offset of the block in the file 53 * @param off offset of the block in the file
@@ -58,29 +60,48 @@
58 */ 60 */
59static uint64_t 61static uint64_t
60compute_disk_offset (uint64_t fsize, 62compute_disk_offset (uint64_t fsize,
61 uint64_t off, 63 uint64_t off,
62 unsigned int depth, 64 unsigned int depth,
63 unsigned int treedepth) 65 unsigned int treedepth)
64{ 66{
67 unsigned int i;
68 uint64_t lsize; /* what is the size of all IBlocks for level "i"? */
69 uint64_t loff; /* where do IBlocks for level "i" start? */
70 unsigned int ioff; /* which IBlock corresponds to "off" at level "i"? */
71
65 if (depth == treedepth) 72 if (depth == treedepth)
66 return off; 73 return off;
67 return 42; // FIXME 74 /* first IBlocks start at the end of file, rounded up
75 to full DBLOCK_SIZE */
76 loff = ((fsize + DBLOCK_SIZE - 1) / DBLOCK_SIZE) * DBLOCK_SIZE;
77 lsize = ( (fsize + DBLOCK_SIZE-1) / DBLOCK_SIZE) * sizeof (struct ContentHashKey);
78 GNUNET_assert (0 == (off % DBLOCK_SIZE));
79 ioff = (off / DBLOCK_SIZE);
80 for (i=treedepth-1;i>depth;i--)
81 {
82 loff += lsize;
83 lsize = (lsize + CHK_PER_INODE - 1) / CHK_PER_INODE;
84 GNUNET_assert (lsize > 0);
85 GNUNET_assert (0 == (ioff % CHK_PER_INODE));
86 ioff /= CHK_PER_INODE;
87 }
88 return loff + ioff * sizeof (struct ContentHashKey);
68} 89}
69 90
91
70/** 92/**
71 * Given a file of the specified treedepth and 93 * Given a file of the specified treedepth and a block at the given
72 * a block at the given offset and depth, 94 * offset and depth, calculate the offset for the CHK at the given
73 * calculate the offset for the CHK at 95 * index.
74 * the given index.
75 * 96 *
76 * @param offset the offset of the first 97 * @param offset the offset of the first
77 * DBLOCK in the subtree of the 98 * DBLOCK in the subtree of the
78 * identified IBLOCK 99 * identified IBLOCK
79 * @param depth the depth of the IBLOCK in the tree 100 * @param depth the depth of the IBLOCK in the tree
80 * @param treedepth overall depth of the tree 101 * @param treedepth overall depth of the tree
81 * @param i which CHK in the IBLOCK are we 102 * @param k which CHK in the IBLOCK are we
82 * talking about 103 * talking about
83 * @return offset if i=0, otherwise an appropriately 104 * @return offset if k=0, otherwise an appropriately
84 * larger value (i.e., if depth = treedepth-1, 105 * larger value (i.e., if depth = treedepth-1,
85 * the returned value should be offset+DBLOCK_SIZE) 106 * the returned value should be offset+DBLOCK_SIZE)
86 */ 107 */
@@ -88,12 +109,47 @@ static uint64_t
88compute_dblock_offset (uint64_t offset, 109compute_dblock_offset (uint64_t offset,
89 unsigned int depth, 110 unsigned int depth,
90 unsigned int treedepth, 111 unsigned int treedepth,
91 unsigned int i) 112 unsigned int k)
92{ 113{
93 GNUNET_assert (depth < treedepth); 114 unsigned int i;
94 if (i == 0) 115 uint64_t lsize; /* what is the size of the sum of all DBlocks
116 that a CHK at level i corresponds to? */
117
118 if (depth == treedepth)
95 return offset; 119 return offset;
96 return 42; // FIXME 120 lsize = DBLOCK_SIZE;
121 for (i=treedepth-1;i>depth;i--)
122 lsize *= CHK_PER_INODE;
123 return offset + i * lsize;
124}
125
126
127/**
128 * Fill in all of the generic fields for
129 * a download event.
130 *
131 * @param pc structure to fill in
132 * @param dc overall download context
133 */
134static void
135make_download_status (struct GNUNET_FS_ProgressInfo *pi,
136 struct GNUNET_FS_DownloadContext *dc)
137{
138 pi->value.download.dc = dc;
139 pi->value.download.cctx
140 = dc->client_info;
141 pi->value.download.pctx
142 = (dc->parent == NULL) ? NULL : dc->parent->client_info;
143 pi->value.download.uri
144 = dc->uri;
145 pi->value.download.length
146 = dc->length;
147 pi->value.download.duration
148 = GNUNET_TIME_absolute_get_duration (dc->start_time);
149 pi->value.download.completed
150 = dc->completed;
151 pi->value.download.anonymity
152 = dc->anonymity;
97} 153}
98 154
99 155
@@ -167,6 +223,50 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc);
167 223
168 224
169/** 225/**
226 * Compute how many bytes of data should be stored in
227 * the specified node.
228 *
229 * @param fsize overall file size
230 * @param off offset of the node
231 * @param depth depth of the node
232 * @return number of bytes stored in this node
233 */
234static size_t
235calculate_block_size (uint64_t fsize,
236 unsigned int totaldepth,
237 uint64_t offset,
238 unsigned int depth)
239{
240 unsigned int i;
241 size_t ret;
242 uint64_t rsize;
243 uint64_t epos;
244 unsigned int chks;
245
246 GNUNET_assert (offset < fsize);
247 if (depth == totaldepth)
248 {
249 ret = DBLOCK_SIZE;
250 if (offset + ret > fsize)
251 ret = (size_t) (fsize - offset);
252 return ret;
253 }
254
255 rsize = DBLOCK_SIZE;
256 for (i = totaldepth-1; i > depth; i--)
257 rsize *= CHK_PER_INODE;
258 epos = offset + rsize * CHK_PER_INODE;
259 GNUNET_assert (epos > offset);
260 if (epos > fsize)
261 epos = fsize;
262 /* round up when computing #CHKs in our IBlock */
263 chks = (epos - offset + rsize - 1) / rsize;
264 GNUNET_assert (chks <= CHK_PER_INODE);
265 return chks * sizeof (struct ContentHashKey);
266}
267
268
269/**
170 * Process a search result. 270 * Process a search result.
171 * 271 *
172 * @param sc our search context 272 * @param sc our search context
@@ -180,6 +280,7 @@ process_result (struct GNUNET_FS_DownloadContext *dc,
180 const void *data, 280 const void *data,
181 size_t size) 281 size_t size)
182{ 282{
283 struct GNUNET_FS_ProgressInfo pi;
183 GNUNET_HashCode query; 284 GNUNET_HashCode query;
184 struct DownloadRequest *sm; 285 struct DownloadRequest *sm;
185 struct GNUNET_CRYPTO_AesSessionKey skey; 286 struct GNUNET_CRYPTO_AesSessionKey skey;
@@ -189,8 +290,8 @@ process_result (struct GNUNET_FS_DownloadContext *dc,
189 size_t app; 290 size_t app;
190 unsigned int i; 291 unsigned int i;
191 struct ContentHashKey *chk; 292 struct ContentHashKey *chk;
293 char *emsg;
192 294
193 // FIXME: check that size is as big as expected, otherwise ignore!!!
194 GNUNET_CRYPTO_hash (data, size, &query); 295 GNUNET_CRYPTO_hash (data, size, &query);
195 sm = GNUNET_CONTAINER_multihashmap_get (dc->active, 296 sm = GNUNET_CONTAINER_multihashmap_get (dc->active,
196 &query); 297 &query);
@@ -199,6 +300,23 @@ process_result (struct GNUNET_FS_DownloadContext *dc,
199 GNUNET_break (0); 300 GNUNET_break (0);
200 return; 301 return;
201 } 302 }
303 if (size != calculate_block_size (GNUNET_ntohll (dc->uri->data.chk.file_length),
304 dc->treedepth,
305 sm->offset,
306 sm->depth))
307 {
308 dc->emsg = GNUNET_strdup ("Internal error or bogus download URI");
309 /* signal error */
310 pi.status = GNUNET_FS_STATUS_DOWNLOAD_ERROR;
311 make_download_status (&pi, dc);
312 pi.value.download.specifics.error.message = dc->emsg;
313 dc->client_info = dc->h->upcb (dc->h->upcb_cls,
314 &pi);
315 /* abort all pending requests */
316 GNUNET_CLIENT_disconnect (dc->client);
317 dc->client = NULL;
318 return;
319 }
202 GNUNET_assert (GNUNET_YES == 320 GNUNET_assert (GNUNET_YES ==
203 GNUNET_CONTAINER_multihashmap_remove (dc->active, 321 GNUNET_CONTAINER_multihashmap_remove (dc->active,
204 &query, 322 &query,
@@ -218,16 +336,44 @@ process_result (struct GNUNET_FS_DownloadContext *dc,
218 sm->offset, 336 sm->offset,
219 sm->depth, 337 sm->depth,
220 dc->treedepth); 338 dc->treedepth);
221 GNUNET_assert (off != 339 emsg = NULL;
222 GNUNET_DISK_file_seek (dc->handle, 340 if ( (off !=
223 off, 341 GNUNET_DISK_file_seek (dc->handle,
224 GNUNET_DISK_SEEK_SET) ); 342 off,
225 GNUNET_DISK_file_write (dc->handle, 343 GNUNET_DISK_SEEK_SET) ) )
226 pt, 344 GNUNET_asprintf (&emsg,
227 size); 345 _("Failed to seek to offset %llu in file `%s': %s\n"),
228 } 346 (unsigned long long) off,
229 // FIXME: make persistent 347 dc->filename,
348 STRERROR (errno));
349 else if (size !=
350 GNUNET_DISK_file_write (dc->handle,
351 pt,
352 size))
353 GNUNET_asprintf (&emsg,
354 _("Failed to write block of %u bytes at offset %llu in file `%s': %s\n"),
355 (unsigned int) size,
356 (unsigned long long) off,
357 dc->filename,
358 STRERROR (errno));
359 if (NULL != emsg)
360 {
361 dc->emsg = emsg;
362 // FIXME: make persistent
363
364 /* signal error */
365 pi.status = GNUNET_FS_STATUS_DOWNLOAD_ERROR;
366 make_download_status (&pi, dc);
367 pi.value.download.specifics.error.message = emsg;
368 dc->client_info = dc->h->upcb (dc->h->upcb_cls,
369 &pi);
230 370
371 /* abort all pending requests */
372 GNUNET_CLIENT_disconnect (dc->client);
373 dc->client = NULL;
374 return;
375 }
376 }
231 if (sm->depth == dc->treedepth) 377 if (sm->depth == dc->treedepth)
232 { 378 {
233 app = size; 379 app = size;
@@ -247,7 +393,37 @@ process_result (struct GNUNET_FS_DownloadContext *dc,
247 } 393 }
248 dc->completed += app; 394 dc->completed += app;
249 } 395 }
250 // FIXME: call progress callback 396
397 pi.status = GNUNET_FS_STATUS_DOWNLOAD_PROGRESS;
398 make_download_status (&pi, dc);
399 pi.value.download.specifics.progress.data = pt;
400 pi.value.download.specifics.progress.offset = sm->offset;
401 pi.value.download.specifics.progress.data_len = size;
402 pi.value.download.specifics.progress.depth = sm->depth;
403 dc->client_info = dc->h->upcb (dc->h->upcb_cls,
404 &pi);
405 GNUNET_assert (dc->completed <= dc->length);
406 if (dc->completed == dc->length)
407 {
408 /* truncate file to size (since we store IBlocks at the end) */
409 if (dc->handle != NULL)
410 {
411 GNUNET_DISK_file_close (dc->handle);
412 dc->handle = NULL;
413 if (0 != truncate (dc->filename,
414 GNUNET_ntohll (dc->uri->data.chk.file_length)))
415 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
416 "truncate",
417 dc->filename);
418 }
419 /* signal completion */
420 pi.status = GNUNET_FS_STATUS_DOWNLOAD_COMPLETED;
421 make_download_status (&pi, dc);
422 dc->client_info = dc->h->upcb (dc->h->upcb_cls,
423 &pi);
424 GNUNET_assert (sm->depth == dc->treedepth);
425 }
426 // FIXME: make persistent
251 if (sm->depth == dc->treedepth) 427 if (sm->depth == dc->treedepth)
252 return; 428 return;
253 GNUNET_assert (0 == (size % sizeof(struct ContentHashKey))); 429 GNUNET_assert (0 == (size % sizeof(struct ContentHashKey)));
@@ -458,6 +634,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc)
458 * 634 *
459 * @param h handle to the file sharing subsystem 635 * @param h handle to the file sharing subsystem
460 * @param uri the URI of the file (determines what to download); CHK or LOC URI 636 * @param uri the URI of the file (determines what to download); CHK or LOC URI
637 * @param meta known metadata for the file (can be NULL)
461 * @param filename where to store the file, maybe NULL (then no file is 638 * @param filename where to store the file, maybe NULL (then no file is
462 * created on disk and data must be grabbed from the callbacks) 639 * created on disk and data must be grabbed from the callbacks)
463 * @param offset at what offset should we start the download (typically 0) 640 * @param offset at what offset should we start the download (typically 0)
@@ -471,6 +648,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc)
471struct GNUNET_FS_DownloadContext * 648struct GNUNET_FS_DownloadContext *
472GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h, 649GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
473 const struct GNUNET_FS_Uri *uri, 650 const struct GNUNET_FS_Uri *uri,
651 const struct GNUNET_CONTAINER_MetaData *meta,
474 const char *filename, 652 const char *filename,
475 uint64_t offset, 653 uint64_t offset,
476 uint64_t length, 654 uint64_t length,
@@ -478,6 +656,7 @@ GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
478 enum GNUNET_FS_DownloadOptions options, 656 enum GNUNET_FS_DownloadOptions options,
479 struct GNUNET_FS_DownloadContext *parent) 657 struct GNUNET_FS_DownloadContext *parent)
480{ 658{
659 struct GNUNET_FS_ProgressInfo pi;
481 struct GNUNET_FS_DownloadContext *dc; 660 struct GNUNET_FS_DownloadContext *dc;
482 struct GNUNET_CLIENT_Connection *client; 661 struct GNUNET_CLIENT_Connection *client;
483 662
@@ -499,6 +678,7 @@ GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
499 dc->client = client; 678 dc->client = client;
500 dc->parent = parent; 679 dc->parent = parent;
501 dc->uri = GNUNET_FS_uri_dup (uri); 680 dc->uri = GNUNET_FS_uri_dup (uri);
681 dc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
502 if (NULL != filename) 682 if (NULL != filename)
503 { 683 {
504 dc->filename = GNUNET_strdup (filename); 684 dc->filename = GNUNET_strdup (filename);
@@ -519,6 +699,7 @@ GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
519 _("Download failed: could not open file `%s': %s\n"), 699 _("Download failed: could not open file `%s': %s\n"),
520 dc->filename, 700 dc->filename,
521 STRERROR (errno)); 701 STRERROR (errno));
702 GNUNET_CONTAINER_meta_data_destroy (dc->meta);
522 GNUNET_FS_uri_destroy (dc->uri); 703 GNUNET_FS_uri_destroy (dc->uri);
523 GNUNET_free (dc->filename); 704 GNUNET_free (dc->filename);
524 GNUNET_CLIENT_disconnect (dc->client); 705 GNUNET_CLIENT_disconnect (dc->client);
@@ -547,7 +728,12 @@ GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
547 &receive_results, 728 &receive_results,
548 dc, 729 dc,
549 GNUNET_TIME_UNIT_FOREVER_REL); 730 GNUNET_TIME_UNIT_FOREVER_REL);
550 // FIXME: signal download start 731 pi.status = GNUNET_FS_STATUS_DOWNLOAD_START;
732 make_download_status (&pi, dc);
733 pi.value.download.specifics.start.meta = meta;
734 dc->client_info = dc->h->upcb (dc->h->upcb_cls,
735 &pi);
736
551 return dc; 737 return dc;
552} 738}
553 739
@@ -580,9 +766,14 @@ void
580GNUNET_FS_file_download_stop (struct GNUNET_FS_DownloadContext *dc, 766GNUNET_FS_file_download_stop (struct GNUNET_FS_DownloadContext *dc,
581 int do_delete) 767 int do_delete)
582{ 768{
583 // FIXME: make unpersistent 769 struct GNUNET_FS_ProgressInfo pi;
584 // FIXME: signal download end 770
585 771 // FIXME: make unpersistent
772 pi.status = GNUNET_FS_STATUS_DOWNLOAD_STOPPED;
773 make_download_status (&pi, dc);
774 dc->client_info = dc->h->upcb (dc->h->upcb_cls,
775 &pi);
776
586 if (GNUNET_SCHEDULER_NO_TASK != dc->task) 777 if (GNUNET_SCHEDULER_NO_TASK != dc->task)
587 GNUNET_SCHEDULER_cancel (dc->h->sched, 778 GNUNET_SCHEDULER_cancel (dc->h->sched,
588 dc->task); 779 dc->task);
@@ -594,7 +785,8 @@ GNUNET_FS_file_download_stop (struct GNUNET_FS_DownloadContext *dc,
594 GNUNET_CONTAINER_multihashmap_destroy (dc->active); 785 GNUNET_CONTAINER_multihashmap_destroy (dc->active);
595 if (dc->filename != NULL) 786 if (dc->filename != NULL)
596 { 787 {
597 GNUNET_DISK_file_close (dc->handle); 788 if (NULL != dc->handle)
789 GNUNET_DISK_file_close (dc->handle);
598 if ( (dc->completed != dc->length) && 790 if ( (dc->completed != dc->length) &&
599 (GNUNET_YES == do_delete) ) 791 (GNUNET_YES == do_delete) )
600 { 792 {
@@ -605,75 +797,15 @@ GNUNET_FS_file_download_stop (struct GNUNET_FS_DownloadContext *dc,
605 } 797 }
606 GNUNET_free (dc->filename); 798 GNUNET_free (dc->filename);
607 } 799 }
800 GNUNET_CONTAINER_meta_data_destroy (dc->meta);
608 GNUNET_FS_uri_destroy (dc->uri); 801 GNUNET_FS_uri_destroy (dc->uri);
609 GNUNET_free (dc); 802 GNUNET_free (dc);
610} 803}
611 804
612 805
613 806
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629#if 0 807#if 0
630 808
631/**
632 * Compute how many bytes of data are stored in
633 * this node.
634 */
635static unsigned int
636get_node_size (const struct Node *node)
637{
638 unsigned int i;
639 unsigned int ret;
640 unsigned long long rsize;
641 unsigned long long spos;
642 unsigned long long epos;
643
644 GNUNET_GE_ASSERT (node->ctx->ectx, node->offset < node->ctx->total);
645 if (node->level == 0)
646 {
647 ret = GNUNET_ECRS_DBLOCK_SIZE;
648 if (node->offset + (unsigned long long) ret > node->ctx->total)
649 ret = (unsigned int) (node->ctx->total - node->offset);
650#if DEBUG_DOWNLOAD
651 GNUNET_GE_LOG (node->ctx->rm->ectx,
652 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
653 "Node at offset %llu and level %d has size %u\n",
654 node->offset, node->level, ret);
655#endif
656 return ret;
657 }
658 rsize = GNUNET_ECRS_DBLOCK_SIZE;
659 for (i = 0; i < node->level - 1; i++)
660 rsize *= GNUNET_ECRS_CHK_PER_INODE;
661 spos = rsize * (node->offset / sizeof (GNUNET_EC_ContentHashKey));
662 epos = spos + rsize * GNUNET_ECRS_CHK_PER_INODE;
663 if (epos > node->ctx->total)
664 epos = node->ctx->total;
665 ret = (epos - spos) / rsize;
666 if (ret * rsize < epos - spos)
667 ret++; /* need to round up! */
668#if DEBUG_DOWNLOAD
669 GNUNET_GE_LOG (node->ctx->rm->ectx,
670 GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
671 "Node at offset %llu and level %d has size %u\n",
672 node->offset, node->level,
673 ret * sizeof (GNUNET_EC_ContentHashKey));
674#endif
675 return ret * sizeof (GNUNET_EC_ContentHashKey);
676}
677 809
678/** 810/**
679 * Check if self block is already present on the drive. If the block 811 * Check if self block is already present on the drive. If the block
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index 5de9cbeb8..e173b1149 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -192,8 +192,8 @@ GNUNET_FS_file_information_create_from_file (void *client_info,
192 const struct GNUNET_FS_Uri *keywords, 192 const struct GNUNET_FS_Uri *keywords,
193 const struct GNUNET_CONTAINER_MetaData *meta, 193 const struct GNUNET_CONTAINER_MetaData *meta,
194 int do_index, 194 int do_index,
195 unsigned int anonymity, 195 uint32_t anonymity,
196 unsigned int priority, 196 uint32_t priority,
197 struct GNUNET_TIME_Absolute expirationTime) 197 struct GNUNET_TIME_Absolute expirationTime)
198{ 198{
199 struct FileInfo *fi; 199 struct FileInfo *fi;
@@ -280,8 +280,8 @@ GNUNET_FS_file_information_create_from_data (void *client_info,
280 const struct GNUNET_FS_Uri *keywords, 280 const struct GNUNET_FS_Uri *keywords,
281 const struct GNUNET_CONTAINER_MetaData *meta, 281 const struct GNUNET_CONTAINER_MetaData *meta,
282 int do_index, 282 int do_index,
283 unsigned int anonymity, 283 uint32_t anonymity,
284 unsigned int priority, 284 uint32_t priority,
285 struct GNUNET_TIME_Absolute expirationTime) 285 struct GNUNET_TIME_Absolute expirationTime)
286{ 286{
287 return GNUNET_FS_file_information_create_from_reader (client_info, 287 return GNUNET_FS_file_information_create_from_reader (client_info,
@@ -323,8 +323,8 @@ GNUNET_FS_file_information_create_from_reader (void *client_info,
323 const struct GNUNET_FS_Uri *keywords, 323 const struct GNUNET_FS_Uri *keywords,
324 const struct GNUNET_CONTAINER_MetaData *meta, 324 const struct GNUNET_CONTAINER_MetaData *meta,
325 int do_index, 325 int do_index,
326 unsigned int anonymity, 326 uint32_t anonymity,
327 unsigned int priority, 327 uint32_t priority,
328 struct GNUNET_TIME_Absolute expirationTime) 328 struct GNUNET_TIME_Absolute expirationTime)
329{ 329{
330 struct GNUNET_FS_FileInformation *ret; 330 struct GNUNET_FS_FileInformation *ret;
@@ -387,12 +387,12 @@ struct DirScanCls
387 /** 387 /**
388 * Desired anonymity level. 388 * Desired anonymity level.
389 */ 389 */
390 unsigned int anonymity; 390 uint32_t anonymity;
391 391
392 /** 392 /**
393 * Desired publishing priority. 393 * Desired publishing priority.
394 */ 394 */
395 unsigned int priority; 395 uint32_t priority;
396 396
397 /** 397 /**
398 * Expiration time for publication. 398 * Expiration time for publication.
@@ -499,8 +499,8 @@ int
499GNUNET_FS_directory_scanner_default (void *cls, 499GNUNET_FS_directory_scanner_default (void *cls,
500 const char *dirname, 500 const char *dirname,
501 int do_index, 501 int do_index,
502 unsigned int anonymity, 502 uint32_t anonymity,
503 unsigned int priority, 503 uint32_t priority,
504 struct GNUNET_TIME_Absolute expirationTime, 504 struct GNUNET_TIME_Absolute expirationTime,
505 GNUNET_FS_FileProcessor proc, 505 GNUNET_FS_FileProcessor proc,
506 void *proc_cls, 506 void *proc_cls,
@@ -593,8 +593,8 @@ GNUNET_FS_file_information_create_from_directory (void *client_info,
593 GNUNET_FS_DirectoryScanner scanner, 593 GNUNET_FS_DirectoryScanner scanner,
594 void *scanner_cls, 594 void *scanner_cls,
595 int do_index, 595 int do_index,
596 unsigned int anonymity, 596 uint32_t anonymity,
597 unsigned int priority, 597 uint32_t priority,
598 struct GNUNET_TIME_Absolute expirationTime, 598 struct GNUNET_TIME_Absolute expirationTime,
599 char **emsg) 599 char **emsg)
600{ 600{
@@ -656,8 +656,8 @@ struct GNUNET_FS_FileInformation *
656GNUNET_FS_file_information_create_empty_directory (void *client_info, 656GNUNET_FS_file_information_create_empty_directory (void *client_info,
657 const struct GNUNET_CONTAINER_MetaData *meta, 657 const struct GNUNET_CONTAINER_MetaData *meta,
658 const struct GNUNET_FS_Uri *keywords, 658 const struct GNUNET_FS_Uri *keywords,
659 unsigned int anonymity, 659 uint32_t anonymity,
660 unsigned int priority, 660 uint32_t priority,
661 struct GNUNET_TIME_Absolute expirationTime) 661 struct GNUNET_TIME_Absolute expirationTime)
662{ 662{
663 struct GNUNET_FS_FileInformation *ret; 663 struct GNUNET_FS_FileInformation *ret;
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c
index fb45d99e9..64763d164 100644
--- a/src/fs/fs_namespace.c
+++ b/src/fs/fs_namespace.c
@@ -46,9 +46,9 @@
46struct GNUNET_FS_Uri * 46struct GNUNET_FS_Uri *
47GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, 47GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
48 struct GNUNET_FS_Namespace *namespace, 48 struct GNUNET_FS_Namespace *namespace,
49 const struct GNUNET_MetaData *meta, 49 const struct GNUNET_CONTAINER_MetaData *meta,
50 unsigned int anonymity, 50 uint32_t anonymity,
51 unsigned int priority, 51 uint32_t priority,
52 struct GNUNET_TIME_Absolute expiration, 52 struct GNUNET_TIME_Absolute expiration,
53 const struct GNUNET_FS_Uri *advertisementURI, 53 const struct GNUNET_FS_Uri *advertisementURI,
54 const char *rootEntry) 54 const char *rootEntry)
@@ -284,9 +284,9 @@ write_namespace_key (struct GNUNET_GC_Configuration *cfg,
284struct GNUNET_ECRS_URI * 284struct GNUNET_ECRS_URI *
285GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context *ectx, 285GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context *ectx,
286 struct GNUNET_GC_Configuration *cfg, 286 struct GNUNET_GC_Configuration *cfg,
287 const struct GNUNET_MetaData *meta, 287 const struct GNUNET_CONTAINER_MetaData *meta,
288 unsigned int anonymityLevel, 288 uint32_t anonymityLevel,
289 unsigned int priority, 289 uint32_t priority,
290 GNUNET_CronTime expiration, 290 GNUNET_CronTime expiration,
291 const struct GNUNET_ECRS_URI *advertisementURI, 291 const struct GNUNET_ECRS_URI *advertisementURI,
292 const char *rootEntry) 292 const char *rootEntry)
@@ -519,8 +519,8 @@ struct GNUNET_ECRS_URI *
519GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx, 519GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx,
520 struct GNUNET_GC_Configuration *cfg, 520 struct GNUNET_GC_Configuration *cfg,
521 const GNUNET_HashCode * pid, 521 const GNUNET_HashCode * pid,
522 unsigned int anonymityLevel, 522 uint32_t anonymityLevel,
523 unsigned int priority, 523 uint32_t priority,
524 GNUNET_CronTime expiration, 524 GNUNET_CronTime expiration,
525 const char *thisId, 525 const char *thisId,
526 const char *nextId, 526 const char *nextId,
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 422984ecb..d58ea3f37 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -467,7 +467,7 @@ static void
467block_proc (void *cls, 467block_proc (void *cls,
468 const GNUNET_HashCode *query, 468 const GNUNET_HashCode *query,
469 uint64_t offset, 469 uint64_t offset,
470 unsigned int type, 470 uint32_t type,
471 const void *block, 471 const void *block,
472 uint16_t block_size) 472 uint16_t block_size)
473{ 473{
@@ -909,8 +909,8 @@ fip_signal_start(void *cls,
909 uint64_t length, 909 uint64_t length,
910 struct GNUNET_CONTAINER_MetaData *meta, 910 struct GNUNET_CONTAINER_MetaData *meta,
911 struct GNUNET_FS_Uri **uri, 911 struct GNUNET_FS_Uri **uri,
912 unsigned int *anonymity, 912 uint32_t *anonymity,
913 unsigned int *priority, 913 uint32_t *priority,
914 struct GNUNET_TIME_Absolute *expirationTime, 914 struct GNUNET_TIME_Absolute *expirationTime,
915 void **client_info) 915 void **client_info)
916{ 916{
@@ -1021,8 +1021,8 @@ fip_signal_stop(void *cls,
1021 uint64_t length, 1021 uint64_t length,
1022 struct GNUNET_CONTAINER_MetaData *meta, 1022 struct GNUNET_CONTAINER_MetaData *meta,
1023 struct GNUNET_FS_Uri **uri, 1023 struct GNUNET_FS_Uri **uri,
1024 unsigned int *anonymity, 1024 uint32_t *anonymity,
1025 unsigned int *priority, 1025 uint32_t *priority,
1026 struct GNUNET_TIME_Absolute *expirationTime, 1026 struct GNUNET_TIME_Absolute *expirationTime,
1027 void **client_info) 1027 void **client_info)
1028{ 1028{
@@ -1135,12 +1135,12 @@ struct PublishKskContext
1135 /** 1135 /**
1136 * Anonymity level for the KBlocks. 1136 * Anonymity level for the KBlocks.
1137 */ 1137 */
1138 unsigned int anonymity; 1138 uint32_t anonymity;
1139 1139
1140 /** 1140 /**
1141 * Priority for the KBlocks. 1141 * Priority for the KBlocks.
1142 */ 1142 */
1143 unsigned int priority; 1143 uint32_t priority;
1144}; 1144};
1145 1145
1146 1146
@@ -1284,8 +1284,8 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
1284 struct GNUNET_CONTAINER_MetaData *meta, 1284 struct GNUNET_CONTAINER_MetaData *meta,
1285 struct GNUNET_FS_Uri *uri, 1285 struct GNUNET_FS_Uri *uri,
1286 struct GNUNET_TIME_Absolute expirationTime, 1286 struct GNUNET_TIME_Absolute expirationTime,
1287 unsigned int anonymity, 1287 uint32_t anonymity,
1288 unsigned int priority, 1288 uint32_t priority,
1289 enum GNUNET_FS_PublishOptions options, 1289 enum GNUNET_FS_PublishOptions options,
1290 GNUNET_FS_PublishContinuation cont, 1290 GNUNET_FS_PublishContinuation cont,
1291 void *cont_cls) 1291 void *cont_cls)
@@ -1443,8 +1443,8 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
1443 struct GNUNET_CONTAINER_MetaData *meta, 1443 struct GNUNET_CONTAINER_MetaData *meta,
1444 struct GNUNET_FS_Uri *uri, 1444 struct GNUNET_FS_Uri *uri,
1445 struct GNUNET_TIME_Absolute expirationTime, 1445 struct GNUNET_TIME_Absolute expirationTime,
1446 unsigned int anonymity, 1446 uint32_t anonymity,
1447 unsigned int priority, 1447 uint32_t priority,
1448 enum GNUNET_FS_PublishOptions options, 1448 enum GNUNET_FS_PublishOptions options,
1449 GNUNET_FS_PublishContinuation cont, 1449 GNUNET_FS_PublishContinuation cont,
1450 void *cont_cls) 1450 void *cont_cls)
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 109a76791..fd7dcf6d9 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -274,7 +274,7 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc,
274static struct GNUNET_FS_SearchContext * 274static struct GNUNET_FS_SearchContext *
275search_start (struct GNUNET_FS_Handle *h, 275search_start (struct GNUNET_FS_Handle *h,
276 const struct GNUNET_FS_Uri *uri, 276 const struct GNUNET_FS_Uri *uri,
277 unsigned int anonymity, 277 uint32_t anonymity,
278 struct GNUNET_FS_SearchContext *parent); 278 struct GNUNET_FS_SearchContext *parent);
279 279
280 280
@@ -738,7 +738,7 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc)
738static struct GNUNET_FS_SearchContext * 738static struct GNUNET_FS_SearchContext *
739search_start (struct GNUNET_FS_Handle *h, 739search_start (struct GNUNET_FS_Handle *h,
740 const struct GNUNET_FS_Uri *uri, 740 const struct GNUNET_FS_Uri *uri,
741 unsigned int anonymity, 741 uint32_t anonymity,
742 struct GNUNET_FS_SearchContext *parent) 742 struct GNUNET_FS_SearchContext *parent)
743{ 743{
744 struct GNUNET_FS_SearchContext *sc; 744 struct GNUNET_FS_SearchContext *sc;
@@ -830,7 +830,7 @@ search_start (struct GNUNET_FS_Handle *h,
830struct GNUNET_FS_SearchContext * 830struct GNUNET_FS_SearchContext *
831GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, 831GNUNET_FS_search_start (struct GNUNET_FS_Handle *h,
832 const struct GNUNET_FS_Uri *uri, 832 const struct GNUNET_FS_Uri *uri,
833 unsigned int anonymity) 833 uint32_t anonymity)
834{ 834{
835 return search_start (h, uri, anonymity, NULL); 835 return search_start (h, uri, anonymity, NULL);
836} 836}
diff --git a/src/fs/fs_tree.h b/src/fs/fs_tree.h
index 4186a4e21..bfbd7019b 100644
--- a/src/fs/fs_tree.h
+++ b/src/fs/fs_tree.h
@@ -67,7 +67,7 @@ struct GNUNET_FS_TreeEncoder;
67typedef void (*GNUNET_FS_TreeBlockProcessor)(void *cls, 67typedef void (*GNUNET_FS_TreeBlockProcessor)(void *cls,
68 const GNUNET_HashCode *query, 68 const GNUNET_HashCode *query,
69 uint64_t offset, 69 uint64_t offset,
70 unsigned int type, 70 uint32_t type,
71 const void *block, 71 const void *block,
72 uint16_t block_size); 72 uint16_t block_size);
73 73
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c
index 23779bc97..03dae383f 100644
--- a/src/fs/fs_unindex.c
+++ b/src/fs/fs_unindex.c
@@ -200,7 +200,7 @@ static void
200unindex_process (void *cls, 200unindex_process (void *cls,
201 const GNUNET_HashCode *query, 201 const GNUNET_HashCode *query,
202 uint64_t offset, 202 uint64_t offset,
203 unsigned int type, 203 uint32_t type,
204 const void *block, 204 const void *block,
205 uint16_t block_size) 205 uint16_t block_size)
206{ 206{
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index fb6b7f133..ee10a0156 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -415,7 +415,7 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext*
415 * the metadata must be passed as the "scls" argument. 415 * the metadata must be passed as the "scls" argument.
416 * 416 *
417 * @param ctx command line processor context 417 * @param ctx command line processor context
418 * @param scls must be of type "struct GNUNET_MetaData **" 418 * @param scls must be of type "struct GNUNET_CONTAINER_MetaData **"
419 * @param option name of the option (typically 'k') 419 * @param option name of the option (typically 'k')
420 * @param value command line argument given 420 * @param value command line argument given
421 * @return GNUNET_OK on success 421 * @return GNUNET_OK on success
@@ -864,12 +864,11 @@ struct GNUNET_FS_ProgressInfo
864 const struct GNUNET_FS_Uri *uri; 864 const struct GNUNET_FS_Uri *uri;
865 865
866 /** 866 /**
867 * How large is the file overall? For directories, 867 * How large is the download overall? This
868 * this is only the size of the directory itself, 868 * is NOT necessarily the size from the
869 * not of the other files contained within the 869 * URI since we may be doing a partial download.
870 * directory.
871 */ 870 */
872 uint64_t size; 871 uint64_t length;
873 872
874 /** 873 /**
875 * At what time do we expect to finish the download? 874 * At what time do we expect to finish the download?
@@ -938,8 +937,8 @@ struct GNUNET_FS_ProgressInfo
938 /** 937 /**
939 * Known metadata for the download. 938 * Known metadata for the download.
940 */ 939 */
941 const struct GNUNET_MetaData *meta; 940 const struct GNUNET_CONTAINER_MetaData *meta;
942 941
943 } start; 942 } start;
944 943
945 /** 944 /**
@@ -951,7 +950,7 @@ struct GNUNET_FS_ProgressInfo
951 /** 950 /**
952 * Known metadata for the download. 951 * Known metadata for the download.
953 */ 952 */
954 const struct GNUNET_MetaData *meta; 953 const struct GNUNET_CONTAINER_MetaData *meta;
955 954
956 /** 955 /**
957 * Error message, NULL if we have not encountered any error yet. 956 * Error message, NULL if we have not encountered any error yet.
@@ -1449,8 +1448,8 @@ typedef int (*GNUNET_FS_FileInformationProcessor)(void *cls,
1449 uint64_t length, 1448 uint64_t length,
1450 struct GNUNET_CONTAINER_MetaData *meta, 1449 struct GNUNET_CONTAINER_MetaData *meta,
1451 struct GNUNET_FS_Uri **uri, 1450 struct GNUNET_FS_Uri **uri,
1452 unsigned int *anonymity, 1451 uint32_t *anonymity,
1453 unsigned int *priority, 1452 uint32_t *priority,
1454 struct GNUNET_TIME_Absolute *expirationTime, 1453 struct GNUNET_TIME_Absolute *expirationTime,
1455 void **client_info); 1454 void **client_info);
1456 1455
@@ -1513,8 +1512,8 @@ GNUNET_FS_file_information_create_from_file (void *client_info,
1513 const struct GNUNET_FS_Uri *keywords, 1512 const struct GNUNET_FS_Uri *keywords,
1514 const struct GNUNET_CONTAINER_MetaData *meta, 1513 const struct GNUNET_CONTAINER_MetaData *meta,
1515 int do_index, 1514 int do_index,
1516 unsigned int anonymity, 1515 uint32_t anonymity,
1517 unsigned int priority, 1516 uint32_t priority,
1518 struct GNUNET_TIME_Absolute expirationTime); 1517 struct GNUNET_TIME_Absolute expirationTime);
1519 1518
1520 1519
@@ -1543,8 +1542,8 @@ GNUNET_FS_file_information_create_from_data (void *client_info,
1543 const struct GNUNET_FS_Uri *keywords, 1542 const struct GNUNET_FS_Uri *keywords,
1544 const struct GNUNET_CONTAINER_MetaData *meta, 1543 const struct GNUNET_CONTAINER_MetaData *meta,
1545 int do_index, 1544 int do_index,
1546 unsigned int anonymity, 1545 uint32_t anonymity,
1547 unsigned int priority, 1546 uint32_t priority,
1548 struct GNUNET_TIME_Absolute expirationTime); 1547 struct GNUNET_TIME_Absolute expirationTime);
1549 1548
1550 1549
@@ -1597,8 +1596,8 @@ GNUNET_FS_file_information_create_from_reader (void *client_info,
1597 const struct GNUNET_FS_Uri *keywords, 1596 const struct GNUNET_FS_Uri *keywords,
1598 const struct GNUNET_CONTAINER_MetaData *meta, 1597 const struct GNUNET_CONTAINER_MetaData *meta,
1599 int do_index, 1598 int do_index,
1600 unsigned int anonymity, 1599 uint32_t anonymity,
1601 unsigned int priority, 1600 uint32_t priority,
1602 struct GNUNET_TIME_Absolute expirationTime); 1601 struct GNUNET_TIME_Absolute expirationTime);
1603 1602
1604 1603
@@ -1634,8 +1633,8 @@ typedef void (*GNUNET_FS_FileProcessor)(void *cls,
1634typedef int (*GNUNET_FS_DirectoryScanner)(void *cls, 1633typedef int (*GNUNET_FS_DirectoryScanner)(void *cls,
1635 const char *dirname, 1634 const char *dirname,
1636 int do_index, 1635 int do_index,
1637 unsigned int anonymity, 1636 uint32_t anonymity,
1638 unsigned int priority, 1637 uint32_t priority,
1639 struct GNUNET_TIME_Absolute expirationTime, 1638 struct GNUNET_TIME_Absolute expirationTime,
1640 GNUNET_FS_FileProcessor proc, 1639 GNUNET_FS_FileProcessor proc,
1641 void *proc_cls, 1640 void *proc_cls,
@@ -1669,8 +1668,8 @@ int
1669GNUNET_FS_directory_scanner_default (void *cls, 1668GNUNET_FS_directory_scanner_default (void *cls,
1670 const char *dirname, 1669 const char *dirname,
1671 int do_index, 1670 int do_index,
1672 unsigned int anonymity, 1671 uint32_t anonymity,
1673 unsigned int priority, 1672 uint32_t priority,
1674 struct GNUNET_TIME_Absolute expirationTime, 1673 struct GNUNET_TIME_Absolute expirationTime,
1675 GNUNET_FS_FileProcessor proc, 1674 GNUNET_FS_FileProcessor proc,
1676 void *proc_cls, 1675 void *proc_cls,
@@ -1705,8 +1704,8 @@ GNUNET_FS_file_information_create_from_directory (void *client_info,
1705 GNUNET_FS_DirectoryScanner scanner, 1704 GNUNET_FS_DirectoryScanner scanner,
1706 void *scanner_cls, 1705 void *scanner_cls,
1707 int do_index, 1706 int do_index,
1708 unsigned int anonymity, 1707 uint32_t anonymity,
1709 unsigned int priority, 1708 uint32_t priority,
1710 struct GNUNET_TIME_Absolute expirationTime, 1709 struct GNUNET_TIME_Absolute expirationTime,
1711 char **emsg); 1710 char **emsg);
1712 1711
@@ -1731,8 +1730,8 @@ struct GNUNET_FS_FileInformation *
1731GNUNET_FS_file_information_create_empty_directory (void *client_info, 1730GNUNET_FS_file_information_create_empty_directory (void *client_info,
1732 const struct GNUNET_CONTAINER_MetaData *meta, 1731 const struct GNUNET_CONTAINER_MetaData *meta,
1733 const struct GNUNET_FS_Uri *keywords, 1732 const struct GNUNET_FS_Uri *keywords,
1734 unsigned int anonymity, 1733 uint32_t anonymity,
1735 unsigned int priority, 1734 uint32_t priority,
1736 struct GNUNET_TIME_Absolute expirationTime); 1735 struct GNUNET_TIME_Absolute expirationTime);
1737 1736
1738 1737
@@ -1874,8 +1873,8 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
1874 struct GNUNET_CONTAINER_MetaData *meta, 1873 struct GNUNET_CONTAINER_MetaData *meta,
1875 struct GNUNET_FS_Uri *uri, 1874 struct GNUNET_FS_Uri *uri,
1876 struct GNUNET_TIME_Absolute expirationTime, 1875 struct GNUNET_TIME_Absolute expirationTime,
1877 unsigned int anonymity, 1876 uint32_t anonymity,
1878 unsigned int priority, 1877 uint32_t priority,
1879 enum GNUNET_FS_PublishOptions options, 1878 enum GNUNET_FS_PublishOptions options,
1880 GNUNET_FS_PublishContinuation cont, 1879 GNUNET_FS_PublishContinuation cont,
1881 void *cont_cls); 1880 void *cont_cls);
@@ -1904,8 +1903,8 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
1904 struct GNUNET_CONTAINER_MetaData *meta, 1903 struct GNUNET_CONTAINER_MetaData *meta,
1905 struct GNUNET_FS_Uri *uri, 1904 struct GNUNET_FS_Uri *uri,
1906 struct GNUNET_TIME_Absolute expirationTime, 1905 struct GNUNET_TIME_Absolute expirationTime,
1907 unsigned int anonymity, 1906 uint32_t anonymity,
1908 unsigned int priority, 1907 uint32_t priority,
1909 enum GNUNET_FS_PublishOptions options, 1908 enum GNUNET_FS_PublishOptions options,
1910 GNUNET_FS_PublishContinuation cont, 1909 GNUNET_FS_PublishContinuation cont,
1911 void *cont_cls); 1910 void *cont_cls);
@@ -1983,9 +1982,9 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc);
1983struct GNUNET_FS_Uri * 1982struct GNUNET_FS_Uri *
1984GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, 1983GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
1985 struct GNUNET_FS_Namespace *namespace, 1984 struct GNUNET_FS_Namespace *namespace,
1986 const struct GNUNET_MetaData *meta, 1985 const struct GNUNET_CONTAINER_MetaData *meta,
1987 unsigned int anonymity, 1986 uint32_t anonymity,
1988 unsigned int priority, 1987 uint32_t priority,
1989 struct GNUNET_TIME_Absolute expiration, 1988 struct GNUNET_TIME_Absolute expiration,
1990 const struct GNUNET_FS_Uri *advertisementURI, 1989 const struct GNUNET_FS_Uri *advertisementURI,
1991 const char *rootEntry); 1990 const char *rootEntry);
@@ -2092,7 +2091,7 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace,
2092struct GNUNET_FS_SearchContext * 2091struct GNUNET_FS_SearchContext *
2093GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, 2092GNUNET_FS_search_start (struct GNUNET_FS_Handle *h,
2094 const struct GNUNET_FS_Uri *uri, 2093 const struct GNUNET_FS_Uri *uri,
2095 unsigned int anonymity); 2094 uint32_t anonymity);
2096 2095
2097 2096
2098/** 2097/**
@@ -2165,6 +2164,7 @@ enum GNUNET_FS_DownloadOptions
2165 * 2164 *
2166 * @param h handle to the file sharing subsystem 2165 * @param h handle to the file sharing subsystem
2167 * @param uri the URI of the file (determines what to download); CHK or LOC URI 2166 * @param uri the URI of the file (determines what to download); CHK or LOC URI
2167 * @param meta known metadata for the file (can be NULL)
2168 * @param filename where to store the file, maybe NULL (then no file is 2168 * @param filename where to store the file, maybe NULL (then no file is
2169 * created on disk and data must be grabbed from the callbacks) 2169 * created on disk and data must be grabbed from the callbacks)
2170 * @param offset at what offset should we start the download (typically 0) 2170 * @param offset at what offset should we start the download (typically 0)
@@ -2178,6 +2178,7 @@ enum GNUNET_FS_DownloadOptions
2178struct GNUNET_FS_DownloadContext * 2178struct GNUNET_FS_DownloadContext *
2179GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h, 2179GNUNET_FS_file_download_start (struct GNUNET_FS_Handle *h,
2180 const struct GNUNET_FS_Uri *uri, 2180 const struct GNUNET_FS_Uri *uri,
2181 const struct GNUNET_CONTAINER_MetaData *meta,
2181 const char *filename, 2182 const char *filename,
2182 uint64_t offset, 2183 uint64_t offset,
2183 uint64_t length, 2184 uint64_t length,