aboutsummaryrefslogtreecommitdiff
path: root/src/set
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-11-27 14:10:47 +0000
committerChristian Grothoff <christian@grothoff.org>2014-11-27 14:10:47 +0000
commit0d3932d5151f61cf4838123dd7edc66f27c08dfc (patch)
tree7804fca56796e33c77cd46738e296dc2d61a1973 /src/set
parent6062da84163355a854b8213538ad82127552adc0 (diff)
downloadgnunet-0d3932d5151f61cf4838123dd7edc66f27c08dfc.tar.gz
gnunet-0d3932d5151f61cf4838123dd7edc66f27c08dfc.zip
-renaming
Diffstat (limited to 'src/set')
-rw-r--r--src/set/Makefile.am2
-rw-r--r--src/set/gnunet-service-set_union.c4
-rw-r--r--src/set/gnunet-service-set_union_strata_estimator.c (renamed from src/set/strata_estimator.c)48
-rw-r--r--src/set/gnunet-service-set_union_strata_estimator.h (renamed from src/set/strata_estimator.h)2
4 files changed, 48 insertions, 8 deletions
diff --git a/src/set/Makefile.am b/src/set/Makefile.am
index 9cc7c0e6d..c18df4549 100644
--- a/src/set/Makefile.am
+++ b/src/set/Makefile.am
@@ -45,7 +45,7 @@ gnunet_service_set_SOURCES = \
45 gnunet-service-set_union.c \ 45 gnunet-service-set_union.c \
46 gnunet-service-set_intersection.c \ 46 gnunet-service-set_intersection.c \
47 ibf.c ibf.h \ 47 ibf.c ibf.h \
48 strata_estimator.c strata_estimator.h \ 48 gnunet-service-set_union_strata_estimator.c gnunet-service-set_union_strata_estimator.h \
49 set_protocol.h 49 set_protocol.h
50gnunet_service_set_LDADD = \ 50gnunet_service_set_LDADD = \
51 $(top_builddir)/src/util/libgnunetutil.la \ 51 $(top_builddir)/src/util/libgnunetutil.la \
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 5926b25f5..ff056ea3c 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file set/gnunet-service-set.c 22 * @file set/gnunet-service-set_union.c
23 * @brief two-peer set operations 23 * @brief two-peer set operations
24 * @author Florian Dold 24 * @author Florian Dold
25 */ 25 */
@@ -27,7 +27,7 @@
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet-service-set.h" 28#include "gnunet-service-set.h"
29#include "ibf.h" 29#include "ibf.h"
30#include "strata_estimator.h" 30#include "gnunet-service-set_union_strata_estimator.h"
31#include "set_protocol.h" 31#include "set_protocol.h"
32#include <gcrypt.h> 32#include <gcrypt.h>
33 33
diff --git a/src/set/strata_estimator.c b/src/set/gnunet-service-set_union_strata_estimator.c
index a148c1488..2288e25f5 100644
--- a/src/set/strata_estimator.c
+++ b/src/set/gnunet-service-set_union_strata_estimator.c
@@ -17,9 +17,8 @@
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20
21/** 20/**
22 * @file set/ibf.h 21 * @file set/gnunet-service-set_union_strata_estimator.c
23 * @brief invertible bloom filter 22 * @brief invertible bloom filter
24 * @author Florian Dold 23 * @author Florian Dold
25 */ 24 */
@@ -27,8 +26,15 @@
27#include "platform.h" 26#include "platform.h"
28#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
29#include "ibf.h" 28#include "ibf.h"
30#include "strata_estimator.h" 29#include "gnunet-service-set_union_strata_estimator.h"
30
31 31
32/**
33 * Write the given strata estimator to the buffer.
34 *
35 * @param se strata estimator to serialize
36 * @param buf buffer to write to, must be of appropriate size
37 */
32void 38void
33strata_estimator_write (const struct StrataEstimator *se, void *buf) 39strata_estimator_write (const struct StrataEstimator *se, void *buf)
34{ 40{
@@ -42,6 +48,14 @@ strata_estimator_write (const struct StrataEstimator *se, void *buf)
42 } 48 }
43} 49}
44 50
51
52/**
53 * Read strata from the buffer into the given strata
54 * estimator. The strata estimator must already be allocated.
55 *
56 * @param buf buffer to read from
57 * @param se strata estimator to write to
58 */
45void 59void
46strata_estimator_read (const void *buf, struct StrataEstimator *se) 60strata_estimator_read (const void *buf, struct StrataEstimator *se)
47{ 61{
@@ -54,6 +68,12 @@ strata_estimator_read (const void *buf, struct StrataEstimator *se)
54} 68}
55 69
56 70
71/**
72 * Add a key to the strata estimator.
73 *
74 * @param se strata estimator to add the key to
75 * @param key key to add
76 */
57void 77void
58strata_estimator_insert (struct StrataEstimator *se, struct IBF_Key key) 78strata_estimator_insert (struct StrataEstimator *se, struct IBF_Key key)
59{ 79{
@@ -67,6 +87,12 @@ strata_estimator_insert (struct StrataEstimator *se, struct IBF_Key key)
67} 87}
68 88
69 89
90/**
91 * Remove a key from the strata estimator.
92 *
93 * @param se strata estimator to remove the key from
94 * @param key key to remove
95 */
70void 96void
71strata_estimator_remove (struct StrataEstimator *se, struct IBF_Key key) 97strata_estimator_remove (struct StrataEstimator *se, struct IBF_Key key)
72{ 98{
@@ -80,7 +106,14 @@ strata_estimator_remove (struct StrataEstimator *se, struct IBF_Key key)
80} 106}
81 107
82 108
83 109/**
110 * Create a new strata estimator with the given parameters.
111 *
112 * @param strata_count number of stratas, that is, number of ibfs in the estimator
113 * @param ibf_size size of each ibf stratum
114 * @param ibf_hashnum hashnum parameter of each ibf
115 * @return a freshly allocated, empty strata estimator
116 */
84struct StrataEstimator * 117struct StrataEstimator *
85strata_estimator_create (unsigned int strata_count, uint32_t ibf_size, uint8_t ibf_hashnum) 118strata_estimator_create (unsigned int strata_count, uint32_t ibf_size, uint8_t ibf_hashnum)
86{ 119{
@@ -147,6 +180,7 @@ strata_estimator_difference (const struct StrataEstimator *se1,
147 return count; 180 return count;
148} 181}
149 182
183
150/** 184/**
151 * Make a copy of a strata estimator. 185 * Make a copy of a strata estimator.
152 * 186 *
@@ -169,10 +203,16 @@ strata_estimator_dup (struct StrataEstimator *se)
169} 203}
170 204
171 205
206/**
207 * Destroy a strata estimator, free all of its resources.
208 *
209 * @param se strata estimator to destroy.
210 */
172void 211void
173strata_estimator_destroy (struct StrataEstimator *se) 212strata_estimator_destroy (struct StrataEstimator *se)
174{ 213{
175 int i; 214 int i;
215
176 for (i = 0; i < se->strata_count; i++) 216 for (i = 0; i < se->strata_count; i++)
177 ibf_destroy (se->strata[i]); 217 ibf_destroy (se->strata[i]);
178 GNUNET_free (se->strata); 218 GNUNET_free (se->strata);
diff --git a/src/set/strata_estimator.h b/src/set/gnunet-service-set_union_strata_estimator.h
index 9de5598bd..bb8d09d31 100644
--- a/src/set/strata_estimator.h
+++ b/src/set/gnunet-service-set_union_strata_estimator.h
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file set/strata_estimator.h 22 * @file set/gnunet-service-set_union_strata_estimator.h
23 * @brief estimator of set difference 23 * @brief estimator of set difference
24 * @author Florian Dold 24 * @author Florian Dold
25 */ 25 */