63 *emsg =
GNUNET_strdup (
_ (
"Failed to find given position in file"));
115 const void *pt_block,
173 "Datastore REMOVE operation succeeded\n");
219 "Sending REMOVE request to DATASTORE service\n");
326 GNUNET_strdup (
_ (
"Failed to connect to FS service for unindexing."));
332 "Sending UNINDEX message to FS service\n");
367 if (NULL != directory_scan_result->
ksk_uri)
385 _ (
"Internal error scanning `%s'.\n"),
446 _ (
"Failed to remove UBlock: %s\n"),
501 if (size <
sizeof(
struct UBlock))
510 if (0 != memcmp (&query,
518 char pt[size -
sizeof(
struct UBlock)];
530 if (NULL == memchr (&pt[1], 0,
sizeof(pt) - 1))
542 if (0 != memcmp (&uc->
chk,
733 if (uc->
dscan != NULL)
841 if (NULL != uc->
dscan)
unsigned int depth
Depth of the given block in the tree; 0 would be the lowest level (DBLOCKs).
static struct GNUNET_TIME_Absolute min_expiration
Minimum time that content should have to not be discarded instantly (time stamp of any content that w...
Open the file for reading.
char * serialization
Short name under which we are serializing the state of this operation.
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_get_anonymous(void)
Get the shared private key we use for anonymous users.
static void signal_unindex_error(struct GNUNET_FS_UnindexContext *uc)
We've encountered an error during unindexing.
struct ContentHashKey chk
Query and key of the top GNUNET_EC_IBlock.
void GNUNET_CRYPTO_ecdsa_public_key_derive(const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, const char *context, struct GNUNET_CRYPTO_EcdsaPublicKey *result)
Derive a public key from a given public key and a label.
struct GNUNET_MessageHeader * msg
void GNUNET_FS_unindex_stop(struct GNUNET_FS_UnindexContext *uc)
Clean up after completion of an unindex operation.
struct FileIdentifier chk
Information needed to retrieve a file (content-hash-key plus file size).
uint32_t reserved
Always zero.
Notification that we started to unindex a file.
static void unindex_progress(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.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
struct GNUNET_FS_DirScanner * GNUNET_FS_directory_scan_start(const char *filename, int disable_extractor, const char *ex, GNUNET_FS_DirScannerProgressCallback cb, void *cb_cls)
Start a directory scanner thread.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
struct GNUNET_FS_TreeEncoder * tc
Merkle-ish tree encoder context.
uint32_t ksk_offset
Current offset in KSK removal.
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
struct GNUNET_FS_Uri * GNUNET_FS_uri_parse(const char *uri, char **emsg)
Convert a UTF-8 String to a URI.
Notification that we made progress unindexing a file.
GNUNET_MQ_Error
Error codes for the queue.
Master context for most FS operations.
static void continue_after_remove(void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
Continuation called to notify client about result of the remove operation for the UBlock...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_PublishStatusEvent::@26::GNUNET_FS_PublishErrorEvent error
void GNUNET_FS_ublock_decrypt_(const void *input, size_t input_len, const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *label, void *output)
Decrypt the given UBlock, storing the result in output.
static struct GNUNET_FS_UnindexContext * uc
static unsigned int replication
Nobody is allowed to do anything to the file.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
struct GNUNET_FS_Uri * ksk_uri
Keywords for this file or directory (derived from metadata).
void GNUNET_FS_tree_encoder_next(struct GNUNET_FS_TreeEncoder *te)
Encrypt the next block of the file (and call proc and progress accordingly; or of course "cont" if we...
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Private ECC key encoded for transmission.
uint64_t offset
At what offset in the file is "data"?
off_t GNUNET_DISK_file_seek(const struct GNUNET_DISK_FileHandle *h, off_t offset, enum GNUNET_DISK_Seek whence)
Move the read/write pointer in a file.
struct GNUNET_HashCode file_id
Hash of the file's contents (once computed).
Notification that we suspended unindexing a file.
enum UnindexState state
Current operatinonal phase.
struct GNUNET_CRYPTO_FileHashContext * GNUNET_CRYPTO_hash_file(enum GNUNET_SCHEDULER_Priority priority, const char *filename, size_t blocksize, GNUNET_CRYPTO_HashCompletedCallback callback, void *callback_cls)
Compute the hash of an entire file.
static struct GNUNET_PEERINFO_Handle * pi
Handle to peerinfo service.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
Handle for controlling an unindexing operation.
struct GNUNET_DATASTORE_Handle * dsh
Connection to the datastore service, only valid during the UNINDEX_STATE_DS_NOTIFY phase...
struct GNUNET_FS_Uri * GNUNET_FS_uri_dup(const struct GNUNET_FS_Uri *uri)
Duplicate URI.
static void unindex_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 c...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static void unindex_process(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.
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Find out which keywords apply.
We're notifying the FS service about the unindexing.
union GNUNET_FS_ProgressInfo::@25 value
Values that depend on the event type.
void GNUNET_FS_unindex_do_extract_keywords_(struct GNUNET_FS_UnindexContext *uc)
If necessary, connect to the datastore and remove the UBlocks.
struct GNUNET_HashCode uquery
Current query of 'get_key' operation.
struct TopLevelActivity * top
Our top-level activity entry.
A node of a directory tree (produced by dirscanner)
struct GNUNET_DISK_FileHandle * fh
Handle used to read the file.
#define GNUNET_FS_SYNC_PATH_MASTER_UNINDEX
Name of the directory with unindex operations.
static void handle_unindex_response(void *cls, const struct GNUNET_MessageHeader *msg)
Function called with the response from the FS service to our unindexing request.
void GNUNET_FS_unindex_do_remove_(struct GNUNET_FS_UnindexContext *uc)
Connect to the datastore and remove the blocks.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
struct GNUNET_FS_UnindexContext * GNUNET_FS_unindex_start(struct GNUNET_FS_Handle *h, const char *filename, void *cctx)
Unindex a file.
void GNUNET_FS_end_top(struct GNUNET_FS_Handle *h, struct TopLevelActivity *top)
Destroy a top-level activity entry.
void GNUNET_FS_unindex_do_remove_kblocks_(struct GNUNET_FS_UnindexContext *uc)
If necessary, connect to the datastore and remove the KBlocks.
enum GNUNET_FS_Status status
Specific status code (determines the event type).
We're telling the datastore to remove KBlocks.
struct GNUNET_HashCode query
Hash of the encrypted content, used for querying.
struct GNUNET_FS_ProgressInfo::@25::GNUNET_FS_UnindexEvent unindex
Message sent from a GNUnet (fs) unindexing activity to the gnunet-service-fs to indicate that a file ...
struct GNUNET_HashCode file_id
Hash of the file that we will unindex.
struct GNUNET_TIME_Absolute start_time
When did we start?
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
We've encountered a fatal error.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_remove(struct GNUNET_DATASTORE_Handle *h, const struct GNUNET_HashCode *key, size_t size, const void *data, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Explicitly remove some content from the database.
struct GNUNET_FS_TreeEncoder * GNUNET_FS_tree_encoder_create(struct GNUNET_FS_Handle *h, uint64_t size, void *cls, GNUNET_FS_DataReader reader, GNUNET_FS_TreeBlockProcessor proc, GNUNET_FS_TreeProgressCallback progress, GNUNET_SCHEDULER_TaskCallback cont)
Initialize a tree encoder.
void GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc)
Cancel a file hashing operation.
void GNUNET_FS_directory_scan_abort(struct GNUNET_FS_DirScanner *ds)
Abort the scan.
void GNUNET_FS_uri_destroy(struct GNUNET_FS_Uri *uri)
Free URI.
There was an internal error.
struct GNUNET_FS_Uri * ksk_uri
Keywords found (telling us which KBlocks to remove).
Type of a block representing any type of search result (universal).
static char * expiration
Credential TTL.
char * filename
Name of the file that we are unindexing.
Message handler for a specific message type.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
#define GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK
Reply to client indicating unindex receipt.
struct GNUNET_DATASTORE_QueueEntry * dqe
Handle to datastore 'get_key' operation issued for obtaining KBlocks.
GNUNET_FS_DirScannerProgressUpdateReason
Progress reasons of the directory scanner.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
struct GNUNET_MQ_Handle * mq
Connection to the FS service, only valid during the UNINDEX_STATE_FS_NOTIFY phase.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Notification that the unindexing of this file was stopped (final event for this action).
Last call to the progress function: we have finished scanning the directory.
Notification that the unindexing of this file was completed.
struct GNUNET_MQ_Envelope * env
struct GNUNET_HashCode file_id
Hash code of the entire content of the file that was indexed (used to uniquely identify the plaintext...
#define GNUNET_MESSAGE_TYPE_FS_UNINDEX
Request from client to unindex a file.
void GNUNET_FS_unindex_make_status_(struct GNUNET_FS_ProgressInfo *pi, struct GNUNET_FS_UnindexContext *uc, uint64_t offset)
Fill in all of the generic fields for an unindex event and call the callback.
void GNUNET_FS_unindex_sync_(struct GNUNET_FS_UnindexContext *uc)
Synchronize this unindex struct with its mirror on disk.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
union GNUNET_FS_Uri::@13 data
struct GNUNET_FS_Handle * fsh
File-sharing handle that generated the event.
struct TopLevelActivity * GNUNET_FS_make_top(struct GNUNET_FS_Handle *h, SuspendSignalFunction ssf, void *ssf_cls)
Create a top-level activity entry.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_size(const char *filename, uint64_t *size, int include_symbolic_links, int single_file_mode)
Get the size of the file (or directory) of the given file (in bytes).
void GNUNET_DATASTORE_cancel(struct GNUNET_DATASTORE_QueueEntry *qe)
Cancel a datastore operation.
static void unindex_finish(struct GNUNET_FS_UnindexContext *uc)
Function called when we are done with removing UBlocks.
GNUNET_FS_ProgressCallback upcb
Function to call with updates on our progress.
static void process_kblock_for_unindex(void *cls, const struct GNUNET_HashCode *key, size_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, uint64_t uid)
Function called from datastore with result from us looking for a UBlock.
We're currently hashing the file.
#define HASHING_BLOCKSIZE
Blocksize to use when hashing files for indexing (blocksize for IO, not for the DBlocks).
Seek an absolute position (from the start of the file).
shared definitions for the FS library
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
We're telling the datastore to delete the respective DBlocks and IBlocks.
void GNUNET_FS_share_tree_free(struct GNUNET_FS_ShareTreeItem *toplevel)
Release memory of a share item tree.
A Universal Resource Identifier (URI), opaque.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
static void unindex_directory_scan_cb(void *cls, const char *filename, int is_directory, enum GNUNET_FS_DirScannerProgressUpdateReason reason)
Function called by the directory scanner as we extract keywords that we will need to remove UBlocks...
static void process_cont(void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
Continuation called to notify client about result of the datastore removal operation.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
struct GNUNET_FS_DirScanner * dscan
Directory scanner to find keywords (KBlock removal).
void * upcb_cls
Closure for upcb.
struct GNUNET_FS_Uri::@13::@14 ksk
void GNUNET_FS_unindex_process_hash_(void *cls, const struct GNUNET_HashCode *file_id)
Function called once the hash of the file that is being unindexed has been computed.
struct ContentHashKey chk
The content hash key of the last block we processed, will in the end be set to the CHK from the URI...
#define GNUNET_log(kind,...)
uint64_t offset
At which offset should we be able to find this on-demand encoded block? (in NBO)
Data block (leaf) in the CHK tree.
static void unindex_extract_keywords(void *cls)
Function called when the tree encoder has processed all blocks.
struct GNUNET_TIME_Relative GNUNET_TIME_calculate_eta(struct GNUNET_TIME_Absolute start, uint64_t finished, uint64_t total)
Calculate the estimate time of arrival/completion for an operation.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
char * emsg
Error message, NULL on success.
void GNUNET_FS_unindex_signal_suspend_(void *cls)
Create SUSPEND event for the given unindex operation and then clean up our state (without stop signal...
void GNUNET_FS_tree_encoder_finish(struct GNUNET_FS_TreeEncoder *te, char **emsg)
Clean up a tree encoder and return information about possible errors.
struct GNUNET_FS_ShareTreeItem * GNUNET_FS_directory_scan_get_result(struct GNUNET_FS_DirScanner *ds)
Obtain the result of the scan after the scan has signalled completion.
Time for absolute times used by GNUnet, in microseconds.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
static unsigned int anonymity
static size_t unindex_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 ...
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_get_key(struct GNUNET_DATASTORE_Handle *h, uint64_t next_uid, bool random, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls)
Get a result for a particular key from the datastore.
void * client_info
Pointer kept for the client.
struct GNUNET_FS_Handle * h
Global FS context.
uint32_t data
The data value.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
Notification that we encountered an error unindexing a file.
struct GNUNET_CRYPTO_EcdsaPublicKey verification_key
Public key used to sign this block.
universal block for keyword and namespace search results
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
void GNUNET_FS_remove_sync_file_(struct GNUNET_FS_Handle *h, const char *ext, const char *ent)
Remove serialization/deserialization file from disk.
index block (indexing a DBlock that can be obtained directly from reading the plaintext file) ...
#define GNUNET_free(ptr)
Wrapper around free.
Argument given to the progress callback with information about what is going on.
void * cctx
Client context pointer (set the last time by the client for this operation; initially NULL on START/R...
Merkle-tree-ish-CHK file encoding for GNUnet.
uint64_t file_size
Overall size of the file.
publish a UBLOCK in GNUnet
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.