diff options
-rw-r--r-- | src/block/block.c | 32 | ||||
-rw-r--r-- | src/block/plugin_block_test.c | 10 | ||||
-rw-r--r-- | src/include/gnunet_plugin_lib.h | 6 |
3 files changed, 30 insertions, 18 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 | */ |
80 | void | 80 | void |
81 | GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode * in, uint32_t mingle_number, | 81 | GNUNET_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 | */ |
98 | static void | 99 | static void |
99 | add_plugin (void *cls, const char *library_name, void *lib_ret) | 100 | add_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 | */ |
164 | static struct GNUNET_BLOCK_PluginFunctions * | 168 | static struct GNUNET_BLOCK_PluginFunctions * |
165 | find_plugin (struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type) | 169 | find_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 | */ |
204 | enum GNUNET_BLOCK_EvaluationResult | 209 | enum 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 | */ |
233 | int | 238 | int |
@@ -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 | */ |
258 | static size_t | 264 | static 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 | */ |
104 | static int | 104 | static 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 | */ |
118 | void * | 121 | void * |
119 | libgnunet_plugin_block_test_init (void *cls) | 122 | libgnunet_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 | */ |
139 | void * | 145 | void * |
140 | libgnunet_plugin_block_test_done (void *cls) | 146 | libgnunet_plugin_block_test_done (void *cls) |
diff --git a/src/include/gnunet_plugin_lib.h b/src/include/gnunet_plugin_lib.h index b36e77ade..daf1b4cca 100644 --- a/src/include/gnunet_plugin_lib.h +++ b/src/include/gnunet_plugin_lib.h | |||
@@ -84,9 +84,9 @@ GNUNET_PLUGIN_load (const char *library_name, void *arg); | |||
84 | * | 84 | * |
85 | * @param cls closure | 85 | * @param cls closure |
86 | * @param library_name full name of the library (to be used with | 86 | * @param library_name full name of the library (to be used with |
87 | * 'GNUNET_PLUGIN_unload') | 87 | * #GNUNET_PLUGIN_unload) |
88 | * @param lib_ret return value from the initialization function | 88 | * @param lib_ret return value from the initialization function |
89 | * of the library (same as what 'GNUNET_PLUGIN_load' would | 89 | * of the library (same as what #GNUNET_PLUGIN_load would |
90 | * have returned for the given library name) | 90 | * have returned for the given library name) |
91 | */ | 91 | */ |
92 | typedef void (*GNUNET_PLUGIN_LoaderCallback) (void *cls, | 92 | typedef void (*GNUNET_PLUGIN_LoaderCallback) (void *cls, |
@@ -104,7 +104,7 @@ typedef void (*GNUNET_PLUGIN_LoaderCallback) (void *cls, | |||
104 | * @param basename basename of the plugins to load | 104 | * @param basename basename of the plugins to load |
105 | * @param arg argument to the plugin initialization function | 105 | * @param arg argument to the plugin initialization function |
106 | * @param cb function to call for each plugin found | 106 | * @param cb function to call for each plugin found |
107 | * @param cb_cls closure for 'cb' | 107 | * @param cb_cls closure for @a cb |
108 | */ | 108 | */ |
109 | void | 109 | void |
110 | GNUNET_PLUGIN_load_all (const char *basename, void *arg, | 110 | GNUNET_PLUGIN_load_all (const char *basename, void *arg, |