29#include "gnunet_signatures.h"
151 (
const char *)
enc.encoding);
203 _ (
"Failed to open `%s' for writing: %s\n"),
210 "fs-namespace-node-count",
236 _ (
"Failed to write `%s': %s\n"),
284 if (count > 1024 * 1024)
294 for (i = 0; i < count; i++)
335 _ (
"Failed to read `%s': %s\n"),
409 if (NULL != psc->
cont)
414 if (NULL != psc->
nsn)
425 if (NULL != psc->
cont)
434 const char *identifier,
460 if (NULL == psc->
dsh)
502 if (NULL != psc->
dsh)
508 if (NULL != psc->
nsn)
629 if (UINT_MAX == fc->
id)
690 "No updateable nodes found for ID `%s'\n",
721 "Calculating TREEs to find roots of update trees\n");
733 "TREE of node `%s' is %u\n",
748 if (UINT_MAX == fc.
id)
766 "Starting new TREE %u with node `%s'\n",
786 "TREE of node `%s' is %u\n",
796 "Root of TREE %u is node `%s'\n",
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_MessageHeader * msg
shared definitions for the FS library
@ GNUNET_FS_URI_SKS
Signed key space (file in namespace).
static int process_update_node(void *cls, const struct GNUNET_HashCode *key, void *value)
Call the iterator in the closure for each node.
static void sks_publish_cont(void *cls, const char *msg)
Function called by the UBlock construction with the result from the PUT (UBlock) request.
static char * get_update_information_directory(struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns)
Return the name of the directory in which we store the update information graph for the given local n...
static void free_update_information_graph(struct GNUNET_FS_UpdateInformationGraph *uig)
Release memory occupied by UIG datastructure.
static int find_trees(void *cls, const struct GNUNET_HashCode *key, void *value)
Find all nodes reachable from the current node (including the current node itself).
static struct GNUNET_FS_UpdateInformationGraph * read_update_information_graph(struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns)
Read the namespace update node graph from a file.
static void write_update_information_graph(struct GNUNET_FS_UpdateInformationGraph *uig)
Write a namespace's update node graph to a file.
void GNUNET_FS_publish_ublock_cancel_(struct GNUNET_FS_PublishUblockContext *uc)
Abort UBlock publishing operation.
struct GNUNET_FS_PublishUblockContext * GNUNET_FS_publish_ublock_(struct GNUNET_FS_Handle *h, struct GNUNET_DATASTORE_Handle *dsh, const char *label, const char *ulabel, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_UBlockContinuation cont, void *cont_cls)
Publish a UBlock.
publish a UBLOCK in GNUnet
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static int ret
Final status code.
@ END
We're done processing.
struct GNUNET_HashCode key
The key used in the DHT.
static OpusEncoder * enc
OPUS encoder.
static struct GNUNET_NAMECACHE_Handle * ns
Handle to the namecache.
static char * value
Value of the record to add/remove.
static struct GNUNET_FS_Uri * uri
Value of URI provided on command-line (when not publishing a file but just creating UBlocks to refer ...
static struct GNUNET_FS_MetaData * meta
Meta-data provided via command-line option.
static struct GNUNET_FS_BlockOptions bo
Options we set for published blocks.
static char * next_id
Command-line option for namespace publishing: identifier for updates to this publication.
static struct GNUNET_FS_PublishContext * pc
Handle to FS-publishing operation.
static struct GNUNET_CRYPTO_EddsaPublicKey pub
API for file sharing via GNUnet.
enum GNUNET_GenericReturnValue GNUNET_BIO_write_close(struct GNUNET_BIO_WriteHandle *h, char **emsg)
Close an IO handle.
struct GNUNET_BIO_ReadSpec GNUNET_BIO_read_spec_string(const char *what, char **result, size_t max_length)
Create the specification to read a 0-terminated string.
struct GNUNET_BIO_WriteHandle * GNUNET_BIO_write_open_file(const char *fn)
Open a file for writing.
enum GNUNET_GenericReturnValue GNUNET_BIO_write_int32(struct GNUNET_BIO_WriteHandle *h, const char *what, int32_t i)
Write an (u)int32_t.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_spec_commit(struct GNUNET_BIO_ReadHandle *h, struct GNUNET_BIO_ReadSpec *rs)
Execute the read specifications in order.
struct GNUNET_BIO_WriteSpec GNUNET_BIO_write_spec_string(const char *what, const char *s)
Create the specification to write a 0-terminated string.
#define GNUNET_BIO_read_spec_end()
End of specifications marker.
#define GNUNET_BIO_write_spec_end()
End of specifications marker.
enum GNUNET_GenericReturnValue GNUNET_BIO_write_spec_commit(struct GNUNET_BIO_WriteHandle *h, struct GNUNET_BIO_WriteSpec *ws)
Execute the write specifications in order.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_close(struct GNUNET_BIO_ReadHandle *h, char **emsg)
Close an open handle.
enum GNUNET_GenericReturnValue GNUNET_BIO_read_int32(struct GNUNET_BIO_ReadHandle *h, const char *what, int32_t *i)
Read an (u)int32_t.
struct GNUNET_BIO_ReadHandle * GNUNET_BIO_read_open_file(const char *fn)
Open a file for reading.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
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).
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
struct GNUNET_FS_Uri * GNUNET_FS_uri_dup(const struct GNUNET_FS_Uri *uri)
Duplicate URI.
void GNUNET_FS_namespace_list_updateable(struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *next_id, GNUNET_FS_IdentifierProcessor ip, void *ip_cls)
List all of the identifiers in the namespace for which we could produce an update.
GNUNET_FS_PublishOptions
Options for publishing.
char * GNUNET_FS_uri_to_string(const struct GNUNET_FS_Uri *uri)
Convert a URI to a UTF-8 String.
void GNUNET_FS_uri_destroy(struct GNUNET_FS_Uri *uri)
Free URI.
struct GNUNET_FS_PublishSksContext * GNUNET_FS_publish_sks(struct GNUNET_FS_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *identifier, const char *update, const struct GNUNET_FS_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, enum GNUNET_FS_PublishOptions options, GNUNET_FS_PublishContinuation cont, void *cont_cls)
Publish an SBlock on GNUnet.
void(* GNUNET_FS_PublishContinuation)(void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
Signature of a function called as the continuation of a KBlock or SBlock publication.
void(* GNUNET_FS_IdentifierProcessor)(void *cls, const char *last_id, const struct GNUNET_FS_Uri *last_uri, const struct GNUNET_FS_MetaData *last_meta, const char *next_id)
Function called on updateable identifiers.
struct GNUNET_FS_Uri * GNUNET_FS_uri_parse(const char *uri, char **emsg)
Convert a UTF-8 String to a URI.
struct GNUNET_BIO_ReadSpec GNUNET_FS_read_spec_meta_data(const char *what, struct GNUNET_FS_MetaData **result)
Create the specification to read a metadata container.
struct GNUNET_BIO_WriteSpec GNUNET_FS_write_spec_meta_data(const char *what, const struct GNUNET_FS_MetaData *m)
Create the specification to write a metadata container.
void GNUNET_FS_publish_sks_cancel(struct GNUNET_FS_PublishSksContext *psc)
Abort the SKS publishing operation.
@ GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY
Simulate publishing.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
void GNUNET_CRYPTO_hash_to_enc(const struct GNUNET_HashCode *block, struct GNUNET_CRYPTO_HashAsciiEncoded *result)
Convert hash to ASCII encoding.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
#define GNUNET_log(kind,...)
#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.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_array_append(arr, len, element)
Append an element to an array (growing the array by one).
#define GNUNET_free(ptr)
Wrapper around free.
Closure for 'find_trees'.
unsigned int id
Identifier for the current TREE, or UINT_MAX for none yet.
struct GNUNET_FS_UpdateInformationGraph * uig
UIG we are operating on.
unsigned int tree_array_size
Size of 'tree_array'.
struct NamespaceUpdateNode ** tree_array
Array with 'head's of TREEs.
unsigned int nug
Current generational ID used.
const struct GNUNET_CONFIGURATION_Handle * cfg
The configuration that we are using.
Handle for buffered reading.
Structure specifying a reading operation on an IO handle.
GNUNET_BIO_ReadHandler rh
Function performing data deserialization.
Handle for buffered writing.
Structure specifying a writing operation on an IO handle.
GNUNET_BIO_WriteHandler wh
Function performing data serialization.
Internal representation of the hash map.
Private ECC key encoded for transmission.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
0-terminated ASCII encoding of a struct GNUNET_HashCode.
Handle to the datastore service.
Settings for publishing a block (which may of course also apply to an entire directory or file).
Master context for most FS operations.
Context for the SKS publication.
struct GNUNET_CRYPTO_EcdsaPrivateKey ns
Namespace we're publishing to.
GNUNET_FS_PublishContinuation cont
Function to call once we're done.
struct GNUNET_DATASTORE_Handle * dsh
Handle to the datastore.
void * cont_cls
Closure for cont.
struct NamespaceUpdateNode * nsn
Namespace update node to add to namespace on success (or to be deleted if publishing failed).
struct GNUNET_FS_PublishUblockContext * uc
Handle for our UBlock operation request.
struct GNUNET_FS_Handle * h
Handle to FS.
struct GNUNET_FS_Uri * uri
URI of the new entry in the namespace.
Context for 'ublock_put_cont'.
A Universal Resource Identifier (URI), opaque.
union GNUNET_FS_Uri::@49 data
struct GNUNET_FS_Uri::@49::@51 sks
enum GNUNET_FS_UriType type
Type of the URI.
struct GNUNET_CRYPTO_EcdsaPublicKey ns
Identifier of the namespace.
char * identifier
Human-readable identifier chosen for this entry in the namespace.
Information about an (updateable) node in the namespace.
struct GNUNET_FS_MetaData * md
Metadata for this entry.
struct GNUNET_FS_Uri * uri
URI of this entry in the namespace.
char * update
Identifier of children of this node.
unsigned int tree_id
TREE this entry belongs to (if nug is current).
unsigned int nug
Namespace update generation ID.
char * id
Identifier for this node.
Closure for 'process_update_node'.
void * ip_cls
Closure for 'ip'.
GNUNET_FS_IdentifierProcessor ip
Function to call for each node.