aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2010-09-13 03:18:26 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2010-09-13 03:18:26 +0000
commit672c8ac16367a0c20c29a2f183ff0814a549414f (patch)
tree98c0c6e0171109e7e4403fc50b6cae03a5c26c15
parente55811080fc99b40df58c48a28fbc87932912f92 (diff)
new block lib
git-svn-id: https://gnunet.org/svn/gnunet@12973 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--TODO9
-rw-r--r--contrib/defaults.conf3
-rw-r--r--src/block/block.c236
-rw-r--r--src/block/plugin_block_fs.c7
-rw-r--r--src/block/test_block.c61
-rw-r--r--src/fs/fs.h1
-rw-r--r--src/fs/gnunet-service-fs.c56
-rw-r--r--src/include/Makefile.am3
-rw-r--r--src/include/block_fs.h165
-rw-r--r--src/include/gnunet_block_lib.h156
-rw-r--r--src/util/test_time.c12
11 files changed, 327 insertions, 382 deletions
diff --git a/TODO b/TODO
index 9349189b36..e95522d87d 100644
--- a/TODO
+++ b/TODO
@@ -1,14 +1,11 @@
0.9.0pre2:
-* BLOCK:
- - implement FS plugin
- - design new block-lib API
+ FS:
- move FS serivce to new block API
-* FS:
- integrate with DHT
- measure latencies (core, datastore) => trust economy
- refuse content migration message (or solicit?)
- FS performance benchmarking
-* DHT:
+* DHT: [Nate]
- use new block lib
* CORE:
- derived key generation [Nils]
@@ -101,6 +98,8 @@
- good to have for DHT evaluation!
* DHT: [Nate]
- performance tests
+* BLOCK:
+ - more testing (KBlock, SBlock, NBlock)
0.9.1:
* TRANSPORT: [MW]
diff --git a/contrib/defaults.conf b/contrib/defaults.conf
index 73f303b3ff..f936386f8c 100644
--- a/contrib/defaults.conf
+++ b/contrib/defaults.conf
@@ -261,3 +261,6 @@ UNIXPATH = /tmp/gnunet-service-dht.sock
# REJECT_FROM =
# REJECT_FROM6 =
# PREFIX =
+
+[block]
+PLUGINS = fs
diff --git a/src/block/block.c b/src/block/block.c
index cb6837499d..8d8018b502 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -29,205 +29,6 @@
#include "gnunet_block_lib.h"
#include "plugin_block.h"
-/**
- * Check if the given KBlock is well-formed.
- *
- * @param kb the kblock data (or at least "dsize" bytes claiming to be one)
- * @param dsize size of "kb" in bytes; check for < sizeof(struct KBlock)!
- * @param query where to store the query that this block answers
- * @return GNUNET_OK if this is actually a well-formed KBlock
- */
-static int
-check_kblock (const struct KBlock *kb,
- size_t dsize,
- GNUNET_HashCode *query)
-{
- if (dsize < sizeof (struct KBlock))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (dsize - sizeof (struct KBlock) !=
- ntohl (kb->purpose.size)
- - sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose)
- - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) )
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_KBLOCK,
- &kb->purpose,
- &kb->signature,
- &kb->keyspace))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (query != NULL)
- GNUNET_CRYPTO_hash (&kb->keyspace,
- sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- query);
- return GNUNET_OK;
-}
-
-
-/**
- * Check if the given NBlock is well-formed.
- *
- * @param nb the nblock data (or at least "dsize" bytes claiming to be one)
- * @param dsize size of "nb" in bytes; check for < sizeof(struct NBlock)!
- * @param query where to store the query that this block answers
- * @return GNUNET_OK if this is actually a well-formed NBlock
- */
-static int
-check_nblock (const struct NBlock *nb,
- size_t dsize,
- GNUNET_HashCode *query)
-{
- if (dsize < sizeof (struct NBlock))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (dsize - sizeof (struct NBlock) !=
- ntohl (nb->ns_purpose.size)
- - sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose)
- - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) )
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (dsize !=
- ntohl (nb->ksk_purpose.size) + sizeof (struct GNUNET_CRYPTO_RsaSignature))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK_KSIG,
- &nb->ksk_purpose,
- &nb->ksk_signature,
- &nb->keyspace))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK,
- &nb->ns_purpose,
- &nb->ns_signature,
- &nb->subspace))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (query != NULL)
- GNUNET_CRYPTO_hash (&nb->keyspace,
- sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- query);
- return GNUNET_OK;
-}
-
-
-/**
- * Check if the given SBlock is well-formed.
- *
- * @param sb the sblock data (or at least "dsize" bytes claiming to be one)
- * @param dsize size of "kb" in bytes; check for < sizeof(struct SBlock)!
- * @param query where to store the query that this block answers
- * @return GNUNET_OK if this is actually a well-formed SBlock
- */
-static int
-check_sblock (const struct SBlock *sb,
- size_t dsize,
- GNUNET_HashCode *query)
-{
- if (dsize < sizeof (struct SBlock))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (dsize !=
- ntohl (sb->purpose.size) + sizeof (struct GNUNET_CRYPTO_RsaSignature))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (GNUNET_OK !=
- GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK,
- &sb->purpose,
- &sb->signature,
- &sb->subspace))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if (query != NULL)
- *query = sb->identifier;
- return GNUNET_OK;
-}
-
-
-/**
- * Check if the given block is well-formed (and of the given type).
- *
- * @param type type of the block
- * @param block the block data (or at least "size" bytes claiming to be one)
- * @param size size of "kb" in bytes; check that it is large enough
- * @param query where to store the query that this block answers
- * @return GNUNET_OK if this is actually a well-formed block,
- * GNUNET_NO if we could not determine the query,
- * GNUNET_SYSERR if the block is malformed
- */
-int
-GNUNET_BLOCK_check_block (enum GNUNET_BLOCK_Type type,
- const void *block,
- size_t size,
- GNUNET_HashCode *query)
-{
- /* first, validate! */
- switch (type)
- {
- case GNUNET_BLOCK_TYPE_DBLOCK:
- case GNUNET_BLOCK_TYPE_IBLOCK:
- GNUNET_CRYPTO_hash (block, size, query);
- break;
- case GNUNET_BLOCK_TYPE_KBLOCK:
- if (GNUNET_OK !=
- check_kblock (block,
- size,
- query))
- return GNUNET_SYSERR;
- break;
- case GNUNET_BLOCK_TYPE_SBLOCK:
- if (GNUNET_OK !=
- check_sblock (block,
- size,
- query))
- return GNUNET_SYSERR;
- break;
- case GNUNET_BLOCK_TYPE_NBLOCK:
- if (GNUNET_OK !=
- check_nblock (block,
- size,
- query))
- return GNUNET_SYSERR;
- return GNUNET_OK;
- case GNUNET_BLOCK_TYPE_ONDEMAND:
- if (size != sizeof (struct OnDemandBlock))
- return GNUNET_SYSERR;
- memset (query, 0, sizeof (GNUNET_HashCode));
- return GNUNET_NO;
- default:
- /* unknown block type */
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
-}
-
-/* ***************** NEW API ******************* */
/**
* Handle for a plugin.
@@ -272,12 +73,47 @@ struct GNUNET_BLOCK_Context *
GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_BLOCK_Context *ctx;
+ struct GNUNET_BLOCK_PluginFunctions *api;
+ struct Plugin *plugin;
unsigned int num_plugins;
+ char *plugs;
+ char *pos;
+ char *libname;
ctx = GNUNET_malloc (sizeof (struct GNUNET_BLOCK_Context));
ctx->cfg = cfg;
num_plugins = 0;
- /* FIXME: actually load plugins... */
+ if (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "block", "PLUGINS", &plugs))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Loading block plugins `%s'\n"), plugs);
+ pos = strtok (plugs, " ");
+ while (pos != NULL)
+ {
+ GNUNET_asprintf (&libname, "libgnunet_plugin_block_%s", pos);
+ api = GNUNET_PLUGIN_load (libname, NULL);
+ if (api == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to load block plugin `%s'\n"),
+ pos);
+ GNUNET_free (libname);
+ }
+ else
+ {
+ plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin->api = api;
+ plugin->library_name = libname;
+ GNUNET_array_append (ctx->plugins,
+ num_plugins,
+ plugin);
+ }
+ pos = strtok (NULL, " ");
+ }
+ GNUNET_free (plugs);
+ }
GNUNET_array_append (ctx->plugins,
num_plugins,
NULL);
diff --git a/src/block/plugin_block_fs.c b/src/block/plugin_block_fs.c
index 362932991c..0626e458c9 100644
--- a/src/block/plugin_block_fs.c
+++ b/src/block/plugin_block_fs.c
@@ -26,6 +26,7 @@
#include "platform.h"
#include "plugin_block.h"
+#include "block_fs.h"
#include "gnunet_signatures.h"
#define DEBUG_FS_BLOCK GNUNET_NO
@@ -97,6 +98,8 @@ block_plugin_fs_evaluate (void *cls,
GNUNET_break_op (0);
return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID;
}
+ if (reply_block == NULL)
+ return GNUNET_BLOCK_EVALUATION_REQUEST_VALID;
return GNUNET_BLOCK_EVALUATION_OK_LAST;
case GNUNET_BLOCK_TYPE_KBLOCK:
case GNUNET_BLOCK_TYPE_NBLOCK:
@@ -310,7 +313,7 @@ block_plugin_fs_get_key (void *cls,
* Entry point for the plugin.
*/
void *
-gnunet_plugin_block_fs_init (void *cls)
+libgnunet_plugin_block_fs_init (void *cls)
{
static enum GNUNET_BLOCK_Type types[] =
{
@@ -335,7 +338,7 @@ gnunet_plugin_block_fs_init (void *cls)
* Exit point from the plugin.
*/
void *
-gnunet_plugin_block_fs_done (void *cls)
+libgnunet_plugin_block_fs_done (void *cls)
{
struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
diff --git a/src/block/test_block.c b/src/block/test_block.c
index bdb806e5bf..02719e5aa5 100644
--- a/src/block/test_block.c
+++ b/src/block/test_block.c
@@ -29,8 +29,67 @@
#define VERBOSE GNUNET_NO
+static int
+test_fs (struct GNUNET_BLOCK_Context *ctx)
+{
+ GNUNET_HashCode key;
+ char block[4];
+
+ memset (block, 1, sizeof (block));
+ if (GNUNET_OK !=
+ GNUNET_BLOCK_get_key (ctx,
+ GNUNET_BLOCK_TYPE_DBLOCK,
+ block,
+ sizeof (block),
+ &key))
+ return 1;
+ if (GNUNET_BLOCK_EVALUATION_OK_LAST !=
+ GNUNET_BLOCK_evaluate (ctx,
+ GNUNET_BLOCK_TYPE_DBLOCK,
+ &key,
+ NULL, 0,
+ NULL, 0,
+ block, sizeof (block)))
+ return 2;
+ if (GNUNET_BLOCK_EVALUATION_REQUEST_VALID !=
+ GNUNET_BLOCK_evaluate (ctx,
+ GNUNET_BLOCK_TYPE_DBLOCK,
+ &key,
+ NULL, 0,
+ NULL, 0,
+ NULL, 0))
+ return 4;
+ GNUNET_log_skip (1, GNUNET_NO);
+ if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID !=
+ GNUNET_BLOCK_evaluate (ctx,
+ GNUNET_BLOCK_TYPE_DBLOCK,
+ &key,
+ NULL, 0,
+ "bogus", 5,
+ NULL, 0))
+ return 8;
+ GNUNET_log_skip (0, GNUNET_YES);
+ return 0;
+}
+
int
main (int argc, char *argv[])
{
- return 0; /* testcase passed */
+ int ret;
+ struct GNUNET_BLOCK_Context *ctx;
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+
+ GNUNET_log_setup ("test-block", "WARNING", NULL);
+ cfg = GNUNET_CONFIGURATION_create ();
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ "block",
+ "PLUGINS",
+ "fs");
+ ctx = GNUNET_BLOCK_context_create (cfg);
+ ret = test_fs (ctx);
+ GNUNET_BLOCK_context_destroy (ctx);
+ GNUNET_CONFIGURATION_destroy (cfg);
+ if (ret != 0)
+ fprintf (stderr, "Tests failed: %d\n", ret);
+ return ret;
}
diff --git a/src/fs/fs.h b/src/fs/fs.h
index 699f73a796..605e6c84ba 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -31,6 +31,7 @@
#include "gnunet_datastore_service.h"
#include "gnunet_fs_service.h"
#include "gnunet_block_lib.h"
+#include "block_fs.h"
/**
* Maximum size of the datastore queue for P2P operations.
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 6b56784db8..a0e275f2de 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -616,6 +616,15 @@ struct MigrationReadyBlock
*/
static struct GNUNET_DATASTORE_Handle *dsh;
+/**
+ * Our block context.
+ */
+static struct GNUNET_BLOCK_Context *block_ctx;
+
+/**
+ * Our block configuration.
+ */
+static struct GNUNET_CONFIGURATION_Handle *block_cfg;
/**
* Our scheduler.
@@ -1569,12 +1578,19 @@ shutdown_task (void *cls,
GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
stats = NULL;
}
- GNUNET_DATASTORE_disconnect (dsh,
- GNUNET_NO);
+ if (dsh != NULL)
+ {
+ GNUNET_DATASTORE_disconnect (dsh,
+ GNUNET_NO);
+ dsh = NULL;
+ }
while (mig_head != NULL)
delete_migration_block (mig_head);
GNUNET_assert (0 == mig_size);
- dsh = NULL;
+ GNUNET_BLOCK_context_destroy (block_ctx);
+ block_ctx = NULL;
+ GNUNET_CONFIGURATION_destroy (block_cfg);
+ block_cfg = NULL;
sched = NULL;
cfg = NULL;
GNUNET_free_non_null (trustDirectory);
@@ -2783,17 +2799,18 @@ handle_p2p_put (void *cls,
type = ntohl (put->type);
expiration = GNUNET_TIME_absolute_ntoh (put->expiration);
+ if (type == GNUNET_BLOCK_TYPE_ONDEMAND)
+ return GNUNET_SYSERR;
if (GNUNET_OK !=
- GNUNET_BLOCK_check_block (type,
- &put[1],
- dsize,
- &query))
+ GNUNET_BLOCK_get_key (block_ctx,
+ type,
+ &put[1],
+ dsize,
+ &query))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (type == GNUNET_BLOCK_TYPE_ONDEMAND)
- return GNUNET_SYSERR;
if (GNUNET_BLOCK_TYPE_SBLOCK == type)
{
sb = (const struct SBlock*) &put[1];
@@ -3051,10 +3068,12 @@ process_local_reply (void *cls,
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&prq.namespace);
}
- if (GNUNET_OK != GNUNET_BLOCK_check_block (type,
- data,
- size,
- &query))
+ if (GNUNET_OK !=
+ GNUNET_BLOCK_get_key (block_ctx,
+ type,
+ data,
+ size,
+ &query))
{
GNUNET_break (0);
GNUNET_DATASTORE_remove (dsh,
@@ -3786,12 +3805,23 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown (sched);
return;
}
+ block_cfg = GNUNET_CONFIGURATION_create ();
+ GNUNET_CONFIGURATION_set_value_string (block_cfg,
+ "block",
+ "PLUGINS",
+ "fs");
+ block_ctx = GNUNET_BLOCK_context_create (block_cfg);
+ GNUNET_assert (NULL != block_ctx);
if ( (GNUNET_OK != GNUNET_FS_indexing_init (sched, cfg, dsh)) ||
(GNUNET_OK != main_init (sched, server, cfg)) )
{
GNUNET_SCHEDULER_shutdown (sched);
GNUNET_DATASTORE_disconnect (dsh, GNUNET_NO);
dsh = NULL;
+ GNUNET_BLOCK_context_destroy (block_ctx);
+ block_ctx = NULL;
+ GNUNET_CONFIGURATION_destroy (block_cfg);
+ block_cfg = NULL;
return;
}
}
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 01e42fe3af..4e7fb8b7b1 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -3,7 +3,8 @@ SUBDIRS = .
gnunetincludedir = $(includedir)/gnunet
nodist_gnunetinclude_HEADERS = \
- gnunet_directories.h
+ gnunet_directories.h \
+ block_fs.h
if MINGW
WINPROC = winproc.h
diff --git a/src/include/block_fs.h b/src/include/block_fs.h
new file mode 100644
index 0000000000..c3dcdeced1
--- /dev/null
+++ b/src/include/block_fs.h
@@ -0,0 +1,165 @@
+/*
+ This file is part of GNUnet.
+ (C) 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
+ by the Free Software Foundation; either version 3, 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 include/block_fs.h
+ * @brief fs block formats (shared between fs and block)
+ * @author Christian Grothoff
+ */
+#ifndef BLOCK_FS_H
+#define BLOCK_FS_H
+
+#include "gnunet_util_lib.h"
+
+/**
+ * @brief keyword block (advertising data under a keyword)
+ */
+struct KBlock
+{
+
+ /**
+ * GNUNET_RSA_Signature using RSA-key generated from search keyword.
+ */
+ struct GNUNET_CRYPTO_RsaSignature signature;
+
+ /**
+ * What is being signed and why?
+ */
+ struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
+
+ /**
+ * Key generated (!) from the H(keyword) as the seed!
+ */
+ struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
+
+ /* 0-terminated URI here */
+
+ /* variable-size Meta-Data follows here */
+
+};
+
+
+/**
+ * @brief namespace content block (advertising data under an identifier in a namespace)
+ */
+struct SBlock
+{
+
+ /**
+ * 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;
+
+ /**
+ * Hash of the hash of the human-readable identifier used for
+ * this entry (the hash of the human-readable identifier is
+ * used as the key for decryption; the xor of this identifier
+ * and the hash of the "keyspace" is the datastore-query hash).
+ */
+ GNUNET_HashCode identifier;
+
+ /**
+ * Public key of the namespace.
+ */
+ struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
+
+ /* 0-terminated update-identifier 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 generated from search keyword.
+ */
+ struct GNUNET_CRYPTO_RsaSignature ksk_signature;
+
+ /**
+ * What is being signed and why?
+ */
+ struct GNUNET_CRYPTO_RsaSignaturePurpose ksk_purpose;
+
+ /**
+ * Key generated (!) from the H(keyword) as the seed!
+ */
+ struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
+
+ /**
+ * GNUNET_RSA_Signature using RSA-key of the namespace
+ */
+ struct GNUNET_CRYPTO_RsaSignature ns_signature;
+
+ /**
+ * What is being signed and why?
+ */
+ struct GNUNET_CRYPTO_RsaSignaturePurpose ns_purpose;
+
+ /**
+ * Public key of the namespace.
+ */
+ struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
+
+ /* from here on, data is encrypted with H(keyword) */
+
+ /* 0-terminated root identifier here */
+
+ /* variable-size Meta-Data follows here */
+
+};
+
+
+/**
+ * @brief index block (indexing a DBlock that
+ * can be obtained directly from reading
+ * the plaintext file)
+ */
+struct OnDemandBlock
+{
+ /**
+ * Hash code of the entire content of the
+ * file that was indexed (used to uniquely
+ * identify the plaintext file).
+ */
+ GNUNET_HashCode file_id;
+
+ /**
+ * At which offset should we be able to find
+ * this on-demand encoded block? (in NBO)
+ */
+ uint64_t offset GNUNET_PACKED;
+
+};
+
+
+#endif
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index ace4f23bb7..7d06d592f4 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -83,163 +83,7 @@ enum GNUNET_BLOCK_Type
};
-/* **************** FIXME: move these to block_fs.h or so ***************** */
-/**
- * @brief keyword block (advertising data under a keyword)
- */
-struct KBlock
-{
-
- /**
- * GNUNET_RSA_Signature using RSA-key generated from search keyword.
- */
- struct GNUNET_CRYPTO_RsaSignature signature;
-
- /**
- * What is being signed and why?
- */
- struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
-
- /**
- * Key generated (!) from the H(keyword) as the seed!
- */
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
-
- /* 0-terminated URI here */
-
- /* variable-size Meta-Data follows here */
-
-};
-
-
-/**
- * @brief namespace content block (advertising data under an identifier in a namespace)
- */
-struct SBlock
-{
-
- /**
- * 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;
-
- /**
- * Hash of the hash of the human-readable identifier used for
- * this entry (the hash of the human-readable identifier is
- * used as the key for decryption; the xor of this identifier
- * and the hash of the "keyspace" is the datastore-query hash).
- */
- GNUNET_HashCode identifier;
-
- /**
- * Public key of the namespace.
- */
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
-
- /* 0-terminated update-identifier 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 generated from search keyword.
- */
- struct GNUNET_CRYPTO_RsaSignature ksk_signature;
-
- /**
- * What is being signed and why?
- */
- struct GNUNET_CRYPTO_RsaSignaturePurpose ksk_purpose;
-
- /**
- * Key generated (!) from the H(keyword) as the seed!
- */
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
-
- /**
- * GNUNET_RSA_Signature using RSA-key of the namespace
- */
- struct GNUNET_CRYPTO_RsaSignature ns_signature;
-
- /**
- * What is being signed and why?
- */
- struct GNUNET_CRYPTO_RsaSignaturePurpose ns_purpose;
-
- /**
- * Public key of the namespace.
- */
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
-
- /* from here on, data is encrypted with H(keyword) */
-
- /* 0-terminated root identifier here */
-
- /* variable-size Meta-Data follows here */
-
-};
-
-
-/**
- * @brief index block (indexing a DBlock that
- * can be obtained directly from reading
- * the plaintext file)
- */
-struct OnDemandBlock
-{
- /**
- * Hash code of the entire content of the
- * file that was indexed (used to uniquely
- * identify the plaintext file).
- */
- GNUNET_HashCode file_id;
-
- /**
- * At which offset should we be able to find
- * this on-demand encoded block? (in NBO)
- */
- uint64_t offset GNUNET_PACKED;
-
-};
-
-
-/* **************** OLD API ***************** */
-
-/**
- * Check if the given block is well-formed (and of the given type).
- *
- * @param type type of the block
- * @param block the block data (or at least "size" bytes claiming to be one)
- * @param size size of "kb" in bytes; check that it is large enough
- * @param query where to store the query that this block answers
- * @return GNUNET_OK if this is actually a well-formed KBlock
- * GNUNET_NO if we could not determine the query,
- * GNUNET_SYSERR if the block is malformed
- */
-int
-GNUNET_BLOCK_check_block (enum GNUNET_BLOCK_Type type,
- const void *block,
- size_t size,
- GNUNET_HashCode *query);
-
-
-/* **************** NEW API ***************** */
/**
* Possible ways for how a block may relate to a query.
diff --git a/src/util/test_time.c b/src/util/test_time.c
index bf4655b48e..eecbbafaee 100644
--- a/src/util/test_time.c
+++ b/src/util/test_time.c
@@ -64,8 +64,10 @@ check ()
GNUNET_assert (GNUNET_TIME_relative_get_zero ().value == GNUNET_TIME_relative_multiply (rel,0).value);
/* test infinity-check for relative to absolute */
+ GNUNET_log_skip (1, GNUNET_NO);
last = GNUNET_TIME_relative_to_absolute (rel);
GNUNET_assert (last.value == GNUNET_TIME_UNIT_FOREVER_ABS.value);
+ GNUNET_log_skip (0, GNUNET_YES);
/*check relative to absolute*/
rel.value = 0;
@@ -179,13 +181,15 @@ check ()
forever = GNUNET_TIME_absolute_get_forever ();
forever.value = forever.value - 1024;
GNUNET_assert(GNUNET_TIME_absolute_get_zero ().value ==
- GNUNET_TIME_calculate_eta (forever,50000,100000).value);
- /*check zero*/
+ GNUNET_TIME_calculate_eta (forever, 50000, 100000).value);
+ /* check zero */
+ GNUNET_log_skip (1, GNUNET_NO);
GNUNET_assert(GNUNET_TIME_UNIT_ZERO.value ==
- (GNUNET_TIME_calculate_eta (last,60000,50000)).value);
+ (GNUNET_TIME_calculate_eta (last, 60000, 50000)).value);
+ GNUNET_log_skip (0, GNUNET_YES);
/*check forever*/
GNUNET_assert(GNUNET_TIME_UNIT_FOREVER_REL.value ==
- (GNUNET_TIME_calculate_eta (last,0,50000)).value);
+ (GNUNET_TIME_calculate_eta (last, 0, 50000)).value);
/*check relative subtract*/
now = GNUNET_TIME_absolute_get ();