From: Christian Grothoff Date: Wed, 24 Mar 2010 09:58:58 +0000 (+0000) Subject: stuff X-Git-Tag: initial-import-from-subversion-38251~22384 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3aea10e56e9f4b4971dd2626bd4f69ea796787e2;p=oweals%2Fgnunet.git stuff --- diff --git a/TODO b/TODO index 9cd5e7739..6b7dee43e 100644 --- a/TODO +++ b/TODO @@ -23,24 +23,15 @@ away), in order in which they will likely be done: sessions even if no connections exist for a while! (likely related...) - transport reports bw quota violations on big-endian systems (core or transport issue?) -* HELLO: - - need function to test "equivalency" of HELLOs; use in topology! * FS: - - GAP improvements: - + active reply route caching design & implementation of service, - gap extension! - gnunet-publish cannot be aborted using CTRL-C - on some systems, keyword search does not find locally published content (need testcase of command-line tools!) - 2-peer download is still too slow (why?) - advanced FS API parts - + namespaces: fundamental namespace API - + search: SBlocks, KSBlocks, probes, notify FS-service of known results - + collection + + search: SBlocks, NBlocks, probes, notify FS-service of known results + location URIs (publish, search, download) + indexing: index-failure-cleanup - + download: management/bounding of parallel downloads (for recursive dl.) - + datastore reservation (publishing) + gnunet-publish (URI args) + gnunet-download (directory) + gnunet-search (options, incl. namespace search) @@ -52,14 +43,8 @@ away), in order in which they will likely be done: + getopt API + insert: sblocks, loc uris + download: loc uris - + search: sblocks, skblocks, loc uris + + search: sblocks, nblocks, loc uris + namespaces - + collection - - implement FS performance tests - + insert - + download - + search - + unindex - [./fs/gnunet-service-fs.c:208]: (style) struct or union member 'LocalGetContext::results_bf_size' is never used - [./fs/gnunet-service-fs.c:501]: (style) struct or union member 'PendingRequest::used_pids_size' is never used - [./fs/gnunet-service-fs.c:654]: (style) struct or union member 'ConnectedPeer::last_client_replies' is never used @@ -100,12 +85,16 @@ away), in order in which they will likely be done: [On W32, we need to select after calling socket before doing connect etc.] * FS: + - datastore reservation (publishing) - persistence support (publish, unindex, search, download) + - download: management/bounding of parallel downloads (for recursive dl.) - non-anonymous FS service (needs DHT) + basic DHT integration + CS-DHT-functions (DHT-put of LOC) + P2P-functions (DHT-get) - - active migration support (in fs or in datastore?) + - active migration support (in fs or in datastore or new daemon?) + - GAP improvements: + + active reply route caching design & implementation of service; gap extension! * TOPOLOGY: - needs more testing (especially F2F topology) - needs to re-try connecting after disconnect (currently, it @@ -134,6 +123,8 @@ away), in order in which they will likely be done: more balanced load) - check if new HELLO learned is different from old HELLO before resetting entire state! +* HELLO: + - need function to test "equivalency" of HELLOs (or integrate with "merge"?); use in PEERINFO 0.9.0pre2: * Module features to implement: @@ -160,6 +151,13 @@ away), in order in which they will likely be done: - better crash management (attach debugging support, capture and analyze debug output, detect random vs. deterministic crashes) - shutdown sequence? +* FS: + - collection API & tests + - implement FS performance tests + + insert + + download + + search + + unindex 0.9.0pre3: diff --git a/contrib/defaults.conf b/contrib/defaults.conf index f7750a0a8..1259a82d0 100644 --- a/contrib/defaults.conf +++ b/contrib/defaults.conf @@ -188,6 +188,7 @@ FILENAME = $SERVICEHOME/datastore/sqlite.db [fs] INDEXDB = $SERVICEHOME/idxinfo.lst +IDENTITY_DIR = $SERVICEHOME/identities/ PORT = 2094 HOSTNAME = localhost HOME = $SERVICEHOME diff --git a/src/fs/fs.h b/src/fs/fs.h index 67bb6f4dd..0d4ed268a 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h @@ -35,6 +35,20 @@ */ #define DBLOCK_SIZE (32*1024) +/** + * Maximum legal size for a kblock. + */ +#define MAX_KBLOCK_SIZE (60 * 1024) + +/** + * Maximum legal size for an sblock. + */ +#define MAX_SBLOCK_SIZE (60 * 1024) + +/** + * Maximum legal size for an nblock. + */ +#define MAX_NBLOCK_SIZE (60 * 1024) /** * Pick a multiple of 2 here to achive 8-byte alignment! @@ -1036,6 +1050,11 @@ struct GNUNET_FS_Namespace */ struct GNUNET_CRYPTO_RsaPrivateKey *key; + /** + * Name of the file with the private key. + */ + char *filename; + /** * Reference counter. */ @@ -1124,7 +1143,35 @@ struct SBlock /* 0-terminated update-identifier here */ - /* 0-terminated URI here */ + /* 0-terminated URI here (except for NBlocks) */ + + /* variable-size Meta-Data follows here */ + +}; + + +/** + * @brief namespace advertisement block (advertising root of a namespace) + */ +struct NBlock +{ + + /** + * GNUNET_RSA_Signature using RSA-key of the namespace + */ + struct GNUNET_CRYPTO_RsaSignature signature; + + /** + * What is being signed and why? + */ + struct GNUNET_CRYPTO_RsaSignaturePurpose purpose; + + /** + * Public key of the namespace. + */ + struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace; + + /* 0-terminated root identifier here */ /* variable-size Meta-Data follows here */ diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index a72a64a49..c040bad76 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet - (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) + (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -24,7 +24,90 @@ * @author Christian Grothoff */ #include "platform.h" +#include "gnunet_constants.h" +#include "gnunet_signatures.h" +#include "gnunet_util_lib.h" #include "gnunet_fs_service.h" +#include "fs.h" + +/** + * Return the name of the directory in which we store + * our local namespaces (or rather, their public keys). + * + * @param h global fs handle + * @return NULL on error, otherwise the name of the directory + */ +static char * +get_namespace_directory (struct GNUNET_FS_Handle *h) +{ + char *dn; + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (h->cfg, + "FS", + "IDENTITY_DIR", + &dn)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Configuration fails to specify `%s' in section `%s'\n"), + "IDENTITY_DIR", + "fs"); + return NULL; + } + return dn; +} + + +/** + * Context for advertising a namespace. + */ +struct AdvertisementContext +{ + /** + * Function to call with the result. + */ + GNUNET_FS_PublishContinuation cont; + + /** + * Closure for cont. + */ + void *cont_cls; + + /** + * Datastore handle. + */ + struct GNUNET_DATASTORE_Handle *dsh; + + /** + * URI that was created. + */ + struct GNUNET_FS_Uri *uri; +}; + + +/** + * Continuation called to notify client about result of the + * operation. + * + * @param cls closure (our struct AdvertismentContext) + * @param success GNUNET_SYSERR on failure + * @param msg NULL on success, otherwise an error message + */ +static void +advertisement_cont (void *cls, + int success, + const char *msg) +{ + struct AdvertisementContext *ac = cls; + + if (GNUNET_OK != success) + ac->cont (ac->cont_cls, NULL, msg); + else + ac->cont (ac->cont_cls, ac->uri, NULL); + GNUNET_DATASTORE_disconnect (ac->dsh, GNUNET_NO); + GNUNET_FS_uri_destroy (ac->uri); + GNUNET_free (ac); +} /** @@ -36,25 +119,96 @@ * @param anonymity for the namespace advertismement * @param priority for the namespace advertisement * @param expiration for the namespace advertisement - * @param advertisementURI the keyword (!) URI to advertise the - * namespace under (we will create a GNUNET_EC_KNBlock) - * @param rootEntry name of the root entry in the namespace (for - * the namespace advertisement) - * - * @return uri of the advertisement + * @param rootEntry name of the root of the namespace + * @param cont continuation + * @param cont_cls closure for cont */ -struct GNUNET_FS_Uri * +void GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, struct GNUNET_FS_Namespace *namespace, const struct GNUNET_CONTAINER_MetaData *meta, uint32_t anonymity, uint32_t priority, struct GNUNET_TIME_Absolute expiration, - const struct GNUNET_FS_Uri *advertisementURI, - const char *rootEntry) + const char *rootEntry, + GNUNET_FS_PublishContinuation cont, + void *cont_cls) { - GNUNET_break (0); - return NULL; + size_t reslen; + size_t size; + ssize_t mdsize; + struct NBlock *nb; + char *rtgt; + char *mdst; + struct GNUNET_DATASTORE_Handle *dsh; + struct AdvertisementContext *ctx; + + /* create advertisements */ + mdsize = GNUNET_CONTAINER_meta_data_get_serialized_size (meta); + if (-1 == mdsize) + { + cont (cont_cls, NULL, _("Failed to serialize meta data")); + return; + } + reslen = strlen (rootEntry) + 1; + size = mdsize + sizeof (struct NBlock) + reslen; + if (size > MAX_NBLOCK_SIZE) + { + size = MAX_NBLOCK_SIZE; + mdsize = size - sizeof (struct NBlock) - reslen; + } + nb = GNUNET_malloc (size); + GNUNET_CRYPTO_rsa_key_get_public (namespace->key, &nb->subspace); + rtgt = (char *) &nb[1]; + memcpy (rtgt, rootEntry, reslen); + mdst = &rtgt[reslen]; + mdsize = GNUNET_CONTAINER_meta_data_serialize (meta, + &mdst, + mdsize, + GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); + if (mdsize == -1) + { + GNUNET_break (0); + GNUNET_free (nb); + cont (cont_cls, NULL, _("Failed to serialize meta data")); + return; + } + size = mdsize + sizeof (struct NBlock) + reslen; + nb->purpose.size = htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature)); + nb->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK); + GNUNET_break (GNUNET_OK == + GNUNET_CRYPTO_rsa_sign (namespace->key, + &nb->purpose, + &nb->signature)); + dsh = GNUNET_DATASTORE_connect (h->cfg, h->sched); + if (NULL == dsh) + { + GNUNET_free (nb); + cont (cont_cls, NULL, _("Failed to connect to datastore service")); + return; + } + ctx = GNUNET_malloc (sizeof (struct AdvertisementContext)); + ctx->cont = cont; + ctx->cont_cls = cont_cls; + ctx->dsh = dsh; + ctx->uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri)); + ctx->uri->type = sks; + ctx->uri->data.sks.identifier = GNUNET_strdup (""); + GNUNET_CRYPTO_hash (&nb->subspace, + sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), + &ctx->uri->data.sks.namespace); + GNUNET_DATASTORE_put (dsh, + 0, + &ctx->uri->data.sks.namespace, + size, + nb, + GNUNET_DATASTORE_BLOCKTYPE_NBLOCK, + priority, + anonymity, + expiration, + GNUNET_CONSTANTS_SERVICE_TIMEOUT, + &advertisement_cont, + ctx); } @@ -70,8 +224,30 @@ struct GNUNET_FS_Namespace * GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name) { - GNUNET_break (0); - return NULL; + char *dn; + char *fn; + struct GNUNET_FS_Namespace *ret; + + dn = get_namespace_directory (h); + GNUNET_asprintf (&fn, + "%s%s%s", + dn, + DIR_SEPARATOR_STR, + name); + ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Namespace)); + ret->rc = 1; + ret->key = GNUNET_CRYPTO_rsa_key_create_from_file (fn); + if (ret->key == NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Failed to create or read private key for namespace `%s'\n"), + name); + GNUNET_free (ret); + GNUNET_free (fn); + return NULL; + } + ret->filename = fn; + return ret; } @@ -90,644 +266,114 @@ int GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *namespace, int freeze) { - GNUNET_break (0); - return GNUNET_SYSERR; -} - - -/** - * Build a list of all available local (!) namespaces The returned - * names are only the nicknames since we only iterate over the local - * namespaces. - * - * @param h handle to the file sharing subsystem - * @param cb function to call on each known namespace - * @param cb_cls closure for cb - */ -void -GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, - GNUNET_FS_NamespaceInfoProcessor cb, - void *cb_cls) -{ - GNUNET_break (0); -} - -/* end of fs_namespace.c */ - -#if 0 -/* - This file is part of GNUnet - (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors) - - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2, or (at your - option) any later version. - - GNUnet is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -/** - * @file applications/fs/ecrs/namespace.c - * @brief creation, deletion and advertising of namespaces - * @author Christian Grothoff - */ - -#include "platform.h" -#include "gnunet_directories.h" -#include "gnunet_protocols.h" -#include "gnunet_ecrs_lib.h" -#include "gnunet_fs_lib.h" -#include "ecrs_core.h" -#include "ecrs.h" - -#define PSEUDODIR "data/namespace/keys/" -#define INITVALUE "GNUnet!!" -#define MAX_SBLOCK_SIZE 32000 - -static char * -getPseudonymFileName (struct GNUNET_GE_Context *ectx, - struct GNUNET_GC_Configuration *cfg, - const GNUNET_HashCode * pid) -{ - char *gnHome; - char *fileName; - GNUNET_EncName enc; - - GNUNET_GC_get_configuration_value_filename (cfg, - "GNUNET", - "GNUNET_HOME", - GNUNET_DEFAULT_HOME_DIRECTORY, - &fileName); - gnHome = GNUNET_expand_file_name (ectx, fileName); - GNUNET_free (fileName); - fileName = - GNUNET_malloc (strlen (gnHome) + strlen (PSEUDODIR) + - sizeof (GNUNET_EncName) + 2); - strcpy (fileName, gnHome); - GNUNET_free (gnHome); - strcat (fileName, DIR_SEPARATOR_STR); - strcat (fileName, PSEUDODIR); - GNUNET_disk_directory_create (ectx, fileName); - if (pid != NULL) - { - GNUNET_hash_to_enc (pid, &enc); - strcat (fileName, (char *) &enc); - } - return fileName; -} - - -/** - * Check if the given namespace exists (locally). - * - * @return GNUNET_OK if the namespace exists, GNUNET_SYSERR if not - */ -int -GNUNET_ECRS_namespace_test_exists (struct GNUNET_GE_Context *ectx, - struct GNUNET_GC_Configuration *cfg, - const GNUNET_HashCode * pid) -{ - char *fileName; - int ret; - - fileName = getPseudonymFileName (ectx, cfg, pid); - ret = GNUNET_disk_file_test (ectx, fileName); - GNUNET_free (fileName); - return ret; -} - -/** - * Delete a local namespace. - * - * @return GNUNET_OK on success, GNUNET_SYSERR on error - */ -int -GNUNET_ECRS_namespace_delete (struct GNUNET_GE_Context *ectx, - struct GNUNET_GC_Configuration *cfg, - const GNUNET_HashCode * pid) -{ - char *fileName; - - fileName = getPseudonymFileName (ectx, cfg, pid); - if (GNUNET_YES != GNUNET_disk_file_test (ectx, fileName)) + namespace->rc--; + if (freeze) { - GNUNET_free (fileName); - return GNUNET_SYSERR; /* no such namespace */ + if (0 != UNLINK (namespace->filename)) + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, + "unlink", + namespace->filename); } - if (0 != UNLINK (fileName)) + if (0 == namespace->rc) { - GNUNET_GE_LOG_STRERROR_FILE (ectx, - GNUNET_GE_WARNING | GNUNET_GE_USER | - GNUNET_GE_BULK, "unlink", fileName); - GNUNET_free (fileName); - return GNUNET_SYSERR; + GNUNET_CRYPTO_rsa_key_free (namespace->key); + GNUNET_free (namespace->filename); + GNUNET_free (namespace); } - GNUNET_free (fileName); return GNUNET_OK; } -/** - * Write the private key of the namespace to a file. - */ -static int -write_namespace_key (struct GNUNET_GC_Configuration *cfg, - const struct GNUNET_RSA_PrivateKey *key) -{ - GNUNET_RSA_PrivateKeyEncoded *namespace_priv_key_encoded; - char *fileName; - GNUNET_RSA_PublicKey pubk; - GNUNET_HashCode pid; - - GNUNET_RSA_get_public_key (key, &pubk); - GNUNET_hash (&pubk, sizeof (GNUNET_RSA_PublicKey), &pid); - fileName = getPseudonymFileName (NULL, cfg, &pid); - if (GNUNET_YES == GNUNET_disk_file_test (NULL, fileName)) - { - GNUNET_GE_BREAK (NULL, 0); /* hash collision!? */ - GNUNET_free (fileName); - return GNUNET_SYSERR; - } - namespace_priv_key_encoded = GNUNET_RSA_encode_key (key); - GNUNET_disk_file_write (NULL, fileName, - (const char *) namespace_priv_key_encoded, - ntohs (namespace_priv_key_encoded->len), "600"); - GNUNET_free (fileName); - GNUNET_free (namespace_priv_key_encoded); - return GNUNET_OK; -} /** - * Create a new namespace (and publish an advertismement). - * This publishes both an GNUNET_EC_NBlock in the namespace itself - * as well as KNBlocks under all keywords specified in - * the advertisementURI. - * - * @param anonymity_level for the namespace advertismement - * @param priority for the namespace advertisement - * @param expiration for the namespace advertisement - * @param advertisementURI the keyword (!) URI to advertise the - * namespace under (GNUNET_EC_KNBlock) - * @param meta meta-data for the namespace advertisement - * (will be used to derive a name) - * @param rootEntry name of the root entry in the namespace (for - * the namespace advertisement) - * @param rootURI set to the URI of the namespace, NULL if - * no advertisement was created - * - * @return URI on success, NULL on error + * Context for the 'process_namespace' callback. + * Specifies a function to call on each namespace. */ -struct GNUNET_ECRS_URI * -GNUNET_ECRS_namespace_create (struct GNUNET_GE_Context *ectx, - struct GNUNET_GC_Configuration *cfg, - const struct GNUNET_CONTAINER_MetaData *meta, - uint32_t anonymityLevel, - uint32_t priority, - GNUNET_CronTime expiration, - const struct GNUNET_ECRS_URI *advertisementURI, - const char *rootEntry) -{ - struct GNUNET_ECRS_URI *rootURI; - struct GNUNET_RSA_PrivateKey *namespace_priv_key; - GNUNET_HashCode hc; - struct GNUNET_ClientServerConnection *sock; - GNUNET_DatastoreValue *value; - GNUNET_DatastoreValue *knvalue; - unsigned int size; - unsigned int mdsize; - struct GNUNET_RSA_PrivateKey *pk; - GNUNET_EC_SBlock *sb; - GNUNET_EC_KSBlock *ksb; - char **keywords; - const char *keyword; - unsigned int keywordCount; - int i; - char *cpy; - char *rtgt; - - if ((advertisementURI != NULL) - && (!GNUNET_ECRS_uri_test_ksk (advertisementURI))) - { - GNUNET_GE_BREAK (ectx, 0); - return NULL; - } - namespace_priv_key = GNUNET_RSA_create_key (); - if (GNUNET_OK != write_namespace_key (cfg, namespace_priv_key)) - { - GNUNET_RSA_free_key (namespace_priv_key); - return NULL; - } - - /* create advertisements */ - mdsize = GNUNET_meta_data_get_serialized_size (meta, GNUNET_SERIALIZE_PART); - size = mdsize + sizeof (GNUNET_EC_SBlock) + strlen (rootEntry) + 2; - if (size > MAX_SBLOCK_SIZE) - { - size = MAX_SBLOCK_SIZE; - mdsize = size - sizeof (GNUNET_EC_SBlock) - strlen (rootEntry) - 2; - } - value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size); - memset (value, 0, sizeof (GNUNET_DatastoreValue) + size); - sb = (GNUNET_EC_SBlock *) & value[1]; - sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED); - GNUNET_RSA_get_public_key (namespace_priv_key, &sb->subspace); - rtgt = (char *) &sb[1]; - memcpy (rtgt, rootEntry, strlen (rootEntry) + 1); - mdsize = GNUNET_meta_data_serialize (ectx, - meta, - &rtgt[strlen (rootEntry) + 2], - mdsize, GNUNET_SERIALIZE_PART); - if (mdsize == -1) - { - GNUNET_GE_BREAK (ectx, 0); - GNUNET_RSA_free_key (namespace_priv_key); - GNUNET_free (value); - return NULL; - } - size = mdsize + sizeof (GNUNET_EC_SBlock) + strlen (rootEntry) + 2; - GNUNET_GE_ASSERT (ectx, - GNUNET_OK == GNUNET_RSA_sign (namespace_priv_key, - size - - - sizeof - (GNUNET_RSA_Signature) - - sizeof - (GNUNET_RSA_PublicKey) - - sizeof (unsigned int), - &sb->identifier, - &sb->signature)); - value->size = htonl (sizeof (GNUNET_DatastoreValue) + size); - value->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED); - value->priority = htonl (priority); - value->anonymity_level = htonl (anonymityLevel); - value->expiration_time = GNUNET_htonll (expiration); - sock = GNUNET_client_connection_create (ectx, cfg); - if (sock == NULL) - { - GNUNET_free (value); - GNUNET_RSA_free_key (namespace_priv_key); - return NULL; - } - if (GNUNET_OK != GNUNET_FS_insert (sock, value)) - { - GNUNET_free (value); - GNUNET_client_connection_destroy (sock); - GNUNET_RSA_free_key (namespace_priv_key); - return NULL; - } - - - /* publish KNBlocks */ - size += sizeof (GNUNET_EC_KSBlock) - sizeof (GNUNET_EC_SBlock); - knvalue = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size); - *knvalue = *value; - knvalue->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD_SIGNED); - knvalue->size = htonl (sizeof (GNUNET_DatastoreValue) + size); - ksb = (GNUNET_EC_KSBlock *) & knvalue[1]; - ksb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD_SIGNED); - memcpy (&ksb->sblock, - sb, sizeof (GNUNET_EC_SBlock) + mdsize + strlen (rootEntry) + 2); - - if (advertisementURI != NULL) - { - keywords = advertisementURI->data.ksk.keywords; - keywordCount = advertisementURI->data.ksk.keywordCount; - cpy = - GNUNET_malloc (size - sizeof (GNUNET_EC_KBlock) - - sizeof (unsigned int)); - memcpy (cpy, - &ksb->sblock, - size - sizeof (GNUNET_EC_KBlock) - sizeof (unsigned int)); - for (i = 0; i < keywordCount; i++) - { - keyword = keywords[i]; - /* first character of keyword indicates - mandatory or not -- ignore for hashing! */ - GNUNET_hash (&keyword[1], strlen (&keyword[1]), &hc); - pk = GNUNET_RSA_create_key_from_hash (&hc); - GNUNET_RSA_get_public_key (pk, &ksb->kblock.keyspace); - GNUNET_GE_ASSERT (ectx, - size - sizeof (GNUNET_EC_KBlock) - - sizeof (unsigned int) == - sizeof (GNUNET_EC_SBlock) + mdsize + - strlen (rootEntry) + 2); - GNUNET_ECRS_encryptInPlace (&hc, &ksb->sblock, - size - sizeof (GNUNET_EC_KBlock) - - sizeof (unsigned int)); - - GNUNET_GE_ASSERT (ectx, - GNUNET_OK == GNUNET_RSA_sign (pk, - size - - sizeof - (GNUNET_EC_KBlock) - - sizeof (unsigned - int), - &ksb->sblock, - &ksb-> - kblock.signature)); - /* extra check: verify sig */ - GNUNET_RSA_free_key (pk); - if (GNUNET_OK != GNUNET_FS_insert (sock, knvalue)) - { - GNUNET_GE_BREAK (ectx, 0); - GNUNET_free (cpy); - GNUNET_free (knvalue); - GNUNET_free (value); - GNUNET_client_connection_destroy (sock); - GNUNET_RSA_free_key (namespace_priv_key); - return NULL; - } - /* restore nblock to avoid re-encryption! */ - memcpy (&ksb->sblock, - cpy, - size - sizeof (GNUNET_EC_KBlock) - sizeof (unsigned int)); - } - GNUNET_free (cpy); - } - rootURI = GNUNET_malloc (sizeof (URI)); - rootURI->type = sks; - GNUNET_hash (&sb->subspace, - sizeof (GNUNET_RSA_PublicKey), &rootURI->data.sks.namespace); - rootURI->data.sks.identifier = GNUNET_strdup (rootEntry); - GNUNET_free (knvalue); - GNUNET_free (value); - GNUNET_client_connection_destroy (sock); - GNUNET_RSA_free_key (namespace_priv_key); - - return rootURI; -} - -static struct GNUNET_RSA_PrivateKey * -read_namespace_key (struct GNUNET_GC_Configuration *cfg, - const GNUNET_HashCode * pid) +struct ProcessNamespaceContext { - char *fileName; - GNUNET_RSA_PrivateKeyEncoded *hke; - struct GNUNET_RSA_PrivateKey *hk; - char *dst; - unsigned long long len; - - fileName = getPseudonymFileName (NULL, cfg, pid); - if (GNUNET_OK != GNUNET_disk_file_size (NULL, fileName, &len, GNUNET_YES)) - { - GNUNET_free (fileName); - return NULL; - } - if (len < 2) - { - GNUNET_GE_LOG (NULL, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("File `%s' does not contain a pseudonym.\n"), - fileName); - GNUNET_free (fileName); - return NULL; - } - dst = GNUNET_malloc (len); - len = GNUNET_disk_file_read (NULL, fileName, len, dst); - hke = (GNUNET_RSA_PrivateKeyEncoded *) dst; - if (ntohs (hke->len) != len) - { - GNUNET_GE_LOG (NULL, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("Format of pseudonym `%s' is invalid.\n"), fileName); - GNUNET_free (fileName); - GNUNET_free (hke); - return NULL; - } - GNUNET_free (fileName); - hk = GNUNET_RSA_decode_key (hke); - GNUNET_free (hke); - return hk; -} + /** + * Function to call. + */ + GNUNET_FS_NamespaceInfoProcessor cb; + + /** + * Closure for 'cb'. + */ + void *cb_cls; +}; /** - * Add an entry into a namespace. + * Function called with a filename of a namespace. Reads the key and + * calls the callback. * - * @param dstU to which URI should the namespace entry refer? - * @param md what meta-data should be associated with the - * entry? - * @param thisId name of this entry in the namespace (keyword/identifier) - * @param nextId name of the update for this entry (to be published in - * the future; maybe NULL) - * @param pid unique identifier of the namespace/pseudonym - * @return URI on success, NULL on error + * @param cls closure (struct ProcessNamespaceContext) + * @param filename complete filename (absolute path) + * @return GNUNET_OK to continue to iterate, + * GNUNET_SYSERR to abort iteration with error! */ -struct GNUNET_ECRS_URI * -GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx, - struct GNUNET_GC_Configuration *cfg, - const GNUNET_HashCode * pid, - uint32_t anonymityLevel, - uint32_t priority, - GNUNET_CronTime expiration, - const char *thisId, - const char *nextId, - const struct GNUNET_ECRS_URI *dstU, - const struct GNUNET_MetaData *md) -{ - struct GNUNET_ECRS_URI *uri; - struct GNUNET_ClientServerConnection *sock; - GNUNET_DatastoreValue *value; - unsigned int size; - unsigned int mdsize; - struct GNUNET_RSA_PrivateKey *hk; - GNUNET_EC_SBlock *sb; - char *dstURI; - char *destPos; - GNUNET_HashCode hc; /* hash of thisId = key */ - GNUNET_HashCode hc2; /* hash of hc = identifier */ - int ret; - unsigned int nidlen; - - hk = read_namespace_key (cfg, pid); - if (hk == NULL) - return NULL; - - /* THEN: construct GNUNET_EC_SBlock */ - dstURI = GNUNET_ECRS_uri_to_string (dstU); - mdsize = GNUNET_meta_data_get_serialized_size (md, GNUNET_SERIALIZE_PART); - if (nextId == NULL) - nextId = ""; - nidlen = strlen (nextId) + 1; - size = mdsize + sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1 + nidlen; - if (size > MAX_SBLOCK_SIZE) - { - size = MAX_SBLOCK_SIZE; - mdsize = - size - (sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1 + nidlen); - } - value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size); - sb = (GNUNET_EC_SBlock *) & value[1]; - sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED); - destPos = (char *) &sb[1]; - memcpy (destPos, nextId, nidlen); - destPos += nidlen; - memcpy (destPos, dstURI, strlen (dstURI) + 1); - destPos += strlen (dstURI) + 1; - mdsize = GNUNET_meta_data_serialize (ectx, - md, - destPos, - mdsize, GNUNET_SERIALIZE_PART); - if (mdsize == -1) - { - GNUNET_GE_BREAK (ectx, 0); - GNUNET_free (dstURI); - GNUNET_RSA_free_key (hk); - GNUNET_free (value); - return NULL; - } - size = sizeof (GNUNET_EC_SBlock) + mdsize + strlen (dstURI) + 1 + nidlen; - value->size = htonl (sizeof (GNUNET_DatastoreValue) + size); - value->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED); - value->priority = htonl (priority); - value->anonymity_level = htonl (anonymityLevel); - value->expiration_time = GNUNET_htonll (expiration); - GNUNET_hash (thisId, strlen (thisId), &hc); - GNUNET_hash (&hc, sizeof (GNUNET_HashCode), &hc2); - uri = GNUNET_malloc (sizeof (URI)); - uri->type = sks; - GNUNET_RSA_get_public_key (hk, &sb->subspace); - GNUNET_hash (&sb->subspace, - sizeof (GNUNET_RSA_PublicKey), &uri->data.sks.namespace); - GNUNET_GE_BREAK (ectx, 0 == memcmp (&uri->data.sks.namespace, - pid, sizeof (GNUNET_HashCode))); - uri->data.sks.identifier = GNUNET_strdup (thisId); - GNUNET_hash_xor (&hc2, &uri->data.sks.namespace, &sb->identifier); - GNUNET_ECRS_encryptInPlace (&hc, &sb[1], size - sizeof (GNUNET_EC_SBlock)); - GNUNET_GE_ASSERT (ectx, - GNUNET_OK == GNUNET_RSA_sign (hk, - size - - - sizeof - (GNUNET_RSA_Signature) - - sizeof - (GNUNET_RSA_PublicKey) - - sizeof (unsigned int), - &sb->identifier, - &sb->signature)); - GNUNET_RSA_free_key (hk); - sock = GNUNET_client_connection_create (ectx, cfg); - ret = GNUNET_FS_insert (sock, value); - if (ret != GNUNET_OK) - { - GNUNET_free (uri); - uri = NULL; - } - GNUNET_client_connection_destroy (sock); - GNUNET_free (value); - GNUNET_free (dstURI); - - return uri; -} - -struct lNCLS -{ - struct GNUNET_GE_Context *ectx; - struct GNUNET_GC_Configuration *cfg; - GNUNET_ECRS_NamespaceInfoProcessor cb; - void *cls; - int cnt; -}; - static int -processFile_ (void *cls, const char *fileName) +process_namespace (void *cls, + const char *filename) { - struct lNCLS *c = cls; - struct GNUNET_RSA_PrivateKey *hk; - GNUNET_RSA_PrivateKeyEncoded *hke; - char *dst; - unsigned long long len; - GNUNET_HashCode namespace; - GNUNET_RSA_PublicKey pk; + struct ProcessNamespaceContext *pnc = cls; + struct GNUNET_CRYPTO_RsaPrivateKey *key; + struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk; + GNUNET_HashCode id; const char *name; + const char *t; - if (GNUNET_OK != - GNUNET_disk_file_size (c->ectx, fileName, &len, GNUNET_YES)) - return GNUNET_OK; - if (len < 2) - { - GNUNET_GE_LOG (c->ectx, - GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("Format of file `%s' is invalid, trying to remove.\n"), - fileName); - UNLINK (fileName); - return GNUNET_OK; - } - dst = GNUNET_malloc (len); - len = GNUNET_disk_file_read (c->ectx, fileName, len, dst); - hke = (GNUNET_RSA_PrivateKeyEncoded *) dst; - if (ntohs (hke->len) != len) + key = GNUNET_CRYPTO_rsa_key_create_from_file (filename); + if (key == NULL) { - GNUNET_GE_LOG (c->ectx, - GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("Format of file `%s' is invalid, trying to remove.\n"), - fileName); - UNLINK (fileName); - GNUNET_free (hke); + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Failed to read namespace private key file `%s', deleting it!\n"), + filename); + if (0 != UNLINK (filename)) + GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, + "unlink", + filename); return GNUNET_OK; } - hk = GNUNET_RSA_decode_key (hke); - GNUNET_free (hke); - if (hk == NULL) - { - GNUNET_GE_LOG (c->ectx, - GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER, - _("Format of file `%s' is invalid, trying to remove.\n"), - fileName); - UNLINK (fileName); - GNUNET_GE_BREAK (c->ectx, 0); - return GNUNET_SYSERR; - } - GNUNET_RSA_get_public_key (hk, &pk); - GNUNET_RSA_free_key (hk); - GNUNET_hash (&pk, sizeof (GNUNET_RSA_PublicKey), &namespace); - if (NULL != c->cb) - { - name = fileName; - while (NULL != strstr (name, DIR_SEPARATOR_STR)) - name = 1 + strstr (name, DIR_SEPARATOR_STR); - if (GNUNET_OK == c->cb (&namespace, name, c->cls)) - c->cnt++; - else - c->cnt = GNUNET_SYSERR; - } - else - c->cnt++; + GNUNET_CRYPTO_rsa_key_get_public (key, &pk); + GNUNET_CRYPTO_rsa_key_free (key); + GNUNET_CRYPTO_hash (&pk, sizeof(pk), &id); + name = filename; + while (NULL != (t = strstr (name, DIR_SEPARATOR_STR))) + name = t + 1; + pnc->cb (pnc->cb_cls, + name, + &id); return GNUNET_OK; } + /** - * Build a list of all available namespaces + * Build a list of all available local (!) namespaces The returned + * names are only the nicknames since we only iterate over the local + * namespaces. * - * @param list where to store the names (is allocated, caller frees) - * @return GNUNET_SYSERR on error, otherwise the number of pseudonyms in list + * @param h handle to the file sharing subsystem + * @param cb function to call on each known namespace + * @param cb_cls closure for cb */ -int -GNUNET_ECRS_get_namespaces (struct GNUNET_GE_Context *ectx, - struct GNUNET_GC_Configuration *cfg, - GNUNET_ECRS_NamespaceInfoProcessor cb, void *cls) +void +GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, + GNUNET_FS_NamespaceInfoProcessor cb, + void *cb_cls) { - char *dirName; - struct lNCLS myCLS; - - myCLS.cls = cls; - myCLS.cb = cb; - myCLS.cnt = 0; - myCLS.ectx = ectx; - myCLS.cfg = cfg; - dirName = getPseudonymFileName (ectx, cfg, NULL); - GNUNET_disk_directory_scan (ectx, dirName, &processFile_, &myCLS); - GNUNET_free (dirName); - return myCLS.cnt; + char *dn; + struct ProcessNamespaceContext ctx; + + dn = get_namespace_directory (h); + if (dn == NULL) + return; + ctx.cb = cb; + ctx.cb_cls = cb_cls; + GNUNET_DISK_directory_scan (dn, + &process_namespace, + &ctx); + GNUNET_free (dn); } +/* end of fs_namespace.c */ - -/* end of namespace.c */ -#endif diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index db95a6100..634f88801 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -42,16 +42,6 @@ #define DEBUG_PUBLISH GNUNET_NO -/** - * Maximum allowed size for a KBlock. - */ -#define MAX_KBLOCK_SIZE 60000 - -/** - * Maximum allowed size for an SBlock. - */ -#define MAX_SBLOCK_SIZE 60000 - /** * Main function that performs the upload. * @param cls "struct GNUNET_FS_PublishContext" identifies the upload @@ -1593,4 +1583,128 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, } +#if 0 + +/** + * Add an entry into a namespace. + * + * @param dstU to which URI should the namespace entry refer? + * @param md what meta-data should be associated with the + * entry? + * @param thisId name of this entry in the namespace (keyword/identifier) + * @param nextId name of the update for this entry (to be published in + * the future; maybe NULL) + * @param pid unique identifier of the namespace/pseudonym + * @return URI on success, NULL on error + */ +struct GNUNET_ECRS_URI * +GNUNET_ECRS_namespace_add_content (struct GNUNET_GE_Context *ectx, + struct GNUNET_GC_Configuration *cfg, + const GNUNET_HashCode * pid, + uint32_t anonymityLevel, + uint32_t priority, + GNUNET_CronTime expiration, + const char *thisId, + const char *nextId, + const struct GNUNET_ECRS_URI *dstU, + const struct GNUNET_MetaData *md) +{ + struct GNUNET_ECRS_URI *uri; + struct GNUNET_ClientServerConnection *sock; + GNUNET_DatastoreValue *value; + unsigned int size; + unsigned int mdsize; + struct GNUNET_RSA_PrivateKey *hk; + GNUNET_EC_SBlock *sb; + char *dstURI; + char *destPos; + GNUNET_HashCode hc; /* hash of thisId = key */ + GNUNET_HashCode hc2; /* hash of hc = identifier */ + int ret; + unsigned int nidlen; + + hk = read_namespace_key (cfg, pid); + if (hk == NULL) + return NULL; + + /* THEN: construct GNUNET_EC_SBlock */ + dstURI = GNUNET_ECRS_uri_to_string (dstU); + mdsize = GNUNET_meta_data_get_serialized_size (md, GNUNET_SERIALIZE_PART); + if (nextId == NULL) + nextId = ""; + nidlen = strlen (nextId) + 1; + size = mdsize + sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1 + nidlen; + if (size > MAX_SBLOCK_SIZE) + { + size = MAX_SBLOCK_SIZE; + mdsize = + size - (sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1 + nidlen); + } + value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size); + sb = (GNUNET_EC_SBlock *) & value[1]; + sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED); + destPos = (char *) &sb[1]; + memcpy (destPos, nextId, nidlen); + destPos += nidlen; + memcpy (destPos, dstURI, strlen (dstURI) + 1); + destPos += strlen (dstURI) + 1; + mdsize = GNUNET_meta_data_serialize (ectx, + md, + destPos, + mdsize, GNUNET_SERIALIZE_PART); + if (mdsize == -1) + { + GNUNET_GE_BREAK (ectx, 0); + GNUNET_free (dstURI); + GNUNET_RSA_free_key (hk); + GNUNET_free (value); + return NULL; + } + size = sizeof (GNUNET_EC_SBlock) + mdsize + strlen (dstURI) + 1 + nidlen; + value->size = htonl (sizeof (GNUNET_DatastoreValue) + size); + value->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED); + value->priority = htonl (priority); + value->anonymity_level = htonl (anonymityLevel); + value->expiration_time = GNUNET_htonll (expiration); + GNUNET_hash (thisId, strlen (thisId), &hc); + GNUNET_hash (&hc, sizeof (GNUNET_HashCode), &hc2); + uri = GNUNET_malloc (sizeof (URI)); + uri->type = sks; + GNUNET_RSA_get_public_key (hk, &sb->subspace); + GNUNET_hash (&sb->subspace, + sizeof (GNUNET_RSA_PublicKey), &uri->data.sks.namespace); + GNUNET_GE_BREAK (ectx, 0 == memcmp (&uri->data.sks.namespace, + pid, sizeof (GNUNET_HashCode))); + uri->data.sks.identifier = GNUNET_strdup (thisId); + GNUNET_hash_xor (&hc2, &uri->data.sks.namespace, &sb->identifier); + GNUNET_ECRS_encryptInPlace (&hc, &sb[1], size - sizeof (GNUNET_EC_SBlock)); + GNUNET_GE_ASSERT (ectx, + GNUNET_OK == GNUNET_RSA_sign (hk, + size + - + sizeof + (GNUNET_RSA_Signature) - + sizeof + (GNUNET_RSA_PublicKey) - + sizeof (unsigned int), + &sb->identifier, + &sb->signature)); + GNUNET_RSA_free_key (hk); + sock = GNUNET_client_connection_create (ectx, cfg); + ret = GNUNET_FS_insert (sock, value); + if (ret != GNUNET_OK) + { + GNUNET_free (uri); + uri = NULL; + } + GNUNET_client_connection_destroy (sock); + GNUNET_free (value); + GNUNET_free (dstURI); + + return uri; +} + +#endif + + /* end of fs_publish.c */ diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 70cbd3f84..59fd3022b 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -1847,8 +1847,8 @@ process_reply (void *cls, } break; - case GNUNET_DATASTORE_BLOCKTYPE_SKBLOCK: - // FIXME: any checks against duplicates for SKBlocks? + case GNUNET_DATASTORE_BLOCKTYPE_NBLOCK: + // FIXME: any checks against duplicates for NBlocks? break; default: GNUNET_break (0); @@ -1996,8 +1996,8 @@ handle_p2p_put (void *cls, &prq.namespace)) return GNUNET_SYSERR; break; - case GNUNET_DATASTORE_BLOCKTYPE_SKBLOCK: - // FIXME -- validate SKBLOCK! + case GNUNET_DATASTORE_BLOCKTYPE_NBLOCK: + // FIXME -- validate NBLOCK! GNUNET_break (0); return GNUNET_OK; default: @@ -2212,7 +2212,7 @@ process_local_reply (void *cls, pr->results_found++; if ( (pr->type == GNUNET_DATASTORE_BLOCKTYPE_KBLOCK) || (pr->type == GNUNET_DATASTORE_BLOCKTYPE_SBLOCK) || - (pr->type == GNUNET_DATASTORE_BLOCKTYPE_SKBLOCK) ) + (pr->type == GNUNET_DATASTORE_BLOCKTYPE_NBLOCK) ) { if (pr->bf == NULL) { diff --git a/src/hello/hello.c b/src/hello/hello.c index e37ae10e6..dfcc31dc2 100644 --- a/src/hello/hello.c +++ b/src/hello/hello.c @@ -510,6 +510,4 @@ GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, return GNUNET_OK; } - - /* end of hello.c */ diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index e3e62a143..d7842a519 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -107,8 +107,8 @@ struct GNUNET_PeerIdentity /** * Function called with a filename. * - * @param filename complete filename (absolute path) * @param cls closure + * @param filename complete filename (absolute path) * @return GNUNET_OK to continue to iterate, * GNUNET_SYSERR to abort iteration with error! */ diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index aa35c82ee..a506362f2 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h @@ -72,9 +72,9 @@ extern "C" #define GNUNET_DATASTORE_BLOCKTYPE_ONDEMAND 5 /** - * FIXME. + * Type of a block that is used to advertise a namespace. */ -#define GNUNET_DATASTORE_BLOCKTYPE_SKBLOCK 6 /* not yet used */ +#define GNUNET_DATASTORE_BLOCKTYPE_NBLOCK 6 /** diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 111dcd5ac..fe0394335 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h @@ -435,9 +435,9 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext* */ int GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext* ctx, - void *scls, - const char *option, - const char *value); + void *scls, + const char *option, + const char *value); @@ -2044,22 +2044,20 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); * @param anonymity for the namespace advertismement * @param priority for the namespace advertisement * @param expiration for the namespace advertisement - * @param advertisementURI the keyword (!) URI to advertise the - * namespace under (we will create a GNUNET_EC_KNBlock) - * @param rootEntry name of the root entry in the namespace (for - * the namespace advertisement) - * - * @return uri of the advertisement + * @param rootEntry name of the root of the namespace + * @param cont continuation + * @param cont_cls closure for cont */ -struct GNUNET_FS_Uri * +void GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, struct GNUNET_FS_Namespace *namespace, const struct GNUNET_CONTAINER_MetaData *meta, uint32_t anonymity, uint32_t priority, struct GNUNET_TIME_Absolute expiration, - const struct GNUNET_FS_Uri *advertisementURI, - const char *rootEntry); + const char *rootEntry, + GNUNET_FS_PublishContinuation cont, + void *cont_cls); /** diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index d7d116c74..6191c4f7e 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2001, 2002, 2003, 2004, 2005, 2006 Christian Grothoff (and other contributing authors) + (C) 2001, 2002, 2003, 2004, 2005, 2006, 2010 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -207,8 +207,6 @@ int GNUNET_HELLO_get_id (const struct GNUNET_HELLO_Message *hello, struct GNUNET_PeerIdentity *peer); - - /* ifndef GNUNET_HELLO_LIB_H */ #endif /* end of gnunet_hello_lib.h */ diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h index 29aa36811..8b71bb616 100644 --- a/src/include/gnunet_signatures.h +++ b/src/include/gnunet_signatures.h @@ -76,10 +76,15 @@ extern "C" */ #define GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK 6 +/** + * Signature of advertisment for a namespace. + */ +#define GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK 7 + /** * */ -#define GNUNET_SIGNATURE_PURPOSE_RESOLVER_RESPONSE 7 +#define GNUNET_SIGNATURE_PURPOSE_RESOLVER_RESPONSE 8 #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index b466dfbbe..57f88c980 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -883,7 +883,6 @@ consider_for_advertising (const struct GNUNET_HELLO_Message *hello) peer = find_peer (&pid); if (peer == NULL) peer = make_peer (&pid, hello, GNUNET_NO); - // FIXME: check if 'hello' is any different from peer->hello? #if DEBUG_TOPOLOGY GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found `%s' from peer `%s' for advertising\n",