diff options
Diffstat (limited to 'src/include/gnunet_fs_service.h')
-rw-r--r-- | src/include/gnunet_fs_service.h | 1161 |
1 files changed, 597 insertions, 564 deletions
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 04e7b606c..b6eb83609 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -80,8 +80,8 @@ struct GNUNET_FS_Uri; | |||
80 | * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort | 80 | * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort |
81 | */ | 81 | */ |
82 | typedef int (*GNUNET_FS_KeywordIterator) (void *cls, | 82 | typedef int (*GNUNET_FS_KeywordIterator) (void *cls, |
83 | const char *keyword, | 83 | const char *keyword, |
84 | int is_mandatory); | 84 | int is_mandatory); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Get a unique key from a URI. This is for putting URIs | 87 | * Get a unique key from a URI. This is for putting URIs |
@@ -90,9 +90,8 @@ typedef int (*GNUNET_FS_KeywordIterator) (void *cls, | |||
90 | * @param uri uri to convert to a unique key | 90 | * @param uri uri to convert to a unique key |
91 | * @param key wherer to store the unique key | 91 | * @param key wherer to store the unique key |
92 | */ | 92 | */ |
93 | void | 93 | void |
94 | GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, | 94 | GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, GNUNET_HashCode * key); |
95 | GNUNET_HashCode * key); | ||
96 | 95 | ||
97 | /** | 96 | /** |
98 | * Convert a URI to a UTF-8 String. | 97 | * Convert a URI to a UTF-8 String. |
@@ -100,8 +99,7 @@ GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, | |||
100 | * @param uri uri to convert to a string | 99 | * @param uri uri to convert to a string |
101 | * @return the UTF-8 string | 100 | * @return the UTF-8 string |
102 | */ | 101 | */ |
103 | char * | 102 | char *GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); |
104 | GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); | ||
105 | 103 | ||
106 | /** | 104 | /** |
107 | * Convert keyword URI to a human readable format | 105 | * Convert keyword URI to a human readable format |
@@ -110,8 +108,7 @@ GNUNET_FS_uri_to_string (const struct GNUNET_FS_Uri *uri); | |||
110 | * @param uri ksk uri to convert to a string | 108 | * @param uri ksk uri to convert to a string |
111 | * @return string with the keywords | 109 | * @return string with the keywords |
112 | */ | 110 | */ |
113 | char * | 111 | char *GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri); |
114 | GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri); | ||
115 | 112 | ||
116 | 113 | ||
117 | /** | 114 | /** |
@@ -124,8 +121,7 @@ GNUNET_FS_uri_ksk_to_string_fancy (const struct GNUNET_FS_Uri *uri); | |||
124 | */ | 121 | */ |
125 | void | 122 | void |
126 | GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, | 123 | GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, |
127 | const char *keyword, | 124 | const char *keyword, int is_mandatory); |
128 | int is_mandatory); | ||
129 | 125 | ||
130 | 126 | ||
131 | /** | 127 | /** |
@@ -137,7 +133,7 @@ GNUNET_FS_uri_ksk_add_keyword (struct GNUNET_FS_Uri *uri, | |||
137 | */ | 133 | */ |
138 | void | 134 | void |
139 | GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, | 135 | GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, |
140 | const char *keyword); | 136 | const char *keyword); |
141 | 137 | ||
142 | 138 | ||
143 | /** | 139 | /** |
@@ -147,17 +143,14 @@ GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, | |||
147 | * @param emsg where to store the parser error message (if any) | 143 | * @param emsg where to store the parser error message (if any) |
148 | * @return NULL on error | 144 | * @return NULL on error |
149 | */ | 145 | */ |
150 | struct GNUNET_FS_Uri * | 146 | struct GNUNET_FS_Uri *GNUNET_FS_uri_parse (const char *uri, char **emsg); |
151 | GNUNET_FS_uri_parse (const char *uri, | ||
152 | char **emsg); | ||
153 | 147 | ||
154 | /** | 148 | /** |
155 | * Free URI. | 149 | * Free URI. |
156 | * | 150 | * |
157 | * @param uri uri to free | 151 | * @param uri uri to free |
158 | */ | 152 | */ |
159 | void | 153 | void GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri); |
160 | GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri); | ||
161 | 154 | ||
162 | 155 | ||
163 | /** | 156 | /** |
@@ -166,7 +159,7 @@ GNUNET_FS_uri_destroy (struct GNUNET_FS_Uri *uri); | |||
166 | * @param uri ksk uri to get the number of keywords from | 159 | * @param uri ksk uri to get the number of keywords from |
167 | * @return 0 if this is not a keyword URI | 160 | * @return 0 if this is not a keyword URI |
168 | */ | 161 | */ |
169 | unsigned int | 162 | unsigned int |
170 | GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri); | 163 | GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri); |
171 | 164 | ||
172 | 165 | ||
@@ -179,10 +172,10 @@ GNUNET_FS_uri_ksk_get_keyword_count (const struct GNUNET_FS_Uri *uri); | |||
179 | * @return -1 if this is not a keyword URI, otherwise number of | 172 | * @return -1 if this is not a keyword URI, otherwise number of |
180 | * keywords iterated over until iterator aborted | 173 | * keywords iterated over until iterator aborted |
181 | */ | 174 | */ |
182 | int | 175 | int |
183 | GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, | 176 | GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, |
184 | GNUNET_FS_KeywordIterator iterator, | 177 | GNUNET_FS_KeywordIterator iterator, |
185 | void *iterator_cls); | 178 | void *iterator_cls); |
186 | 179 | ||
187 | 180 | ||
188 | /** | 181 | /** |
@@ -194,7 +187,7 @@ GNUNET_FS_uri_ksk_get_keywords (const struct GNUNET_FS_Uri *uri, | |||
194 | */ | 187 | */ |
195 | int | 188 | int |
196 | GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, | 189 | GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, |
197 | struct GNUNET_PeerIdentity * peer); | 190 | struct GNUNET_PeerIdentity *peer); |
198 | 191 | ||
199 | 192 | ||
200 | /** | 193 | /** |
@@ -203,8 +196,8 @@ GNUNET_FS_uri_loc_get_peer_identity (const struct GNUNET_FS_Uri *uri, | |||
203 | * @param uri location URI to get the content URI from | 196 | * @param uri location URI to get the content URI from |
204 | * @return NULL if argument is not a location URI | 197 | * @return NULL if argument is not a location URI |
205 | */ | 198 | */ |
206 | struct GNUNET_FS_Uri * | 199 | struct GNUNET_FS_Uri *GNUNET_FS_uri_loc_get_uri (const struct GNUNET_FS_Uri |
207 | GNUNET_FS_uri_loc_get_uri (const struct GNUNET_FS_Uri *uri); | 200 | *uri); |
208 | 201 | ||
209 | 202 | ||
210 | /** | 203 | /** |
@@ -225,10 +218,13 @@ GNUNET_FS_uri_loc_get_expiration (const struct GNUNET_FS_Uri *uri); | |||
225 | * @param expiration_time how long will the content be offered? | 218 | * @param expiration_time how long will the content be offered? |
226 | * @return the location URI, NULL on error | 219 | * @return the location URI, NULL on error |
227 | */ | 220 | */ |
228 | struct GNUNET_FS_Uri * | 221 | struct GNUNET_FS_Uri *GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri |
229 | GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, | 222 | *baseUri, |
230 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 223 | const struct |
231 | struct GNUNET_TIME_Absolute expiration_time); | 224 | GNUNET_CONFIGURATION_Handle |
225 | *cfg, | ||
226 | struct GNUNET_TIME_Absolute | ||
227 | expiration_time); | ||
232 | 228 | ||
233 | 229 | ||
234 | /** | 230 | /** |
@@ -239,8 +235,8 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, | |||
239 | * @param uri the URI to canonicalize | 235 | * @param uri the URI to canonicalize |
240 | * @return canonicalized version of the URI, NULL on error | 236 | * @return canonicalized version of the URI, NULL on error |
241 | */ | 237 | */ |
242 | struct GNUNET_FS_Uri * | 238 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_canonicalize (const struct GNUNET_FS_Uri |
243 | GNUNET_FS_uri_ksk_canonicalize (const struct GNUNET_FS_Uri *uri); | 239 | *uri); |
244 | 240 | ||
245 | 241 | ||
246 | /** | 242 | /** |
@@ -252,9 +248,8 @@ GNUNET_FS_uri_ksk_canonicalize (const struct GNUNET_FS_Uri *uri); | |||
252 | * @param u2 second uri | 248 | * @param u2 second uri |
253 | * @return merged URI, NULL on error | 249 | * @return merged URI, NULL on error |
254 | */ | 250 | */ |
255 | struct GNUNET_FS_Uri * | 251 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, |
256 | GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, | 252 | const struct GNUNET_FS_Uri *u2); |
257 | const struct GNUNET_FS_Uri *u2); | ||
258 | 253 | ||
259 | 254 | ||
260 | /** | 255 | /** |
@@ -263,8 +258,7 @@ GNUNET_FS_uri_ksk_merge (const struct GNUNET_FS_Uri *u1, | |||
263 | * @param uri the URI to duplicate | 258 | * @param uri the URI to duplicate |
264 | * @return copy of the URI | 259 | * @return copy of the URI |
265 | */ | 260 | */ |
266 | struct GNUNET_FS_Uri * | 261 | struct GNUNET_FS_Uri *GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri); |
267 | GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri); | ||
268 | 262 | ||
269 | 263 | ||
270 | /** | 264 | /** |
@@ -284,9 +278,8 @@ GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri); | |||
284 | * @return an FS URI for the given keywords, NULL | 278 | * @return an FS URI for the given keywords, NULL |
285 | * if keywords is not legal (i.e. empty). | 279 | * if keywords is not legal (i.e. empty). |
286 | */ | 280 | */ |
287 | struct GNUNET_FS_Uri * | 281 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create (const char *keywords, |
288 | GNUNET_FS_uri_ksk_create (const char *keywords, | 282 | char **emsg); |
289 | char **emsg); | ||
290 | 283 | ||
291 | 284 | ||
292 | /** | 285 | /** |
@@ -306,9 +299,8 @@ GNUNET_FS_uri_ksk_create (const char *keywords, | |||
306 | * @return an FS URI for the given keywords, NULL | 299 | * @return an FS URI for the given keywords, NULL |
307 | * if keywords is not legal (i.e. empty). | 300 | * if keywords is not legal (i.e. empty). |
308 | */ | 301 | */ |
309 | struct GNUNET_FS_Uri * | 302 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, |
310 | GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, | 303 | const char **argv); |
311 | const char **argv); | ||
312 | 304 | ||
313 | 305 | ||
314 | /** | 306 | /** |
@@ -318,9 +310,9 @@ GNUNET_FS_uri_ksk_create_from_args (unsigned int argc, | |||
318 | * @param u2 the other URI | 310 | * @param u2 the other URI |
319 | * @return GNUNET_YES if the URIs are equal | 311 | * @return GNUNET_YES if the URIs are equal |
320 | */ | 312 | */ |
321 | int | 313 | int |
322 | GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, | 314 | GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, |
323 | const struct GNUNET_FS_Uri *u2); | 315 | const struct GNUNET_FS_Uri *u2); |
324 | 316 | ||
325 | 317 | ||
326 | /** | 318 | /** |
@@ -329,8 +321,7 @@ GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, | |||
329 | * @param uri the uri to check | 321 | * @param uri the uri to check |
330 | * @return GNUNET_YES if this is an SKS uri | 322 | * @return GNUNET_YES if this is an SKS uri |
331 | */ | 323 | */ |
332 | int | 324 | int GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); |
333 | GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); | ||
334 | 325 | ||
335 | 326 | ||
336 | /** | 327 | /** |
@@ -347,10 +338,8 @@ struct GNUNET_FS_Namespace; | |||
347 | * @param emsg where to store an error message | 338 | * @param emsg where to store an error message |
348 | * @return an FS URI for the given namespace and identifier | 339 | * @return an FS URI for the given namespace and identifier |
349 | */ | 340 | */ |
350 | struct GNUNET_FS_Uri * | 341 | struct GNUNET_FS_Uri *GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, |
351 | GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, | 342 | const char *id, char **emsg); |
352 | const char *id, | ||
353 | char **emsg); | ||
354 | 343 | ||
355 | 344 | ||
356 | /** | 345 | /** |
@@ -360,9 +349,8 @@ GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, | |||
360 | * @param id identifier | 349 | * @param id identifier |
361 | * @return an FS URI for the given namespace and identifier | 350 | * @return an FS URI for the given namespace and identifier |
362 | */ | 351 | */ |
363 | struct GNUNET_FS_Uri * | 352 | struct GNUNET_FS_Uri *GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode * |
364 | GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode *nsid, | 353 | nsid, const char *id); |
365 | const char *id); | ||
366 | 354 | ||
367 | 355 | ||
368 | /** | 356 | /** |
@@ -373,9 +361,9 @@ GNUNET_FS_uri_sks_create_from_nsid (GNUNET_HashCode *nsid, | |||
373 | * @param nsid where to store the ID of the namespace | 361 | * @param nsid where to store the ID of the namespace |
374 | * @return GNUNET_OK on success | 362 | * @return GNUNET_OK on success |
375 | */ | 363 | */ |
376 | int | 364 | int |
377 | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, | 365 | GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, |
378 | GNUNET_HashCode * nsid); | 366 | GNUNET_HashCode * nsid); |
379 | 367 | ||
380 | 368 | ||
381 | /** | 369 | /** |
@@ -384,8 +372,7 @@ GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, | |||
384 | * @param uri the sks uri | 372 | * @param uri the sks uri |
385 | * @return NULL on error (not a valid SKS URI) | 373 | * @return NULL on error (not a valid SKS URI) |
386 | */ | 374 | */ |
387 | char * | 375 | char *GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); |
388 | GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); | ||
389 | 376 | ||
390 | 377 | ||
391 | /** | 378 | /** |
@@ -396,9 +383,8 @@ GNUNET_FS_uri_sks_get_content_id (const struct GNUNET_FS_Uri *uri); | |||
396 | * @param uri SKS uri to convert | 383 | * @param uri SKS uri to convert |
397 | * @return NULL on error (not an SKS URI) | 384 | * @return NULL on error (not an SKS URI) |
398 | */ | 385 | */ |
399 | char * | 386 | char *GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle |
400 | GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg, | 387 | *cfg, const struct GNUNET_FS_Uri *uri); |
401 | const struct GNUNET_FS_Uri *uri); | ||
402 | 388 | ||
403 | 389 | ||
404 | /** | 390 | /** |
@@ -407,8 +393,7 @@ GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
407 | * @param uri the uri | 393 | * @param uri the uri |
408 | * @return GNUNET_YES if this is a KSK uri | 394 | * @return GNUNET_YES if this is a KSK uri |
409 | */ | 395 | */ |
410 | int | 396 | int GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); |
411 | GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); | ||
412 | 397 | ||
413 | 398 | ||
414 | /** | 399 | /** |
@@ -417,8 +402,7 @@ GNUNET_FS_uri_test_ksk (const struct GNUNET_FS_Uri *uri); | |||
417 | * @param uri the uri to check | 402 | * @param uri the uri to check |
418 | * @return GNUNET_YES if this is a CHK uri | 403 | * @return GNUNET_YES if this is a CHK uri |
419 | */ | 404 | */ |
420 | int | 405 | int GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); |
421 | GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); | ||
422 | 406 | ||
423 | 407 | ||
424 | /** | 408 | /** |
@@ -428,8 +412,7 @@ GNUNET_FS_uri_test_chk (const struct GNUNET_FS_Uri *uri); | |||
428 | * @param uri the CHK (or LOC) URI to inspect | 412 | * @param uri the CHK (or LOC) URI to inspect |
429 | * @return size of the file as specified in the CHK URI | 413 | * @return size of the file as specified in the CHK URI |
430 | */ | 414 | */ |
431 | uint64_t | 415 | uint64_t GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri); |
432 | GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri); | ||
433 | 416 | ||
434 | 417 | ||
435 | /** | 418 | /** |
@@ -438,8 +421,7 @@ GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri); | |||
438 | * @param uri the uri to check | 421 | * @param uri the uri to check |
439 | * @return GNUNET_YES if this is a LOC uri | 422 | * @return GNUNET_YES if this is a LOC uri |
440 | */ | 423 | */ |
441 | int | 424 | int GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); |
442 | GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); | ||
443 | 425 | ||
444 | 426 | ||
445 | /** | 427 | /** |
@@ -450,8 +432,9 @@ GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri); | |||
450 | * @param md metadata to use | 432 | * @param md metadata to use |
451 | * @return NULL on error, otherwise a KSK URI | 433 | * @return NULL on error, otherwise a KSK URI |
452 | */ | 434 | */ |
453 | struct GNUNET_FS_Uri * | 435 | struct GNUNET_FS_Uri *GNUNET_FS_uri_ksk_create_from_meta_data (const struct |
454 | GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData *md); | 436 | GNUNET_CONTAINER_MetaData |
437 | *md); | ||
455 | 438 | ||
456 | 439 | ||
457 | /* ******************** command-line option parsing API *********************** */ | 440 | /* ******************** command-line option parsing API *********************** */ |
@@ -469,10 +452,9 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData | |||
469 | * @return GNUNET_OK on success | 452 | * @return GNUNET_OK on success |
470 | */ | 453 | */ |
471 | int | 454 | int |
472 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, | 455 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext |
473 | void *scls, | 456 | *ctx, void *scls, const char *option, |
474 | const char *option, | 457 | const char *value); |
475 | const char *value); | ||
476 | 458 | ||
477 | 459 | ||
478 | /** | 460 | /** |
@@ -488,10 +470,9 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* | |||
488 | * @return GNUNET_OK on success | 470 | * @return GNUNET_OK on success |
489 | */ | 471 | */ |
490 | int | 472 | int |
491 | GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, | 473 | GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext |
492 | void *scls, | 474 | *ctx, void *scls, const char *option, |
493 | const char *option, | 475 | const char *value); |
494 | const char *value); | ||
495 | 476 | ||
496 | 477 | ||
497 | 478 | ||
@@ -636,7 +617,7 @@ enum GNUNET_FS_Status | |||
636 | * be generated in this case. | 617 | * be generated in this case. |
637 | */ | 618 | */ |
638 | GNUNET_FS_STATUS_SEARCH_SUSPEND, | 619 | GNUNET_FS_STATUS_SEARCH_SUSPEND, |
639 | 620 | ||
640 | /** | 621 | /** |
641 | * This search has yielded a result. | 622 | * This search has yielded a result. |
642 | */ | 623 | */ |
@@ -689,7 +670,7 @@ enum GNUNET_FS_Status | |||
689 | 670 | ||
690 | /** | 671 | /** |
691 | * Notification that we started to unindex a file. | 672 | * Notification that we started to unindex a file. |
692 | */ | 673 | */ |
693 | GNUNET_FS_STATUS_UNINDEX_START, | 674 | GNUNET_FS_STATUS_UNINDEX_START, |
694 | 675 | ||
695 | /** | 676 | /** |
@@ -724,7 +705,6 @@ enum GNUNET_FS_Status | |||
724 | * was stopped (final event for this action). | 705 | * was stopped (final event for this action). |
725 | */ | 706 | */ |
726 | GNUNET_FS_STATUS_UNINDEX_STOPPED | 707 | GNUNET_FS_STATUS_UNINDEX_STOPPED |
727 | |||
728 | }; | 708 | }; |
729 | 709 | ||
730 | 710 | ||
@@ -773,17 +753,19 @@ struct GNUNET_FS_FileInformation; | |||
773 | * information about what is going on. | 753 | * information about what is going on. |
774 | */ | 754 | */ |
775 | struct GNUNET_FS_ProgressInfo | 755 | struct GNUNET_FS_ProgressInfo |
776 | { | 756 | { |
777 | 757 | ||
778 | /** | 758 | /** |
779 | * Values that depend on the event type. | 759 | * Values that depend on the event type. |
780 | */ | 760 | */ |
781 | union { | 761 | union |
782 | 762 | { | |
763 | |||
783 | /** | 764 | /** |
784 | * Values for all "GNUNET_FS_STATUS_PUBLISH_*" events. | 765 | * Values for all "GNUNET_FS_STATUS_PUBLISH_*" events. |
785 | */ | 766 | */ |
786 | struct { | 767 | struct |
768 | { | ||
787 | 769 | ||
788 | /** | 770 | /** |
789 | * Context for controlling the upload. | 771 | * Context for controlling the upload. |
@@ -811,7 +793,7 @@ struct GNUNET_FS_ProgressInfo | |||
811 | * Name of the file being published; can be NULL. | 793 | * Name of the file being published; can be NULL. |
812 | */ | 794 | */ |
813 | const char *filename; | 795 | const char *filename; |
814 | 796 | ||
815 | /** | 797 | /** |
816 | * How large is the file overall? For directories, | 798 | * How large is the file overall? For directories, |
817 | * this is only the size of the directory itself, | 799 | * this is only the size of the directory itself, |
@@ -824,7 +806,7 @@ struct GNUNET_FS_ProgressInfo | |||
824 | * At what time do we expect to finish the upload? | 806 | * At what time do we expect to finish the upload? |
825 | * (will be a value in the past for completed | 807 | * (will be a value in the past for completed |
826 | * uploads). | 808 | * uploads). |
827 | */ | 809 | */ |
828 | struct GNUNET_TIME_Relative eta; | 810 | struct GNUNET_TIME_Relative eta; |
829 | 811 | ||
830 | /** | 812 | /** |
@@ -846,90 +828,96 @@ struct GNUNET_FS_ProgressInfo | |||
846 | /** | 828 | /** |
847 | * Additional values for specific events. | 829 | * Additional values for specific events. |
848 | */ | 830 | */ |
849 | union { | 831 | union |
832 | { | ||
850 | 833 | ||
851 | /** | 834 | /** |
852 | * These values are only valid for | 835 | * These values are only valid for |
853 | * GNUNET_FS_STATUS_PUBLISH_PROGRESS events. | 836 | * GNUNET_FS_STATUS_PUBLISH_PROGRESS events. |
854 | */ | 837 | */ |
855 | struct { | 838 | struct |
856 | 839 | { | |
857 | /** | 840 | |
841 | /** | ||
858 | * Data block we just published. | 842 | * Data block we just published. |
859 | */ | 843 | */ |
860 | const void *data; | 844 | const void *data; |
861 | 845 | ||
862 | /** | 846 | /** |
863 | * At what offset in the file is "data"? | 847 | * At what offset in the file is "data"? |
864 | */ | 848 | */ |
865 | uint64_t offset; | 849 | uint64_t offset; |
866 | 850 | ||
867 | /** | 851 | /** |
868 | * Length of the data block. | 852 | * Length of the data block. |
869 | */ | 853 | */ |
870 | uint64_t data_len; | 854 | uint64_t data_len; |
871 | 855 | ||
872 | /** | 856 | /** |
873 | * Depth of the given block in the tree; | 857 | * Depth of the given block in the tree; |
874 | * 0 would be the lowest level (DBLOCKs). | 858 | * 0 would be the lowest level (DBLOCKs). |
875 | */ | 859 | */ |
876 | unsigned int depth; | 860 | unsigned int depth; |
877 | 861 | ||
878 | } progress; | 862 | } progress; |
879 | 863 | ||
880 | /** | 864 | /** |
881 | * These values are only valid for | 865 | * These values are only valid for |
882 | * GNUNET_FS_STATUS_PUBLISH_RESUME events. | 866 | * GNUNET_FS_STATUS_PUBLISH_RESUME events. |
883 | */ | 867 | */ |
884 | struct { | 868 | struct |
885 | 869 | { | |
886 | /** | 870 | |
871 | /** | ||
887 | * Error message, NULL if no error was encountered so far. | 872 | * Error message, NULL if no error was encountered so far. |
888 | */ | 873 | */ |
889 | const char *message; | 874 | const char *message; |
890 | 875 | ||
891 | /** | 876 | /** |
892 | * URI of the file (if the download had been completed) | 877 | * URI of the file (if the download had been completed) |
893 | */ | 878 | */ |
894 | const struct GNUNET_FS_Uri *chk_uri; | 879 | const struct GNUNET_FS_Uri *chk_uri; |
895 | 880 | ||
896 | } resume; | 881 | } resume; |
897 | 882 | ||
898 | /** | 883 | /** |
899 | * These values are only valid for | 884 | * These values are only valid for |
900 | * GNUNET_FS_STATUS_PUBLISH_COMPLETED events. | 885 | * GNUNET_FS_STATUS_PUBLISH_COMPLETED events. |
901 | */ | 886 | */ |
902 | struct { | 887 | struct |
903 | 888 | { | |
904 | /** | 889 | |
890 | /** | ||
905 | * URI of the file. | 891 | * URI of the file. |
906 | */ | 892 | */ |
907 | const struct GNUNET_FS_Uri *chk_uri; | 893 | const struct GNUNET_FS_Uri *chk_uri; |
908 | 894 | ||
909 | } completed; | 895 | } completed; |
910 | 896 | ||
911 | /** | 897 | /** |
912 | * These values are only valid for | 898 | * These values are only valid for |
913 | * GNUNET_FS_STATUS_PUBLISH_ERROR events. | 899 | * GNUNET_FS_STATUS_PUBLISH_ERROR events. |
914 | */ | 900 | */ |
915 | struct { | 901 | struct |
916 | 902 | { | |
917 | /** | 903 | |
904 | /** | ||
918 | * Error message, never NULL. | 905 | * Error message, never NULL. |
919 | */ | 906 | */ |
920 | const char *message; | 907 | const char *message; |
921 | 908 | ||
922 | } error; | 909 | } error; |
923 | 910 | ||
924 | } specifics; | 911 | } specifics; |
925 | 912 | ||
926 | } publish; | 913 | } publish; |
927 | 914 | ||
928 | 915 | ||
929 | /** | 916 | /** |
930 | * Values for all "GNUNET_FS_STATUS_DOWNLOAD_*" events. | 917 | * Values for all "GNUNET_FS_STATUS_DOWNLOAD_*" events. |
931 | */ | 918 | */ |
932 | struct { | 919 | struct |
920 | { | ||
933 | 921 | ||
934 | /** | 922 | /** |
935 | * Context for controlling the download. | 923 | * Context for controlling the download. |
@@ -956,7 +944,7 @@ struct GNUNET_FS_ProgressInfo | |||
956 | * download was started from a search result. | 944 | * download was started from a search result. |
957 | */ | 945 | */ |
958 | void *sctx; | 946 | void *sctx; |
959 | 947 | ||
960 | /** | 948 | /** |
961 | * URI used for this download. | 949 | * URI used for this download. |
962 | */ | 950 | */ |
@@ -966,7 +954,7 @@ struct GNUNET_FS_ProgressInfo | |||
966 | * Name of the file that we are downloading. | 954 | * Name of the file that we are downloading. |
967 | */ | 955 | */ |
968 | const char *filename; | 956 | const char *filename; |
969 | 957 | ||
970 | /** | 958 | /** |
971 | * How large is the download overall? This | 959 | * How large is the download overall? This |
972 | * is NOT necessarily the size from the | 960 | * is NOT necessarily the size from the |
@@ -978,12 +966,12 @@ struct GNUNET_FS_ProgressInfo | |||
978 | * At what time do we expect to finish the download? | 966 | * At what time do we expect to finish the download? |
979 | * (will be a value in the past for completed | 967 | * (will be a value in the past for completed |
980 | * uploads). | 968 | * uploads). |
981 | */ | 969 | */ |
982 | struct GNUNET_TIME_Relative eta; | 970 | struct GNUNET_TIME_Relative eta; |
983 | 971 | ||
984 | /** | 972 | /** |
985 | * How long has this download been active? | 973 | * How long has this download been active? |
986 | */ | 974 | */ |
987 | struct GNUNET_TIME_Relative duration; | 975 | struct GNUNET_TIME_Relative duration; |
988 | 976 | ||
989 | /** | 977 | /** |
@@ -1004,83 +992,88 @@ struct GNUNET_FS_ProgressInfo | |||
1004 | /** | 992 | /** |
1005 | * Additional values for specific events. | 993 | * Additional values for specific events. |
1006 | */ | 994 | */ |
1007 | union { | 995 | union |
1008 | 996 | { | |
1009 | /** | 997 | |
998 | /** | ||
1010 | * These values are only valid for | 999 | * These values are only valid for |
1011 | * GNUNET_FS_STATUS_DOWNLOAD_PROGRESS events. | 1000 | * GNUNET_FS_STATUS_DOWNLOAD_PROGRESS events. |
1012 | */ | 1001 | */ |
1013 | struct { | 1002 | struct |
1014 | 1003 | { | |
1015 | /** | 1004 | |
1005 | /** | ||
1016 | * Data block we just obtained, can be NULL (even if | 1006 | * Data block we just obtained, can be NULL (even if |
1017 | * data_len > 0) if we found the entire block 'intact' on | 1007 | * data_len > 0) if we found the entire block 'intact' on |
1018 | * disk. In this case, it is also possible for 'data_len' | 1008 | * disk. In this case, it is also possible for 'data_len' |
1019 | * to be larger than an individual (32k) block. | 1009 | * to be larger than an individual (32k) block. |
1020 | */ | 1010 | */ |
1021 | const void *data; | 1011 | const void *data; |
1022 | 1012 | ||
1023 | /** | 1013 | /** |
1024 | * At what offset in the file is "data"? | 1014 | * At what offset in the file is "data"? |
1025 | */ | 1015 | */ |
1026 | uint64_t offset; | 1016 | uint64_t offset; |
1027 | 1017 | ||
1028 | /** | 1018 | /** |
1029 | * Length of the data block. | 1019 | * Length of the data block. |
1030 | */ | 1020 | */ |
1031 | uint64_t data_len; | 1021 | uint64_t data_len; |
1032 | 1022 | ||
1033 | /** | 1023 | /** |
1034 | * Depth of the given block in the tree; | 1024 | * Depth of the given block in the tree; |
1035 | * 0 would be the lowest level (DBLOCKS). | 1025 | * 0 would be the lowest level (DBLOCKS). |
1036 | */ | 1026 | */ |
1037 | unsigned int depth; | 1027 | unsigned int depth; |
1038 | 1028 | ||
1039 | } progress; | 1029 | } progress; |
1040 | 1030 | ||
1041 | /** | 1031 | /** |
1042 | * These values are only valid for | 1032 | * These values are only valid for |
1043 | * GNUNET_FS_STATUS_DOWNLOAD_START events. | 1033 | * GNUNET_FS_STATUS_DOWNLOAD_START events. |
1044 | */ | 1034 | */ |
1045 | struct { | 1035 | struct |
1036 | { | ||
1046 | 1037 | ||
1047 | /** | 1038 | /** |
1048 | * Known metadata for the download. | 1039 | * Known metadata for the download. |
1049 | */ | 1040 | */ |
1050 | const struct GNUNET_CONTAINER_MetaData *meta; | 1041 | const struct GNUNET_CONTAINER_MetaData *meta; |
1051 | 1042 | ||
1052 | } start; | 1043 | } start; |
1053 | 1044 | ||
1054 | /** | 1045 | /** |
1055 | * These values are only valid for | 1046 | * These values are only valid for |
1056 | * GNUNET_FS_STATUS_DOWNLOAD_RESUME events. | 1047 | * GNUNET_FS_STATUS_DOWNLOAD_RESUME events. |
1057 | */ | 1048 | */ |
1058 | struct { | 1049 | struct |
1050 | { | ||
1059 | 1051 | ||
1060 | /** | 1052 | /** |
1061 | * Known metadata for the download. | 1053 | * Known metadata for the download. |
1062 | */ | 1054 | */ |
1063 | const struct GNUNET_CONTAINER_MetaData *meta; | 1055 | const struct GNUNET_CONTAINER_MetaData *meta; |
1064 | 1056 | ||
1065 | /** | 1057 | /** |
1066 | * Error message, NULL if we have not encountered any error yet. | 1058 | * Error message, NULL if we have not encountered any error yet. |
1067 | */ | 1059 | */ |
1068 | const char *message; | 1060 | const char *message; |
1069 | 1061 | ||
1070 | } resume; | 1062 | } resume; |
1071 | 1063 | ||
1072 | /** | 1064 | /** |
1073 | * These values are only valid for | 1065 | * These values are only valid for |
1074 | * GNUNET_FS_STATUS_DOWNLOAD_ERROR events. | 1066 | * GNUNET_FS_STATUS_DOWNLOAD_ERROR events. |
1075 | */ | 1067 | */ |
1076 | struct { | 1068 | struct |
1069 | { | ||
1077 | 1070 | ||
1078 | /** | 1071 | /** |
1079 | * Error message. | 1072 | * Error message. |
1080 | */ | 1073 | */ |
1081 | const char *message; | 1074 | const char *message; |
1082 | 1075 | ||
1083 | } error; | 1076 | } error; |
1084 | 1077 | ||
1085 | } specifics; | 1078 | } specifics; |
1086 | 1079 | ||
@@ -1089,7 +1082,8 @@ struct GNUNET_FS_ProgressInfo | |||
1089 | /** | 1082 | /** |
1090 | * Values for all "GNUNET_FS_STATUS_SEARCH_*" events. | 1083 | * Values for all "GNUNET_FS_STATUS_SEARCH_*" events. |
1091 | */ | 1084 | */ |
1092 | struct { | 1085 | struct |
1086 | { | ||
1093 | 1087 | ||
1094 | /** | 1088 | /** |
1095 | * Context for controlling the search, NULL for | 1089 | * Context for controlling the search, NULL for |
@@ -1138,123 +1132,127 @@ struct GNUNET_FS_ProgressInfo | |||
1138 | /** | 1132 | /** |
1139 | * Additional values for specific events. | 1133 | * Additional values for specific events. |
1140 | */ | 1134 | */ |
1141 | union { | 1135 | union |
1142 | 1136 | { | |
1143 | /** | 1137 | |
1138 | /** | ||
1144 | * These values are only valid for | 1139 | * These values are only valid for |
1145 | * GNUNET_FS_STATUS_SEARCH_RESULT events. | 1140 | * GNUNET_FS_STATUS_SEARCH_RESULT events. |
1146 | */ | 1141 | */ |
1147 | struct { | 1142 | struct |
1148 | 1143 | { | |
1149 | /** | 1144 | |
1145 | /** | ||
1150 | * Metadata for the search result. | 1146 | * Metadata for the search result. |
1151 | */ | 1147 | */ |
1152 | const struct GNUNET_CONTAINER_MetaData *meta; | 1148 | const struct GNUNET_CONTAINER_MetaData *meta; |
1153 | 1149 | ||
1154 | /** | 1150 | /** |
1155 | * URI for the search result. | 1151 | * URI for the search result. |
1156 | */ | 1152 | */ |
1157 | const struct GNUNET_FS_Uri *uri; | 1153 | const struct GNUNET_FS_Uri *uri; |
1158 | 1154 | ||
1159 | /** | 1155 | /** |
1160 | * Handle to the result (for starting downloads). | 1156 | * Handle to the result (for starting downloads). |
1161 | */ | 1157 | */ |
1162 | struct GNUNET_FS_SearchResult *result; | 1158 | struct GNUNET_FS_SearchResult *result; |
1163 | 1159 | ||
1164 | /** | 1160 | /** |
1165 | * Applicability rank (the larger, the better the result | 1161 | * Applicability rank (the larger, the better the result |
1166 | * fits the search criteria). | 1162 | * fits the search criteria). |
1167 | */ | 1163 | */ |
1168 | uint32_t applicability_rank; | 1164 | uint32_t applicability_rank; |
1165 | |||
1166 | } result; | ||
1169 | 1167 | ||
1170 | } result; | 1168 | /** |
1171 | |||
1172 | /** | ||
1173 | * These values are only valid for | 1169 | * These values are only valid for |
1174 | * GNUNET_FS_STATUS_SEARCH_RESUME_RESULT events. | 1170 | * GNUNET_FS_STATUS_SEARCH_RESUME_RESULT events. |
1175 | */ | 1171 | */ |
1176 | struct { | 1172 | struct |
1177 | 1173 | { | |
1178 | /** | 1174 | |
1175 | /** | ||
1179 | * Metadata for the search result. | 1176 | * Metadata for the search result. |
1180 | */ | 1177 | */ |
1181 | const struct GNUNET_CONTAINER_MetaData *meta; | 1178 | const struct GNUNET_CONTAINER_MetaData *meta; |
1182 | 1179 | ||
1183 | /** | 1180 | /** |
1184 | * URI for the search result. | 1181 | * URI for the search result. |
1185 | */ | 1182 | */ |
1186 | const struct GNUNET_FS_Uri *uri; | 1183 | const struct GNUNET_FS_Uri *uri; |
1187 | 1184 | ||
1188 | /** | 1185 | /** |
1189 | * Handle to the result (for starting downloads). | 1186 | * Handle to the result (for starting downloads). |
1190 | */ | 1187 | */ |
1191 | struct GNUNET_FS_SearchResult *result; | 1188 | struct GNUNET_FS_SearchResult *result; |
1192 | 1189 | ||
1193 | /** | 1190 | /** |
1194 | * Current availability rank (negative: | 1191 | * Current availability rank (negative: |
1195 | * unavailable, positive: available) | 1192 | * unavailable, positive: available) |
1196 | */ | 1193 | */ |
1197 | int32_t availability_rank; | 1194 | int32_t availability_rank; |
1198 | 1195 | ||
1199 | /** | 1196 | /** |
1200 | * On how many total queries is the given | 1197 | * On how many total queries is the given |
1201 | * availability_rank based? | 1198 | * availability_rank based? |
1202 | */ | 1199 | */ |
1203 | uint32_t availability_certainty; | 1200 | uint32_t availability_certainty; |
1204 | 1201 | ||
1205 | /** | 1202 | /** |
1206 | * Updated applicability rank (the larger, | 1203 | * Updated applicability rank (the larger, |
1207 | * the better the result fits the search | 1204 | * the better the result fits the search |
1208 | * criteria). | 1205 | * criteria). |
1209 | */ | 1206 | */ |
1210 | uint32_t applicability_rank; | 1207 | uint32_t applicability_rank; |
1211 | 1208 | ||
1212 | } resume_result; | 1209 | } resume_result; |
1213 | 1210 | ||
1214 | /** | 1211 | /** |
1215 | * These values are only valid for | 1212 | * These values are only valid for |
1216 | * GNUNET_FS_STATUS_SEARCH_UPDATE events. | 1213 | * GNUNET_FS_STATUS_SEARCH_UPDATE events. |
1217 | */ | 1214 | */ |
1218 | struct { | 1215 | struct |
1216 | { | ||
1219 | 1217 | ||
1220 | /** | 1218 | /** |
1221 | * Private context set for for this result | 1219 | * Private context set for for this result |
1222 | * during the "RESULT" event. | 1220 | * during the "RESULT" event. |
1223 | */ | 1221 | */ |
1224 | void *cctx; | 1222 | void *cctx; |
1225 | 1223 | ||
1226 | /** | 1224 | /** |
1227 | * Metadata for the search result. | 1225 | * Metadata for the search result. |
1228 | */ | 1226 | */ |
1229 | const struct GNUNET_CONTAINER_MetaData *meta; | 1227 | const struct GNUNET_CONTAINER_MetaData *meta; |
1230 | 1228 | ||
1231 | /** | 1229 | /** |
1232 | * URI for the search result. | 1230 | * URI for the search result. |
1233 | */ | 1231 | */ |
1234 | const struct GNUNET_FS_Uri *uri; | 1232 | const struct GNUNET_FS_Uri *uri; |
1235 | 1233 | ||
1236 | /** | 1234 | /** |
1237 | * Current availability rank (negative: | 1235 | * Current availability rank (negative: |
1238 | * unavailable, positive: available) | 1236 | * unavailable, positive: available) |
1239 | */ | 1237 | */ |
1240 | int32_t availability_rank; | 1238 | int32_t availability_rank; |
1241 | 1239 | ||
1242 | /** | 1240 | /** |
1243 | * On how many total queries is the given | 1241 | * On how many total queries is the given |
1244 | * availability_rank based? | 1242 | * availability_rank based? |
1245 | */ | 1243 | */ |
1246 | uint32_t availability_certainty; | 1244 | uint32_t availability_certainty; |
1247 | 1245 | ||
1248 | /** | 1246 | /** |
1249 | * Updated applicability rank (the larger, | 1247 | * Updated applicability rank (the larger, |
1250 | * the better the result fits the search | 1248 | * the better the result fits the search |
1251 | * criteria). | 1249 | * criteria). |
1252 | */ | 1250 | */ |
1253 | uint32_t applicability_rank; | 1251 | uint32_t applicability_rank; |
1252 | |||
1253 | } update; | ||
1254 | 1254 | ||
1255 | } update; | 1255 | /** |
1256 | |||
1257 | /** | ||
1258 | * These values are only valid for | 1256 | * These values are only valid for |
1259 | * GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND events. | 1257 | * GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND events. |
1260 | * These events are automatically triggered for | 1258 | * These events are automatically triggered for |
@@ -1263,27 +1261,28 @@ struct GNUNET_FS_ProgressInfo | |||
1263 | * happens primarily to give the client a chance | 1261 | * happens primarily to give the client a chance |
1264 | * to clean up the "cctx" (if needed). | 1262 | * to clean up the "cctx" (if needed). |
1265 | */ | 1263 | */ |
1266 | struct { | 1264 | struct |
1265 | { | ||
1267 | 1266 | ||
1268 | /** | 1267 | /** |
1269 | * Private context set for for this result | 1268 | * Private context set for for this result |
1270 | * during the "RESULT" event. | 1269 | * during the "RESULT" event. |
1271 | */ | 1270 | */ |
1272 | void *cctx; | 1271 | void *cctx; |
1273 | 1272 | ||
1274 | /** | 1273 | /** |
1275 | * Metadata for the search result. | 1274 | * Metadata for the search result. |
1276 | */ | 1275 | */ |
1277 | const struct GNUNET_CONTAINER_MetaData *meta; | 1276 | const struct GNUNET_CONTAINER_MetaData *meta; |
1278 | 1277 | ||
1279 | /** | 1278 | /** |
1280 | * URI for the search result. | 1279 | * URI for the search result. |
1281 | */ | 1280 | */ |
1282 | const struct GNUNET_FS_Uri *uri; | 1281 | const struct GNUNET_FS_Uri *uri; |
1282 | |||
1283 | } result_suspend; | ||
1283 | 1284 | ||
1284 | } result_suspend; | 1285 | /** |
1285 | |||
1286 | /** | ||
1287 | * These values are only valid for | 1286 | * These values are only valid for |
1288 | * GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED events. | 1287 | * GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED events. |
1289 | * These events are automatically triggered for | 1288 | * These events are automatically triggered for |
@@ -1292,89 +1291,93 @@ struct GNUNET_FS_ProgressInfo | |||
1292 | * happens primarily to give the client a chance | 1291 | * happens primarily to give the client a chance |
1293 | * to clean up the "cctx" (if needed). | 1292 | * to clean up the "cctx" (if needed). |
1294 | */ | 1293 | */ |
1295 | struct { | 1294 | struct |
1295 | { | ||
1296 | 1296 | ||
1297 | /** | 1297 | /** |
1298 | * Private context set for for this result | 1298 | * Private context set for for this result |
1299 | * during the "RESULT" event. | 1299 | * during the "RESULT" event. |
1300 | */ | 1300 | */ |
1301 | void *cctx; | 1301 | void *cctx; |
1302 | 1302 | ||
1303 | /** | 1303 | /** |
1304 | * Metadata for the search result. | 1304 | * Metadata for the search result. |
1305 | */ | 1305 | */ |
1306 | const struct GNUNET_CONTAINER_MetaData *meta; | 1306 | const struct GNUNET_CONTAINER_MetaData *meta; |
1307 | 1307 | ||
1308 | /** | 1308 | /** |
1309 | * URI for the search result. | 1309 | * URI for the search result. |
1310 | */ | 1310 | */ |
1311 | const struct GNUNET_FS_Uri *uri; | 1311 | const struct GNUNET_FS_Uri *uri; |
1312 | 1312 | ||
1313 | } result_stopped; | 1313 | } result_stopped; |
1314 | 1314 | ||
1315 | /** | 1315 | /** |
1316 | * These values are only valid for | 1316 | * These values are only valid for |
1317 | * GNUNET_FS_STATUS_SEARCH_RESUME events. | 1317 | * GNUNET_FS_STATUS_SEARCH_RESUME events. |
1318 | */ | 1318 | */ |
1319 | struct { | 1319 | struct |
1320 | { | ||
1320 | 1321 | ||
1321 | /** | 1322 | /** |
1322 | * Error message, NULL if we have not encountered any error yet. | 1323 | * Error message, NULL if we have not encountered any error yet. |
1323 | */ | 1324 | */ |
1324 | const char *message; | 1325 | const char *message; |
1325 | 1326 | ||
1326 | /** | 1327 | /** |
1327 | * Is this search currently paused? | 1328 | * Is this search currently paused? |
1328 | */ | 1329 | */ |
1329 | int is_paused; | 1330 | int is_paused; |
1330 | 1331 | ||
1331 | } resume; | 1332 | } resume; |
1332 | 1333 | ||
1333 | /** | 1334 | /** |
1334 | * These values are only valid for | 1335 | * These values are only valid for |
1335 | * GNUNET_FS_STATUS_SEARCH_ERROR events. | 1336 | * GNUNET_FS_STATUS_SEARCH_ERROR events. |
1336 | */ | 1337 | */ |
1337 | struct { | 1338 | struct |
1339 | { | ||
1338 | 1340 | ||
1339 | /** | 1341 | /** |
1340 | * Error message. | 1342 | * Error message. |
1341 | */ | 1343 | */ |
1342 | const char *message; | 1344 | const char *message; |
1343 | 1345 | ||
1344 | } error; | 1346 | } error; |
1345 | 1347 | ||
1346 | /** | 1348 | /** |
1347 | * Values for all "GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE" events. | 1349 | * Values for all "GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE" events. |
1348 | */ | 1350 | */ |
1349 | struct { | 1351 | struct |
1350 | 1352 | { | |
1351 | /** | 1353 | |
1354 | /** | ||
1352 | * Handle to the namespace (NULL if it is not a local | 1355 | * Handle to the namespace (NULL if it is not a local |
1353 | * namespace). | 1356 | * namespace). |
1354 | */ | 1357 | */ |
1355 | struct GNUNET_FS_Namespace *ns; | 1358 | struct GNUNET_FS_Namespace *ns; |
1356 | 1359 | ||
1357 | /** | 1360 | /** |
1358 | * Short, human-readable name of the namespace. | 1361 | * Short, human-readable name of the namespace. |
1359 | */ | 1362 | */ |
1360 | const char *name; | 1363 | const char *name; |
1361 | 1364 | ||
1362 | /** | 1365 | /** |
1363 | * Root identifier for the namespace, can be NULL. | 1366 | * Root identifier for the namespace, can be NULL. |
1364 | */ | 1367 | */ |
1365 | const char *root; | 1368 | const char *root; |
1366 | 1369 | ||
1367 | /** | 1370 | /** |
1368 | * Metadata for the namespace. | 1371 | * Metadata for the namespace. |
1369 | */ | 1372 | */ |
1370 | const struct GNUNET_CONTAINER_MetaData *meta; | 1373 | const struct GNUNET_CONTAINER_MetaData *meta; |
1371 | 1374 | ||
1372 | /** | 1375 | /** |
1373 | * Hash-identifier for the namespace. | 1376 | * Hash-identifier for the namespace. |
1374 | */ | 1377 | */ |
1375 | GNUNET_HashCode id; | 1378 | GNUNET_HashCode id; |
1376 | 1379 | ||
1377 | } namespace; | 1380 | } namespace; |
1378 | 1381 | ||
1379 | } specifics; | 1382 | } specifics; |
1380 | 1383 | ||
@@ -1383,7 +1386,8 @@ struct GNUNET_FS_ProgressInfo | |||
1383 | /** | 1386 | /** |
1384 | * Values for all "GNUNET_FS_STATUS_UNINDEX_*" events. | 1387 | * Values for all "GNUNET_FS_STATUS_UNINDEX_*" events. |
1385 | */ | 1388 | */ |
1386 | struct { | 1389 | struct |
1390 | { | ||
1387 | 1391 | ||
1388 | /** | 1392 | /** |
1389 | * Context for controlling the unindexing. | 1393 | * Context for controlling the unindexing. |
@@ -1411,7 +1415,7 @@ struct GNUNET_FS_ProgressInfo | |||
1411 | * At what time do we expect to finish unindexing? | 1415 | * At what time do we expect to finish unindexing? |
1412 | * (will be a value in the past for completed | 1416 | * (will be a value in the past for completed |
1413 | * unindexing opeations). | 1417 | * unindexing opeations). |
1414 | */ | 1418 | */ |
1415 | struct GNUNET_TIME_Relative eta; | 1419 | struct GNUNET_TIME_Relative eta; |
1416 | 1420 | ||
1417 | /** | 1421 | /** |
@@ -1428,62 +1432,66 @@ struct GNUNET_FS_ProgressInfo | |||
1428 | /** | 1432 | /** |
1429 | * Additional values for specific events. | 1433 | * Additional values for specific events. |
1430 | */ | 1434 | */ |
1431 | union { | 1435 | union |
1436 | { | ||
1432 | 1437 | ||
1433 | /** | 1438 | /** |
1434 | * These values are only valid for | 1439 | * These values are only valid for |
1435 | * GNUNET_FS_STATUS_UNINDEX_PROGRESS events. | 1440 | * GNUNET_FS_STATUS_UNINDEX_PROGRESS events. |
1436 | */ | 1441 | */ |
1437 | struct { | 1442 | struct |
1438 | 1443 | { | |
1439 | /** | 1444 | |
1445 | /** | ||
1440 | * Data block we just unindexed. | 1446 | * Data block we just unindexed. |
1441 | */ | 1447 | */ |
1442 | const void *data; | 1448 | const void *data; |
1443 | 1449 | ||
1444 | /** | 1450 | /** |
1445 | * At what offset in the file is "data"? | 1451 | * At what offset in the file is "data"? |
1446 | */ | 1452 | */ |
1447 | uint64_t offset; | 1453 | uint64_t offset; |
1448 | 1454 | ||
1449 | /** | 1455 | /** |
1450 | * Length of the data block. | 1456 | * Length of the data block. |
1451 | */ | 1457 | */ |
1452 | uint64_t data_len; | 1458 | uint64_t data_len; |
1453 | 1459 | ||
1454 | /** | 1460 | /** |
1455 | * Depth of the given block in the tree; | 1461 | * Depth of the given block in the tree; |
1456 | * 0 would be the lowest level (DBLOCKS). | 1462 | * 0 would be the lowest level (DBLOCKS). |
1457 | */ | 1463 | */ |
1458 | unsigned int depth; | 1464 | unsigned int depth; |
1459 | 1465 | ||
1460 | } progress; | 1466 | } progress; |
1461 | 1467 | ||
1462 | /** | 1468 | /** |
1463 | * These values are only valid for | 1469 | * These values are only valid for |
1464 | * GNUNET_FS_STATUS_UNINDEX_RESUME events. | 1470 | * GNUNET_FS_STATUS_UNINDEX_RESUME events. |
1465 | */ | 1471 | */ |
1466 | struct { | 1472 | struct |
1473 | { | ||
1467 | 1474 | ||
1468 | /** | 1475 | /** |
1469 | * Error message, NULL if we have not encountered any error yet. | 1476 | * Error message, NULL if we have not encountered any error yet. |
1470 | */ | 1477 | */ |
1471 | const char *message; | 1478 | const char *message; |
1472 | 1479 | ||
1473 | } resume; | 1480 | } resume; |
1474 | 1481 | ||
1475 | /** | 1482 | /** |
1476 | * These values are only valid for | 1483 | * These values are only valid for |
1477 | * GNUNET_FS_STATUS_UNINDEX_ERROR events. | 1484 | * GNUNET_FS_STATUS_UNINDEX_ERROR events. |
1478 | */ | 1485 | */ |
1479 | struct { | 1486 | struct |
1487 | { | ||
1480 | 1488 | ||
1481 | /** | 1489 | /** |
1482 | * Error message. | 1490 | * Error message. |
1483 | */ | 1491 | */ |
1484 | const char *message; | 1492 | const char *message; |
1485 | 1493 | ||
1486 | } error; | 1494 | } error; |
1487 | 1495 | ||
1488 | } specifics; | 1496 | } specifics; |
1489 | 1497 | ||
@@ -1493,7 +1501,7 @@ struct GNUNET_FS_ProgressInfo | |||
1493 | 1501 | ||
1494 | /** | 1502 | /** |
1495 | * Specific status code (determines the event type). | 1503 | * Specific status code (determines the event type). |
1496 | */ | 1504 | */ |
1497 | enum GNUNET_FS_Status status; | 1505 | enum GNUNET_FS_Status status; |
1498 | 1506 | ||
1499 | }; | 1507 | }; |
@@ -1514,53 +1522,51 @@ struct GNUNET_FS_ProgressInfo | |||
1514 | * will be passed to future callbacks in the respective | 1522 | * will be passed to future callbacks in the respective |
1515 | * field in the GNUNET_FS_ProgressInfo struct. | 1523 | * field in the GNUNET_FS_ProgressInfo struct. |
1516 | */ | 1524 | */ |
1517 | typedef void* (*GNUNET_FS_ProgressCallback) | 1525 | typedef void *(*GNUNET_FS_ProgressCallback) |
1518 | (void *cls, | 1526 | (void *cls, const struct GNUNET_FS_ProgressInfo * info); |
1519 | const struct GNUNET_FS_ProgressInfo *info); | ||
1520 | 1527 | ||
1521 | 1528 | ||
1522 | /** | 1529 | /** |
1523 | * General (global) option flags for file-sharing. | 1530 | * General (global) option flags for file-sharing. |
1524 | */ | 1531 | */ |
1525 | enum GNUNET_FS_Flags | 1532 | enum GNUNET_FS_Flags |
1526 | { | 1533 | { |
1527 | /** | 1534 | /** |
1528 | * No special flags set. | 1535 | * No special flags set. |
1529 | */ | 1536 | */ |
1530 | GNUNET_FS_FLAGS_NONE = 0, | 1537 | GNUNET_FS_FLAGS_NONE = 0, |
1531 | 1538 | ||
1532 | /** | 1539 | /** |
1533 | * Is persistence of operations desired? | 1540 | * Is persistence of operations desired? |
1534 | * (will create SUSPEND/RESUME events). | 1541 | * (will create SUSPEND/RESUME events). |
1535 | */ | 1542 | */ |
1536 | GNUNET_FS_FLAGS_PERSISTENCE = 1, | 1543 | GNUNET_FS_FLAGS_PERSISTENCE = 1, |
1537 | 1544 | ||
1538 | /** | 1545 | /** |
1539 | * Should we automatically trigger probes for search results | 1546 | * Should we automatically trigger probes for search results |
1540 | * to determine availability? | 1547 | * to determine availability? |
1541 | * (will create GNUNET_FS_STATUS_SEARCH_UPDATE events). | 1548 | * (will create GNUNET_FS_STATUS_SEARCH_UPDATE events). |
1542 | */ | 1549 | */ |
1543 | GNUNET_FS_FLAGS_DO_PROBES = 2 | 1550 | GNUNET_FS_FLAGS_DO_PROBES = 2 |
1544 | 1551 | }; | |
1545 | }; | ||
1546 | 1552 | ||
1547 | /** | 1553 | /** |
1548 | * Options specified in the VARARGs portion of GNUNET_FS_start. | 1554 | * Options specified in the VARARGs portion of GNUNET_FS_start. |
1549 | */ | 1555 | */ |
1550 | enum GNUNET_FS_OPTIONS | 1556 | enum GNUNET_FS_OPTIONS |
1551 | { | 1557 | { |
1552 | 1558 | ||
1553 | /** | 1559 | /** |
1554 | * Last option in the VARARG list. | 1560 | * Last option in the VARARG list. |
1555 | */ | 1561 | */ |
1556 | GNUNET_FS_OPTIONS_END = 0, | 1562 | GNUNET_FS_OPTIONS_END = 0, |
1557 | 1563 | ||
1558 | /** | 1564 | /** |
1559 | * Select the desired amount of parallelism (this option should be | 1565 | * Select the desired amount of parallelism (this option should be |
1560 | * followed by an "unsigned int" giving the desired maximum number | 1566 | * followed by an "unsigned int" giving the desired maximum number |
1561 | * of parallel downloads). | 1567 | * of parallel downloads). |
1562 | */ | 1568 | */ |
1563 | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, | 1569 | GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM = 1, |
1564 | 1570 | ||
1565 | /** | 1571 | /** |
1566 | * Maximum number of requests that should be pending at a given | 1572 | * Maximum number of requests that should be pending at a given |
@@ -1568,9 +1574,8 @@ enum GNUNET_FS_OPTIONS | |||
1568 | * if we are above this threshold, we should not activate any | 1574 | * if we are above this threshold, we should not activate any |
1569 | * additional downloads. | 1575 | * additional downloads. |
1570 | */ | 1576 | */ |
1571 | GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 | 1577 | GNUNET_FS_OPTIONS_REQUEST_PARALLELISM = 2 |
1572 | 1578 | }; | |
1573 | }; | ||
1574 | 1579 | ||
1575 | 1580 | ||
1576 | /** | 1581 | /** |
@@ -1621,8 +1626,7 @@ struct GNUNET_FS_BlockOptions | |||
1621 | /** | 1626 | /** |
1622 | * Return the current year (i.e. '2011'). | 1627 | * Return the current year (i.e. '2011'). |
1623 | */ | 1628 | */ |
1624 | unsigned int | 1629 | unsigned int GNUNET_FS_get_current_year (void); |
1625 | GNUNET_FS_get_current_year (void); | ||
1626 | 1630 | ||
1627 | 1631 | ||
1628 | /** | 1632 | /** |
@@ -1631,8 +1635,7 @@ GNUNET_FS_get_current_year (void); | |||
1631 | * @param year a year (after 1970, please ;-)). | 1635 | * @param year a year (after 1970, please ;-)). |
1632 | * @return absolute time for January 1st of that year. | 1636 | * @return absolute time for January 1st of that year. |
1633 | */ | 1637 | */ |
1634 | struct GNUNET_TIME_Absolute | 1638 | struct GNUNET_TIME_Absolute GNUNET_FS_year_to_time (unsigned int year); |
1635 | GNUNET_FS_year_to_time (unsigned int year); | ||
1636 | 1639 | ||
1637 | 1640 | ||
1638 | /** | 1641 | /** |
@@ -1652,13 +1655,12 @@ struct GNUNET_FS_Handle; | |||
1652 | * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END | 1655 | * @param ... list of optional options, terminated with GNUNET_FS_OPTIONS_END |
1653 | * @return NULL on error | 1656 | * @return NULL on error |
1654 | */ | 1657 | */ |
1655 | struct GNUNET_FS_Handle * | 1658 | struct GNUNET_FS_Handle *GNUNET_FS_start (const struct |
1656 | GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1659 | GNUNET_CONFIGURATION_Handle *cfg, |
1657 | const char *client_name, | 1660 | const char *client_name, |
1658 | GNUNET_FS_ProgressCallback upcb, | 1661 | GNUNET_FS_ProgressCallback upcb, |
1659 | void *upcb_cls, | 1662 | void *upcb_cls, |
1660 | enum GNUNET_FS_Flags flags, | 1663 | enum GNUNET_FS_Flags flags, ...); |
1661 | ...); | ||
1662 | 1664 | ||
1663 | 1665 | ||
1664 | /** | 1666 | /** |
@@ -1667,9 +1669,8 @@ GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1667 | * called after this function returns. | 1669 | * called after this function returns. |
1668 | * | 1670 | * |
1669 | * @param h handle that was returned from GNUNET_FS_start | 1671 | * @param h handle that was returned from GNUNET_FS_start |
1670 | */ | 1672 | */ |
1671 | void | 1673 | void GNUNET_FS_stop (struct GNUNET_FS_Handle *h); |
1672 | GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | ||
1673 | 1674 | ||
1674 | 1675 | ||
1675 | /** | 1676 | /** |
@@ -1681,12 +1682,11 @@ GNUNET_FS_stop (struct GNUNET_FS_Handle *h); | |||
1681 | * @return GNUNET_SYSERR on error, otherwise the number | 1682 | * @return GNUNET_SYSERR on error, otherwise the number |
1682 | * of meta-data items obtained | 1683 | * of meta-data items obtained |
1683 | */ | 1684 | */ |
1684 | int | 1685 | int |
1685 | GNUNET_FS_meta_data_extract_from_file (struct | 1686 | GNUNET_FS_meta_data_extract_from_file (struct |
1686 | GNUNET_CONTAINER_MetaData | 1687 | GNUNET_CONTAINER_MetaData |
1687 | *md, const char *filename, | 1688 | *md, const char *filename, |
1688 | struct EXTRACTOR_PluginList * | 1689 | struct EXTRACTOR_PluginList *extractors); |
1689 | extractors); | ||
1690 | 1690 | ||
1691 | 1691 | ||
1692 | /** | 1692 | /** |
@@ -1704,14 +1704,17 @@ GNUNET_FS_meta_data_extract_from_file (struct | |||
1704 | * this entry from the directory, GNUNET_SYSERR | 1704 | * this entry from the directory, GNUNET_SYSERR |
1705 | * to abort the iteration | 1705 | * to abort the iteration |
1706 | */ | 1706 | */ |
1707 | typedef int (*GNUNET_FS_FileInformationProcessor)(void *cls, | 1707 | typedef int (*GNUNET_FS_FileInformationProcessor) (void *cls, |
1708 | struct GNUNET_FS_FileInformation *fi, | 1708 | struct |
1709 | uint64_t length, | 1709 | GNUNET_FS_FileInformation * |
1710 | struct GNUNET_CONTAINER_MetaData *meta, | 1710 | fi, uint64_t length, |
1711 | struct GNUNET_FS_Uri **uri, | 1711 | struct |
1712 | struct GNUNET_FS_BlockOptions *bo, | 1712 | GNUNET_CONTAINER_MetaData * |
1713 | int *do_index, | 1713 | meta, |
1714 | void **client_info); | 1714 | struct GNUNET_FS_Uri ** uri, |
1715 | struct GNUNET_FS_BlockOptions | ||
1716 | * bo, int *do_index, | ||
1717 | void **client_info); | ||
1715 | 1718 | ||
1716 | 1719 | ||
1717 | /** | 1720 | /** |
@@ -1724,8 +1727,8 @@ typedef int (*GNUNET_FS_FileInformationProcessor)(void *cls, | |||
1724 | * can be passed to "GNUNET_FS_file_information_recover" | 1727 | * can be passed to "GNUNET_FS_file_information_recover" |
1725 | * to read this fi-struct from disk. | 1728 | * to read this fi-struct from disk. |
1726 | */ | 1729 | */ |
1727 | const char * | 1730 | const char *GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation |
1728 | GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s); | 1731 | *s); |
1729 | 1732 | ||
1730 | 1733 | ||
1731 | 1734 | ||
@@ -1743,14 +1746,17 @@ GNUNET_FS_file_information_get_id (struct GNUNET_FS_FileInformation *s); | |||
1743 | * @param bo block options | 1746 | * @param bo block options |
1744 | * @return publish structure entry for the file | 1747 | * @return publish structure entry for the file |
1745 | */ | 1748 | */ |
1746 | struct GNUNET_FS_FileInformation * | 1749 | struct GNUNET_FS_FileInformation |
1747 | GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, | 1750 | *GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, |
1748 | void *client_info, | 1751 | void *client_info, |
1749 | const char *filename, | 1752 | const char *filename, |
1750 | const struct GNUNET_FS_Uri *keywords, | 1753 | const struct GNUNET_FS_Uri |
1751 | const struct GNUNET_CONTAINER_MetaData *meta, | 1754 | *keywords, |
1752 | int do_index, | 1755 | const struct |
1753 | const struct GNUNET_FS_BlockOptions *bo); | 1756 | GNUNET_CONTAINER_MetaData |
1757 | *meta, int do_index, | ||
1758 | const struct | ||
1759 | GNUNET_FS_BlockOptions *bo); | ||
1754 | 1760 | ||
1755 | 1761 | ||
1756 | /** | 1762 | /** |
@@ -1769,15 +1775,17 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, | |||
1769 | * @param bo block options | 1775 | * @param bo block options |
1770 | * @return publish structure entry for the file | 1776 | * @return publish structure entry for the file |
1771 | */ | 1777 | */ |
1772 | struct GNUNET_FS_FileInformation * | 1778 | struct GNUNET_FS_FileInformation |
1773 | GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, | 1779 | *GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, |
1774 | void *client_info, | 1780 | void *client_info, |
1775 | uint64_t length, | 1781 | uint64_t length, void *data, |
1776 | void *data, | 1782 | const struct GNUNET_FS_Uri |
1777 | const struct GNUNET_FS_Uri *keywords, | 1783 | *keywords, |
1778 | const struct GNUNET_CONTAINER_MetaData *meta, | 1784 | const struct |
1779 | int do_index, | 1785 | GNUNET_CONTAINER_MetaData |
1780 | const struct GNUNET_FS_BlockOptions *bo); | 1786 | *meta, int do_index, |
1787 | const struct | ||
1788 | GNUNET_FS_BlockOptions *bo); | ||
1781 | 1789 | ||
1782 | 1790 | ||
1783 | /** | 1791 | /** |
@@ -1796,11 +1804,9 @@ GNUNET_FS_file_information_create_from_data (struct GNUNET_FS_Handle *h, | |||
1796 | * @param emsg location for the reader to store an error message | 1804 | * @param emsg location for the reader to store an error message |
1797 | * @return number of bytes written, usually "max", 0 on error | 1805 | * @return number of bytes written, usually "max", 0 on error |
1798 | */ | 1806 | */ |
1799 | typedef size_t (*GNUNET_FS_DataReader)(void *cls, | 1807 | typedef size_t (*GNUNET_FS_DataReader) (void *cls, |
1800 | uint64_t offset, | 1808 | uint64_t offset, |
1801 | size_t max, | 1809 | size_t max, void *buf, char **emsg); |
1802 | void *buf, | ||
1803 | char **emsg); | ||
1804 | 1810 | ||
1805 | 1811 | ||
1806 | /** | 1812 | /** |
@@ -1819,16 +1825,19 @@ typedef size_t (*GNUNET_FS_DataReader)(void *cls, | |||
1819 | * @param bo block options | 1825 | * @param bo block options |
1820 | * @return publish structure entry for the file | 1826 | * @return publish structure entry for the file |
1821 | */ | 1827 | */ |
1822 | struct GNUNET_FS_FileInformation * | 1828 | struct GNUNET_FS_FileInformation |
1823 | GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, | 1829 | *GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, |
1824 | void *client_info, | 1830 | void *client_info, |
1825 | uint64_t length, | 1831 | uint64_t length, |
1826 | GNUNET_FS_DataReader reader, | 1832 | GNUNET_FS_DataReader reader, |
1827 | void *reader_cls, | 1833 | void *reader_cls, |
1828 | const struct GNUNET_FS_Uri *keywords, | 1834 | const struct GNUNET_FS_Uri |
1829 | const struct GNUNET_CONTAINER_MetaData *meta, | 1835 | *keywords, |
1830 | int do_index, | 1836 | const struct |
1831 | const struct GNUNET_FS_BlockOptions *bo); | 1837 | GNUNET_CONTAINER_MetaData |
1838 | *meta, int do_index, | ||
1839 | const struct | ||
1840 | GNUNET_FS_BlockOptions *bo); | ||
1832 | 1841 | ||
1833 | 1842 | ||
1834 | /** | 1843 | /** |
@@ -1841,9 +1850,9 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, | |||
1841 | * @param fi information about the file (should not be | 1850 | * @param fi information about the file (should not be |
1842 | * used henceforth by the caller) | 1851 | * used henceforth by the caller) |
1843 | */ | 1852 | */ |
1844 | typedef void (*GNUNET_FS_FileProcessor)(void *cls, | 1853 | typedef void (*GNUNET_FS_FileProcessor) (void *cls, |
1845 | const char *filename, | 1854 | const char *filename, |
1846 | struct GNUNET_FS_FileInformation *fi); | 1855 | struct GNUNET_FS_FileInformation * fi); |
1847 | 1856 | ||
1848 | 1857 | ||
1849 | /** | 1858 | /** |
@@ -1859,14 +1868,13 @@ typedef void (*GNUNET_FS_FileProcessor)(void *cls, | |||
1859 | * @param emsg where to store an error message (on errors) | 1868 | * @param emsg where to store an error message (on errors) |
1860 | * @return GNUNET_OK on success | 1869 | * @return GNUNET_OK on success |
1861 | */ | 1870 | */ |
1862 | typedef int (*GNUNET_FS_DirectoryScanner)(void *cls, | 1871 | typedef int (*GNUNET_FS_DirectoryScanner) (void *cls, |
1863 | struct GNUNET_FS_Handle *h, | 1872 | struct GNUNET_FS_Handle * h, |
1864 | const char *dirname, | 1873 | const char *dirname, |
1865 | int do_index, | 1874 | int do_index, |
1866 | const struct GNUNET_FS_BlockOptions *bo, | 1875 | const struct GNUNET_FS_BlockOptions * |
1867 | GNUNET_FS_FileProcessor proc, | 1876 | bo, GNUNET_FS_FileProcessor proc, |
1868 | void *proc_cls, | 1877 | void *proc_cls, char **emsg); |
1869 | char **emsg); | ||
1870 | 1878 | ||
1871 | 1879 | ||
1872 | 1880 | ||
@@ -1893,13 +1901,12 @@ typedef int (*GNUNET_FS_DirectoryScanner)(void *cls, | |||
1893 | */ | 1901 | */ |
1894 | int | 1902 | int |
1895 | GNUNET_FS_directory_scanner_default (void *cls, | 1903 | GNUNET_FS_directory_scanner_default (void *cls, |
1896 | struct GNUNET_FS_Handle *h, | 1904 | struct GNUNET_FS_Handle *h, |
1897 | const char *dirname, | 1905 | const char *dirname, |
1898 | int do_index, | 1906 | int do_index, |
1899 | const struct GNUNET_FS_BlockOptions *bo, | 1907 | const struct GNUNET_FS_BlockOptions *bo, |
1900 | GNUNET_FS_FileProcessor proc, | 1908 | GNUNET_FS_FileProcessor proc, |
1901 | void *proc_cls, | 1909 | void *proc_cls, char **emsg); |
1902 | char **emsg); | ||
1903 | 1910 | ||
1904 | 1911 | ||
1905 | /** | 1912 | /** |
@@ -1922,15 +1929,17 @@ GNUNET_FS_directory_scanner_default (void *cls, | |||
1922 | * @param emsg where to store an error message | 1929 | * @param emsg where to store an error message |
1923 | * @return publish structure entry for the directory, NULL on error | 1930 | * @return publish structure entry for the directory, NULL on error |
1924 | */ | 1931 | */ |
1925 | struct GNUNET_FS_FileInformation * | 1932 | struct GNUNET_FS_FileInformation |
1926 | GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h, | 1933 | *GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle |
1927 | void *client_info, | 1934 | *h, void *client_info, |
1928 | const char *filename, | 1935 | const char *filename, |
1929 | GNUNET_FS_DirectoryScanner scanner, | 1936 | GNUNET_FS_DirectoryScanner |
1930 | void *scanner_cls, | 1937 | scanner, |
1931 | int do_index, | 1938 | void *scanner_cls, |
1932 | const struct GNUNET_FS_BlockOptions *bo, | 1939 | int do_index, |
1933 | char **emsg); | 1940 | const struct |
1941 | GNUNET_FS_BlockOptions | ||
1942 | *bo, char **emsg); | ||
1934 | 1943 | ||
1935 | 1944 | ||
1936 | /** | 1945 | /** |
@@ -1947,12 +1956,17 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h, | |||
1947 | * @param bo block options | 1956 | * @param bo block options |
1948 | * @return publish structure entry for the directory , NULL on error | 1957 | * @return publish structure entry for the directory , NULL on error |
1949 | */ | 1958 | */ |
1950 | struct GNUNET_FS_FileInformation * | 1959 | struct GNUNET_FS_FileInformation |
1951 | GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | 1960 | *GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle |
1952 | void *client_info, | 1961 | *h, void *client_info, |
1953 | const struct GNUNET_FS_Uri *keywords, | 1962 | const struct |
1954 | const struct GNUNET_CONTAINER_MetaData *meta, | 1963 | GNUNET_FS_Uri *keywords, |
1955 | const struct GNUNET_FS_BlockOptions *bo); | 1964 | const struct |
1965 | GNUNET_CONTAINER_MetaData | ||
1966 | *meta, | ||
1967 | const struct | ||
1968 | GNUNET_FS_BlockOptions | ||
1969 | *bo); | ||
1956 | 1970 | ||
1957 | 1971 | ||
1958 | /** | 1972 | /** |
@@ -1962,7 +1976,8 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h, | |||
1962 | * @return GNUNET_YES if so, GNUNET_NO if not | 1976 | * @return GNUNET_YES if so, GNUNET_NO if not |
1963 | */ | 1977 | */ |
1964 | int | 1978 | int |
1965 | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation *ent); | 1979 | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation |
1980 | *ent); | ||
1966 | 1981 | ||
1967 | 1982 | ||
1968 | /** | 1983 | /** |
@@ -1978,7 +1993,7 @@ GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation | |||
1978 | */ | 1993 | */ |
1979 | int | 1994 | int |
1980 | GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, | 1995 | GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, |
1981 | struct GNUNET_FS_FileInformation *ent); | 1996 | struct GNUNET_FS_FileInformation *ent); |
1982 | 1997 | ||
1983 | 1998 | ||
1984 | /** | 1999 | /** |
@@ -1997,8 +2012,8 @@ GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, | |||
1997 | */ | 2012 | */ |
1998 | void | 2013 | void |
1999 | GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, | 2014 | GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, |
2000 | GNUNET_FS_FileInformationProcessor proc, | 2015 | GNUNET_FS_FileInformationProcessor proc, |
2001 | void *proc_cls); | 2016 | void *proc_cls); |
2002 | 2017 | ||
2003 | 2018 | ||
2004 | /** | 2019 | /** |
@@ -2013,27 +2028,27 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir, | |||
2013 | */ | 2028 | */ |
2014 | void | 2029 | void |
2015 | GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | 2030 | GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, |
2016 | GNUNET_FS_FileInformationProcessor cleaner, | 2031 | GNUNET_FS_FileInformationProcessor cleaner, |
2017 | void *cleaner_cls); | 2032 | void *cleaner_cls); |
2018 | 2033 | ||
2019 | 2034 | ||
2020 | /** | 2035 | /** |
2021 | * Options for publishing. Compatible options | 2036 | * Options for publishing. Compatible options |
2022 | * can be OR'ed together. | 2037 | * can be OR'ed together. |
2023 | */ | 2038 | */ |
2024 | enum GNUNET_FS_PublishOptions | 2039 | enum GNUNET_FS_PublishOptions |
2025 | { | 2040 | { |
2026 | /** | 2041 | /** |
2027 | * No options (use defaults for everything). | 2042 | * No options (use defaults for everything). |
2028 | */ | 2043 | */ |
2029 | GNUNET_FS_PUBLISH_OPTION_NONE = 0, | 2044 | GNUNET_FS_PUBLISH_OPTION_NONE = 0, |
2030 | 2045 | ||
2031 | /** | 2046 | /** |
2032 | * Simulate publishing. With this option, no data will be stored | 2047 | * Simulate publishing. With this option, no data will be stored |
2033 | * in the datastore. Useful for computing URIs from files. | 2048 | * in the datastore. Useful for computing URIs from files. |
2034 | */ | 2049 | */ |
2035 | GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 | 2050 | GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY = 1 |
2036 | }; | 2051 | }; |
2037 | 2052 | ||
2038 | /** | 2053 | /** |
2039 | * Publish a file or directory. | 2054 | * Publish a file or directory. |
@@ -2048,13 +2063,19 @@ enum GNUNET_FS_PublishOptions | |||
2048 | * @param options options for the publication | 2063 | * @param options options for the publication |
2049 | * @return context that can be used to control the publish operation | 2064 | * @return context that can be used to control the publish operation |
2050 | */ | 2065 | */ |
2051 | struct GNUNET_FS_PublishContext * | 2066 | struct GNUNET_FS_PublishContext *GNUNET_FS_publish_start (struct |
2052 | GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | 2067 | GNUNET_FS_Handle *h, |
2053 | struct GNUNET_FS_FileInformation *fi, | 2068 | struct |
2054 | struct GNUNET_FS_Namespace *namespace, | 2069 | GNUNET_FS_FileInformation |
2055 | const char *nid, | 2070 | *fi, |
2056 | const char *nuid, | 2071 | struct |
2057 | enum GNUNET_FS_PublishOptions options); | 2072 | GNUNET_FS_Namespace |
2073 | *namespace, | ||
2074 | const char *nid, | ||
2075 | const char *nuid, | ||
2076 | enum | ||
2077 | GNUNET_FS_PublishOptions | ||
2078 | options); | ||
2058 | 2079 | ||
2059 | 2080 | ||
2060 | /** | 2081 | /** |
@@ -2065,8 +2086,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, | |||
2065 | * | 2086 | * |
2066 | * @param pc context for the publication to stop | 2087 | * @param pc context for the publication to stop |
2067 | */ | 2088 | */ |
2068 | void | 2089 | void GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc); |
2069 | GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc); | ||
2070 | 2090 | ||
2071 | 2091 | ||
2072 | /** | 2092 | /** |
@@ -2077,10 +2097,10 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc); | |||
2077 | * @param uri URI under which the block is now available, NULL on error | 2097 | * @param uri URI under which the block is now available, NULL on error |
2078 | * @param emsg error message, NULL on success | 2098 | * @param emsg error message, NULL on success |
2079 | */ | 2099 | */ |
2080 | typedef void (*GNUNET_FS_PublishContinuation)(void *cls, | 2100 | typedef void (*GNUNET_FS_PublishContinuation) (void *cls, |
2081 | const struct GNUNET_FS_Uri *uri, | 2101 | const struct GNUNET_FS_Uri * uri, |
2082 | const char *emsg); | 2102 | const char *emsg); |
2083 | 2103 | ||
2084 | 2104 | ||
2085 | /** | 2105 | /** |
2086 | * Publish a KBlock on GNUnet. | 2106 | * Publish a KBlock on GNUnet. |
@@ -2096,13 +2116,12 @@ typedef void (*GNUNET_FS_PublishContinuation)(void *cls, | |||
2096 | */ | 2116 | */ |
2097 | void | 2117 | void |
2098 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | 2118 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, |
2099 | const struct GNUNET_FS_Uri *ksk_uri, | 2119 | const struct GNUNET_FS_Uri *ksk_uri, |
2100 | const struct GNUNET_CONTAINER_MetaData *meta, | 2120 | const struct GNUNET_CONTAINER_MetaData *meta, |
2101 | const struct GNUNET_FS_Uri *uri, | 2121 | const struct GNUNET_FS_Uri *uri, |
2102 | const struct GNUNET_FS_BlockOptions *bo, | 2122 | const struct GNUNET_FS_BlockOptions *bo, |
2103 | enum GNUNET_FS_PublishOptions options, | 2123 | enum GNUNET_FS_PublishOptions options, |
2104 | GNUNET_FS_PublishContinuation cont, | 2124 | GNUNET_FS_PublishContinuation cont, void *cont_cls); |
2105 | void *cont_cls); | ||
2106 | 2125 | ||
2107 | 2126 | ||
2108 | /** | 2127 | /** |
@@ -2121,15 +2140,14 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | |||
2121 | */ | 2140 | */ |
2122 | void | 2141 | void |
2123 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | 2142 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, |
2124 | struct GNUNET_FS_Namespace *namespace, | 2143 | struct GNUNET_FS_Namespace *namespace, |
2125 | const char *identifier, | 2144 | const char *identifier, |
2126 | const char *update, | 2145 | const char *update, |
2127 | const struct GNUNET_CONTAINER_MetaData *meta, | 2146 | const struct GNUNET_CONTAINER_MetaData *meta, |
2128 | const struct GNUNET_FS_Uri *uri, | 2147 | const struct GNUNET_FS_Uri *uri, |
2129 | const struct GNUNET_FS_BlockOptions *bo, | 2148 | const struct GNUNET_FS_BlockOptions *bo, |
2130 | enum GNUNET_FS_PublishOptions options, | 2149 | enum GNUNET_FS_PublishOptions options, |
2131 | GNUNET_FS_PublishContinuation cont, | 2150 | GNUNET_FS_PublishContinuation cont, void *cont_cls); |
2132 | void *cont_cls); | ||
2133 | 2151 | ||
2134 | 2152 | ||
2135 | /** | 2153 | /** |
@@ -2141,8 +2159,8 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
2141 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | 2159 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort |
2142 | */ | 2160 | */ |
2143 | typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, | 2161 | typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, |
2144 | const char *filename, | 2162 | const char *filename, |
2145 | const GNUNET_HashCode *file_id); | 2163 | const GNUNET_HashCode * file_id); |
2146 | 2164 | ||
2147 | 2165 | ||
2148 | /** | 2166 | /** |
@@ -2156,12 +2174,11 @@ typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, | |||
2156 | * error) or "PREREQ_DONE" (on success) | 2174 | * error) or "PREREQ_DONE" (on success) |
2157 | * @param cont_cls closure for cont | 2175 | * @param cont_cls closure for cont |
2158 | */ | 2176 | */ |
2159 | void | 2177 | void |
2160 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | 2178 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, |
2161 | GNUNET_FS_IndexedFileProcessor iterator, | 2179 | GNUNET_FS_IndexedFileProcessor iterator, |
2162 | void *iterator_cls, | 2180 | void *iterator_cls, |
2163 | GNUNET_SCHEDULER_Task cont, | 2181 | GNUNET_SCHEDULER_Task cont, void *cont_cls); |
2164 | void *cont_cls); | ||
2165 | 2182 | ||
2166 | 2183 | ||
2167 | /** | 2184 | /** |
@@ -2172,10 +2189,10 @@ GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | |||
2172 | * @param cctx initial value for the client context | 2189 | * @param cctx initial value for the client context |
2173 | * @return NULL on error, otherwise handle | 2190 | * @return NULL on error, otherwise handle |
2174 | */ | 2191 | */ |
2175 | struct GNUNET_FS_UnindexContext * | 2192 | struct GNUNET_FS_UnindexContext *GNUNET_FS_unindex_start (struct |
2176 | GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | 2193 | GNUNET_FS_Handle *h, |
2177 | const char *filename, | 2194 | const char *filename, |
2178 | void *cctx); | 2195 | void *cctx); |
2179 | 2196 | ||
2180 | 2197 | ||
2181 | /** | 2198 | /** |
@@ -2183,8 +2200,7 @@ GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, | |||
2183 | * | 2200 | * |
2184 | * @param uc handle | 2201 | * @param uc handle |
2185 | */ | 2202 | */ |
2186 | void | 2203 | void GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); |
2187 | GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | ||
2188 | 2204 | ||
2189 | 2205 | ||
2190 | /** | 2206 | /** |
@@ -2201,13 +2217,13 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | |||
2201 | */ | 2217 | */ |
2202 | void | 2218 | void |
2203 | GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | 2219 | GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, |
2204 | struct GNUNET_FS_Uri *ksk_uri, | 2220 | struct GNUNET_FS_Uri *ksk_uri, |
2205 | struct GNUNET_FS_Namespace *namespace, | 2221 | struct GNUNET_FS_Namespace *namespace, |
2206 | const struct GNUNET_CONTAINER_MetaData *meta, | 2222 | const struct GNUNET_CONTAINER_MetaData *meta, |
2207 | const struct GNUNET_FS_BlockOptions *bo, | 2223 | const struct GNUNET_FS_BlockOptions *bo, |
2208 | const char *rootEntry, | 2224 | const char *rootEntry, |
2209 | GNUNET_FS_PublishContinuation cont, | 2225 | GNUNET_FS_PublishContinuation cont, |
2210 | void *cont_cls); | 2226 | void *cont_cls); |
2211 | 2227 | ||
2212 | 2228 | ||
2213 | /** | 2229 | /** |
@@ -2218,9 +2234,8 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
2218 | * @param name name to use for the namespace | 2234 | * @param name name to use for the namespace |
2219 | * @return handle to the namespace, NULL on error | 2235 | * @return handle to the namespace, NULL on error |
2220 | */ | 2236 | */ |
2221 | struct GNUNET_FS_Namespace * | 2237 | struct GNUNET_FS_Namespace *GNUNET_FS_namespace_create (struct GNUNET_FS_Handle |
2222 | GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, | 2238 | *h, const char *name); |
2223 | const char *name); | ||
2224 | 2239 | ||
2225 | 2240 | ||
2226 | /** | 2241 | /** |
@@ -2234,9 +2249,8 @@ GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, | |||
2234 | * | 2249 | * |
2235 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 2250 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
2236 | */ | 2251 | */ |
2237 | int | 2252 | int |
2238 | GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, | 2253 | GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int freeze); |
2239 | int freeze); | ||
2240 | 2254 | ||
2241 | 2255 | ||
2242 | /** | 2256 | /** |
@@ -2249,8 +2263,8 @@ GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, | |||
2249 | * @param id hash identifier for the namespace | 2263 | * @param id hash identifier for the namespace |
2250 | */ | 2264 | */ |
2251 | typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, | 2265 | typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, |
2252 | const char *name, | 2266 | const char *name, |
2253 | const GNUNET_HashCode *id); | 2267 | const GNUNET_HashCode * id); |
2254 | 2268 | ||
2255 | 2269 | ||
2256 | /** | 2270 | /** |
@@ -2262,10 +2276,9 @@ typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, | |||
2262 | * @param cb function to call on each known namespace | 2276 | * @param cb function to call on each known namespace |
2263 | * @param cb_cls closure for cb | 2277 | * @param cb_cls closure for cb |
2264 | */ | 2278 | */ |
2265 | void | 2279 | void |
2266 | GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, | 2280 | GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, |
2267 | GNUNET_FS_NamespaceInfoProcessor cb, | 2281 | GNUNET_FS_NamespaceInfoProcessor cb, void *cb_cls); |
2268 | void *cb_cls); | ||
2269 | 2282 | ||
2270 | 2283 | ||
2271 | /** | 2284 | /** |
@@ -2277,12 +2290,12 @@ GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, | |||
2277 | * @param last_meta metadata associated with last_uri | 2290 | * @param last_meta metadata associated with last_uri |
2278 | * @param next_id identifier that should be used for updates | 2291 | * @param next_id identifier that should be used for updates |
2279 | */ | 2292 | */ |
2280 | typedef void | 2293 | typedef void |
2281 | (*GNUNET_FS_IdentifierProcessor)(void *cls, | 2294 | (*GNUNET_FS_IdentifierProcessor) (void *cls, |
2282 | const char *last_id, | 2295 | const char *last_id, |
2283 | const struct GNUNET_FS_Uri *last_uri, | 2296 | const struct GNUNET_FS_Uri * last_uri, |
2284 | const struct GNUNET_CONTAINER_MetaData *last_meta, | 2297 | const struct GNUNET_CONTAINER_MetaData * |
2285 | const char *next_id); | 2298 | last_meta, const char *next_id); |
2286 | 2299 | ||
2287 | 2300 | ||
2288 | /** | 2301 | /** |
@@ -2307,28 +2320,27 @@ typedef void | |||
2307 | */ | 2320 | */ |
2308 | void | 2321 | void |
2309 | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | 2322 | GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, |
2310 | const char *next_id, | 2323 | const char *next_id, |
2311 | GNUNET_FS_IdentifierProcessor ip, | 2324 | GNUNET_FS_IdentifierProcessor ip, |
2312 | void *ip_cls); | 2325 | void *ip_cls); |
2313 | 2326 | ||
2314 | 2327 | ||
2315 | /** | 2328 | /** |
2316 | * Options for searching. Compatible options | 2329 | * Options for searching. Compatible options |
2317 | * can be OR'ed together. | 2330 | * can be OR'ed together. |
2318 | */ | 2331 | */ |
2319 | enum GNUNET_FS_SearchOptions | 2332 | enum GNUNET_FS_SearchOptions |
2320 | { | 2333 | { |
2321 | /** | 2334 | /** |
2322 | * No options (use defaults for everything). | 2335 | * No options (use defaults for everything). |
2323 | */ | 2336 | */ |
2324 | GNUNET_FS_SEARCH_OPTION_NONE = 0, | 2337 | GNUNET_FS_SEARCH_OPTION_NONE = 0, |
2325 | 2338 | ||
2326 | /** | 2339 | /** |
2327 | * Only search the local host, do not search remote systems (no P2P) | 2340 | * Only search the local host, do not search remote systems (no P2P) |
2328 | */ | 2341 | */ |
2329 | GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY = 1 | 2342 | GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY = 1 |
2330 | 2343 | }; | |
2331 | }; | ||
2332 | 2344 | ||
2333 | 2345 | ||
2334 | /** | 2346 | /** |
@@ -2342,12 +2354,14 @@ enum GNUNET_FS_SearchOptions | |||
2342 | * @param cctx initial value for the client context | 2354 | * @param cctx initial value for the client context |
2343 | * @return context that can be used to control the search | 2355 | * @return context that can be used to control the search |
2344 | */ | 2356 | */ |
2345 | struct GNUNET_FS_SearchContext * | 2357 | struct GNUNET_FS_SearchContext *GNUNET_FS_search_start (struct GNUNET_FS_Handle |
2346 | GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, | 2358 | *h, |
2347 | const struct GNUNET_FS_Uri *uri, | 2359 | const struct |
2348 | uint32_t anonymity, | 2360 | GNUNET_FS_Uri *uri, |
2349 | enum GNUNET_FS_SearchOptions options, | 2361 | uint32_t anonymity, |
2350 | void *cctx); | 2362 | enum |
2363 | GNUNET_FS_SearchOptions | ||
2364 | options, void *cctx); | ||
2351 | 2365 | ||
2352 | 2366 | ||
2353 | /** | 2367 | /** |
@@ -2355,8 +2369,7 @@ GNUNET_FS_search_start (struct GNUNET_FS_Handle *h, | |||
2355 | * | 2369 | * |
2356 | * @param sc context for the search that should be paused | 2370 | * @param sc context for the search that should be paused |
2357 | */ | 2371 | */ |
2358 | void | 2372 | void GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc); |
2359 | GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc); | ||
2360 | 2373 | ||
2361 | 2374 | ||
2362 | /** | 2375 | /** |
@@ -2364,8 +2377,7 @@ GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc); | |||
2364 | * | 2377 | * |
2365 | * @param sc context for the search that should be resumed | 2378 | * @param sc context for the search that should be resumed |
2366 | */ | 2379 | */ |
2367 | void | 2380 | void GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc); |
2368 | GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc); | ||
2369 | 2381 | ||
2370 | 2382 | ||
2371 | /** | 2383 | /** |
@@ -2373,8 +2385,7 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc); | |||
2373 | * | 2385 | * |
2374 | * @param sc context for the search that should be stopped | 2386 | * @param sc context for the search that should be stopped |
2375 | */ | 2387 | */ |
2376 | void | 2388 | void GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc); |
2377 | GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc); | ||
2378 | 2389 | ||
2379 | 2390 | ||
2380 | 2391 | ||
@@ -2383,29 +2394,29 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc); | |||
2383 | * Options for downloading. Compatible options | 2394 | * Options for downloading. Compatible options |
2384 | * can be OR'ed together. | 2395 | * can be OR'ed together. |
2385 | */ | 2396 | */ |
2386 | enum GNUNET_FS_DownloadOptions | 2397 | enum GNUNET_FS_DownloadOptions |
2387 | { | 2398 | { |
2388 | /** | 2399 | /** |
2389 | * No options (use defaults for everything). | 2400 | * No options (use defaults for everything). |
2390 | */ | 2401 | */ |
2391 | GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, | 2402 | GNUNET_FS_DOWNLOAD_OPTION_NONE = 0, |
2392 | 2403 | ||
2393 | /** | 2404 | /** |
2394 | * Only download from the local host, do not access remote systems (no P2P) | 2405 | * Only download from the local host, do not access remote systems (no P2P) |
2395 | */ | 2406 | */ |
2396 | GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY = 1, | 2407 | GNUNET_FS_DOWNLOAD_OPTION_LOOPBACK_ONLY = 1, |
2397 | 2408 | ||
2398 | /** | 2409 | /** |
2399 | * Do a recursive download (that is, automatically trigger the | 2410 | * Do a recursive download (that is, automatically trigger the |
2400 | * download of files in directories). | 2411 | * download of files in directories). |
2401 | */ | 2412 | */ |
2402 | GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE = 2, | 2413 | GNUNET_FS_DOWNLOAD_OPTION_RECURSIVE = 2, |
2403 | 2414 | ||
2404 | /** | 2415 | /** |
2405 | * Do not append temporary data to | 2416 | * Do not append temporary data to |
2406 | * the target file (for the IBlocks). | 2417 | * the target file (for the IBlocks). |
2407 | */ | 2418 | */ |
2408 | GNUNET_FS_DOWNLOAD_NO_TEMPORARIES = 4, | 2419 | GNUNET_FS_DOWNLOAD_NO_TEMPORARIES = 4, |
2409 | 2420 | ||
2410 | /** | 2421 | /** |
2411 | * Internal option used to flag this download as a 'probe' for a | 2422 | * Internal option used to flag this download as a 'probe' for a |
@@ -2414,9 +2425,8 @@ enum GNUNET_FS_DownloadOptions | |||
2414 | * Also, probe downloads are not serialized on suspension. Normal | 2425 | * Also, probe downloads are not serialized on suspension. Normal |
2415 | * clients should not use this! | 2426 | * clients should not use this! |
2416 | */ | 2427 | */ |
2417 | GNUNET_FS_DOWNLOAD_IS_PROBE = (1<<31) | 2428 | GNUNET_FS_DOWNLOAD_IS_PROBE = (1 << 31) |
2418 | 2429 | }; | |
2419 | }; | ||
2420 | 2430 | ||
2421 | 2431 | ||
2422 | 2432 | ||
@@ -2450,18 +2460,26 @@ enum GNUNET_FS_DownloadOptions | |||
2450 | * for top-level downloads; useful for manually-triggered recursive downloads) | 2460 | * for top-level downloads; useful for manually-triggered recursive downloads) |
2451 | * @return context that can be used to control this download | 2461 | * @return context that can be used to control this download |
2452 | */ | 2462 | */ |
2453 | struct GNUNET_FS_DownloadContext * | 2463 | struct GNUNET_FS_DownloadContext *GNUNET_FS_download_start (struct |
2454 | GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | 2464 | GNUNET_FS_Handle *h, |
2455 | const struct GNUNET_FS_Uri *uri, | 2465 | const struct |
2456 | const struct GNUNET_CONTAINER_MetaData *meta, | 2466 | GNUNET_FS_Uri *uri, |
2457 | const char *filename, | 2467 | const struct |
2458 | const char *tempname, | 2468 | GNUNET_CONTAINER_MetaData |
2459 | uint64_t offset, | 2469 | *meta, |
2460 | uint64_t length, | 2470 | const char |
2461 | uint32_t anonymity, | 2471 | *filename, |
2462 | enum GNUNET_FS_DownloadOptions options, | 2472 | const char |
2463 | void *cctx, | 2473 | *tempname, |
2464 | struct GNUNET_FS_DownloadContext *parent); | 2474 | uint64_t offset, |
2475 | uint64_t length, | ||
2476 | uint32_t anonymity, | ||
2477 | enum | ||
2478 | GNUNET_FS_DownloadOptions | ||
2479 | options, void *cctx, | ||
2480 | struct | ||
2481 | GNUNET_FS_DownloadContext | ||
2482 | *parent); | ||
2465 | 2483 | ||
2466 | 2484 | ||
2467 | /** | 2485 | /** |
@@ -2498,16 +2516,29 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, | |||
2498 | * @param cctx initial value for the client context for this download | 2516 | * @param cctx initial value for the client context for this download |
2499 | * @return context that can be used to control this download | 2517 | * @return context that can be used to control this download |
2500 | */ | 2518 | */ |
2501 | struct GNUNET_FS_DownloadContext * | 2519 | struct GNUNET_FS_DownloadContext *GNUNET_FS_download_start_from_search (struct |
2502 | GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, | 2520 | GNUNET_FS_Handle |
2503 | struct GNUNET_FS_SearchResult *sr, | 2521 | *h, |
2504 | const char *filename, | 2522 | struct |
2505 | const char *tempname, | 2523 | GNUNET_FS_SearchResult |
2506 | uint64_t offset, | 2524 | *sr, |
2507 | uint64_t length, | 2525 | const |
2508 | uint32_t anonymity, | 2526 | char |
2509 | enum GNUNET_FS_DownloadOptions options, | 2527 | *filename, |
2510 | void *cctx); | 2528 | const |
2529 | char | ||
2530 | *tempname, | ||
2531 | uint64_t | ||
2532 | offset, | ||
2533 | uint64_t | ||
2534 | length, | ||
2535 | uint32_t | ||
2536 | anonymity, | ||
2537 | enum | ||
2538 | GNUNET_FS_DownloadOptions | ||
2539 | options, | ||
2540 | void | ||
2541 | *cctx); | ||
2511 | 2542 | ||
2512 | 2543 | ||
2513 | /** | 2544 | /** |
@@ -2517,8 +2548,7 @@ GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, | |||
2517 | * @param do_delete delete files of incomplete downloads | 2548 | * @param do_delete delete files of incomplete downloads |
2518 | */ | 2549 | */ |
2519 | void | 2550 | void |
2520 | GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, | 2551 | GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, int do_delete); |
2521 | int do_delete); | ||
2522 | 2552 | ||
2523 | 2553 | ||
2524 | 2554 | ||
@@ -2536,8 +2566,9 @@ GNUNET_FS_download_stop (struct GNUNET_FS_DownloadContext *dc, | |||
2536 | * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if | 2566 | * @return GNUNET_YES if it is, GNUNET_NO if it is not, GNUNET_SYSERR if |
2537 | * we have no mime-type information (treat as 'GNUNET_NO') | 2567 | * we have no mime-type information (treat as 'GNUNET_NO') |
2538 | */ | 2568 | */ |
2539 | int | 2569 | int |
2540 | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData *md); | 2570 | GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData |
2571 | *md); | ||
2541 | 2572 | ||
2542 | 2573 | ||
2543 | /** | 2574 | /** |
@@ -2546,8 +2577,7 @@ GNUNET_FS_meta_data_test_for_directory (const struct GNUNET_CONTAINER_MetaData * | |||
2546 | * | 2577 | * |
2547 | * @param md metadata to add mimetype to | 2578 | * @param md metadata to add mimetype to |
2548 | */ | 2579 | */ |
2549 | void | 2580 | void GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); |
2550 | GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); | ||
2551 | 2581 | ||
2552 | 2582 | ||
2553 | /** | 2583 | /** |
@@ -2556,8 +2586,8 @@ GNUNET_FS_meta_data_make_directory (struct GNUNET_CONTAINER_MetaData *md); | |||
2556 | * @param md given meta data | 2586 | * @param md given meta data |
2557 | * @return NULL if meta data is useless for suggesting a filename | 2587 | * @return NULL if meta data is useless for suggesting a filename |
2558 | */ | 2588 | */ |
2559 | char * | 2589 | char *GNUNET_FS_meta_data_suggest_filename (const struct |
2560 | GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData *md); | 2590 | GNUNET_CONTAINER_MetaData *md); |
2561 | 2591 | ||
2562 | 2592 | ||
2563 | /** | 2593 | /** |
@@ -2575,12 +2605,14 @@ GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData *md | |||
2575 | * embedded with the directory itself). | 2605 | * embedded with the directory itself). |
2576 | * @param data data available for the file (length bytes) | 2606 | * @param data data available for the file (length bytes) |
2577 | */ | 2607 | */ |
2578 | typedef void (*GNUNET_FS_DirectoryEntryProcessor)(void *cls, | 2608 | typedef void (*GNUNET_FS_DirectoryEntryProcessor) (void *cls, |
2579 | const char *filename, | 2609 | const char *filename, |
2580 | const struct GNUNET_FS_Uri *uri, | 2610 | const struct GNUNET_FS_Uri * |
2581 | const struct GNUNET_CONTAINER_MetaData *meta, | 2611 | uri, |
2582 | size_t length, | 2612 | const struct |
2583 | const void *data); | 2613 | GNUNET_CONTAINER_MetaData * |
2614 | meta, size_t length, | ||
2615 | const void *data); | ||
2584 | 2616 | ||
2585 | 2617 | ||
2586 | /** | 2618 | /** |
@@ -2602,12 +2634,12 @@ typedef void (*GNUNET_FS_DirectoryEntryProcessor)(void *cls, | |||
2602 | * GNUNET_NO if this could be part of a directory (but not 100% OK) | 2634 | * GNUNET_NO if this could be part of a directory (but not 100% OK) |
2603 | * GNUNET_SYSERR if 'data' does not represent a directory | 2635 | * GNUNET_SYSERR if 'data' does not represent a directory |
2604 | */ | 2636 | */ |
2605 | int | 2637 | int |
2606 | GNUNET_FS_directory_list_contents (size_t size, | 2638 | GNUNET_FS_directory_list_contents (size_t size, |
2607 | const void *data, | 2639 | const void *data, |
2608 | uint64_t offset, | 2640 | uint64_t offset, |
2609 | GNUNET_FS_DirectoryEntryProcessor dep, | 2641 | GNUNET_FS_DirectoryEntryProcessor dep, |
2610 | void *dep_cls); | 2642 | void *dep_cls); |
2611 | 2643 | ||
2612 | 2644 | ||
2613 | /** | 2645 | /** |
@@ -2620,8 +2652,10 @@ struct GNUNET_FS_DirectoryBuilder; | |||
2620 | * | 2652 | * |
2621 | * @param mdir metadata for the directory | 2653 | * @param mdir metadata for the directory |
2622 | */ | 2654 | */ |
2623 | struct GNUNET_FS_DirectoryBuilder * | 2655 | struct GNUNET_FS_DirectoryBuilder *GNUNET_FS_directory_builder_create (const |
2624 | GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData *mdir); | 2656 | struct |
2657 | GNUNET_CONTAINER_MetaData | ||
2658 | *mdir); | ||
2625 | 2659 | ||
2626 | 2660 | ||
2627 | /** | 2661 | /** |
@@ -2636,10 +2670,10 @@ GNUNET_FS_directory_builder_create (const struct GNUNET_CONTAINER_MetaData *mdir | |||
2636 | */ | 2670 | */ |
2637 | void | 2671 | void |
2638 | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | 2672 | GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, |
2639 | const struct GNUNET_FS_Uri *uri, | 2673 | const struct GNUNET_FS_Uri *uri, |
2640 | const struct GNUNET_CONTAINER_MetaData *md, | 2674 | const struct GNUNET_CONTAINER_MetaData *md, |
2641 | const void *data); | 2675 | const void *data); |
2642 | 2676 | ||
2643 | 2677 | ||
2644 | /** | 2678 | /** |
2645 | * Finish building the directory. Frees the | 2679 | * Finish building the directory. Frees the |
@@ -2653,8 +2687,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, | |||
2653 | */ | 2687 | */ |
2654 | int | 2688 | int |
2655 | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, | 2689 | GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld, |
2656 | size_t *rsize, | 2690 | size_t * rsize, void **rdata); |
2657 | void **rdata); | ||
2658 | 2691 | ||
2659 | 2692 | ||
2660 | #if 0 /* keep Emacsens' auto-indent happy */ | 2693 | #if 0 /* keep Emacsens' auto-indent happy */ |