Merge branch 'master' of ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / include / gnunet_block_group_lib.h
index a1ea807f6181aed9379ac2e34c82a308b89acc2e..3a3dfb2e27aada6e180b4d82da038f9f95d53c65 100644 (file)
@@ -43,6 +43,24 @@ extern "C"
 #endif
 
 
+/**
+ * How many bytes should a bloomfilter be if we have already seen
+ * entry_count responses?  Sized so that do not have to
+ * re-size the filter too often (to keep it cheap).
+ *
+ * Since other peers will also add entries but not resize the filter,
+ * we should generally pick a slightly larger size than what the
+ * strict math would suggest.
+ *
+ * @param entry_count expected number of entries in the Bloom filter
+ * @param k number of bits set per entry
+ * @return must be a power of two and smaller or equal to 2^15.
+ */
+size_t
+GNUNET_BLOCK_GROUP_compute_bloomfilter_size (unsigned int entry_count,
+                                             unsigned int k);
+
+
 /**
  * Create a new block group that filters duplicates using a Bloom filter.
  *