+ if (GNUNET_OK != GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size))
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
+ ret->is_directory = GNUNET_NO;
+ ret->data.file.do_index = GNUNET_YES;
+ ret->data.file.have_hash = GNUNET_NO;
+ ret->data.file.index_start_confirmed = GNUNET_NO;
+ ret->data.file.reader = &GNUNET_FS_data_reader_file_;
+ ret->data.file.reader_cls =
+ GNUNET_FS_make_file_reader_context_ (ret->filename);
+ break;
+ case 2: /* file-index-with-hash */
+ if (NULL == ret->filename)
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
+ if ((GNUNET_OK != GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) ||
+ (GNUNET_OK !=
+ GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id,
+ sizeof (GNUNET_HashCode))))
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
+ ret->is_directory = GNUNET_NO;
+ ret->data.file.do_index = GNUNET_YES;
+ ret->data.file.have_hash = GNUNET_YES;
+ ret->data.file.index_start_confirmed = GNUNET_NO;
+ ret->data.file.reader = &GNUNET_FS_data_reader_file_;
+ ret->data.file.reader_cls =
+ GNUNET_FS_make_file_reader_context_ (ret->filename);
+ break;
+ case 3: /* file-index-with-hash-confirmed */
+ if (NULL == ret->filename)
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
+ if ((GNUNET_OK != GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) ||
+ (GNUNET_OK !=
+ GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id,
+ sizeof (GNUNET_HashCode))))
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
+ ret->is_directory = GNUNET_NO;
+ ret->data.file.do_index = GNUNET_YES;
+ ret->data.file.have_hash = GNUNET_YES;
+ ret->data.file.index_start_confirmed = GNUNET_YES;
+ ret->data.file.reader = &GNUNET_FS_data_reader_file_;
+ ret->data.file.reader_cls =
+ GNUNET_FS_make_file_reader_context_ (ret->filename);
+ break;
+ case 4: /* directory */
+ ret->is_directory = GNUNET_YES;
+ if ((GNUNET_OK != GNUNET_BIO_read_int32 (rh, &dsize)) ||
+ (NULL == (ret->data.dir.dir_data = GNUNET_malloc_large (dsize))) ||
+ (GNUNET_OK !=
+ GNUNET_BIO_read (rh, "dir-data", ret->data.dir.dir_data, dsize)) ||
+ (GNUNET_OK !=
+ GNUNET_BIO_read_string (rh, "ent-filename", &filename, 16 * 1024)))
+ {
+ GNUNET_break (0);
+ goto cleanup;
+ }
+ ret->data.dir.dir_size = (uint32_t) dsize;
+ if (filename != NULL)