aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-23 08:38:43 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-23 08:38:43 +0000
commit12faacd1ef84944a000c6cd01e2b44d0f404e236 (patch)
tree848e0d996e3a0201dffc1e3da31941d7146a6de0 /src/block
parentc6e5a96f679fe6e35e29792e4992fa337a3b69b5 (diff)
downloadgnunet-12faacd1ef84944a000c6cd01e2b44d0f404e236.tar.gz
gnunet-12faacd1ef84944a000c6cd01e2b44d0f404e236.zip
-doxygen
Diffstat (limited to 'src/block')
-rw-r--r--src/block/block.c32
-rw-r--r--src/block/plugin_block_test.c10
2 files changed, 27 insertions, 15 deletions
diff --git a/src/block/block.c b/src/block/block.c
index 344038d6e..d2c7a067b 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -78,8 +78,9 @@ struct GNUNET_BLOCK_Context
78 * @param hc where to store the result. 78 * @param hc where to store the result.
79 */ 79 */
80void 80void
81GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingle_number, 81GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
82 struct GNUNET_HashCode * hc) 82 uint32_t mingle_number,
83 struct GNUNET_HashCode *hc)
83{ 84{
84 struct GNUNET_HashCode m; 85 struct GNUNET_HashCode m;
85 86
@@ -96,15 +97,18 @@ GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingle_num
96 * @param lib_ret the plugin API 97 * @param lib_ret the plugin API
97 */ 98 */
98static void 99static void
99add_plugin (void *cls, const char *library_name, void *lib_ret) 100add_plugin (void *cls,
101 const char *library_name,
102 void *lib_ret)
100{ 103{
101 struct GNUNET_BLOCK_Context *ctx = cls; 104 struct GNUNET_BLOCK_Context *ctx = cls;
102 struct GNUNET_BLOCK_PluginFunctions *api = lib_ret; 105 struct GNUNET_BLOCK_PluginFunctions *api = lib_ret;
103 struct Plugin *plugin; 106 struct Plugin *plugin;
104 107
105 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Loading block plugin `%s'\n"), 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
109 "Loading block plugin `%s'\n",
106 library_name); 110 library_name);
107 plugin = GNUNET_malloc (sizeof (struct Plugin)); 111 plugin = GNUNET_new (struct Plugin);
108 plugin->api = api; 112 plugin->api = api;
109 plugin->library_name = GNUNET_strdup (library_name); 113 plugin->library_name = GNUNET_strdup (library_name);
110 GNUNET_array_append (ctx->plugins, ctx->num_plugins, plugin); 114 GNUNET_array_append (ctx->plugins, ctx->num_plugins, plugin);
@@ -123,7 +127,7 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg)
123{ 127{
124 struct GNUNET_BLOCK_Context *ctx; 128 struct GNUNET_BLOCK_Context *ctx;
125 129
126 ctx = GNUNET_malloc (sizeof (struct GNUNET_BLOCK_Context)); 130 ctx = GNUNET_new (struct GNUNET_BLOCK_Context);
127 ctx->cfg = cfg; 131 ctx->cfg = cfg;
128 GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_", NULL, &add_plugin, ctx); 132 GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_", NULL, &add_plugin, ctx);
129 return ctx; 133 return ctx;
@@ -162,7 +166,8 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx)
162 * @return NULL if no matching plugin exists 166 * @return NULL if no matching plugin exists
163 */ 167 */
164static struct GNUNET_BLOCK_PluginFunctions * 168static struct GNUNET_BLOCK_PluginFunctions *
165find_plugin (struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type) 169find_plugin (struct GNUNET_BLOCK_Context *ctx,
170 enum GNUNET_BLOCK_Type type)
166{ 171{
167 struct Plugin *plugin; 172 struct Plugin *plugin;
168 unsigned int i; 173 unsigned int i;
@@ -194,11 +199,11 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type)
194 * @param type block type 199 * @param type block type
195 * @param query original query (hash) 200 * @param query original query (hash)
196 * @param bf pointer to bloom filter associated with query; possibly updated (!) 201 * @param bf pointer to bloom filter associated with query; possibly updated (!)
197 * @param bf_mutator mutation value for bf 202 * @param bf_mutator mutation value for @a bf
198 * @param xquery extended query data (can be NULL, depending on type) 203 * @param xquery extended query data (can be NULL, depending on type)
199 * @param xquery_size number of bytes in xquery 204 * @param xquery_size number of bytes in @a xquery
200 * @param reply_block response to validate 205 * @param reply_block response to validate
201 * @param reply_block_size number of bytes in reply block 206 * @param reply_block_size number of bytes in @a reply_block
202 * @return characterization of result 207 * @return characterization of result
203 */ 208 */
204enum GNUNET_BLOCK_EvaluationResult 209enum GNUNET_BLOCK_EvaluationResult
@@ -225,9 +230,9 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
225 * @param ctx block context 230 * @param ctx block context
226 * @param type block type 231 * @param type block type
227 * @param block block to get the key for 232 * @param block block to get the key for
228 * @param block_size number of bytes in block 233 * @param block_size number of bytes in @a block
229 * @param key set to the key (query) for the given block 234 * @param key set to the key (query) for the given block
230 * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported 235 * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported
231 * (or if extracting a key from a block of this type does not work) 236 * (or if extracting a key from a block of this type does not work)
232 */ 237 */
233int 238int
@@ -253,6 +258,7 @@ GNUNET_BLOCK_get_key (struct GNUNET_BLOCK_Context *ctx,
253 * we should generally pick a slightly larger size than what the 258 * we should generally pick a slightly larger size than what the
254 * strict math would suggest. 259 * strict math would suggest.
255 * 260 *
261 * @param entry_count expected number of entries in the Bloom filter
256 * @return must be a power of two and smaller or equal to 2^15. 262 * @return must be a power of two and smaller or equal to 2^15.
257 */ 263 */
258static size_t 264static size_t
@@ -279,7 +285,7 @@ compute_bloomfilter_size (unsigned int entry_count)
279 * 285 *
280 * @param bf_mutator mutation value to use 286 * @param bf_mutator mutation value to use
281 * @param seen_results results already seen 287 * @param seen_results results already seen
282 * @param seen_results_count number of entries in 'seen_results' 288 * @param seen_results_count number of entries in @a seen_results
283 * @return NULL if seen_results_count is 0, otherwise a BF 289 * @return NULL if seen_results_count is 0, otherwise a BF
284 * that would match the given results. 290 * that would match the given results.
285 */ 291 */
diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c
index eaffa361f..130c2ac3c 100644
--- a/src/block/plugin_block_test.c
+++ b/src/block/plugin_block_test.c
@@ -98,7 +98,7 @@ block_plugin_test_evaluate (void *cls, enum GNUNET_BLOCK_Type type,
98 * @param block block to get the key for 98 * @param block block to get the key for
99 * @param block_size number of bytes in @a block 99 * @param block_size number of bytes in @a block
100 * @param key set to the key (query) for the given block 100 * @param key set to the key (query) for the given block
101 * @return GNUNET_OK on success, GNUNET_SYSERR if type not supported 101 * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported
102 * (or if extracting a key from a block of this type does not work) 102 * (or if extracting a key from a block of this type does not work)
103 */ 103 */
104static int 104static int
@@ -114,6 +114,9 @@ block_plugin_test_get_key (void *cls, enum GNUNET_BLOCK_Type type,
114 114
115/** 115/**
116 * Entry point for the plugin. 116 * Entry point for the plugin.
117 *
118 * @param cls NULL
119 * @return the exported block API
117 */ 120 */
118void * 121void *
119libgnunet_plugin_block_test_init (void *cls) 122libgnunet_plugin_block_test_init (void *cls)
@@ -125,7 +128,7 @@ libgnunet_plugin_block_test_init (void *cls)
125 }; 128 };
126 struct GNUNET_BLOCK_PluginFunctions *api; 129 struct GNUNET_BLOCK_PluginFunctions *api;
127 130
128 api = GNUNET_malloc (sizeof (struct GNUNET_BLOCK_PluginFunctions)); 131 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
129 api->evaluate = &block_plugin_test_evaluate; 132 api->evaluate = &block_plugin_test_evaluate;
130 api->get_key = &block_plugin_test_get_key; 133 api->get_key = &block_plugin_test_get_key;
131 api->types = types; 134 api->types = types;
@@ -135,6 +138,9 @@ libgnunet_plugin_block_test_init (void *cls)
135 138
136/** 139/**
137 * Exit point from the plugin. 140 * Exit point from the plugin.
141 *
142 * @param cls the return value from #libgnunet_plugin_block_test_init
143 * @return NULL
138 */ 144 */
139void * 145void *
140libgnunet_plugin_block_test_done (void *cls) 146libgnunet_plugin_block_test_done (void *cls)