move mingle function
authorChristian Grothoff <christian@grothoff.org>
Sat, 18 Sep 2010 04:36:48 +0000 (04:36 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 18 Sep 2010 04:36:48 +0000 (04:36 +0000)
src/block/Makefile.am
src/block/block.c
src/block/plugin_block_fs.c

index 238c48af3bd6ca8d5594cb042d58cde2647abe44..2fc0c0081c37ef0cf667d4f6a6ade1dbf8e904b8 100644 (file)
@@ -19,6 +19,7 @@ plugin_LTLIBRARIES = \
 libgnunet_plugin_block_fs_la_SOURCES = \
   plugin_block_fs.c
 libgnunet_plugin_block_fs_la_LIBADD = \
+  $(top_builddir)/src/block/libgnunetblock.la \
   $(top_builddir)/src/util/libgnunetutil.la 
 libgnunet_plugin_block_fs_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)
index 8d8018b50276fb085feb1226a5500eed7b42bf6f..29382dad193d74665f61aac25c4d41f94a7f5e14 100644 (file)
@@ -46,6 +46,7 @@ struct Plugin
   struct GNUNET_BLOCK_PluginFunctions *api;
 };
 
+
 /**
  * Handle to an initialized block library.
  */
@@ -63,6 +64,27 @@ struct GNUNET_BLOCK_Context
 };
 
 
+/**
+ * Mingle hash with the mingle_number to produce different bits.
+ * 
+ * @param in original hash code
+ * @param mingle_number number for hash permutation
+ * @param hc where to store the result.
+ */
+void
+GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in,
+                         int32_t mingle_number, 
+                         GNUNET_HashCode * hc)
+{
+  GNUNET_HashCode m;
+
+  GNUNET_CRYPTO_hash (&mingle_number, 
+                     sizeof (int32_t), 
+                     &m);
+  GNUNET_CRYPTO_hash_xor (&m, in, hc);
+}
+
+
 /**
  * Create a block context.  Loads the block plugins.
  *
index 0626e458c95da5c150f2127a55c91d64d28edb7a..a5219b706bee7e17c9a4d420e4a7d4cbce18138a 100644 (file)
  */
 #define BLOOMFILTER_K 16
 
-/**
- * Mingle hash with the mingle_number to produce different bits.
- */
-static void
-mingle_hash (const GNUNET_HashCode * in,
-            int32_t mingle_number, 
-            GNUNET_HashCode * hc)
-{
-  GNUNET_HashCode m;
-
-  GNUNET_CRYPTO_hash (&mingle_number, 
-                     sizeof (int32_t), 
-                     &m);
-  GNUNET_CRYPTO_hash_xor (&m, in, hc);
-}
-
-
 /**
  * Function called to validate a reply or a request.  For
  * request evaluation, simply pass "NULL" for the reply_block.
@@ -113,7 +96,7 @@ block_plugin_fs_evaluate (void *cls,
       GNUNET_CRYPTO_hash (reply_block,
                          reply_block_size,
                          &chash);
-      mingle_hash (&chash, bf_mutator, &mhash);
+      GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash);
       if (NULL != *bf)
        {
          if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf,
@@ -154,7 +137,7 @@ block_plugin_fs_evaluate (void *cls,
       GNUNET_CRYPTO_hash (reply_block,
                          reply_block_size,
                          &chash);
-      mingle_hash (&chash, bf_mutator, &mhash);
+      GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash);
       if (NULL != *bf)
        {
          if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf,