publish a file or directory in GNUnet More...
#include "platform.h"
#include "gnunet_constants.h"
#include "gnunet_signatures.h"
#include "gnunet_util_lib.h"
#include "gnunet_fs_service.h"
#include "fs_api.h"
#include "fs_tree.h"
Go to the source code of this file.
Functions | |
void * | GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi, struct GNUNET_FS_PublishContext *pc, const struct GNUNET_FS_FileInformation *p, uint64_t offset) |
Fill in all of the generic fields for a publish event and call the callback. More... | |
static void | publish_cleanup (struct GNUNET_FS_PublishContext *pc) |
Cleanup the publish context, we're done with it. More... | |
static void | ds_put_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) |
Function called by the datastore API with the result from the PUT request. More... | |
static void | signal_publish_completion (struct GNUNET_FS_FileInformation *p, struct GNUNET_FS_PublishContext *pc) |
Generate the callback that signals clients that a file (or directory) has been completely published. More... | |
static void | signal_publish_error (struct GNUNET_FS_FileInformation *p, struct GNUNET_FS_PublishContext *pc, const char *emsg) |
Generate the callback that signals clients that a file (or directory) has encountered a problem during publication. More... | |
static void | finish_release_reserve (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) |
Datastore returns from reservation cancel request. More... | |
static void | publish_sblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) |
We've finished publishing the SBlock as part of a larger upload. More... | |
static void | publish_sblock (struct GNUNET_FS_PublishContext *pc) |
We are almost done publishing the structure, add SBlocks (if needed). More... | |
static void | publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) |
We've finished publishing a KBlock as part of a larger upload. More... | |
static size_t | block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) |
Function called by the tree encoder to obtain a block of plaintext data (for the lowest level of the tree). More... | |
static void | encode_cont (void *cls) |
The tree encoder has finished processing a file. More... | |
static void | block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset, unsigned int depth, enum GNUNET_BLOCK_Type type, const void *block, uint16_t block_size) |
Function called asking for the current (encoded) block to be processed. More... | |
static void | progress_proc (void *cls, uint64_t offset, const void *pt_block, size_t pt_size, unsigned int depth) |
Function called with information about our progress in computing the tree encoding. More... | |
static void | publish_content (struct GNUNET_FS_PublishContext *pc) |
We are uploading a file or directory; load (if necessary) the next block into memory, encrypt it and send it to the FS service. More... | |
static int | check_index_start_failed (void *cls, const struct GNUNET_MessageHeader *msg) |
Check the response from the "fs" service to our 'start index' request. More... | |
static void | handle_index_start_failed (void *cls, const struct GNUNET_MessageHeader *msg) |
Process the response from the "fs" service to our 'start index' request. More... | |
static void | handle_index_start_ok (void *cls, const struct GNUNET_MessageHeader *msg) |
Process the response from the "fs" service to our 'start index' request. More... | |
static void | index_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
static void | hash_for_index_cb (void *cls, const struct GNUNET_HashCode *res) |
Function called once the hash computation over an indexed file has completed. More... | |
static void | publish_kblocks (struct GNUNET_FS_PublishContext *pc) |
We've computed the CHK/LOC URI, now publish the KSKs (if applicable). More... | |
static void | handle_signature_response (void *cls, const struct ResponseLocSignatureMessage *sig) |
Process the response from the "fs" service to our LOC sign request. More... | |
static void | loc_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
static void | create_loc_uri (struct GNUNET_FS_PublishContext *pc) |
We're publishing without anonymity. More... | |
void | GNUNET_FS_publish_main_ (void *cls) |
Main function that performs the upload. More... | |
static int | fip_signal_start (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_FS_MetaData *meta, struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) |
Signal the FS's progress function that we are starting an upload. More... | |
static void | suspend_operation (struct GNUNET_FS_FileInformation *fi, struct GNUNET_FS_PublishContext *pc) |
Actually signal the FS's progress function that we are suspending an upload. More... | |
static int | fip_signal_suspend (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_FS_MetaData *meta, struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) |
Signal the FS's progress function that we are suspending an upload. More... | |
void | GNUNET_FS_publish_signal_suspend_ (void *cls) |
Create SUSPEND event for the given publish operation and then clean up our state (without stop signal). More... | |
static void | finish_reserve (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) |
We have gotten a reply for our space reservation request. More... | |
static uint64_t | compute_contents_size (struct GNUNET_FS_FileInformation *fi) |
Calculate the total size of all of the files in the directory structure. More... | |
struct GNUNET_FS_PublishContext * | GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, struct GNUNET_FS_FileInformation *fi, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *nid, const char *nuid, enum GNUNET_FS_PublishOptions options) |
Publish a file or directory. More... | |
static int | fip_signal_stop (void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length, struct GNUNET_FS_MetaData *meta, struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) |
Signal the FS's progress function that we are stopping an upload. More... | |
void | GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) |
Stop an upload. More... | |
publish a file or directory in GNUnet
Definition in file fs_publish.c.
void * GNUNET_FS_publish_make_status_ | ( | struct GNUNET_FS_ProgressInfo * | pi, |
struct GNUNET_FS_PublishContext * | pc, | ||
const struct GNUNET_FS_FileInformation * | p, | ||
uint64_t | offset | ||
) |
Fill in all of the generic fields for a publish event and call the callback.
pi | structure to fill in |
pc | overall publishing context |
p | file information for the file being published |
offset | where in the file are we so far |
Definition at line 48 of file fs_publish.c.
References GNUNET_FS_ProgressInfo::fsh, GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_calculate_eta(), GNUNET_YES, GNUNET_FS_PublishContext::h, p, pc, GNUNET_FS_ProgressInfo::publish, GNUNET_FS_Handle::upcb, GNUNET_FS_Handle::upcb_cls, and GNUNET_FS_ProgressInfo::value.
Referenced by ds_put_cont(), encode_cont(), fip_signal_resume(), fip_signal_start(), fip_signal_stop(), GNUNET_FS_publish_main_(), GNUNET_FS_publish_stop(), progress_proc(), signal_publish_completion(), signal_publish_error(), and suspend_operation().
|
static |
Cleanup the publish context, we're done with it.
pc | struct to clean up |
Definition at line 79 of file fs_publish.c.
References GNUNET_FS_PublishContext::dsh, GNUNET_FS_PublishContext::fhc, GNUNET_FS_PublishContext::fi, GNUNET_assert, GNUNET_CRYPTO_hash_file_cancel(), GNUNET_DATASTORE_disconnect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_FS_file_information_destroy(), GNUNET_log, GNUNET_MQ_destroy(), GNUNET_NO, GNUNET_FS_PublishContext::mq, GNUNET_FS_PublishContext::nid, GNUNET_FS_PublishContext::nuid, pc, GNUNET_FS_PublishContext::serialization, and GNUNET_FS_PublishContext::upload_task.
Referenced by GNUNET_FS_publish_signal_suspend_(), and GNUNET_FS_publish_stop().
|
static |
Function called by the datastore API with the result from the PUT request.
cls | the struct GNUNET_FS_PublishContext * |
success | GNUNET_OK on success |
min_expiration | minimum expiration time required for content to be stored |
msg | error message (or NULL) |
Definition at line 117 of file fs_publish.c.
References _, GNUNET_FS_PublishContext::any_done, GNUNET_FS_FileInformation::client_info, GNUNET_FS_FileInformation::data, GNUNET_FS_FileInformation::do_index, GNUNET_FS_FileInformation::emsg, GNUNET_FS_PublishContext::fi_pos, GNUNET_FS_FileInformation::file, GNUNET_FS_FileInformation::filename, GNUNET_asprintf(), GNUNET_assert, GNUNET_FS_publish_main_(), GNUNET_FS_publish_make_status_(), GNUNET_FS_STATUS_PUBLISH_ERROR, GNUNET_FS_unindex_start(), GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, GNUNET_FS_PublishContext::h, GNUNET_FS_FileInformation::is_directory, msg, pc, GNUNET_FS_ProgressInfo::publish, GNUNET_FS_PublishContext::qre, GNUNET_FS_ProgressInfo::status, GNUNET_FS_PublishContext::upload_task, and GNUNET_FS_ProgressInfo::value.
Referenced by block_proc().
|
static |
Generate the callback that signals clients that a file (or directory) has been completely published.
p | the completed upload |
pc | context of the publication |
Definition at line 165 of file fs_publish.c.
References GNUNET_FS_publish_make_status_(), GNUNET_FS_STATUS_PUBLISH_COMPLETED, GNUNET_TIME_UNIT_ZERO, p, pc, GNUNET_FS_ProgressInfo::publish, GNUNET_FS_ProgressInfo::status, and GNUNET_FS_ProgressInfo::value.
Referenced by finish_release_reserve(), and publish_kblocks_cont().
|
static |
Generate the callback that signals clients that a file (or directory) has encountered a problem during publication.
p | the upload that had trouble |
pc | context of the publication |
emsg | error message |
Definition at line 190 of file fs_publish.c.
References GNUNET_FS_PublishContext::any_done, GNUNET_FS_publish_make_status_(), GNUNET_FS_STATUS_PUBLISH_ERROR, GNUNET_FS_unindex_start(), GNUNET_strdup, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, GNUNET_FS_PublishContext::h, p, pc, GNUNET_FS_ProgressInfo::publish, GNUNET_FS_ProgressInfo::status, and GNUNET_FS_ProgressInfo::value.
Referenced by finish_reserve(), handle_index_start_failed(), publish_kblocks_cont(), and publish_sblocks_cont().
|
static |
Datastore returns from reservation cancel request.
cls | the struct GNUNET_FS_PublishContext * |
success | success code (not used) |
min_expiration | minimum expiration time required for content to be stored |
msg | error message (typically NULL, not used) |
Definition at line 223 of file fs_publish.c.
References GNUNET_FS_PublishContext::all_done, GNUNET_FS_PublishContext::fi, GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_publish_sync_(), GNUNET_log, GNUNET_YES, pc, GNUNET_FS_PublishContext::qre, and signal_publish_completion().
Referenced by publish_sblocks_cont().
|
static |
We've finished publishing the SBlock as part of a larger upload.
Check the result and complete the larger upload.
cls | the struct GNUNET_FS_PublishContext * of the larger upload |
uri | URI of the published SBlock |
emsg | NULL on success, otherwise error message |
Definition at line 247 of file fs_publish.c.
References GNUNET_FS_PublishContext::dsh, GNUNET_FS_PublishContext::fi, finish_release_reserve(), GNUNET_assert, GNUNET_DATASTORE_release_reserve(), GNUNET_FS_publish_sync_(), GNUNET_FS_uri_dup(), GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, pc, GNUNET_FS_PublishContext::qre, GNUNET_FS_PublishContext::rid, signal_publish_error(), GNUNET_FS_PublishContext::sks_pc, GNUNET_FS_FileInformation::sks_uri, and uri.
Referenced by publish_sblock().
|
static |
We are almost done publishing the structure, add SBlocks (if needed).
pc | overall upload data |
Definition at line 286 of file fs_publish.c.
References GNUNET_FS_FileInformation::bo, GNUNET_FS_FileInformation::chk_uri, GNUNET_FS_PublishContext::fi, GNUNET_FS_publish_sks(), GNUNET_FS_PublishContext::h, GNUNET_FS_FileInformation::meta, GNUNET_FS_PublishContext::nid, GNUNET_FS_PublishContext::ns, GNUNET_FS_PublishContext::nuid, GNUNET_FS_PublishContext::options, pc, publish_sblocks_cont(), and GNUNET_FS_PublishContext::sks_pc.
Referenced by GNUNET_FS_publish_main_().
|
static |
We've finished publishing a KBlock as part of a larger upload.
Check the result and continue the larger upload.
cls | the struct GNUNET_FS_PublishContext * of the larger upload |
uri | URI of the published blocks |
emsg | NULL on success, otherwise error message |
Definition at line 313 of file fs_publish.c.
References GNUNET_FS_FileInformation::emsg, GNUNET_FS_PublishContext::fi_pos, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_main_(), GNUNET_FS_publish_sync_(), GNUNET_log, GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, GNUNET_FS_PublishContext::ksk_pc, p, pc, signal_publish_completion(), signal_publish_error(), and GNUNET_FS_PublishContext::upload_task.
Referenced by publish_kblocks().
|
static |
Function called by the tree encoder to obtain a block of plaintext data (for the lowest level of the tree).
cls | our publishing context |
offset | identifies which block to get |
max | (maximum) number of bytes to get; returning fewer will also cause errors |
buf | where to copy the plaintext buffer |
emsg | location to store an error message (on error) |
Definition at line 368 of file fs_publish.c.
References GNUNET_FS_FileInformation::emsg, GNUNET_FS_PublishContext::fi_pos, GNUNET_FS_data_reader_file_(), GNUNET_memcpy, GNUNET_MIN, GNUNET_YES, max, p, and pc.
Referenced by publish_content().
|
static |
The tree encoder has finished processing a file.
Call it's finish method and deal with the final result.
cls | our publishing context |
Definition at line 418 of file fs_publish.c.
References _, GNUNET_FS_PublishContext::fi_pos, GNUNET_asprintf(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_FS_compute_depth(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_main_(), GNUNET_FS_publish_make_status_(), GNUNET_FS_STATUS_PUBLISH_ERROR, GNUNET_FS_STATUS_PUBLISH_PROGRESS, GNUNET_FS_tree_encoder_finish(), GNUNET_FS_tree_encoder_get_uri(), GNUNET_FS_uri_chk_get_file_size(), GNUNET_log, GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, GNUNET_TIME_UNIT_FOREVER_REL, p, pc, GNUNET_FS_ProgressInfo::publish, GNUNET_FS_ProgressInfo::status, GNUNET_FS_PublishContext::upload_task, and GNUNET_FS_ProgressInfo::value.
Referenced by publish_content().
|
static |
Function called asking for the current (encoded) block to be processed.
After processing the client should either call GNUNET_FS_tree_encoder_next or (on error) GNUNET_FS_tree_encoder_finish.
cls | closure |
chk | content hash key for the block |
offset | offset of the block in the file |
depth | depth of the block in the file, 0 for DBLOCK |
type | type of the block (IBLOCK or DBLOCK) |
block | the (encrypted) block |
block_size | size of block (in bytes) |
Definition at line 482 of file fs_publish.c.
References ds_put_cont(), GNUNET_FS_PublishContext::dsh, GNUNET_FS_PublishContext::fi_pos, OnDemandBlock::file_id, GNUNET_assert, GNUNET_BLOCK_TYPE_FS_DBLOCK, GNUNET_BLOCK_TYPE_FS_ONDEMAND, GNUNET_DATASTORE_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_publish_main_(), GNUNET_h2s(), GNUNET_htonll(), GNUNET_log, GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, GNUNET_YES, OnDemandBlock::offset, p, pc, GNUNET_FS_PublishContext::qre, ContentHashKey::query, GNUNET_FS_PublishContext::rid, type, and GNUNET_FS_PublishContext::upload_task.
Referenced by publish_content().
|
static |
Function called with information about our progress in computing the tree encoding.
cls | closure |
offset | where are we in the file |
pt_block | plaintext of the currently processed block |
pt_size | size of pt_block |
depth | depth of the block in the tree, 0 for DBLOCK |
Definition at line 567 of file fs_publish.c.
References GNUNET_FS_ProgressInfo::depth, GNUNET_FS_PublishContext::fi_pos, GNUNET_assert, GNUNET_FS_publish_make_status_(), GNUNET_FS_STATUS_PUBLISH_PROGRESS, GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY, GNUNET_TIME_calculate_eta(), GNUNET_YES, GNUNET_FS_FileInformation::is_directory, GNUNET_FS_ProgressInfo::offset, p, pc, GNUNET_FS_ProgressInfo::publish, GNUNET_FS_ProgressInfo::status, and GNUNET_FS_ProgressInfo::value.
Referenced by publish_content().
|
static |
We are uploading a file or directory; load (if necessary) the next block into memory, encrypt it and send it to the FS service.
Then continue with the main task.
pc | overall upload data |
Definition at line 616 of file fs_publish.c.
References block_proc(), block_reader(), GNUNET_FS_FileInformation::chk_uri, GNUNET_FS_FileInformation::data, db, GNUNET_FS_FileInformation::dir, GNUNET_FS_FileInformation::dir_data, GNUNET_FS_FileInformation::emsg, encode_cont(), GNUNET_FS_PublishContext::fi_pos, GNUNET_FS_FileInformation::file, GNUNET_FS_FileInformation::file_size, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_FS_directory_builder_add(), GNUNET_FS_directory_builder_create(), GNUNET_FS_directory_builder_finish(), GNUNET_FS_file_information_sync_(), GNUNET_FS_tree_encoder_create(), GNUNET_FS_tree_encoder_next(), GNUNET_log, GNUNET_malloc, GNUNET_YES, GNUNET_FS_PublishContext::h, GNUNET_FS_FileInformation::is_directory, MAX_INLINE_SIZE, GNUNET_FS_FileInformation::meta, GNUNET_FS_FileInformation::next, p, pc, progress_proc(), GNUNET_FS_FileInformation::reader, GNUNET_FS_FileInformation::reader_cls, and size.
Referenced by GNUNET_FS_publish_main_(), handle_index_start_ok(), hash_for_index_cb(), and index_mq_error_handler().
|
static |
Check the response from the "fs" service to our 'start index' request.
cls | closure (of type struct GNUNET_FS_PublishContext * ) |
msg | the response we got |
Definition at line 697 of file fs_publish.c.
References GNUNET_FS_FileInformation::emsg, GNUNET_break, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.
|
static |
Process the response from the "fs" service to our 'start index' request.
cls | closure (of type struct GNUNET_FS_PublishContext * ) |
msg | the response we got |
Definition at line 720 of file fs_publish.c.
References _, GNUNET_FS_FileInformation::emsg, GNUNET_FS_PublishContext::fi_pos, gettext, GNUNET_asprintf(), GNUNET_free, GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_MQ_destroy(), GNUNET_FS_PublishContext::mq, msg, p, pc, and signal_publish_error().
|
static |
Process the response from the "fs" service to our 'start index' request.
cls | closure (of type struct GNUNET_FS_PublishContext * ) |
msg | the response we got |
Definition at line 752 of file fs_publish.c.
References GNUNET_FS_PublishContext::fi_pos, GNUNET_FS_file_information_sync_(), GNUNET_MQ_destroy(), GNUNET_YES, GNUNET_FS_PublishContext::mq, p, pc, and publish_content().
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_FS_PublishContext * |
error | error code |
Definition at line 776 of file fs_publish.c.
References _, GNUNET_FS_PublishContext::fi_pos, GNUNET_ERROR_TYPE_WARNING, GNUNET_FS_file_information_sync_(), GNUNET_log, GNUNET_MQ_destroy(), GNUNET_NO, GNUNET_FS_PublishContext::mq, p, pc, and publish_content().
Referenced by hash_for_index_cb().
|
static |
Function called once the hash computation over an indexed file has completed.
cls | closure, our publishing context |
res | resulting hash, NULL on error |
Definition at line 806 of file fs_publish.c.
References _, GNUNET_FS_Handle::cfg, IndexStartMessage::device, env, GNUNET_FS_PublishContext::fhc, GNUNET_FS_PublishContext::fi_pos, IndexStartMessage::file_id, GNUNET_assert, GNUNET_CLIENT_connect(), GNUNET_DISK_file_get_identifiers(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_FS_file_information_sync_(), GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY, GNUNET_h2s(), GNUNET_htonll(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_FS_INDEX_START, GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED, GNUNET_MESSAGE_TYPE_FS_INDEX_START_OK, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_filename_expand(), GNUNET_YES, GNUNET_FS_PublishContext::h, handlers, index_mq_error_handler(), IndexStartMessage::inode, GNUNET_FS_PublishContext::mq, GNUNET_FS_PublishContext::options, p, pc, publish_content(), and res.
Referenced by GNUNET_FS_publish_main_().
|
static |
We've computed the CHK/LOC URI, now publish the KSKs (if applicable).
pc | publishing context to do this for |
Definition at line 934 of file fs_publish.c.
References GNUNET_FS_PublishContext::fi_pos, GNUNET_FS_publish_ksk(), GNUNET_FS_PublishContext::h, GNUNET_FS_PublishContext::ksk_pc, GNUNET_FS_PublishContext::options, p, pc, and publish_kblocks_cont().
Referenced by create_loc_uri(), GNUNET_FS_publish_main_(), handle_signature_response(), and loc_mq_error_handler().
|
static |
Process the response from the "fs" service to our LOC sign request.
cls | closure (of type struct GNUNET_FS_PublishContext * ) |
sig | the response we got |
Definition at line 965 of file fs_publish.c.
References ResponseLocSignatureMessage::expiration_time, GNUNET_FS_PublishContext::fi_pos, GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_sync_(), GNUNET_FS_URI_LOC, GNUNET_TIME_absolute_ntoh(), p, pc, ResponseLocSignatureMessage::peer, publish_kblocks(), and ResponseLocSignatureMessage::signature.
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_FS_PublishContext * |
error | error code |
Definition at line 993 of file fs_publish.c.
References _, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_MQ_destroy(), GNUNET_FS_PublishContext::mq, pc, and publish_kblocks().
Referenced by create_loc_uri().
|
static |
We're publishing without anonymity.
Contact the FS service to create a signed LOC URI for further processing, then continue with KSKs.
pc | the publishing context do to this for |
Definition at line 1017 of file fs_publish.c.
References _, GNUNET_FS_Handle::cfg, RequestLocSignatureMessage::chk, env, RequestLocSignatureMessage::expiration_time, GNUNET_FS_PublishContext::fi_pos, RequestLocSignatureMessage::file_length, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_WARNING, GNUNET_htonll(), GNUNET_log, GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGN, GNUNET_MESSAGE_TYPE_FS_REQUEST_LOC_SIGNATURE, GNUNET_MQ_destroy(), GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, GNUNET_TIME_absolute_hton(), GNUNET_FS_PublishContext::h, handlers, loc_mq_error_handler(), GNUNET_FS_PublishContext::mq, p, pc, publish_kblocks(), and RequestLocSignatureMessage::purpose.
Referenced by GNUNET_FS_publish_main_().
void GNUNET_FS_publish_main_ | ( | void * | cls | ) |
Main function that performs the upload.
cls | struct GNUNET_FS_PublishContext * identifies the upload |
Definition at line 1063 of file fs_publish.c.
References _, GNUNET_FS_PublishContext::all_done, create_loc_uri(), EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME, GNUNET_FS_PublishContext::fhc, GNUNET_FS_PublishContext::fi_pos, GNUNET_asprintf(), GNUNET_CRYPTO_hash_file(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_FS_file_information_sync_(), GNUNET_FS_meta_data_get_by_type(), GNUNET_FS_publish_make_status_(), GNUNET_FS_publish_sync_(), GNUNET_FS_STATUS_PUBLISH_ERROR, GNUNET_FS_uri_test_loc(), GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_PRIORITY_IDLE, GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, hash_for_index_cb(), HASHING_BLOCKSIZE, p, pc, GNUNET_FS_ProgressInfo::publish, publish_content(), publish_kblocks(), publish_sblock(), GNUNET_FS_ProgressInfo::status, GNUNET_FS_PublishContext::upload_task, and GNUNET_FS_ProgressInfo::value.
Referenced by block_proc(), deserialize_publish_file(), ds_put_cont(), encode_cont(), finish_reserve(), GNUNET_FS_publish_start(), and publish_kblocks_cont().
|
static |
Signal the FS's progress function that we are starting an upload.
cls | closure (of type struct GNUNET_FS_PublishContext * ) |
fi | the entry in the publish-structure |
length | length of the file or directory |
meta | metadata for the file or directory (can be modified) |
uri | pointer to the keywords that will be used for this entry (can be modified) |
bo | block options |
do_index | should we index? |
client_info | pointer to client context set upon creation (can be modified) |
Definition at line 1194 of file fs_publish.c.
References DBLOCK_SIZE, GNUNET_FS_FileInformation::dir, fip_signal_start(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_file_information_inspect(), GNUNET_FS_file_information_sync_(), GNUNET_FS_publish_make_status_(), GNUNET_FS_STATUS_PUBLISH_START, GNUNET_FS_uri_ksk_get_keyword_count(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_FS_FileInformation::is_directory, pc, GNUNET_FS_PublishContext::reserve_entries, GNUNET_FS_PublishContext::reserve_space, GNUNET_FS_PublishContext::skip_next_fi_callback, GNUNET_FS_ProgressInfo::status, and uri.
Referenced by fip_signal_start(), and GNUNET_FS_publish_start().
|
static |
Actually signal the FS's progress function that we are suspending an upload.
fi | the entry in the publish-structure |
pc | the publish context of which a file is being suspended |
Definition at line 1267 of file fs_publish.c.
References GNUNET_FS_FileInformation::chk_uri, GNUNET_FS_FileInformation::data, GNUNET_FS_FileInformation::dir, GNUNET_FS_FileInformation::dir_size, GNUNET_FS_PublishContext::dsh, GNUNET_FS_ProgressInfo::fi, GNUNET_FS_FileInformation::file, GNUNET_FS_FileInformation::file_size, GNUNET_break, GNUNET_DATASTORE_cancel(), GNUNET_DATASTORE_disconnect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_FS_publish_ksk_cancel(), GNUNET_FS_publish_make_status_(), GNUNET_FS_publish_sks_cancel(), GNUNET_FS_STATUS_PUBLISH_SUSPEND, GNUNET_log, GNUNET_NO, GNUNET_YES, GNUNET_FS_FileInformation::is_directory, GNUNET_FS_PublishContext::ksk_pc, pc, GNUNET_FS_PublishContext::qre, GNUNET_FS_PublishContext::rid, GNUNET_FS_FileInformation::serialization, GNUNET_FS_PublishContext::sks_pc, and GNUNET_FS_ProgressInfo::status.
Referenced by fip_signal_suspend(), and GNUNET_FS_publish_signal_suspend_().
|
static |
Signal the FS's progress function that we are suspending an upload.
Performs the recursion.
cls | closure (of type struct GNUNET_FS_PublishContext * ) |
fi | the entry in the publish-structure |
length | length of the file or directory |
meta | metadata for the file or directory (can be modified) |
uri | pointer to the keywords that will be used for this entry (can be modified) |
bo | block options |
do_index | should we index? |
client_info | pointer to client context set upon creation (can be modified) |
Definition at line 1320 of file fs_publish.c.
References GNUNET_FS_PublishContext::fi, fip_signal_suspend(), GNUNET_FS_file_information_inspect(), GNUNET_FS_meta_data_test_for_directory(), GNUNET_NO, GNUNET_OK, GNUNET_YES, meta, pc, GNUNET_FS_PublishContext::skip_next_fi_callback, and suspend_operation().
Referenced by fip_signal_suspend(), and GNUNET_FS_publish_signal_suspend_().
void GNUNET_FS_publish_signal_suspend_ | ( | void * | cls | ) |
Create SUSPEND event for the given publish operation and then clean up our state (without stop signal).
cls | the struct GNUNET_FS_PublishContext to signal for |
Definition at line 1355 of file fs_publish.c.
References GNUNET_FS_PublishContext::fi, fip_signal_suspend(), GNUNET_FS_end_top(), GNUNET_FS_file_information_inspect(), GNUNET_SCHEDULER_cancel(), GNUNET_YES, GNUNET_FS_PublishContext::h, pc, publish_cleanup(), GNUNET_FS_PublishContext::skip_next_fi_callback, suspend_operation(), GNUNET_FS_PublishContext::top, and GNUNET_FS_PublishContext::upload_task.
Referenced by deserialize_publish_file(), and GNUNET_FS_publish_start().
|
static |
We have gotten a reply for our space reservation request.
Either fail (insufficient space) or start publishing for good.
cls | the struct GNUNET_FS_PublishContext * |
success | positive reservation ID on success |
min_expiration | minimum expiration time required for content to be stored |
msg | error message on error, otherwise NULL |
Definition at line 1383 of file fs_publish.c.
References _, GNUNET_FS_FileInformation::emsg, GNUNET_FS_PublishContext::fi, GNUNET_asprintf(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_FS_publish_main_(), GNUNET_log, GNUNET_SCHEDULER_add_with_priority(), GNUNET_SCHEDULER_PRIORITY_BACKGROUND, msg, pc, GNUNET_FS_PublishContext::qre, GNUNET_FS_PublishContext::rid, signal_publish_error(), and GNUNET_FS_PublishContext::upload_task.
Referenced by GNUNET_FS_publish_start().
|
static |
Calculate the total size of all of the files in the directory structure.
fi | file structure to traverse |
Definition at line 1416 of file fs_publish.c.
References compute_contents_size(), GNUNET_FS_FileInformation::contents_size, GNUNET_FS_FileInformation::data, GNUNET_FS_FileInformation::dir, GNUNET_FS_FileInformation::entries, GNUNET_FS_FileInformation::file, GNUNET_FS_FileInformation::file_size, GNUNET_YES, GNUNET_FS_FileInformation::is_directory, and GNUNET_FS_FileInformation::next.
Referenced by compute_contents_size(), and GNUNET_FS_publish_start().
|
static |
Signal the FS's progress function that we are stopping an upload.
cls | closure (of type struct GNUNET_FS_PublishContext * ) |
fi | the entry in the publish-structure |
length | length of the file or directory |
meta | metadata for the file or directory (can be modified) |
uri | pointer to the keywords that will be used for this entry (can be modified) |
bo | block options (can be modified) |
do_index | should we index? |
client_info | pointer to client context set upon creation (can be modified) |
Definition at line 1524 of file fs_publish.c.
References GNUNET_FS_FileInformation::chk_uri, GNUNET_FS_ProgressInfo::fi, fip_signal_stop(), GNUNET_break, GNUNET_free, GNUNET_FS_file_information_inspect(), GNUNET_FS_meta_data_test_for_directory(), GNUNET_FS_publish_make_status_(), GNUNET_FS_remove_sync_file_(), GNUNET_FS_STATUS_PUBLISH_STOPPED, GNUNET_FS_SYNC_PATH_FILE_INFO, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_FS_PublishContext::h, meta, pc, GNUNET_FS_FileInformation::serialization, GNUNET_FS_PublishContext::skip_next_fi_callback, and GNUNET_FS_ProgressInfo::status.
Referenced by fip_signal_stop(), and GNUNET_FS_publish_stop().