- case 0: /* file-insert */
- if (GNUNET_OK !=
- GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size))
- goto cleanup;
- ret->is_directory = GNUNET_NO;
- ret->data.file.do_index = GNUNET_NO;
- ret->data.file.have_hash = GNUNET_NO;
- ret->data.file.index_start_confirmed = GNUNET_NO;
- if (GNUNET_NO == ret->is_published)
- {
- if (NULL == ret->filename)
- {
- ret->data.file.reader = &GNUNET_FS_data_reader_copy_;
- ret->data.file.reader_cls = GNUNET_malloc_large (ret->data.file.file_size);
- if (ret->data.file.reader_cls == NULL)
- goto cleanup;
- if (GNUNET_OK !=
- GNUNET_BIO_read (rh, "file-data", ret->data.file.reader_cls, ret->data.file.file_size))
- goto cleanup;
- }
- else
- {
- ret->data.file.reader = &GNUNET_FS_data_reader_file_;
- ret->data.file.reader_cls = GNUNET_FS_make_file_reader_context_ (ret->filename);
- }
- }
- break;
- case 1: /* file-index, no hash */
- if (NULL == ret->filename)
- goto cleanup;
- if (GNUNET_OK !=
- GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size))
- 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)
- 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))) )
- 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 */