116 const void *pt_block,
174 "Datastore REMOVE operation succeeded\n");
220 "Sending REMOVE request to DATASTORE service\n");
327 GNUNET_strdup (
_ (
"Failed to connect to FS service for unindexing."));
333 "Sending UNINDEX message to FS service\n");
368 if (NULL != directory_scan_result->
ksk_uri)
386 _ (
"Internal error scanning `%s'.\n"),
447 _ (
"Failed to remove UBlock: %s\n"),
511 if (0 != memcmp (&query,
531 if (NULL == memchr (&pt[1], 0,
sizeof(pt) - 1))
543 if (0 != memcmp (&
uc->
chk,
struct GNUNET_MQ_MessageHandlers handlers[]
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
FS block formats (shared between FS and Block)
#define HASHING_BLOCKSIZE
Blocksize to use when hashing files for indexing (blocksize for IO, not for the DBlocks).
void GNUNET_FS_unindex_sync_(struct GNUNET_FS_UnindexContext *uc)
Synchronize this unindex struct with its mirror on disk.
void GNUNET_FS_remove_sync_file_(struct GNUNET_FS_Handle *h, const char *ext, const char *ent)
Remove serialization/deserialization file from disk.
struct TopLevelActivity * GNUNET_FS_make_top(struct GNUNET_FS_Handle *h, SuspendSignalFunction ssf, void *ssf_cls)
Create a top-level activity entry.
void GNUNET_FS_end_top(struct GNUNET_FS_Handle *h, struct TopLevelActivity *top)
Destroy a top-level activity entry.
shared definitions for the FS library
@ UNINDEX_STATE_EXTRACT_KEYWORDS
Find out which keywords apply.
@ UNINDEX_STATE_COMPLETE
We're done.
@ UNINDEX_STATE_DS_REMOVE
We're telling the datastore to delete the respective DBlocks and IBlocks.
@ UNINDEX_STATE_HASHING
We're currently hashing the file.
@ UNINDEX_STATE_ERROR
We've encountered a fatal error.
@ UNINDEX_STATE_FS_NOTIFY
We're notifying the FS service about the unindexing.
@ UNINDEX_STATE_DS_REMOVE_KBLOCKS
We're telling the datastore to remove KBlocks.
#define GNUNET_FS_SYNC_PATH_MASTER_UNINDEX
Name of the directory with unindex operations.
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.
publish a UBLOCK in GNUnet
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...
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_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.
Merkle-tree-ish-CHK file encoding for GNUnet.
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.
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 ...
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...
void GNUNET_FS_unindex_do_remove_kblocks_(struct GNUNET_FS_UnindexContext *uc)
If necessary, connect to the datastore and remove the KBlocks.
static void unindex_finish(struct GNUNET_FS_UnindexContext *uc)
Function called when we are done with removing UBlocks.
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_do_extract_keywords_(struct GNUNET_FS_UnindexContext *uc)
If necessary, connect to the datastore and remove the UBlocks.
void GNUNET_FS_unindex_do_remove_(struct GNUNET_FS_UnindexContext *uc)
Connect to the datastore and remove the blocks.
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.
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.
static void unindex_extract_keywords(void *cls)
Function called when the tree encoder has processed all blocks.
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.
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.
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_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.
static void signal_unindex_error(struct GNUNET_FS_UnindexContext *uc)
We've encountered an error during unindexing.
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.
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 struct GNUNET_ARM_Handle * h
Connection with ARM.
static unsigned int replication
Desired replication level.
static char * data
The data to insert into the dht.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_TIME_Relative expiration
User supplied expiration value.
static unsigned int anonymity
static uint32_t type
Type string converted to DNS type value.
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...
static struct GNUNET_FS_UnindexContext * uc
API for file sharing via GNUnet.
Constants for network protocols.
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.
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.
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.
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_CRYPTO_ecdsa_key_get_anonymous(void)
Get the shared private key we use for anonymous users.
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.
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
void GNUNET_DATASTORE_cancel(struct GNUNET_DATASTORE_QueueEntry *qe)
Cancel a datastore operation.
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
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_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.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
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.
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).
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
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.
@ GNUNET_DISK_OPEN_READ
Open the file for reading.
@ GNUNET_DISK_PERM_NONE
Nobody is allowed to do anything to the file.
@ GNUNET_DISK_SEEK_SET
Seek an absolute position (from the start of the file).
struct GNUNET_FS_Uri * GNUNET_FS_uri_dup(const struct GNUNET_FS_Uri *uri)
Duplicate URI.
void GNUNET_FS_share_tree_free(struct GNUNET_FS_ShareTreeItem *toplevel)
Release memory of a share item tree.
void GNUNET_FS_unindex_stop(struct GNUNET_FS_UnindexContext *uc)
Clean up after completion of an unindex operation.
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.
void GNUNET_FS_uri_destroy(struct GNUNET_FS_Uri *uri)
Free URI.
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.
GNUNET_FS_DirScannerProgressUpdateReason
Progress reasons of the directory scanner.
struct GNUNET_FS_Uri * GNUNET_FS_uri_parse(const char *uri, char **emsg)
Convert a UTF-8 String to a URI.
struct GNUNET_FS_UnindexContext * GNUNET_FS_unindex_start(struct GNUNET_FS_Handle *h, const char *filename, void *cctx)
Unindex a file.
void GNUNET_FS_directory_scan_abort(struct GNUNET_FS_DirScanner *ds)
Abort the scan.
@ GNUNET_FS_STATUS_UNINDEX_PROGRESS
Notification that we made progress unindexing a file.
@ GNUNET_FS_STATUS_UNINDEX_START
Notification that we started to unindex a file.
@ GNUNET_FS_STATUS_UNINDEX_STOPPED
Notification that the unindexing of this file was stopped (final event for this action).
@ GNUNET_FS_STATUS_UNINDEX_COMPLETED
Notification that the unindexing of this file was completed.
@ GNUNET_FS_STATUS_UNINDEX_SUSPEND
Notification that we suspended unindexing a file.
@ GNUNET_FS_STATUS_UNINDEX_ERROR
Notification that we encountered an error unindexing a file.
@ GNUNET_FS_DIRSCANNER_INTERNAL_ERROR
There was an internal error.
@ GNUNET_FS_DIRSCANNER_FINISHED
Last call to the progress function: we have finished scanning the directory.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
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.
#define GNUNET_log(kind,...)
void GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc)
Cancel a file hashing operation.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
@ GNUNET_SCHEDULER_PRIORITY_IDLE
Run when otherwise idle.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
GNUNET_MQ_Error
Error codes for the queue.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
#define GNUNET_MESSAGE_TYPE_FS_UNINDEX_OK
Reply to client indicating unindex receipt.
#define GNUNET_MESSAGE_TYPE_FS_UNINDEX
Request from client to unindex a file.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
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...
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
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.
static unsigned int size
Size of the "table".
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
@ GNUNET_BLOCK_TYPE_FS_DBLOCK
Data block (leaf) in the CHK tree.
@ GNUNET_BLOCK_TYPE_FS_UBLOCK
Type of a block representing any type of search result (universal).
struct GNUNET_HashCode query
Hash of the encrypted content, used for querying.
struct ContentHashKey chk
Query and key of the top GNUNET_EC_IBlock.
Private ECC key encoded for transmission.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
Master context for most FS operations.
void * upcb_cls
Closure for upcb.
GNUNET_FS_ProgressCallback upcb
Function to call with updates on our progress.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
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...
unsigned int depth
Depth of the given block in the tree; 0 would be the lowest level (DBLOCKs).
struct GNUNET_FS_Handle * fsh
File-sharing handle that generated the event.
enum GNUNET_FS_Status status
Specific status code (determines the event type).
struct GNUNET_FS_ProgressInfo::@21::GNUNET_FS_UnindexEvent unindex
uint64_t offset
At what offset in the file is "data"?
union GNUNET_FS_ProgressInfo::@21 value
Values that depend on the event type.
struct GNUNET_FS_ProgressInfo::@21::GNUNET_FS_PublishStatusEvent::@22::GNUNET_FS_PublishErrorEvent error
A node of a directory tree (produced by dirscanner)
struct GNUNET_FS_Uri * ksk_uri
Keywords for this file or directory (derived from metadata).
Handle for controlling an unindexing operation.
struct GNUNET_FS_TreeEncoder * tc
Merkle-ish tree encoder context.
struct GNUNET_FS_DirScanner * dscan
Directory scanner to find keywords (KBlock removal).
enum UnindexState state
Current operatinonal phase.
void * client_info
Pointer kept for the client.
char * emsg
Error message, NULL on success.
struct GNUNET_DISK_FileHandle * fh
Handle used to read the file.
struct GNUNET_TIME_Absolute start_time
When did we start?
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.
struct GNUNET_DATASTORE_QueueEntry * dqe
Handle to datastore 'get_key' operation issued for obtaining KBlocks.
struct GNUNET_CRYPTO_FileHashContext * fhc
Context for hashing of the file.
struct TopLevelActivity * top
Our top-level activity entry.
char * filename
Name of the file that we are unindexing.
struct GNUNET_DATASTORE_Handle * dsh
Connection to the datastore service, only valid during the UNINDEX_STATE_DS_NOTIFY phase.
struct GNUNET_FS_Handle * h
Global FS context.
uint32_t ksk_offset
Current offset in KSK removal.
char * serialization
Short name under which we are serializing the state of this operation.
struct GNUNET_HashCode uquery
Current query of 'get_key' operation.
struct GNUNET_FS_Uri * ksk_uri
Keywords found (telling us which KBlocks to remove).
struct GNUNET_HashCode file_id
Hash of the file's contents (once computed).
uint64_t file_size
Overall size of the file.
struct GNUNET_MQ_Handle * mq
Connection to the FS service, only valid during the UNINDEX_STATE_FS_NOTIFY phase.
A Universal Resource Identifier (URI), opaque.
char ** keywords
Keywords start with a '+' if they are mandatory (in which case the '+' is NOT part of the keyword) an...
union GNUNET_FS_Uri::@49 data
struct GNUNET_FS_Uri::@49::@50 ksk
unsigned int keywordCount
Size of the keywords array.
struct FileIdentifier chk
Information needed to retrieve a file (content-hash-key plus file size).
Message handler for a specific message type.
Time for absolute times used by GNUnet, in microseconds.
index block (indexing a DBlock that can be obtained directly from reading the plaintext file)
uint64_t offset
At which offset should we be able to find this on-demand encoded block? (in NBO)
struct GNUNET_HashCode file_id
Hash code of the entire content of the file that was indexed (used to uniquely identify the plaintext...
universal block for keyword and namespace search results
struct GNUNET_CRYPTO_EcdsaPublicKey verification_key
Public key used to sign this block.
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.
uint32_t reserved
Always zero.