2 This file is part of GNUnet.
3 Copyright (C) 2010 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Christian Grothoff
25 * Library for creating block groups (to be used by block plugins)
27 * @defgroup block Block group library
28 * Library for data group management
31 #ifndef GNUNET_BLOCK_GROUP_LIB_H
32 #define GNUNET_BLOCK_GROUP_LIB_H
34 #include "gnunet_util_lib.h"
35 #include "gnunet_block_lib.h"
40 #if 0 /* keep Emacsens' auto-indent happy */
47 * Create a new block group that filters duplicates using a Bloom filter.
49 * @param ctx block context in which the block group is created
50 * @param bf_size size of the Bloom filter
51 * @param bf_k K-value for the Bloom filter
52 * @param type block type
53 * @param nonce random value used to seed the group creation
54 * @param raw_data optional serialized prior state of the group, NULL if unavailable/fresh
55 * @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
56 * @return block group handle, NULL if block groups are not supported
57 * by this @a type of block (this is not an error)
59 struct GNUNET_BLOCK_Group *
60 GNUNET_BLOCK_GROUP_bf_create (void *cls,
63 enum GNUNET_BLOCK_Type type,
66 size_t raw_data_size);
70 * Test if @a hc is contained in the Bloom filter of @a bg. If so,
71 * return #GNUNET_YES. If not, add @a hc to the Bloom filter and
74 * @param bg block group to use for testing
75 * @param hc hash of element to evaluate
76 * @return #GNUNET_YES if @a hc is (likely) a duplicate
77 * #GNUNET_NO if @a hc was definitively not in @bg (but now is)
80 GNUNET_BLOCK_GROUP_bf_test_and_set (struct GNUNET_BLOCK_Group *bg,
81 const struct GNUNET_HashCode *hc);
84 #if 0 /* keep Emacsens' auto-indent happy */
91 /* ifndef GNUNET_BLOCK_GROUP_LIB_H */
94 /** @} */ /* end of group */
96 /* end of gnunet_block_group_lib.h */